diff options
Diffstat (limited to 'plugins')
920 files changed, 12319 insertions, 12319 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 416c50279b..94142a7895 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -78,11 +78,11 @@ typedef struct BOOL AnimatedGifGetData(ACCData *data)
{
FIBITMAP *page = fei->FI_LockPage(data->ag.multi, 0);
- if (page == NULL)
+ if (page == nullptr)
return FALSE;
// Get info
- FITAG *tag = NULL;
+ FITAG *tag = nullptr;
if (!fei->FI_GetMetadata(FIMD_ANIMATION, page, "LogicalWidth", &tag))
goto ERR;
data->ag.logicalWidth = *(WORD *)fei->FI_GetTagValue(tag);
@@ -124,16 +124,16 @@ void AnimatedGifMountFrame(ACCData* data, int page) {
data->ag.frame.num = page;
- if (data->ag.hbms[page] != NULL) {
+ if (data->ag.hbms[page] != nullptr) {
data->ag.frame.disposal_method = GIF_DISPOSAL_LEAVE;
return;
}
FIBITMAP *dib = fei->FI_LockPage(data->ag.multi, data->ag.frame.num);
- if (dib == NULL)
+ if (dib == nullptr)
return;
- FITAG *tag = NULL;
+ FITAG *tag = nullptr;
if (fei->FI_GetMetadata(FIMD_ANIMATION, dib, "FrameLeft", &tag))
data->ag.frame.left = *(WORD *)fei->FI_GetTagValue(tag);
else
@@ -194,14 +194,14 @@ void AnimatedGifMountFrame(ACCData* data, int page) void AnimatedGifDeleteTmpValues(ACCData* data)
{
- if (data->ag.multi != NULL) {
+ if (data->ag.multi != nullptr) {
fei->FI_CloseMultiBitmap(data->ag.multi, 0);
- data->ag.multi = NULL;
+ data->ag.multi = nullptr;
}
- if (data->ag.dib != NULL) {
+ if (data->ag.dib != nullptr) {
fei->FI_Unload(data->ag.dib);
- data->ag.dib = NULL;
+ data->ag.dib = nullptr;
}
}
@@ -212,18 +212,18 @@ void DestroyAnimatedGif(ACCData* data) AnimatedGifDeleteTmpValues(data);
- if (data->ag.hbms != NULL) {
+ if (data->ag.hbms != nullptr) {
for (int i = 0; i < data->ag.frameCount; i++)
- if (data->ag.hbms[i] != NULL)
+ if (data->ag.hbms[i] != nullptr)
DeleteObject(data->ag.hbms[i]);
free(data->ag.hbms);
- data->ag.hbms = NULL;
+ data->ag.hbms = nullptr;
}
- if (data->ag.times != NULL) {
+ if (data->ag.times != nullptr) {
free(data->ag.times);
- data->ag.times = NULL;
+ data->ag.times = nullptr;
}
data->showingAnimatedGif = FALSE;
@@ -232,16 +232,16 @@ void DestroyAnimatedGif(ACCData* data) void StartAnimatedGif(ACCData* data)
{
- if (fei == NULL)
+ if (fei == nullptr)
return;
- AVATARCACHEENTRY *ace = NULL;
+ AVATARCACHEENTRY *ace = nullptr;
if (data->hContact != NULL)
ace = (AVATARCACHEENTRY*)GetAvatarBitmap(data->hContact, 0);
else
ace = (AVATARCACHEENTRY*)GetMyAvatar(0, (LPARAM)data->proto);
- if (ace == NULL)
+ if (ace == nullptr)
return;
int format = ProtoGetAvatarFormat(ace->szFilename);
@@ -253,7 +253,7 @@ void StartAnimatedGif(ACCData* data) fif = fei->FI_GetFIFFromFilenameU(ace->szFilename);
data->ag.multi = fei->FI_OpenMultiBitmapU(fif, ace->szFilename, FALSE, TRUE, FALSE, GIF_LOAD256);
- if (data->ag.multi == NULL)
+ if (data->ag.multi == nullptr)
return;
data->ag.frameCount = fei->FI_GetPageCount(data->ag.multi);
@@ -265,7 +265,7 @@ void StartAnimatedGif(ACCData* data) // allocate entire logical area
data->ag.dib = fei->FI_Allocate(data->ag.logicalWidth, data->ag.logicalHeight, 32, 0, 0, 0);
- if (data->ag.dib == NULL)
+ if (data->ag.dib == nullptr)
goto ERR;
// fill with background color to start
@@ -288,7 +288,7 @@ void StartAnimatedGif(ACCData* data) return;
ERR:
fei->FI_CloseMultiBitmap(data->ag.multi, 0);
- data->ag.multi = NULL;
+ data->ag.multi = nullptr;
}
void DestroyAnimation(ACCData* data)
@@ -334,12 +334,12 @@ static void Invalidate(HWND hwnd) ScreenToClient(parent, &rc);
InvalidateRect(parent, &rc, TRUE);
}
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
static void NotifyAvatarChange(HWND hwnd)
{
- PSHNOTIFY pshn = { 0 };
+ PSHNOTIFY pshn = {};
pshn.hdr.idFrom = GetDlgCtrlID(hwnd);
pshn.hdr.hwndFrom = hwnd;
pshn.hdr.code = NM_AVATAR_CHANGED;
@@ -382,7 +382,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_TRANSPARENT);
data = (ACCData*)mir_calloc(sizeof(ACCData));
- if (data == NULL)
+ if (data == nullptr)
return FALSE;
SetWindowLongPtr(hwnd, 0, (LONG_PTR)data);
@@ -502,7 +502,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP else
ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0);
- if (ace == NULL || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
+ if (ace == nullptr || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
*width = 0;
*height = 0;
return TRUE;
@@ -553,7 +553,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP PAINTSTRUCT ps;
{
HDC hdc = BeginPaint(hwnd, &ps);
- if (hdc == NULL)
+ if (hdc == nullptr)
break;
int oldBkMode = SetBkMode(hdc, TRANSPARENT);
@@ -597,7 +597,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP ret = 1;
if (!data->ag.started) {
- SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], NULL);
+ SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], nullptr);
data->ag.started = TRUE;
}
}
@@ -642,7 +642,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return TRUE;
case WM_SIZE:
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
break;
case WM_TIMER:
@@ -664,7 +664,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP AnimatedGifMountFrame(data, frame);
data->ag.started = FALSE;
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
break;
}
@@ -677,7 +677,7 @@ int LoadACC() wc.cbSize = sizeof(wc);
wc.lpszClassName = AVATAR_CONTROL_CLASS;
wc.lpfnWndProc = ACCWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(ACCData*);
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 18250bddd7..160f1a3d1b 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -25,7 +25,7 @@ CacheNode::CacheNode() CacheNode::~CacheNode()
{
- if (hbmPic != 0)
+ if (hbmPic != nullptr)
DeleteObject(hbmPic);
}
@@ -69,11 +69,11 @@ void PushAvatarRequest(CacheNode *cc) CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny)
{
if (g_shutDown)
- return NULL;
+ return nullptr;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || !db_get_b(NULL, AVS_MODULE, szProto, 1))
- return NULL;
+ if (szProto == nullptr || !db_get_b(NULL, AVS_MODULE, szProto, 1))
+ return nullptr;
AVATARCACHEENTRY tmp;
tmp.hContact = hContact;
@@ -82,13 +82,13 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) CacheNode *cc = arCache.find((CacheNode*)&tmp);
if (cc) {
- cc->t_lastAccess = time(NULL);
- return (cc->loaded || findAny) ? cc : NULL;
+ cc->t_lastAccess = time(nullptr);
+ return (cc->loaded || findAny) ? cc : nullptr;
}
// not found
if (!add)
- return NULL;
+ return nullptr;
cc = new CacheNode();
cc->hContact = hContact;
@@ -97,7 +97,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) PushAvatarRequest(cc);
SetEvent(hLoaderEvent); // wake him up
- return NULL;
+ return nullptr;
}
// output a notification message.
@@ -133,7 +133,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) // Get hash
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
DBVARIANT dbv = { 0 };
if (!db_get_s(hContact, szProto, "AvatarHash", &dbv)) {
if (dbv.type == DBVT_WCHAR)
@@ -198,7 +198,7 @@ int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode) mir_cslock lck(cachecs);
CacheNode *cc = arCache.find((CacheNode*)&tmp);
- if (cc != NULL) {
+ if (cc != nullptr) {
DWORD dwFlags = cc->dwFlags;
cc->dwFlags = mode ? (cc->dwFlags | attrib) : (cc->dwFlags & ~attrib);
if (cc->dwFlags != dwFlags)
@@ -231,7 +231,7 @@ void PicLoader(LPVOID) if (node)
arQueue.remove(0);
}
- if (node == NULL)
+ if (node == nullptr)
break;
if (db_get_b(node->hContact, "ContactPhoto", "NeedUpdate", 0))
@@ -239,18 +239,18 @@ void PicLoader(LPVOID) AVATARCACHEENTRY ace_temp;
memcpy(&ace_temp, node, sizeof(AVATARCACHEENTRY));
- ace_temp.hbmPic = 0;
+ ace_temp.hbmPic = nullptr;
- int result = CreateAvatarInCache(node->hContact, &ace_temp, NULL);
+ int result = CreateAvatarInCache(node->hContact, &ace_temp, nullptr);
if (result == -2) {
char *szProto = GetContactProto(node->hContact);
- if (szProto == NULL || Proto_NeedDelaysForAvatars(szProto))
+ if (szProto == nullptr || Proto_NeedDelaysForAvatars(szProto))
QueueAdd(node->hContact);
else if (FetchAvatarFor(node->hContact, szProto) == GAIR_SUCCESS) // Try to create again
- result = CreateAvatarInCache(node->hContact, &ace_temp, NULL);
+ result = CreateAvatarInCache(node->hContact, &ace_temp, nullptr);
}
- if (result == 1 && ace_temp.hbmPic != 0) { // Loaded
+ if (result == 1 && ace_temp.hbmPic != nullptr) { // Loaded
HBITMAP oldPic = node->hbmPic;
{
mir_cslock l(cachecs);
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 6219f7d8f5..020b618285 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -13,7 +13,7 @@ void MakeBmpTransparent(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -31,8 +31,8 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * 4;
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
// Create bitmap
BITMAPINFO RGB32BitsBITMAPINFO;
@@ -44,14 +44,14 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
BYTE *ptPixels;
- HBITMAP hDirectBitmap = CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0);
+ HBITMAP hDirectBitmap = CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0);
// Copy data
if (bmp.bmBitsPixel != 32) {
- HDC hdcOrig = CreateCompatibleDC(NULL);
+ HDC hdcOrig = CreateCompatibleDC(nullptr);
HBITMAP oldOrig = (HBITMAP)SelectObject(hdcOrig, hBitmap);
- HDC hdcDest = CreateCompatibleDC(NULL);
+ HDC hdcDest = CreateCompatibleDC(nullptr);
HBITMAP oldDest = (HBITMAP)SelectObject(hdcDest, hDirectBitmap);
BitBlt(hdcDest, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOrig, 0, 0, SRCCOPY);
@@ -85,7 +85,7 @@ HBITMAP CreateBitmap32(int cx, int cy) RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
UINT *ptPixels;
- return CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0);
+ return CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0);
}
// Set the color of points that are transparent
@@ -99,7 +99,7 @@ void SetTranspBkgColor(HBITMAP hBitmap, COLORREF color) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -161,22 +161,22 @@ void SetHIMETRICtoDP(HDC hdc, SIZE* sz) HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename)
{
- if (fei == NULL)
- return 0;
+ if (fei == nullptr)
+ return nullptr;
FIBITMAP *dib = (FIBITMAP*)CallService(MS_IMG_LOAD, (WPARAM)ptszFilename, IMGL_RETURNDIB | IMGL_WCHAR);
- if (dib == NULL)
- return 0;
+ if (dib == nullptr)
+ return nullptr;
- FIBITMAP *dib32 = NULL;
+ FIBITMAP *dib32 = nullptr;
if (fei->FI_GetBPP(dib) != 32) {
dib32 = fei->FI_ConvertTo32Bits(dib);
fei->FI_Unload(dib);
}
else dib32 = dib;
- if (dib32 == NULL)
- return NULL;
+ if (dib32 == nullptr)
+ return nullptr;
if (fei->FI_IsTransparent(dib32))
if (bIsTransparent)
@@ -185,8 +185,8 @@ HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename) if (fei->FI_GetWidth(dib32) > 128 || fei->FI_GetHeight(dib32) > 128) {
FIBITMAP *dib_new = fei->FI_MakeThumbnail(dib32, 128, FALSE);
fei->FI_Unload(dib32);
- if (dib_new == NULL)
- return 0;
+ if (dib_new == nullptr)
+ return nullptr;
dib32 = dib_new;
}
@@ -196,7 +196,7 @@ HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename) return bitmap;
}
-static HWND hwndClui = 0;
+static HWND hwndClui = nullptr;
//
// Save ///////////////////////////////////////////////////////////////////////////////////////////
@@ -205,7 +205,7 @@ static HWND hwndClui = 0; int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags)
{
- if (fei == NULL)
+ if (fei == nullptr)
return -1;
wchar_t tszFilename[MAX_PATH];
@@ -278,7 +278,7 @@ DWORD GetImgHash(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
WORD *p = (WORD *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return 0;
memset(p, 0, dwLen);
@@ -334,7 +334,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) DWORD dwLen = width * height * 4;
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return FALSE;
HBITMAP hBmpTmp;
@@ -490,7 +490,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) bool transpProportional = (db_get_b(NULL, AVS_MODULE, "MakeTransparencyProportionalToColorDiff", 0) != 0);
int *stack = (int *)malloc(width * height * 2 * sizeof(int));
- if (stack == NULL) {
+ if (stack == nullptr) {
free(p);
return FALSE;
}
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index ab86b8d03d..f691a0945d 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -26,15 +26,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst = 0;
-HICON g_hIcon = 0;
+HINSTANCE g_hInst = nullptr;
+HICON g_hIcon = nullptr;
bool g_shutDown = false;
int hLangpack;
wchar_t g_szDataPath[MAX_PATH]; // user datae path (read at startup only)
BOOL g_AvatarHistoryAvail = FALSE;
-HWND hwndSetMyAvatar = 0;
+HWND hwndSetMyAvatar = nullptr;
HANDLE hMyAvatarsFolder;
HANDLE hGlobalAvatarFolder;
@@ -56,14 +56,14 @@ OBJLIST<protoPicCacheEntry> g_ProtoPictures(10, ComparePicture),
g_MyAvatars(10, ComparePicture);
-char *g_szMetaName = NULL;
+char *g_szMetaName = nullptr;
// Stores the id of the dialog
int OnDetailsInit(WPARAM wParam, LPARAM lParam);
int OptInit(WPARAM wParam, LPARAM lParam);
-FI_INTERFACE *fei = 0;
+FI_INTERFACE *fei = nullptr;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -82,10 +82,10 @@ PLUGININFOEX pluginInfoEx = { static int ProtocolAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack != NULL && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) {
+ if (ack != nullptr && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) {
if (ack->result == ACKRESULT_SUCCESS) {
- if (ack->hProcess == NULL)
- ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, NULL, ack->szModule);
+ if (ack->hProcess == nullptr)
+ ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, nullptr, ack->szModule);
else
ProcessAvatarInfo(ack->hContact, GAIR_SUCCESS, (PROTO_AVATAR_INFORMATION*)ack->hProcess, ack->szModule);
}
@@ -94,7 +94,7 @@ static int ProtocolAck(WPARAM, LPARAM lParam) }
else if (ack->result == ACKRESULT_STATUS) {
char *szProto = GetContactProto(ack->hContact);
- if (szProto == NULL || Proto_NeedDelaysForAvatars(szProto)) {
+ if (szProto == nullptr || Proto_NeedDelaysForAvatars(szProto)) {
// Queue
db_set_b(ack->hContact, "ContactPhoto", "NeedUpdate", 1);
QueueAdd(ack->hContact);
@@ -115,7 +115,7 @@ static int MetaChanged(WPARAM hMeta, LPARAM hSubContact) // Get the node
CacheNode *node = FindAvatarInCache(hSubContact, true);
- if (node == NULL || !node->loaded) {
+ if (node == nullptr || !node->loaded) {
ace = (AVATARCACHEENTRY*)GetProtoDefaultAvatar(hSubContact);
QueueAdd(hSubContact);
}
@@ -198,7 +198,7 @@ static int OnAccChanged(WPARAM wParam, LPARAM lParam) static int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- if (cws == NULL || g_shutDown)
+ if (cws == nullptr || g_shutDown)
return 0;
if (hContact == 0)
@@ -219,7 +219,7 @@ static int ShutdownProc(WPARAM, LPARAM) g_shutDown = true;
SetEvent(hLoaderEvent);
SetEvent(hShutdownEvent);
- CloseHandle(hShutdownEvent); hShutdownEvent = NULL;
+ CloseHandle(hShutdownEvent); hShutdownEvent = nullptr;
return 0;
}
@@ -257,7 +257,7 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm if (GetClipRgn(r->hTargetDC, oldRgn) != 1) {
DeleteObject(oldRgn);
- oldRgn = NULL;
+ oldRgn = nullptr;
}
HRGN rgn;
@@ -324,9 +324,9 @@ static int ModulesLoaded(WPARAM, LPARAM) {
wchar_t szEventName[100];
mir_snwprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId());
- hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName);
+ hLoaderEvent = CreateEvent(nullptr, TRUE, FALSE, szEventName);
- SetThreadPriority(mir_forkthread(PicLoader, 0), THREAD_PRIORITY_IDLE);
+ SetThreadPriority(mir_forkthread(PicLoader, nullptr), THREAD_PRIORITY_IDLE);
// Folders plugin support
hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT L"\\Avatars");
@@ -335,10 +335,10 @@ static int ModulesLoaded(WPARAM, LPARAM) g_AvatarHistoryAvail = ServiceExists(MS_AVATARHISTORY_ENABLED);
int accCount;
- PROTOACCOUNT **accs = NULL;
+ PROTOACCOUNT **accs = nullptr;
Proto_EnumAccounts(&accCount, &accs);
- if (fei != NULL) {
+ if (fei != nullptr) {
LoadDefaultInfo();
int protoCount;
@@ -364,7 +364,7 @@ static int ModulesLoaded(WPARAM, LPARAM) static int LoadAvatarModule()
{
- hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hShutdownEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
@@ -406,8 +406,8 @@ extern "C" int __declspec(dllexport) Load(void) if (ServiceExists(MS_IMG_GETINTERFACE))
result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
- if (fei == NULL || result != S_OK) {
- MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar service"), MB_OK);
+ if (fei == nullptr || result != S_OK) {
+ MessageBox(nullptr, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar service"), MB_OK);
return 1;
}
LoadACC();
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 97e6190c51..0ef9d71dd5 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -47,7 +47,7 @@ struct WindowData static void RemoveProtoPic(const char *szProto) { - if (szProto == NULL) + if (szProto == nullptr) return; db_unset(NULL, PPICT_MODULE, szProto); @@ -55,7 +55,7 @@ static void RemoveProtoPic(const char *szProto) if (!mir_strcmp(AVS_DEFAULT, szProto)) { for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry &p = g_ProtoPictures[i]; - if (p.szProtoname == NULL) + if (p.szProtoname == nullptr) continue; p.clear(); @@ -72,10 +72,10 @@ static void RemoveProtoPic(const char *szProto) for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry &p = g_ProtoPictures[i]; - if (p.szProtoname == NULL) + if (p.szProtoname == nullptr) continue; PROTOACCOUNT *pdescr = Proto_GetAccount(p.szProtoname); - if (pdescr == NULL && mir_strcmp(p.szProtoname, szProto)) + if (pdescr == nullptr && mir_strcmp(p.szProtoname, szProto)) continue; if (!mir_strcmp(p.szProtoname, szProto) || !mir_strcmp(pdescr->szProtoName, szProtoname)) { @@ -104,7 +104,7 @@ static void SetProtoPic(char *szProto) OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.lpstrFilter = filter; - ofn.hwndOwner = 0; + ofn.hwndOwner = nullptr; ofn.lpstrFile = FileName; ofn.nMaxFile = MAX_PATH; ofn.nMaxFileTitle = MAX_PATH; @@ -128,7 +128,7 @@ static void SetProtoPic(char *szProto) if (mir_strlen(p.szProtoname) == 0) continue; - if (p.hbmPic == 0 || !mir_strcmp(p.szProtoname, AVS_DEFAULT)) { + if (p.hbmPic == nullptr || !mir_strcmp(p.szProtoname, AVS_DEFAULT)) { CreateAvatarInCache(0, &p, szProto); NotifyEventHooks(hEventChanged, 0, (LPARAM)&p); } @@ -140,13 +140,13 @@ static void SetProtoPic(char *szProto) mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1); for (int i = 0; i < g_ProtoPictures.getCount(); i++) { PROTOACCOUNT* pdescr = Proto_GetAccount(g_ProtoPictures[i].szProtoname); - if (pdescr == NULL && mir_strcmp(g_ProtoPictures[i].szProtoname, szProto)) + if (pdescr == nullptr && mir_strcmp(g_ProtoPictures[i].szProtoname, szProto)) continue; if (!mir_strcmp(g_ProtoPictures[i].szProtoname, szProto) || !mir_strcmp(pdescr->szProtoName, szProtoname)) { protoPicCacheEntry& p = g_ProtoPictures[i]; if (mir_strlen(p.szProtoname) != 0) { - if (p.hbmPic == 0) { + if (p.hbmPic == nullptr) { CreateAvatarInCache(0, &p, szProto); NotifyEventHooks(hEventChanged, 0, (LPARAM)&p); } @@ -161,7 +161,7 @@ static void SetProtoPic(char *szProto) break; if (!mir_strcmp(p.szProtoname, szProto) && mir_strlen(p.szProtoname) == mir_strlen(szProto)) { - if (p.hbmPic != 0) + if (p.hbmPic != nullptr) DeleteObject(p.hbmPic); memset(&p, 0, sizeof(AVATARCACHEENTRY)); CreateAvatarInCache(0, &p, szProto); @@ -277,10 +277,10 @@ static char* GetProtoFromList(HWND hwndDlg, int iItem) item.mask = LVIF_PARAM; item.iItem = iItem; if (!ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROTOCOLS), &item)) - return NULL; + return nullptr; protoPicCacheEntry *pce = (protoPicCacheEntry *)item.lParam; - return (pce == NULL) ? NULL : pce->szProtoname; + return (pce == nullptr) ? nullptr : pce->szProtoname; } static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -392,12 +392,12 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar } else SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, dbv.ptszVal); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); db_free(&dbv); } else { SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, L""); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); } } } @@ -493,7 +493,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA } SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); ShowWindow(hwndDlg, SW_SHOWNORMAL); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, FALSE); CheckDlgButton(hwndDlg, IDC_PROTECTAVATAR, db_get_b(hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, db_get_b(hContact, "ContactPhoto", "Hidden", 0) ? BST_CHECKED : BST_UNCHECKED); @@ -573,7 +573,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_RESET: ProtectAvatar(hContact, 0); - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); @@ -597,7 +597,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA break; case IDC_DELETE: - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; ProtectAvatar(hContact, 0); if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { @@ -612,7 +612,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA db_unset(hContact, "ContactPhoto", "Format"); DeleteAvatarFromCache(hContact, FALSE); SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); break; } break; @@ -685,11 +685,11 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case DM_REALODAVATAR: SaveTransparentData(hwndDlg, hContact, IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR)); ChangeAvatar(hContact, true); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); break; case DM_AVATARCHANGED: - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); break; case WM_NCDESTROY: @@ -819,7 +819,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa break; case IDC_RESET: ProtectAvatar(hContact, 0); - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); @@ -843,7 +843,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa case IDC_DELETE: ProtectAvatar(hContact, 0); - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); @@ -883,7 +883,7 @@ static char* GetSelectedProtocol(HWND hwndDlg) // Get selection int iItem = ListView_GetSelectionMark(hwndList); if (iItem < 0) - return NULL; + return nullptr; // Get protocol name LVITEM item = { 0 }; @@ -896,7 +896,7 @@ static char* GetSelectedProtocol(HWND hwndDlg) static void EnableDisableControls(HWND hwndDlg, char *proto) { if (IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO)) { - if (proto == NULL) { + if (proto == nullptr) { EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); } @@ -954,7 +954,7 @@ static void EnableDisableProtocols(HWND hwndDlg, BOOL init) } char * proto = GetSelectedProtocol(hwndDlg); - if (proto == NULL) { + if (proto == nullptr) { ListView_SetItemState(hwndList, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x0F); } else { @@ -1064,7 +1064,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP SetMyAvatar(NULL, NULL); else { char *proto = GetSelectedProtocol(hwndDlg); - if (proto != NULL) + if (proto != nullptr) SetMyAvatar((WPARAM)proto, NULL); } break; @@ -1076,7 +1076,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP } else { char *proto = GetSelectedProtocol(hwndDlg); - if (proto == NULL) + if (proto == nullptr) break; char description[256]; @@ -1113,7 +1113,7 @@ int OnDetailsInit(WPARAM wParam, LPARAM lParam) } else { char *szProto = GetContactProto(hContact); - if (szProto == NULL || db_get_b(NULL, AVS_MODULE, szProto, 1)) { + if (szProto == nullptr || db_get_b(NULL, AVS_MODULE, szProto, 1)) { // Contact dialog odp.pfnDlgProc = DlgProcAvatarUserInfo; odp.position = -2000000000; diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index 1b02acda79..3a2a091e3b 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -63,7 +63,7 @@ static mir_cs cs; void InitPolls()
{
// Init request queue
- mir_forkthread(RequestThread, NULL);
+ mir_forkthread(RequestThread, nullptr);
}
void UninitPolls()
@@ -97,7 +97,7 @@ static BOOL PollContactCanHaveAvatar(MCONTACT hContact, const char *szProto) // Return true if this contact has to be checked
static BOOL PollCheckContact(MCONTACT hContact)
{
- return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, false, true) != NULL;
+ return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, false, true) != nullptr;
}
static void QueueRemove(MCONTACT hContact)
@@ -114,7 +114,7 @@ static void QueueRemove(MCONTACT hContact) // Add an contact to a queue
void QueueAdd(MCONTACT hContact, int waitTime)
{
- if (fei == NULL || g_shutDown)
+ if (fei == nullptr || g_shutDown)
return;
mir_cslock lck(cs);
@@ -135,7 +135,7 @@ void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATION *pa QueueRemove(hContact);
if (type == GAIR_SUCCESS) {
- if (pai == NULL)
+ if (pai == nullptr)
return;
// Fix settings in DB
@@ -186,10 +186,10 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto) {
int result = GAIR_NOAVATAR;
- if (szProto == NULL)
+ if (szProto == nullptr)
szProto = GetContactProto(hContact);
- if (szProto != NULL && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) {
+ if (szProto != nullptr && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) {
// Can have avatar, but must request it?
if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, hContact, 0)) || (PollCheckProtocol(szProto) && PollCheckContact(hContact)))
{
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index c09163c78d..458ab27664 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -28,14 +28,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM)
{
- if (hContact == 0 || g_shutDown || fei == NULL)
+ if (hContact == 0 || g_shutDown || fei == nullptr)
return 0;
hContact = GetContactThatHaveTheAvatar(hContact);
// Get the node
CacheNode *node = FindAvatarInCache(hContact, true);
- if (node == NULL || !node->loaded)
+ if (node == nullptr || !node->loaded)
return (INT_PTR)GetProtoDefaultAvatar(hContact);
return (INT_PTR)node;
}
@@ -46,7 +46,7 @@ INT_PTR ProtectAvatar(WPARAM hContact, LPARAM lParam) {
BYTE was_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
- if (fei == NULL || was_locked == (BYTE)lParam) // no need for redundant lockings...
+ if (fei == nullptr || was_locked == (BYTE)lParam) // no need for redundant lockings...
return 0;
if (hContact) {
@@ -98,8 +98,8 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_NOTIFY:
if (data->setView) {
HWND hwndParent = GetParent(hwnd);
- HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL);
- if (hwndLv != NULL) {
+ HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr);
+ if (hwndLv != nullptr) {
SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0);
data->setView = FALSE;
}
@@ -121,19 +121,19 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam) wchar_t *szFinalName;
BYTE locking_request;
- if (hContact == NULL || fei == NULL)
+ if (hContact == NULL || fei == nullptr)
return 0;
int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
wchar_t *tszPath = (wchar_t*)lParam;
- if (tszPath == NULL) {
+ if (tszPath == nullptr) {
wchar_t filter[256];
Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.lpstrFilter = filter;
ofn.nMaxFile = MAX_PATH;
@@ -179,7 +179,7 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam) static INT_PTR CanSetMyAvatar(WPARAM wParam, LPARAM)
{
char *protocol = (char *)wParam;
- if (protocol == NULL || fei == NULL)
+ if (protocol == nullptr || fei == nullptr)
return 0;
return ProtoServiceExists(protocol, PS_SETMYAVATAR);
@@ -196,9 +196,9 @@ static int InternalRemoveMyAvatar(char *protocol) // Remove avatar
int ret = 0;
- if (protocol != NULL) {
+ if (protocol != nullptr) {
if (ProtoServiceExists(protocol, PS_SETMYAVATAR))
- ret = SaveAvatar(protocol, NULL);
+ ret = SaveAvatar(protocol, nullptr);
else
ret = -3;
@@ -225,7 +225,7 @@ static int InternalRemoveMyAvatar(char *protocol) continue;
// Found a protocol
- int retTmp = SaveAvatar(accs[i]->szModuleName, NULL);
+ int retTmp = SaveAvatar(accs[i]->szModuleName, nullptr);
if (retTmp != 0)
ret = retTmp;
}
@@ -240,7 +240,7 @@ static int InternalRemoveMyAvatar(char *protocol) SetIgnoreNotify(protocol, FALSE);
- ReportMyAvatarChanged(WPARAM((protocol == NULL) ? "" : protocol), 0);
+ ReportMyAvatarChanged(WPARAM((protocol == nullptr) ? "" : protocol), 0);
return ret;
}
@@ -293,7 +293,7 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM CheckDlgButton(hwnd, IDC_MAKE_SQUARE, data->square ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_GROW, data->grow ? BST_CHECKED : BST_UNCHECKED);
- if (data->protocol != NULL && (Proto_AvatarImageProportion(data->protocol) & PIP_SQUARE))
+ if (data->protocol != nullptr && (Proto_AvatarImageProportion(data->protocol) & PIP_SQUARE))
EnableWindow(GetDlgItem(hwnd, IDC_MAKE_SQUARE), FALSE);
break;
@@ -301,8 +301,8 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM data = (SetMyAvatarHookData *)ofn->lCustData;
if (data->thumbnail) {
HWND hwndParent = GetParent(hwnd);
- HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL);
- if (hwndLv != NULL) {
+ HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr);
+ if (hwndLv != nullptr) {
SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0);
data->thumbnail = FALSE;
}
@@ -314,7 +314,7 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM data->square = IsDlgButtonChecked(hwnd, IDC_MAKE_SQUARE);
data->grow = IsDlgButtonChecked(hwnd, IDC_GROW);
- hwndSetMyAvatar = NULL;
+ hwndSetMyAvatar = nullptr;
break;
}
@@ -407,7 +407,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen d.hBmpProto = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0);
- if (d.hBmpProto == NULL) {
+ if (d.hBmpProto == nullptr) {
if (d.temp_file[0] != '\0')
DeleteFile(d.temp_file);
return -1;
@@ -489,7 +489,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar return -3;
// file exists...
- HBITMAP hBmp = NULL;
+ HBITMAP hBmp = nullptr;
if (format == PA_FORMAT_SWF) {
if (!allAcceptSWF)
@@ -502,14 +502,14 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar else {
// Try to open if is not a flash or XML
hBmp = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFinalName, IMGL_WCHAR);
- if (hBmp == NULL)
+ if (hBmp == nullptr)
return -4;
}
SetIgnoreNotify(protocol, TRUE);
int ret = 0;
- if (protocol != NULL) {
+ if (protocol != nullptr) {
ret = SetProtoMyAvatar(protocol, hBmp, szFinalName, format, data.square, data.grow);
if (ret == 0) {
DeleteGlobalUserAvatar();
@@ -542,7 +542,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar BOOL saved = TRUE;
if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) {
mir_snwprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar");
- CreateDirectory(globalFile, NULL);
+ CreateDirectory(globalFile, nullptr);
}
wchar_t *ext = wcsrchr(szFinalName, '.'); // Can't be NULL here
@@ -563,7 +563,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar HBITMAP hBmpTmp = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0);
// Check if need to resize
- if (hBmpTmp == hBmp || hBmpTmp == NULL) {
+ if (hBmpTmp == hBmp || hBmpTmp == nullptr) {
// Use original image
mir_snwprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
CopyFile(szFinalName, globalFile, FALSE);
@@ -595,34 +595,34 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar SetIgnoreNotify(protocol, FALSE);
- ReportMyAvatarChanged(WPARAM((protocol == NULL) ? "" : protocol), 0);
+ ReportMyAvatarChanged(WPARAM((protocol == nullptr) ? "" : protocol), 0);
return ret;
}
INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
wchar_t FileName[MAX_PATH];
- wchar_t *szFinalName = NULL;
+ wchar_t *szFinalName = nullptr;
BOOL allAcceptXML;
BOOL allAcceptSWF;
// Protocol allow seting of avatar?
char* protocol = (char*)wParam;
- if (protocol != NULL && !CanSetMyAvatar((WPARAM)protocol, 0))
+ if (protocol != nullptr && !CanSetMyAvatar((WPARAM)protocol, 0))
return -1;
wchar_t* tszPath = (wchar_t*)lParam;
- if (tszPath == NULL && hwndSetMyAvatar != 0) {
+ if (tszPath == nullptr && hwndSetMyAvatar != nullptr) {
SetForegroundWindow(hwndSetMyAvatar);
SetFocus(hwndSetMyAvatar);
ShowWindow(hwndSetMyAvatar, SW_SHOW);
return -2;
}
- SetMyAvatarHookData data = { 0 };
+ SetMyAvatarHookData data = {};
// Check for XML and SWF
- if (protocol == NULL) {
+ if (protocol == nullptr) {
allAcceptXML = TRUE;
allAcceptSWF = TRUE;
@@ -651,7 +651,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) || db_get_b(0, AVS_MODULE, "SetAllwaysMakeSquare", 0);
}
- if (tszPath == NULL) {
+ if (tszPath == nullptr) {
data.protocol = protocol;
CMStringW filter;
@@ -677,7 +677,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) ofn.hInstance = g_hInst;
wchar_t title[256];
- if (protocol == NULL)
+ if (protocol == nullptr)
mir_snwprintf(title, TranslateT("Set my avatar"));
else {
wchar_t* prototmp = mir_a2u(protocol);
@@ -707,7 +707,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA static INT_PTR ContactOptions(WPARAM wParam, LPARAM)
{
if (wParam)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), 0, DlgProcAvatarOptions, (LPARAM)wParam);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), nullptr, DlgProcAvatarOptions, (LPARAM)wParam);
return 0;
}
@@ -715,29 +715,29 @@ static INT_PTR ContactOptions(WPARAM wParam, LPARAM) INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
{
- AVATARCACHEENTRY *ace = NULL;
+ AVATARCACHEENTRY *ace = nullptr;
AVATARDRAWREQUEST *r = (AVATARDRAWREQUEST*)lParam;
- if (fei == NULL || r == NULL || IsBadReadPtr((void *)r, sizeof(AVATARDRAWREQUEST)))
+ if (fei == nullptr || r == nullptr || IsBadReadPtr((void *)r, sizeof(AVATARDRAWREQUEST)))
return 0;
if (r->cbSize != sizeof(AVATARDRAWREQUEST))
return 0;
if (r->dwFlags & AVDRQ_PROTOPICT) {
- if (r->szProto == NULL)
+ if (r->szProto == nullptr)
return 0;
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry& p = g_ProtoPictures[i];
- if (!mir_strcmp(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != 0) {
+ if (!mir_strcmp(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != nullptr) {
ace = (AVATARCACHEENTRY *)&g_ProtoPictures[i];
break;
}
}
}
else if (r->dwFlags & AVDRQ_OWNPIC) {
- if (r->szProto == NULL)
+ if (r->szProto == nullptr)
return 0;
if (r->szProto[0] == '\0' && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1))
@@ -748,9 +748,9 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam) else ace = (AVATARCACHEENTRY *)GetAvatarBitmap((WPARAM)r->hContact, 0);
if (ace && (!(r->dwFlags & AVDRQ_RESPECTHIDDEN) || !(ace->dwFlags & AVS_HIDEONCLIST))) {
- ace->t_lastAccess = time(NULL);
+ ace->t_lastAccess = time(nullptr);
- if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == 0)
+ if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == nullptr)
return 0;
InternalDrawAvatar(r, ace->hbmPic, ace->bmWidth, ace->bmHeight, ace->dwFlags);
@@ -764,7 +764,7 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam) INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- if (wParam || g_shutDown || fei == NULL)
+ if (wParam || g_shutDown || fei == nullptr)
return 0;
char *szProto = (char *)lParam;
@@ -772,7 +772,7 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam) return 0;
for (int i = 0; i < g_MyAvatars.getCount(); i++)
- if (!mir_strcmp(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != 0)
+ if (!mir_strcmp(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != nullptr)
return (INT_PTR)&g_MyAvatars[i];
return 0;
@@ -818,7 +818,7 @@ static void ReloadMyAvatar(LPVOID lpParam) INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
{
const char *proto = (const char*)wParam;
- if (proto == NULL)
+ if (proto == nullptr)
return -1;
for (int i = 0; i < g_MyAvatars.getCount(); i++) {
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index a20372b9dc..1aa82f4515 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -70,16 +70,16 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) ptrW tszValue;
wchar_t tszFilename[MAX_PATH]; tszFilename[0] = 0;
- ace->hbmPic = 0;
+ ace->hbmPic = nullptr;
ace->dwFlags = 0;
ace->bmHeight = 0;
ace->bmWidth = 0;
- ace->lpDIBSection = NULL;
+ ace->lpDIBSection = nullptr;
ace->szFilename[0] = 0;
- if (szProto == NULL) {
+ if (szProto == nullptr) {
char *proto = GetContactProto(hContact);
- if (proto == NULL || !db_get_b(NULL, AVS_MODULE, proto, 1))
+ if (proto == nullptr || !db_get_b(NULL, AVS_MODULE, proto, 1))
return -1;
if (db_get_b(hContact, "ContactPhoto", "Locked", 0) && (tszValue = db_get_wsa(hContact, "ContactPhoto", "Backup")))
@@ -100,7 +100,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) if (!strstr(szProto, "Global avatar for")) {
PROTOACCOUNT* pdescr = Proto_GetAccount(szProto);
- if (pdescr == NULL)
+ if (pdescr == nullptr)
return -1;
char key[MAX_PATH];
mir_snprintf(key, "Global avatar for %s accounts", pdescr->szProtoName);
@@ -148,10 +148,10 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) ace->dwFlags = 0;
ace->bmHeight = 0;
ace->bmWidth = 0;
- ace->lpDIBSection = NULL;
+ ace->lpDIBSection = nullptr;
wcsncpy(ace->szFilename, tszFilename, MAX_PATH);
ace->szFilename[MAX_PATH - 1] = 0;
- if (ace->hbmPic == 0)
+ if (ace->hbmPic == nullptr)
return -1;
BITMAP bminfo;
@@ -232,7 +232,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) int GetFileHash(wchar_t* filename)
{
- HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return 0;
@@ -242,7 +242,7 @@ int GetFileHash(wchar_t* filename) do {
// Read file chunk
dwRead = 0;
- ReadFile(hFile, data, 1024, &dwRead, NULL);
+ ReadFile(hFile, data, 1024, &dwRead, nullptr);
/* loop through each byte of data */
for (int byte = 0; byte < (int)dwRead; ++byte) {
@@ -269,7 +269,7 @@ int GetFileHash(wchar_t* filename) protoPicCacheEntry::~protoPicCacheEntry()
{
- if (hbmPic != 0)
+ if (hbmPic != nullptr)
DeleteObject(hbmPic);
mir_free(szProtoname);
mir_free(tszAccName);
@@ -277,7 +277,7 @@ protoPicCacheEntry::~protoPicCacheEntry() void protoPicCacheEntry::clear()
{
- if (hbmPic != 0)
+ if (hbmPic != nullptr)
DeleteObject(hbmPic);
memset(this, 0, sizeof(AVATARCACHEENTRY));
@@ -384,11 +384,11 @@ protoPicCacheEntry* GetProtoDefaultAvatar(MCONTACT hContact) if (szProto) {
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry& p = g_ProtoPictures[i];
- if (!mir_strcmp(p.szProtoname, szProto) && p.hbmPic != NULL)
+ if (!mir_strcmp(p.szProtoname, szProto) && p.hbmPic != nullptr)
return &g_ProtoPictures[i];
}
}
- return NULL;
+ return nullptr;
}
MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked)
@@ -412,7 +412,7 @@ int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist, int pa_format) // Get the node
CacheNode *node = FindAvatarInCache(hContact, g_AvatarHistoryAvail && fNotifyHist, true);
- if (node == NULL)
+ if (node == nullptr)
return 0;
if (fNotifyHist)
@@ -446,7 +446,7 @@ void DeleteGlobalUserAvatar() void SetIgnoreNotify(char *protocol, BOOL ignore)
{
for (int i = 0; i < g_MyAvatars.getCount(); i++) {
- if (protocol == NULL || !mir_strcmp(g_MyAvatars[i].szProtoname, protocol)) {
+ if (protocol == nullptr || !mir_strcmp(g_MyAvatars[i].szProtoname, protocol)) {
if (ignore)
g_MyAvatars[i].dwFlags |= AVS_IGNORENOTIFY;
else
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index e1d0a79bd0..f77bd1f5de 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -100,7 +100,7 @@ bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) }
if (iAccCount == 0) {
- if (GetParent(hdlg) == NULL)
+ if (GetParent(hdlg) == nullptr)
DestroyWindow(hdlg);
else
EndDialog(hdlg, 0);
@@ -172,7 +172,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) HookEventMessage(ME_PROTO_ACCLISTCHANGED, hdlg, DM_ADDCONTACT_CHANGEACCLIST);
{
wchar_t *szGroup;
- for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) {
+ for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++) {
int id = SendDlgItemMessage(hdlg, IDC_GROUP, CB_ADDSTRING, 0, (LPARAM)szGroup);
SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETITEMDATA, (WPARAM)id, (LPARAM)i);
}
@@ -239,10 +239,10 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) GetDlgItemText(hdlg, IDC_USERID, szUserId, _countof(szUserId));
if (*rtrimw(szUserId) == 0 ||
- (strstr(acs->proto, "GG") && wcstoul(szUserId, NULL, 10) > INT_MAX) || // Gadu-Gadu protocol
- ((CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_NUMERICUSERID) && !wcstoul(szUserId, NULL, 10)))
+ (strstr(acs->proto, "GG") && wcstoul(szUserId, nullptr, 10) > INT_MAX) || // Gadu-Gadu protocol
+ ((CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_NUMERICUSERID) && !wcstoul(szUserId, nullptr, 10)))
{
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("The contact cannot be added to your contact list. Please make sure the contact ID is entered correctly."),
TranslateT("Add contact"), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
break;
@@ -250,8 +250,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) PROTOSEARCHRESULT *psr;
if (strstr(acs->proto, "TLEN")) { // Tlen protocol
- if (wcschr(szUserId, '@') == NULL) {
- MessageBox(NULL,
+ if (wcschr(szUserId, '@') == nullptr) {
+ MessageBox(nullptr,
TranslateT("The contact cannot be added to your contact list. Please make sure the contact ID is entered correctly."),
TranslateT("Add contact"), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
break;
@@ -271,7 +271,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) MCONTACT hContact = (MCONTACT)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr);
if (hContact == NULL) {
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("The contact cannot be added to your contact list. If you are not logged into the selected account, please try to do so. Also, make sure the contact ID is entered correctly."),
TranslateT("Add contact"), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
break;
@@ -310,7 +310,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) }
// fall through
case IDCANCEL:
- if (GetParent(hdlg) == NULL)
+ if (GetParent(hdlg) == nullptr)
DestroyWindow(hdlg);
else
EndDialog(hdlg, 0);
@@ -319,7 +319,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case WM_CLOSE:
/* if there is no parent for the dialog, its a modeless dialog and can't be killed using EndDialog() */
- if (GetParent(hdlg) == NULL)
+ if (GetParent(hdlg) == nullptr)
DestroyWindow(hdlg);
else
EndDialog(hdlg, 0);
@@ -335,7 +335,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) break;
case WM_DESTROY:
- hAddDlg = NULL;
+ hAddDlg = nullptr;
Window_FreeIcon_IcoLib(hdlg);
ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_GETIMAGELIST, 0, 0));
if (acs) {
diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 1326ab1206..26df21c584 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., CLIST_INTERFACE *pcli;
HINSTANCE hInst;
int hLangpack;
-static HANDLE hToolBarItem = 0;
-static HGENMENU hMainMenuItem = 0;
+static HANDLE hToolBarItem = nullptr;
+static HGENMENU hMainMenuItem = nullptr;
HWND hAddDlg;
static IconItem icon = { LPGEN("Add contact"), ICON_ADD, IDI_ADDCONTACT };
@@ -68,7 +68,7 @@ static INT_PTR AddContactPlusDialog(WPARAM, LPARAM) SetForegroundWindow(hAddDlg);
SetFocus(hAddDlg);
}
- else hAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), NULL, AddContactDlgProc, 0);
+ else hAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), nullptr, AddContactDlgProc, 0);
return 0;
}
@@ -107,7 +107,7 @@ static int OnAccListChanged(WPARAM, LPARAM) Menu_RemoveItem(hMainMenuItem);
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hToolBarItem, 0);
- hMainMenuItem = 0;
+ hMainMenuItem = nullptr;
}
return 0;
@@ -115,7 +115,7 @@ static int OnAccListChanged(WPARAM, LPARAM) static int CreateButton(WPARAM, LPARAM)
{
- TTBButton tbb = { 0 };
+ TTBButton tbb = {};
tbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
tbb.pszService = MS_ADDCONTACTPLUS_SHOW;
tbb.name = tbb.pszTooltipUp = LPGEN("Add contact");
diff --git a/plugins/AdvaImg/src/main.cpp b/plugins/AdvaImg/src/main.cpp index b9be9dcb58..d2294db9a9 100644 --- a/plugins/AdvaImg/src/main.cpp +++ b/plugins/AdvaImg/src/main.cpp @@ -71,7 +71,7 @@ static void FI_CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -119,7 +119,7 @@ static BOOL FreeImage_PreMultiply(HBITMAP hBitmap) int height = bmp.bmHeight;
int dwLen = width * height * 4;
BYTE *p = (BYTE *)malloc(dwLen);
- if (p != NULL) {
+ if (p != nullptr) {
GetBitmapBits(hBitmap, dwLen, p);
for (int y = 0; y < height; ++y) {
@@ -149,7 +149,7 @@ static BOOL FreeImage_PreMultiply(HBITMAP hBitmap) static HBITMAP FreeImage_CreateHBITMAPFromDIB(FIBITMAP *in)
{
- FIBITMAP *dib = NULL;
+ FIBITMAP *dib = nullptr;
int bpp = FreeImage_GetBPP(in);
if (bpp == 48)
@@ -161,8 +161,8 @@ static HBITMAP FreeImage_CreateHBITMAPFromDIB(FIBITMAP *in) BYTE *ptPixels;
BITMAPINFO *info = FreeImage_GetInfo(dib);
- HBITMAP hBmp = CreateDIBSection(NULL, info, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0);
- if (ptPixels != NULL)
+ HBITMAP hBmp = CreateDIBSection(nullptr, info, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0);
+ if (ptPixels != nullptr)
memmove(ptPixels, FreeImage_GetBits(dib), FreeImage_GetPitch(dib) * FreeImage_GetHeight(dib));
if (dib != in)
@@ -181,16 +181,16 @@ static FIBITMAP *FreeImage_CreateDIBFromHBITMAP(HBITMAP hBmp) // The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO members (dont't know why)
// So we save these infos below. This is needed for palettized images only.
int nColors = FreeImage_GetColorsUsed(dib);
- HDC dc = GetDC(NULL);
+ HDC dc = GetDC(nullptr);
int Success = GetDIBits(dc, hBmp, 0, FreeImage_GetHeight(dib),
FreeImage_GetBits(dib), FreeImage_GetInfo(dib), DIB_RGB_COLORS);
- ReleaseDC(NULL, dc);
+ ReleaseDC(nullptr, dc);
// restore BITMAPINFO members
FreeImage_GetInfoHeader(dib)->biClrUsed = nColors;
FreeImage_GetInfoHeader(dib)->biClrImportant = nColors;
return dib;
}
- return NULL;
+ return nullptr;
}
@@ -210,8 +210,8 @@ static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam) int xOrig, yOrig, widthOrig, heightOrig;
ResizeBitmap *info = (ResizeBitmap *) wParam;
- if (info == NULL || info->size != sizeof(ResizeBitmap)
- || info->hBmp == NULL
+ if (info == nullptr || info->size != sizeof(ResizeBitmap)
+ || info->hBmp == nullptr
|| info->max_width < 0 || info->max_height < 0
|| (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) < RESIZEBITMAP_STRETCH
|| (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) > RESIZEBITMAP_MAKE_SQUARE)
@@ -296,7 +296,7 @@ static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam) else
{
FIBITMAP *dib = FreeImage_CreateDIBFromHBITMAP(info->hBmp);
- if (dib == NULL)
+ if (dib == nullptr)
return NULL;
FIBITMAP *dib_tmp;
@@ -305,7 +305,7 @@ static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam) else
dib_tmp = dib;
- if (dib_tmp == NULL)
+ if (dib_tmp == nullptr)
{
FreeImage_Unload(dib);
return NULL;
@@ -334,13 +334,13 @@ FIBITMAP* FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, FreeImage_CloseMemory(hmem);
}
- return NULL;
+ return nullptr;
}
FIMEMORY* FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags)
{
if (handle) {
- FIMEMORY *hmem = FreeImage_OpenMemory(NULL, 0);
+ FIMEMORY *hmem = FreeImage_OpenMemory(nullptr, 0);
if(fif == FIF_UNKNOWN)
fif = FIF_BMP;
handle->curpos = 0;
@@ -348,7 +348,7 @@ FIMEMORY* FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_han FreeImage_AcquireMemory(hmem, (BYTE **)&handle->data, (DWORD *)&handle->datalen);
return hmem;
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -379,7 +379,7 @@ static INT_PTR serviceGetInterface(WPARAM wParam, LPARAM lParam) static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam)
{
char *lpszFilename = (char *)wParam;
- if(lpszFilename==NULL) return 0;
+ if(lpszFilename==nullptr) return 0;
FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
if(lParam & IMGL_WCHAR)
@@ -404,7 +404,7 @@ static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam) else
dib = FreeImage_Load(fif, lpszFilename, 0);
- if(dib == NULL || (lParam & IMGL_RETURNDIB))
+ if(dib == nullptr || (lParam & IMGL_RETURNDIB))
return (INT_PTR)dib;
HBITMAP hbm = FreeImage_CreateHBITMAPFromDIB(dib);
@@ -418,7 +418,7 @@ static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam) static INT_PTR serviceLoadFromMem(WPARAM wParam, LPARAM lParam)
{
IMGSRVC_MEMIO *mio = (IMGSRVC_MEMIO *)wParam;
- if(mio->iLen == 0 || mio->pBuf == NULL)
+ if(mio->iLen == 0 || mio->pBuf == nullptr)
return 0;
FIMEMORY *hmem = FreeImage_OpenMemory((BYTE *)mio->pBuf, mio->iLen);
@@ -426,7 +426,7 @@ static INT_PTR serviceLoadFromMem(WPARAM wParam, LPARAM lParam) FIBITMAP *dib = FreeImage_LoadFromMemory(fif, hmem, mio->flags);
FreeImage_CloseMemory(hmem);
- if(dib == NULL || (lParam & IMGL_RETURNDIB))
+ if(dib == nullptr || (lParam & IMGL_RETURNDIB))
return (INT_PTR)dib;
HBITMAP hbm = FreeImage_CreateHBITMAPFromDIB(dib);
@@ -450,7 +450,7 @@ static INT_PTR serviceSave(WPARAM wParam, LPARAM lParam) IMGSRVC_INFO *isi = (IMGSRVC_INFO *)wParam;
FREE_IMAGE_FORMAT fif;
BOOL fUnload = FALSE;
- FIBITMAP *dib = NULL;
+ FIBITMAP *dib = nullptr;
if(isi) {
if(isi->cbSize != sizeof(IMGSRVC_INFO))
@@ -469,13 +469,13 @@ static INT_PTR serviceSave(WPARAM wParam, LPARAM lParam) if(fif == FIF_UNKNOWN)
fif = FIF_BMP; // default, save as bmp
- if(isi->hbm != 0 && (isi->dwMask & IMGI_HBITMAP) && !(isi->dwMask & IMGI_FBITMAP)) {
+ if(isi->hbm != nullptr && (isi->dwMask & IMGI_HBITMAP) && !(isi->dwMask & IMGI_FBITMAP)) {
// create temporary dib, because we got a HBTIMAP passed
fUnload = TRUE;
FI_CorrectBitmap32Alpha(isi->hbm, FALSE);
dib = FreeImage_CreateDIBFromHBITMAP(isi->hbm);
}
- else if(isi->dib != NULL && (isi->dwMask & IMGI_FBITMAP) && !(isi->dwMask & IMGI_HBITMAP))
+ else if(isi->dib != nullptr && (isi->dwMask & IMGI_FBITMAP) && !(isi->dwMask & IMGI_HBITMAP))
dib = isi->dib;
int ret = 0;
@@ -517,7 +517,7 @@ static INT_PTR serviceGetVersion(WPARAM wParam, LPARAM lParam) DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle)
{
- return FreeImage_Rotate(dib, angle, NULL);
+ return FreeImage_Rotate(dib, angle, nullptr);
}
void FI_Populate(void)
diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index f00893fbc9..f47f1f566d 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -4,13 +4,13 @@ #define ID_TIMER_SOUND 10101
#define SOUND_REPEAT_PERIOD 5000 // milliseconds
#define SPEACH_REPEAT_PERIOD 15000 // milliseconds
-MWindowList hAlarmWindowList = 0;
+MWindowList hAlarmWindowList = nullptr;
FontIDW title_font_id, window_font_id;
ColourIDW bk_colour_id;
-HFONT hTitleFont = 0, hWindowFont = 0;
+HFONT hTitleFont = nullptr, hWindowFont = nullptr;
COLORREF title_font_colour, window_font_colour;
-HBRUSH hBackgroundBrush = 0;
+HBRUSH hBackgroundBrush = nullptr;
#define WMU_SETFONTS (WM_USER + 61)
#define WMU_REFRESH (WM_USER + 62)
@@ -43,7 +43,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar wd = new WindowData;
wd->moving = false;
- wd->alarm = 0;
+ wd->alarm = nullptr;
wd->win_num = win_num++;
if (wd->win_num > 0) {
@@ -52,7 +52,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar r.top += 20;
r.left += 20;
- SetWindowPos(hwndDlg, 0, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
+ SetWindowPos(hwndDlg, nullptr, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify");
}
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)wd);
@@ -65,7 +65,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return FALSE;
case WMU_REFRESH:
- InvalidateRect(hwndDlg, 0, TRUE);
+ InvalidateRect(hwndDlg, nullptr, TRUE);
return TRUE;
case WM_CTLCOLORSTATIC:
@@ -99,7 +99,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (hBackgroundBrush) {
SetClassLongPtr(hwndDlg, GCLP_HBRBACKGROUND, (LONG_PTR)hBackgroundBrush);
- InvalidateRect(hwndDlg, 0, TRUE);
+ InvalidateRect(hwndDlg, nullptr, TRUE);
}
return TRUE;
@@ -154,9 +154,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (data->action & AAF_SOUND && options.loop_sound) {
if (data->sound_num <= 3)
- SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, 0);
+ SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, nullptr);
else if (data->sound_num == 4)
- SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, 0);
+ SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, nullptr);
}
HWND hw = GetDlgItem(hwndDlg, IDC_SNOOZE);
@@ -181,7 +181,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar Skin_PlaySound(buff);
}
else if (data->sound_num == 4) {
- if (data->szTitle != NULL && data->szTitle[0] != '\0') {
+ if (data->szTitle != nullptr && data->szTitle[0] != '\0') {
if (ServiceExists("Speak/Say")) {
CallService("Speak/Say", 0, (LPARAM)data->szTitle);
}
@@ -312,7 +312,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar RECT r;
GetWindowRect(hwndDlg, &r);
- SetWindowPos(hwndDlg, 0, r.left + (newp.x - wd->p.x), r.top + (newp.y - wd->p.y), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
+ SetWindowPos(hwndDlg, nullptr, r.left + (newp.x - wd->p.x), r.top + (newp.y - wd->p.y), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
wd->p.x = newp.x;
wd->p.y = newp.y;
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 0ea5f59810..cfa1310cf1 100755 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -20,10 +20,10 @@ bool is_idle = false; void free_alarm_data(ALARM *alarm)
{
- mir_free(alarm->szTitle); alarm->szTitle = 0;
- mir_free(alarm->szDesc); alarm->szDesc = 0;
- mir_free(alarm->szCommand); alarm->szCommand = 0;
- mir_free(alarm->szCommandParams); alarm->szCommandParams = 0;
+ mir_free(alarm->szTitle); alarm->szTitle = nullptr;
+ mir_free(alarm->szDesc); alarm->szDesc = nullptr;
+ mir_free(alarm->szCommand); alarm->szCommand = nullptr;
+ mir_free(alarm->szCommandParams); alarm->szCommandParams = nullptr;
}
void copy_alarm_data(ALARM *dest, ALARM *src)
@@ -651,7 +651,7 @@ void DoAlarm(ALARM *alarm) Skin_PlaySound(buff);
}
else if (alarm->sound_num == 4) {
- if (alarm->szTitle != NULL && alarm->szTitle[0] != '\0') {
+ if (alarm->szTitle != nullptr && alarm->szTitle[0] != '\0') {
if (ServiceExists("Speak/Say")) {
CallService("Speak/Say", 0, (LPARAM)alarm->szTitle);
}
@@ -679,7 +679,7 @@ void DoAlarm(ALARM *alarm) }
if (alarm->action & AAF_COMMAND)
- ShellExecute(0, 0, alarm->szCommand, alarm->szCommandParams, 0, SW_NORMAL);
+ ShellExecute(nullptr, nullptr, alarm->szCommand, alarm->szCommandParams, nullptr, SW_NORMAL);
if (alarm->action & AAF_SYSTRAY) {
CLISTEVENT cle = {};
@@ -802,7 +802,7 @@ void InitList() InitAlarmWin();
- timer_id = SetTimer(0, 0, TIMER_PERIOD, TimerProc);
+ timer_id = SetTimer(nullptr, 0, TIMER_PERIOD, TimerProc);
HookEvent(ME_IDLE_CHANGED, IdleChanged);
}
@@ -814,7 +814,7 @@ void DeinitList() // i don't think this should be necessary, but...
mir_cslock lck(alarm_cs);
- KillTimer(0, timer_id);
+ KillTimer(nullptr, timer_id);
DestroyHookableEvent(hAlarmTriggeredEvent);
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index dc7de3ca63..0e3139bc50 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -78,7 +78,7 @@ void ShowPopup(MCONTACT hContact, const wchar_t *msg) ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = RGB(0, 0, 0);
ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = 0;
+ ppd.PluginData = nullptr;
ppd.iSeconds = 3;
// Now that every field has been filled, we want to see the popup.
@@ -103,18 +103,18 @@ HBITMAP LoadBmpFromIcon(int IdRes) rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
FillRect(hdcMem, &rc, hBkgBrush);
- DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
DeleteObject(hBkgBrush);
DeleteObject(hIcon);
@@ -124,7 +124,7 @@ HBITMAP LoadBmpFromIcon(int IdRes) static int InitTopToolbarButton(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBUP));
ttb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBDN));
ttb.pszService = MODULE "/NewAlarm";
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 2d3fc23d8e..fcbc4d75e0 100755 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -1,24 +1,24 @@ #include "stdafx.h"
#include "frame.h"
-HWND hwnd_plugin = 0;
-HWND hwnd_frame = 0;
-HWND hwnd_list = 0;
+HWND hwnd_plugin = nullptr;
+HWND hwnd_frame = nullptr;
+HWND hwnd_list = nullptr;
int frame_id = -1;
FontID font_id;
ColourID framebk_colour_id;
-HFONT hFont = 0;
+HFONT hFont = nullptr;
COLORREF fontColour, framebk;
-HBRUSH bk_brush = 0;
+HBRUSH bk_brush = nullptr;
#define CLUIFrameTitleBarClassName "CLUIFrameTitleBar"
AlarmList alarm_list;
mir_cs list_cs;
-HGENMENU hMenuShowReminders = 0;
+HGENMENU hMenuShowReminders = nullptr;
#define ID_FRAME_UPDATE_TIMER 1011
#define ID_FRAME_SHOWHIDE_TIMER 1012
@@ -62,9 +62,9 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP RECT r;
GetClientRect(hwnd, &r);
- SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
- InvalidateRect(child, 0, TRUE);
- InvalidateRect(hwnd, 0, TRUE);
+ SetWindowPos(child, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ InvalidateRect(child, nullptr, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
break;
@@ -100,13 +100,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_CREATE:
hwnd_list = CreateWindow(L"LISTBOX", L"",
(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_STANDARD | LBS_NOTIFY | LBS_OWNERDRAWFIXED) & ~LBS_SORT
- & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst, 0);
+ & ~WS_BORDER, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
return FALSE;
case WMU_INITIALIZE:
PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
- SetTimer(hwnd, ID_FRAME_UPDATE_TIMER, 5000, 0);
- SetTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER, 200, 0);
+ SetTimer(hwnd, ID_FRAME_UPDATE_TIMER, 5000, nullptr);
+ SetTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER, 200, nullptr);
return TRUE;
case WM_MEASUREITEM:
@@ -135,7 +135,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetTextColor(dis->hDC, fontColour);
HICON hIcon = (min <= 5 ? hIconList2 : hIconList1);
- DrawIconEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 0, 0, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 0, 0, 0, nullptr, DI_NORMAL);
GetTextExtentPoint32(dis->hDC, alarm.szTitle, (int)mir_wstrlen(alarm.szTitle), &textSize);
@@ -213,7 +213,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (frame_id != -1)
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, FU_TBREDRAW);
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
break;
@@ -228,7 +228,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (options.auto_size_vert && IsWindowVisible(hwnd)) {
if (FrameIsFloating()) {
int height = height_client_to_frame(itemheight * count, GetWindowLongPtr(GetParent(hwnd), GWL_STYLE), GetWindowLongPtr(GetParent(hwnd), GWL_EXSTYLE));
- HWND titleBarHwnd = FindWindowEx(GetParent(hwnd), 0, _A2W(CLUIFrameTitleBarClassName), 0);
+ HWND titleBarHwnd = FindWindowEx(GetParent(hwnd), nullptr, _A2W(CLUIFrameTitleBarClassName), nullptr);
if (titleBarHwnd) {
RECT tbr;
GetWindowRect(titleBarHwnd, &tbr);
@@ -236,7 +236,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
RECT rp_window;
GetWindowRect(GetParent(hwnd), &rp_window);
- SetWindowPos(GetParent(hwnd), 0, 0, 0, rp_window.right - rp_window.left, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ SetWindowPos(GetParent(hwnd), nullptr, 0, 0, rp_window.right - rp_window.left, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
else if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME) && frame_id != -1) {
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, frame_id), count * itemheight);
@@ -254,8 +254,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar height = min(count * itemheight, winheight - (winheight % itemheight));
if (r2.right - r2.left != width || (r.bottom - r.top > 0 && r2.bottom - r2.top != height)) {
- SetWindowPos(hwnd_list, 0, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
- InvalidateRect(hwnd_list, 0, FALSE);
+ SetWindowPos(hwnd_list, nullptr, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ InvalidateRect(hwnd_list, nullptr, FALSE);
}
if (options.auto_showhide) {
@@ -374,7 +374,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar //ClientToScreen(hwnd_list, &pt);
GetCursorPos(&pt);
- BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(menu);
if (ret)
PostMessage(hwnd, WM_COMMAND, ret, 0);
@@ -461,7 +461,7 @@ bool ReminderFrameVisible() void SetReminderFrameVisible(bool visible)
{
- if (frame_id == -1 && hwnd_frame != 0)
+ if (frame_id == -1 && hwnd_frame != nullptr)
ShowWindow(hwnd_frame, visible ? SW_SHOW : SW_HIDE);
}
@@ -481,7 +481,7 @@ INT_PTR ShowHideMenuFunc(WPARAM, LPARAM) int CreateFrame()
{
WNDCLASS wndclass = {};
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hInstance = hInst;
wndclass.lpfnWndProc = FrameWindowProc;
wndclass.lpszClassName = L"AlarmsFrame";
@@ -490,7 +490,7 @@ int CreateFrame() if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"),
WS_CHILD | WS_CLIPCHILDREN,
- 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, nullptr);
CLISTFrame Frame = { sizeof(CLISTFrame) };
Frame.tname = TranslateT("Alarms");
@@ -502,7 +502,7 @@ int CreateFrame() frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
}
else {
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hInstance = hInst;
wndclass.lpfnWndProc = FrameContainerWindowProc;
wndclass.lpszClassName = L"AlarmsFrameContainer";
@@ -510,11 +510,11 @@ int CreateFrame() hwnd_frame = CreateWindowEx(WS_EX_TOOLWINDOW, L"AlarmsFrameContainer", TranslateT("Alarms"),
(WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN) & ~WS_VISIBLE,
- 0, 0, 200, 100, pcli->hwndContactList, NULL, hInst, NULL);
+ 0, 0, 200, 100, pcli->hwndContactList, nullptr, hInst, nullptr);
hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"),
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
- 0, 0, 10, 10, hwnd_frame, NULL, hInst, NULL);
+ 0, 0, 10, 10, hwnd_frame, nullptr, hInst, nullptr);
SetWindowLongPtr(hwnd_frame, GWLP_USERDATA, (LONG_PTR)hwnd_plugin);
@@ -594,9 +594,9 @@ void RefreshReminderFrame() SendMessage(hwnd_plugin, WMU_FILL_LIST, 0, 0);
if (frame_id == -1)
- InvalidateRect(hwnd_frame, 0, TRUE);
+ InvalidateRect(hwnd_frame, nullptr, TRUE);
else
- InvalidateRect(hwnd_plugin, 0, TRUE);
+ InvalidateRect(hwnd_plugin, nullptr, TRUE);
}
void InitFrames()
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index dbc5cf3dcc..ec2a9a3467 100755 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -18,10 +18,10 @@ struct AddEditParam BOOL self_add;
};
-HGENMENU hMainMenuItem = 0;
+HGENMENU hMainMenuItem = nullptr;
// store options dialog window handle statically so it can be refreshed by non-modal add alarm dialog
-HWND hwndOptionsDialog = 0;
+HWND hwndOptionsDialog = nullptr;
static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_DESC, buff, _countof(buff));
replaceStrW(add_edit_alarm->szDesc, buff);
- if (add_edit_alarm->szTitle == 0 || add_edit_alarm->szTitle[0] == '\0') {
+ if (add_edit_alarm->szTitle == nullptr || add_edit_alarm->szTitle[0] == '\0') {
MessageBox(hwndDlg, TranslateT("Please enter a title for this alarm."), TranslateT("Error"), MB_OK | MB_ICONERROR);
return TRUE;
}
@@ -847,13 +847,13 @@ public: class Node
{
public:
- Node() : next(0) {}
+ Node() : next(nullptr) {}
unsigned short value;
Node *next;
};
- ShortList() : head(0) {}
+ ShortList() : head(nullptr) {}
virtual ~ShortList() { clear(); }
void clear()
@@ -1198,7 +1198,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_DESTROY:
- hwndOptionsDialog = 0;
+ hwndOptionsDialog = nullptr;
added_list.clear();
modified_list.clear();
deleted_list.clear();
diff --git a/plugins/AsSingleWindow/src/AsSingleWindow.cpp b/plugins/AsSingleWindow/src/AsSingleWindow.cpp index 4459f498c3..371db5e7f3 100644 --- a/plugins/AsSingleWindow/src/AsSingleWindow.cpp +++ b/plugins/AsSingleWindow/src/AsSingleWindow.cpp @@ -73,7 +73,7 @@ int MsgWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData* data = (MessageWindowEventData*)lParam; - if (data == NULL) + if (data == nullptr) return 0; switch (data->uType) { diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 873283fea4..1a153b144e 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -60,7 +60,7 @@ static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled) mir_snprintf(szSetting, "enabled_%s", assoc->pszClassName);
db_set_b(NULL, "AssocMgr", szSetting, (BYTE)fEnabled);
// dll name for uninstall
- if (assoc->hInstance != NULL && assoc->hInstance != hInst && assoc->hInstance != GetModuleHandle(NULL))
+ if (assoc->hInstance != nullptr && assoc->hInstance != hInst && assoc->hInstance != GetModuleHandle(nullptr))
if (GetModuleFileName(assoc->hInstance, szBuf, _countof(szBuf)))
if (PathToRelativeW(szBuf, szDLL)) {
mir_snprintf(szSetting, "module_%s", assoc->pszClassName);
@@ -97,7 +97,7 @@ void CleanupAssocEnabledSettings(void) if (!db_get_ws(NULL, "AssocMgr", szSetting, &dbv)) {
if (PathToAbsoluteW(dbv.ptszVal, szDLL)) {
// file still exists?
- hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+ hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
db_unset(NULL, "AssocMgr", ppszSettings[i]);
db_unset(NULL, "AssocMgr", szSetting);
@@ -174,7 +174,7 @@ static void CALLBACK NotifyTimerProc(HWND hwnd, UINT, UINT_PTR nTimerID, DWORD) mir_cslock lck(csNotifyTimer);
KillTimer(hwnd, nTimerID);
if (nNotifyTimerID == nTimerID) // might be stopped previously
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, NULL);
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, nullptr, nullptr);
nNotifyTimerID = 0;
}
@@ -183,9 +183,9 @@ static void NotifyAssocChange(BOOL fNow) mir_cslock lck(csNotifyTimer);
if (fNow) {
nNotifyTimerID = 0; // stop previous timer
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSH, NULL, NULL);
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSH, nullptr, nullptr);
}
- else nNotifyTimerID = SetTimer(NULL, nNotifyTimerID, SHELLNOTIFY_DELAY, NotifyTimerProc);
+ else nNotifyTimerID = SetTimer(nullptr, nNotifyTimerID, SHELLNOTIFY_DELAY, NotifyTimerProc);
}
/************************* Assoc List Utils ***********************/
@@ -214,7 +214,7 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) {
ASSOCDATA *assoc2;
assoc2 = (ASSOCDATA*)mir_alloc(sizeof(ASSOCDATA));
- if (assoc2 == NULL) return NULL;
+ if (assoc2 == nullptr) return nullptr;
assoc2->pszClassName = mir_strdup(assoc->pszClassName);
assoc2->pszDescription = mir_wstrdup(assoc->pszDescription);
assoc2->hInstance = assoc->hInstance;
@@ -224,8 +224,8 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) assoc2->pszFileExt = mir_strdup(assoc->pszFileExt);
assoc2->pszMimeType = mir_strdup(assoc->pszMimeType);
assoc2->pszVerbDesc = mir_wstrdup(assoc->pszVerbDesc);
- if (assoc2->pszClassName == NULL || assoc2->pszDescription == NULL ||
- (assoc2->pszFileExt == NULL && assoc->pszFileExt != NULL)) {
+ if (assoc2->pszClassName == nullptr || assoc2->pszDescription == nullptr ||
+ (assoc2->pszFileExt == nullptr && assoc->pszFileExt != nullptr)) {
mir_free(assoc2->pszClassName); // does NULL check
mir_free(assoc2->pszDescription); // does NULL check
mir_free(assoc2->pszService); // does NULL check
@@ -233,7 +233,7 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) mir_free(assoc2->pszMimeType); // does NULL check
mir_free(assoc2->pszVerbDesc); // does NULL check
mir_free(assoc2);
- return NULL;
+ return nullptr;
}
return assoc2;
}
@@ -242,19 +242,19 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) // this function assumes CoInitialize() has been called before
static int ReplaceImageListAssocIcon(HIMAGELIST himl, const ASSOCDATA *assoc, int iPrevIndex)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
int index;
- if (himl == NULL) return -1;
+ if (himl == nullptr) return -1;
// load icon
hIcon = LoadRegClassSmallIcon(assoc->pszClassName);
- if (hIcon == NULL) {
+ if (hIcon == nullptr) {
SHFILEINFOA sfi;
- if (SHGetFileInfoA((assoc->pszFileExt != NULL) ? assoc->pszFileExt : "", FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES))
+ if (SHGetFileInfoA((assoc->pszFileExt != nullptr) ? assoc->pszFileExt : "", FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES))
hIcon = sfi.hIcon; // WinXP: this icon is not updated until the process exits
}
// add icon
- if (hIcon == NULL) return -1;
+ if (hIcon == nullptr) return -1;
index = ImageList_ReplaceIcon(himl, iPrevIndex, hIcon);
DestroyIcon(hIcon);
return index;
@@ -265,7 +265,7 @@ static int ReplaceImageListAssocIcon(HIMAGELIST himl, const ASSOCDATA *assoc, in static wchar_t* GetAssocTypeDesc(const ASSOCDATA *assoc)
{
static wchar_t szDesc[32];
- if (assoc->pszFileExt == NULL)
+ if (assoc->pszFileExt == nullptr)
mir_snwprintf(szDesc, L"%hs:", assoc->pszClassName);
else
mir_snwprintf(szDesc, TranslateT("%hs files"), assoc->pszFileExt);
@@ -277,12 +277,12 @@ static BOOL IsAssocRegistered(const ASSOCDATA *assoc) {
BOOL fSuccess = FALSE, fIsUrl, fUseMainCmdLine;
- fIsUrl = (assoc->pszFileExt == NULL);
- fUseMainCmdLine = (assoc->pszService == NULL);
+ fIsUrl = (assoc->pszFileExt == nullptr);
+ fUseMainCmdLine = (assoc->pszService == nullptr);
// class
wchar_t *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
- if (pszRunCmd != NULL)
+ if (pszRunCmd != nullptr)
fSuccess = IsRegClass(assoc->pszClassName, pszRunCmd);
mir_free(pszRunCmd); // does NULL check
// file ext
@@ -299,34 +299,34 @@ static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc) BOOL fSuccess = FALSE, fIsUrl, fUseMainCmdLine;
wchar_t *pszIconLoc, *pszRunCmd, *pszDdeCmd, *pszAppFileName;
- fIsUrl = (assoc->pszFileExt == NULL);
- fUseMainCmdLine = (assoc->pszService == NULL);
+ fIsUrl = (assoc->pszFileExt == nullptr);
+ fUseMainCmdLine = (assoc->pszService == nullptr);
pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
- if (pszRunCmd != NULL) {
+ if (pszRunCmd != nullptr) {
fSuccess = TRUE; // tentatively
// do not overwrite user customized settings
if (!IsRegClass(assoc->pszClassName, pszRunCmd)) {
// class icon
- if (!assoc->nIconResID && fIsUrl) pszIconLoc = MakeIconLocation(NULL, 0); // miranda logo
+ if (!assoc->nIconResID && fIsUrl) pszIconLoc = MakeIconLocation(nullptr, 0); // miranda logo
else if (!assoc->nIconResID) pszIconLoc = MakeIconLocation(hInst, IDI_MIRANDAFILE); // generic file
else pszIconLoc = MakeIconLocation(assoc->hInstance, assoc->nIconResID);
// register class
- if (fUseMainCmdLine) pszDdeCmd = NULL;
+ if (fUseMainCmdLine) pszDdeCmd = nullptr;
else pszDdeCmd = fIsUrl ? DDEURLCMD : DDEFILECMD;
fSuccess = AddRegClass(assoc->pszClassName, assoc->pszDescription, pszIconLoc, _A2W(MIRANDANAME), pszRunCmd, pszDdeCmd, DDEAPP, DDETOPIC, assoc->pszVerbDesc, assoc->flags&FTDF_BROWSERAUTOOPEN, fIsUrl, assoc->flags&FTDF_ISSHORTCUT);
mir_free(pszIconLoc); // does NULL check
// file type
if (fSuccess && !fIsUrl) {
// register mime type
- if (assoc->pszMimeType != NULL)
+ if (assoc->pszMimeType != nullptr)
if (AddRegMimeType(assoc->pszMimeType, assoc->pszFileExt))
RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, TRUE);
// register file ext
fSuccess = AddRegFileExt(assoc->pszFileExt, assoc->pszClassName, assoc->pszMimeType, assoc->flags&FTDF_ISTEXT);
// register open-with
pszAppFileName = MakeAppFileName(fUseMainCmdLine);
- if (pszAppFileName != NULL)
+ if (pszAppFileName != nullptr)
AddRegOpenWithExtEntry(pszAppFileName, assoc->pszFileExt, assoc->pszDescription);
mir_free(pszAppFileName); // does NULL check
}
@@ -344,12 +344,12 @@ static BOOL UnregisterAssoc(const ASSOCDATA *assoc) BOOL fIsUrl, fUseMainCmdLine;
wchar_t *pszAppFileName;
- fIsUrl = (assoc->pszFileExt == NULL);
- fUseMainCmdLine = (assoc->pszService == NULL);
+ fIsUrl = (assoc->pszFileExt == nullptr);
+ fUseMainCmdLine = (assoc->pszService == nullptr);
// class might have been registered by another instance
wchar_t *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
- if (pszRunCmd != NULL && !IsRegClass(assoc->pszClassName, pszRunCmd)) {
+ if (pszRunCmd != nullptr && !IsRegClass(assoc->pszClassName, pszRunCmd)) {
mir_free(pszRunCmd);
return TRUE; // succeed anyway
}
@@ -360,14 +360,14 @@ static BOOL UnregisterAssoc(const ASSOCDATA *assoc) // file extension
RemoveRegFileExt(assoc->pszFileExt, assoc->pszClassName);
// mime type
- if (assoc->pszMimeType != NULL)
+ if (assoc->pszMimeType != nullptr)
if (WasMimeTypeAdded(assoc->pszMimeType)) {
RemoveRegMimeType(assoc->pszMimeType, assoc->pszFileExt);
RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, FALSE);
}
// open-with entry
pszAppFileName = MakeAppFileName(fUseMainCmdLine);
- if (pszAppFileName != NULL)
+ if (pszAppFileName != nullptr)
RemoveRegOpenWithExtEntry(pszAppFileName, assoc->pszFileExt);
mir_free(pszAppFileName); // does NULL check
}
@@ -402,7 +402,7 @@ static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, // resize storage array
pAssocListBuf = (ASSOCDATA*)mir_realloc(pAssocList, (nAssocListCount + 1)*sizeof(ASSOCDATA));
- if (pAssocListBuf == NULL)
+ if (pAssocListBuf == nullptr)
return FALSE;
pAssocList = pAssocListBuf;
@@ -419,7 +419,7 @@ static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, assoc->pszVerbDesc = pszVerbDesc;
// error check
- if (assoc->pszDescription == NULL || (assoc->pszService == NULL && tdh->pszService != NULL)) {
+ if (assoc->pszDescription == nullptr || (assoc->pszService == nullptr && tdh->pszService != nullptr)) {
mir_free(assoc->pszService); // does NULL check
mir_free(assoc->pszDescription); // does NULL check
return FALSE;
@@ -448,7 +448,7 @@ static BOOL RemoveAssocItem_Worker(const char *pszClassName) // delete registry keys and db setting
UnregisterAssoc(assoc);
- if (assoc->pszMimeType != NULL)
+ if (assoc->pszMimeType != nullptr)
RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, FALSE);
DeleteAssocEnabledSetting(assoc);
@@ -464,7 +464,7 @@ static BOOL RemoveAssocItem_Worker(const char *pszClassName) if ((index + 1) < nAssocListCount)
memmove(assoc, &pAssocList[index + 1], ((nAssocListCount - index - 1)*sizeof(ASSOCDATA)));
pAssocListBuf = (ASSOCDATA*)mir_realloc(pAssocList, (nAssocListCount - 1)*sizeof(ASSOCDATA));
- if (pAssocListBuf != NULL) pAssocList = pAssocListBuf;
+ if (pAssocListBuf != nullptr) pAssocList = pAssocListBuf;
--nAssocListCount;
NotifyAssocChange(FALSE);
@@ -478,12 +478,12 @@ static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam) const FILETYPEDESC *ftd = (FILETYPEDESC*)lParam;
if (ftd->cbSize < sizeof(FILETYPEDESC))
return 1;
- if (ftd->pszFileExt == NULL || ftd->pszFileExt[0] != '.')
+ if (ftd->pszFileExt == nullptr || ftd->pszFileExt[0] != '.')
return 2;
char *pszFileExt = mir_strdup(ftd->pszFileExt);
char *pszClassName = MakeFileClassName(ftd->pszFileExt);
- if (pszFileExt != NULL && pszClassName != NULL) {
+ if (pszFileExt != nullptr && pszClassName != nullptr) {
wchar_t *pszVerbDesc = s2t(ftd->ptszVerbDesc, ftd->flags&FTDF_UNICODE, TRUE); // does NULL check
char *pszMimeType = mir_strdup(ftd->pszMimeType); // does NULL check
if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)ftd, pszFileExt, pszVerbDesc, pszMimeType))
@@ -498,9 +498,9 @@ static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam) static INT_PTR ServiceRemoveFileType(WPARAM, LPARAM lParam)
{
- if ((char*)lParam == NULL) return 2;
+ if ((char*)lParam == nullptr) return 2;
char *pszClassName = MakeFileClassName((char*)lParam);
- if (pszClassName != NULL)
+ if (pszClassName != nullptr)
if (RemoveAssocItem_Worker(pszClassName)) {
mir_free(pszClassName);
return 0;
@@ -515,14 +515,14 @@ static INT_PTR ServiceAddNewUrlType(WPARAM, LPARAM lParam) if (utd->cbSize < sizeof(URLTYPEDESC))
return 1;
- if (utd->pszService == NULL)
+ if (utd->pszService == nullptr)
return 2;
- if (utd->pszProtoPrefix == NULL || utd->pszProtoPrefix[mir_strlen(utd->pszProtoPrefix) - 1] != ':')
+ if (utd->pszProtoPrefix == nullptr || utd->pszProtoPrefix[mir_strlen(utd->pszProtoPrefix) - 1] != ':')
return 2;
char *pszClassName = MakeUrlClassName(utd->pszProtoPrefix);
- if (pszClassName != NULL)
- if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)utd, NULL, NULL, NULL))
+ if (pszClassName != nullptr)
+ if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)utd, nullptr, nullptr, nullptr))
// no need to free pszClassName, as its ownership got transferred to storage list
return 0;
mir_free(pszClassName); // does NULL check
@@ -531,9 +531,9 @@ static INT_PTR ServiceAddNewUrlType(WPARAM, LPARAM lParam) static INT_PTR ServiceRemoveUrlType(WPARAM, LPARAM lParam)
{
- if ((char*)lParam == NULL) return 2;
+ if ((char*)lParam == nullptr) return 2;
char *pszClassName = MakeUrlClassName((char*)lParam);
- if (pszClassName != NULL)
+ if (pszClassName != nullptr)
if (RemoveAssocItem_Worker(pszClassName)) {
mir_free(pszClassName);
return 0;
@@ -556,11 +556,11 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const wchar_t *pszPar return FALSE;
ASSOCDATA *assoc = &pAssocList[index];
// no service specified? correct registry to use main commandline
- if (assoc->pszService == NULL) {
+ if (assoc->pszService == nullptr) {
EnsureAssocRegistered(assoc);
NotifyAssocChange(FALSE);
// try main command line
- if ((INT_PTR)ShellExecute(NULL, NULL, pszParam, NULL, NULL, SW_SHOWNORMAL) >= 32)
+ if ((INT_PTR)ShellExecute(nullptr, nullptr, pszParam, nullptr, nullptr, SW_SHOWNORMAL) >= 32)
*res = 0; // success
return TRUE;
}
@@ -569,7 +569,7 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const wchar_t *pszPar pvParam = t2s(pszParam, assoc->flags&FTDF_UNICODE, FALSE);
// call service
- if (pszService != NULL && pvParam != NULL)
+ if (pszService != nullptr && pvParam != nullptr)
*res = CallService(pszService, 0, (LPARAM)pvParam);
mir_free(pszService); // does NULL check
mir_free(pvParam); // does NULL check
@@ -583,12 +583,12 @@ INT_PTR InvokeFileHandler(const wchar_t *pszFileName) // find extension
wchar_t *p = (wchar_t*)wcsrchr(pszFileName, '.');
- if (p != NULL) {
+ if (p != nullptr) {
pszFileExt = t2a(p);
- if (pszFileExt != NULL) {
+ if (pszFileExt != nullptr) {
// class name
pszClassName = MakeFileClassName(pszFileExt);
- if (pszClassName != NULL)
+ if (pszClassName != nullptr)
if (!InvokeHandler_Worker(pszClassName, pszFileName, &res)) {
// correct registry on error (no longer in list)
RemoveRegFileExt(pszFileExt, pszClassName);
@@ -608,13 +608,13 @@ INT_PTR InvokeUrlHandler(const wchar_t *pszUrl) // find prefix
pszProtoPrefix = t2a(pszUrl);
- if (pszProtoPrefix != NULL) {
+ if (pszProtoPrefix != nullptr) {
p = strchr(pszProtoPrefix, ':');
- if (p != NULL) {
+ if (p != nullptr) {
*(++p) = 0; // remove trailing :
// class name
pszClassName = MakeUrlClassName(pszProtoPrefix);
- if (pszClassName != NULL)
+ if (pszClassName != nullptr)
if (!InvokeHandler_Worker(pszClassName, pszUrl, &res))
// correct registry on error (no longer in list)
RemoveRegClass(pszClassName);
@@ -630,12 +630,12 @@ INT_PTR InvokeUrlHandler(const wchar_t *pszUrl) static int CALLBACK ListViewSortDesc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
int cmp;
- if (((ASSOCDATA*)lParam1)->pszFileExt != NULL && ((ASSOCDATA*)lParam2)->pszFileExt != NULL)
+ if (((ASSOCDATA*)lParam1)->pszFileExt != nullptr && ((ASSOCDATA*)lParam2)->pszFileExt != nullptr)
cmp = CompareStringA((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszFileExt, -1, ((ASSOCDATA*)lParam2)->pszFileExt, -1);
else if (((ASSOCDATA*)lParam1)->pszFileExt == ((ASSOCDATA*)lParam2)->pszFileExt) // both NULL
cmp = CompareStringA((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszClassName, -1, ((ASSOCDATA*)lParam2)->pszClassName, -1);
else // different types, incomparable
- cmp = (((ASSOCDATA*)lParam1)->pszFileExt == NULL) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
+ cmp = (((ASSOCDATA*)lParam1)->pszFileExt == nullptr) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
if (cmp == CSTR_EQUAL)
cmp = CompareString((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszDescription, -1, ((ASSOCDATA*)lParam2)->pszDescription, -1);
if (cmp != 0) cmp -= 2; // maintain CRT conventions
@@ -652,7 +652,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
- CoInitialize(NULL);
+ CoInitialize(nullptr);
HWND hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
ListView_SetUnicodeFormat(hwndList, TRUE);
@@ -675,11 +675,11 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara mir_cslock lck(csAssocList);
{
HDC hdc = GetDC(hwndList);
- if (hdc != NULL) { // BITSPIXEL is compatible with ILC_COLOR flags
+ if (hdc != nullptr) { // BITSPIXEL is compatible with ILC_COLOR flags
himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), GetDeviceCaps(hdc, BITSPIXEL) | ILC_MASK, nAssocListCount, 0);
ReleaseDC(hwndList, hdc);
}
- else himl = NULL;
+ else himl = nullptr;
}
ListView_SetImageList(hwndList, himl, LVSIL_SMALL); // autodestroyed
// enum assoc list
@@ -729,8 +729,8 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.mask = LVIF_PARAM | LVIF_GROUPID;
for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) {
assoc = (ASSOCDATA*)lvi.lParam;
- if (assoc == NULL) continue; // groups
- lvi.iGroupId = (assoc->pszFileExt == NULL) + 1;
+ if (assoc == nullptr) continue; // groups
+ lvi.iGroupId = (assoc->pszFileExt == nullptr) + 1;
ListView_SetItem(hwndList, &lvi);
}
}
@@ -742,7 +742,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara // autostart
wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE);
- if (pszRunCmd != NULL) {
+ if (pszRunCmd != nullptr) {
CheckDlgButton(hwndDlg, IDC_AUTOSTART, IsRegRunEntry(L"MirandaNG", pszRunCmd) ? BST_CHECKED : BST_UNCHECKED);
mir_free(pszRunCmd);
}
@@ -759,7 +759,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.mask = LVIF_PARAM | LVIF_IMAGE;
for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) {
assoc = (ASSOCDATA*)lvi.lParam;
- if (assoc == NULL) continue; // groups
+ if (assoc == nullptr) continue; // groups
lvi.iImage = ReplaceImageListAssocIcon(himl, assoc, lvi.iImage);
ListView_SetItem(hwndList, &lvi);
}
@@ -777,7 +777,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara HBRUSH hBrush = (HBRUSH)SendMessage(hwndDlg, msg, wParam, lParam);
COLORREF clr;
HTHEME hTheme = GetWindowTheme((HWND)lParam);
- if (hTheme != NULL && !GetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &clr)) {
+ if (hTheme != nullptr && !GetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &clr)) {
SetBkMode((HDC)wParam, TRANSPARENT);
SetTextColor((HDC)wParam, clr);
}
@@ -831,7 +831,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.iItem = ListView_GetNextItem(nmhdr->hwndFrom, lvi.iItem, LVNI_ABOVE);
if (lvi.iItem != -1)
if (ListView_GetItem(nmhdr->hwndFrom, &lvi))
- if ((ASSOCDATA*)lvi.lParam == NULL) // groups
+ if ((ASSOCDATA*)lvi.lParam == nullptr) // groups
lvi.iItem = -1;
if (lvi.iItem == -1) {
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); // eat it
@@ -846,7 +846,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.iItem -= ListView_GetCountPerPage(nmhdr->hwndFrom);
if (lvi.iItem >= 0)
if (ListView_GetItem(nmhdr->hwndFrom, &lvi))
- if ((ASSOCDATA*)lvi.lParam == NULL) // groups
+ if ((ASSOCDATA*)lvi.lParam == nullptr) // groups
lvi.iItem = -1;
if (lvi.iItem < 0) {
ListView_SetItemState(nmhdr->hwndFrom, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
@@ -874,14 +874,14 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara mir_cslock lck(csAssocList);
for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) {
assoc = (ASSOCDATA*)lvi.lParam;
- if (assoc == NULL) continue; // groups
+ if (assoc == nullptr) continue; // groups
fEnabled = ListView_GetCheckState(hwndList, lvi.iItem);
SetAssocEnabled(assoc, fEnabled);
// re-register registery keys
if (fEnabled ? !EnsureAssocRegistered(assoc) : !UnregisterAssoc(assoc)) {
char *pszErr = GetWinErrorDescription(GetLastError());
- ShowInfoMessage(NIIF_ERROR, Translate("File association error"), Translate("There was an error writing to the registry to modify the file/url associations.\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown"));
+ ShowInfoMessage(NIIF_ERROR, Translate("File association error"), Translate("There was an error writing to the registry to modify the file/url associations.\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
mir_free(pszErr); // does NULL check
fRegFailed = TRUE; // just show one time
}
@@ -892,12 +892,12 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara // autostart
wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE);
fRegFailed = FALSE;
- if (pszRunCmd != NULL) {
+ if (pszRunCmd != nullptr) {
fEnabled = IsDlgButtonChecked(hwndDlg, IDC_AUTOSTART);
if (fEnabled ? !AddRegRunEntry(L"MirandaNG", pszRunCmd) : !RemoveRegRunEntry(L"MirandaNG", pszRunCmd)) {
char *pszErr;
pszErr = GetWinErrorDescription(GetLastError());
- ShowInfoMessage(NIIF_ERROR, Translate("Autostart error"), Translate("There was an error writing to the registry to modify the autostart list.\n\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown"));
+ ShowInfoMessage(NIIF_ERROR, Translate("Autostart error"), Translate("There was an error writing to the registry to modify the autostart list.\n\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
mir_free(pszErr); // does NULL check
fRegFailed = TRUE; // just show one time
}
@@ -937,7 +937,7 @@ void InitAssocList(void) hHookOptInit = HookEvent(ME_OPT_INITIALISE, AssocListOptInit);
// Assoc List
- pAssocList = NULL;
+ pAssocList = nullptr;
nAssocListCount = 0;
// Services
@@ -952,19 +952,19 @@ void InitAssocList(void) // register open-with app
{
wchar_t *pszAppFileName, *pszIconLoc, *pszRunCmd;
- pszIconLoc = MakeIconLocation(NULL, 0);
+ pszIconLoc = MakeIconLocation(nullptr, 0);
// miranda32.exe
pszAppFileName = MakeAppFileName(TRUE);
pszRunCmd = MakeRunCommand(TRUE, FALSE);
- if (pszAppFileName != NULL && pszRunCmd != NULL)
- AddRegOpenWith(pszAppFileName, FALSE, _A2W(MIRANDANAME), pszIconLoc, pszRunCmd, NULL, NULL, NULL);
+ if (pszAppFileName != nullptr && pszRunCmd != nullptr)
+ AddRegOpenWith(pszAppFileName, FALSE, _A2W(MIRANDANAME), pszIconLoc, pszRunCmd, nullptr, nullptr, nullptr);
mir_free(pszRunCmd); // does NULL check
mir_free(pszAppFileName); // does NULL check
// assocmgr.dll
pszAppFileName = MakeAppFileName(FALSE);
pszRunCmd = MakeRunCommand(FALSE, TRUE);
- if (pszAppFileName != NULL && pszRunCmd != NULL)
+ if (pszAppFileName != nullptr && pszRunCmd != nullptr)
AddRegOpenWith(pszAppFileName, TRUE, _A2W(MIRANDANAME), pszIconLoc, pszRunCmd, DDEFILECMD, DDEAPP, DDETOPIC);
mir_free(pszRunCmd); // does NULL check
mir_free(pszAppFileName); // does NULL check
@@ -977,12 +977,12 @@ void InitAssocList(void) FILETYPEDESC ftd;
ftd.cbSize = sizeof(FILETYPEDESC);
ftd.pszFileExt = ".dat";
- ftd.pszMimeType = NULL;
+ ftd.pszMimeType = nullptr;
ftd.pwszDescription = TranslateT("Miranda NG database");
ftd.hInstance = hInst;
ftd.nIconResID = IDI_MIRANDAFILE;
- ftd.ptszVerbDesc = NULL;
- ftd.pszService = NULL;
+ ftd.ptszVerbDesc = nullptr;
+ ftd.pszService = nullptr;
ftd.flags = FTDF_DEFAULTDISABLED | FTDF_TCHAR;
ServiceAddNewFileType(0, (LPARAM)&ftd);
}
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp index 13da3b00eb..0e9d29fb0e 100644 --- a/plugins/AssocMgr/src/dde.cpp +++ b/plugins/AssocMgr/src/dde.cpp @@ -75,7 +75,7 @@ static wchar_t* GetExecuteParam(wchar_t **ppszString) if (fQuoted)
pszParam++;
wchar_t *p = wcschr(pszParam, (wchar_t)(fQuoted ? '"' : ','));
- if (p != NULL) {
+ if (p != nullptr) {
*(p++) = 0;
if (fQuoted && *p == ',') p++;
}
@@ -105,14 +105,14 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_DDE_EXECUTE: /* posted message */
HGLOBAL hCommand;
- if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hCommand)) {
+ if (UnpackDDElParam(msg, lParam, nullptr, (PUINT_PTR)&hCommand)) {
/* ANSI execute command can't happen for shell */
if (IsWindowUnicode((HWND)wParam)) {
wchar_t *pszCommand = (wchar_t*)GlobalLock(hCommand);
- if (pszCommand != NULL) {
+ if (pszCommand != nullptr) {
wchar_t *pszAction = GetExecuteParam(&pszCommand);
wchar_t *pszArg = GetExecuteParam(&pszCommand);
- if (pszArg != NULL) {
+ if (pszArg != nullptr) {
/* we are inside miranda here, we make it async so the shell does
* not timeout regardless what the plugins try to do. */
if (!mir_wstrcmpi(pszAction, L"file"))
@@ -147,7 +147,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA ATOM hSzItem;
DDEACK ack;
memset(&ack, 0, sizeof(ack));
- if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hSzItem)) {
+ if (UnpackDDElParam(msg, lParam, nullptr, (PUINT_PTR)&hSzItem)) {
lParam = ReuseDDElParam(lParam, msg, WM_DDE_ACK, *(PUINT)&ack, (UINT)hSzItem);
if (!PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, lParam)) {
if (hSzItem) GlobalDeleteAtom(hSzItem);
@@ -166,18 +166,18 @@ static HANDLE StartupMainProcess(wchar_t *pszDatabasePath) wchar_t *p, szPath[MAX_PATH];
/* we are inside RunDll32 here */
- if (!GetModuleFileName(hInst, szPath, _countof(szPath))) return NULL;
+ if (!GetModuleFileName(hInst, szPath, _countof(szPath))) return nullptr;
p = wcsrchr(szPath, '\\');
- if (p != NULL) { *p = 0; p = wcsrchr(szPath, '\\'); }
- if (p == NULL) return NULL;
+ if (p != nullptr) { *p = 0; p = wcsrchr(szPath, '\\'); }
+ if (p == nullptr) return nullptr;
mir_wstrcpy(++p, L"miranda32.exe");
/* inherit startup data from RunDll32 process */
STARTUPINFO si;
GetStartupInfo(&si);
PROCESS_INFORMATION pi;
- if (!CreateProcess(szPath, pszDatabasePath, NULL, NULL, TRUE, GetPriorityClass(GetCurrentProcess()), NULL, NULL, &si, &pi))
- return NULL;
+ if (!CreateProcess(szPath, pszDatabasePath, nullptr, nullptr, TRUE, GetPriorityClass(GetCurrentProcess()), nullptr, nullptr, &si, &pi))
+ return nullptr;
CloseHandle(pi.hThread);
return pi.hProcess;
}
@@ -189,10 +189,10 @@ EXTERN_C __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, wchar_t DWORD dwTick;
/* wait for dde window to be available (avoiding race condition) */
- pHandles[0] = CreateEvent(NULL, TRUE, FALSE, WNDCLASS_DDEMSGWINDOW);
- if (pHandles[0] != NULL) {
+ pHandles[0] = CreateEvent(nullptr, TRUE, FALSE, WNDCLASS_DDEMSGWINDOW);
+ if (pHandles[0] != nullptr) {
pHandles[1] = StartupMainProcess(pszCmdLine); /* obeys nCmdShow using GetStartupInfo() */
- if (pHandles[1] != NULL) {
+ if (pHandles[1] != nullptr) {
dwTick = GetTickCount();
/* either process terminated or dde window created */
if (WaitForMultipleObjects(_countof(pHandles), pHandles, FALSE, DDEMESSAGETIMEOUT) == WAIT_OBJECT_0) {
@@ -213,7 +213,7 @@ EXTERN_C __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, wchar_t static int DdePreShutdown(WPARAM, LPARAM)
{
/* dde needs to be stopped before any plugins are unloaded */
- if (hwndDdeMsg != NULL) DestroyWindow(hwndDdeMsg);
+ if (hwndDdeMsg != nullptr) DestroyWindow(hwndDdeMsg);
UnregisterClass(WNDCLASS_DDEMSGWINDOW, hInst);
return 0;
}
@@ -226,19 +226,19 @@ static int DdeModulesLoaded2(WPARAM, LPARAM) wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hInstance = hInst;
- wcl.hCursor = NULL;
+ wcl.hCursor = nullptr;
wcl.lpszClassName = WNDCLASS_DDEMSGWINDOW;
- wcl.hbrBackground = NULL;
- wcl.hIcon = NULL;
- wcl.lpszMenuName = NULL;
+ wcl.hbrBackground = nullptr;
+ wcl.hIcon = nullptr;
+ wcl.lpszMenuName = nullptr;
wcl.style = 0;
RegisterClass(&wcl);
/* Note: use of HWND_MESSAGE does not fit for DDE as the window must be a top-level one */
- hwndDdeMsg = CreateWindow(WNDCLASS_DDEMSGWINDOW, NULL, 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
+ hwndDdeMsg = CreateWindow(WNDCLASS_DDEMSGWINDOW, nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr);
/* make known dde startup code is passed */
HANDLE hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, WNDCLASS_DDEMSGWINDOW);
- if (hEvent != NULL) {
+ if (hEvent != nullptr) {
SetEvent(hEvent);
CloseHandle(hEvent);
}
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 7a717a0766..43976f1217 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -34,8 +34,8 @@ static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo, pszErr = GetWinErrorDescription(res);
pszInfo2 = s2t(pszInfo, fInfoUnicode, FALSE); // does NULL check
mir_snwprintf(szMsg, TranslateT("Access failed:\n%.64hs(%.128s)\n%.250hs(%u)\n%.256hs (%u)"), pszFunc, pszInfo2, pszFile, nLine, pszErr, res);
- MessageBox(NULL, szMsg, TranslateT("Registry warning"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST | MB_TASKMODAL);
- if (pszErr != NULL) LocalFree(pszErr);
+ MessageBox(nullptr, szMsg, TranslateT("Registry warning"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST | MB_TASKMODAL);
+ if (pszErr != nullptr) LocalFree(pszErr);
mir_free(pszInfo2); // does NULL check
}
return res;
@@ -100,7 +100,7 @@ char* MakeFileClassName(const char *pszFileExt) {
size_t cbLen = mir_strlen(pszFileExt) + 12;
char *pszClass = (char*)mir_alloc(cbLen);
- if (pszClass != NULL)
+ if (pszClass != nullptr)
// using correctly formated PROGID
mir_snprintf(pszClass, cbLen, "miranda%sfile", pszFileExt); // includes dot, buffer safe
return pszClass;
@@ -110,7 +110,7 @@ char* MakeFileClassName(const char *pszFileExt) char* MakeUrlClassName(const char *pszUrl)
{
char *pszClass = mir_strdup(pszUrl);
- if (pszClass != NULL)
+ if (pszClass != nullptr)
// remove trailing :
pszClass[mir_strlen(pszClass) - 1] = 0;
return pszClass;
@@ -119,7 +119,7 @@ char* MakeUrlClassName(const char *pszUrl) static BOOL IsFileClassName(char *pszClassName, char **ppszFileExt)
{
*ppszFileExt = strchr(pszClassName, '.');
- return *ppszFileExt != NULL;
+ return *ppszFileExt != nullptr;
}
// mir_free() the return value
@@ -128,15 +128,15 @@ wchar_t* MakeRunCommand(BOOL fMirExe, BOOL fFixedDbProfile) wchar_t szDbFile[MAX_PATH], szExe[MAX_PATH], *pszFmt;
if (fFixedDbProfile) {
if (Profile_GetNameW(_countof(szDbFile), szDbFile))
- return NULL;
+ return nullptr;
wchar_t *p = wcsrchr(szDbFile, '.');
if (p)
*p = 0;
}
else mir_wstrcpy(szDbFile, L"%1"); // buffer safe
- if (!GetModuleFileName(fMirExe ? NULL : hInst, szExe, _countof(szExe)))
- return NULL;
+ if (!GetModuleFileName(fMirExe ? nullptr : hInst, szExe, _countof(szExe)))
+ return nullptr;
if (fMirExe)
// run command for miranda32.exe
@@ -148,7 +148,7 @@ wchar_t* MakeRunCommand(BOOL fMirExe, BOOL fFixedDbProfile) GetShortPathName(szExe, szExe, _countof(szExe));
// surround by quotes if failed
size_t len = mir_wstrlen(szExe);
- if (wcschr(szExe, ' ') != NULL && (len + 2) < _countof(szExe)) {
+ if (wcschr(szExe, ' ') != nullptr && (len + 2) < _countof(szExe)) {
memmove(szExe, szExe + 1, (len + 1) * sizeof(wchar_t));
szExe[len + 2] = szExe[0] = '\"';
szExe[len + 3] = 0;
@@ -168,29 +168,29 @@ static BOOL IsValidRunCommand(const wchar_t *pszRunCmd) // split into executable path and arguments
if (buf[0] == '\"') {
pargs = wcschr(&buf[1], '\"');
- if (pargs != NULL) *(pargs++) = 0;
+ if (pargs != nullptr) *(pargs++) = 0;
pexe = &buf[1];
if (*pargs == ' ') ++pargs;
}
else {
pargs = wcschr(buf, ' ');
- if (pargs != NULL) *pargs = 0;
+ if (pargs != nullptr) *pargs = 0;
pexe = buf;
}
- if (SearchPath(NULL, pexe, L".exe", _countof(szFullExe), szFullExe, &pszFilePart)) {
- if (pszFilePart != NULL)
+ if (SearchPath(nullptr, pexe, L".exe", _countof(szFullExe), szFullExe, &pszFilePart)) {
+ if (pszFilePart != nullptr)
if (!mir_wstrcmpi(pszFilePart, L"rundll32.exe") || !mir_wstrcmpi(pszFilePart, L"rundll.exe")) {
// split into dll path and arguments
if (pargs[0] == '\"') {
++pargs;
pexe = wcschr(&pargs[1], '\"');
- if (pexe != NULL) *pexe = 0;
+ if (pexe != nullptr) *pexe = 0;
}
else {
pexe = wcschr(pargs, ',');
- if (pexe != NULL) *pexe = 0;
+ if (pexe != nullptr) *pexe = 0;
}
- return SearchPath(NULL, pargs, L".dll", 0, NULL, NULL) != 0;
+ return SearchPath(nullptr, pargs, L".dll", 0, nullptr, nullptr) != 0;
}
return TRUE;
}
@@ -200,11 +200,11 @@ static BOOL IsValidRunCommand(const wchar_t *pszRunCmd) // mir_free() the return value
wchar_t* MakeIconLocation(HMODULE hModule, WORD nIconResID)
{
- wchar_t szModule[MAX_PATH], *pszIconLoc = NULL;
+ wchar_t szModule[MAX_PATH], *pszIconLoc = nullptr;
int cch;
if ((cch = GetModuleFileName(hModule, szModule, _countof(szModule))) != 0) {
pszIconLoc = (wchar_t*)mir_alloc((cch += 8) * sizeof(wchar_t));
- if (pszIconLoc != NULL)
+ if (pszIconLoc != nullptr)
mir_snwprintf(pszIconLoc, cch, L"%s,%i", szModule, -(int)nIconResID); // id may be 0, buffer safe
}
return pszIconLoc;
@@ -214,13 +214,13 @@ wchar_t* MakeIconLocation(HMODULE hModule, WORD nIconResID) wchar_t* MakeAppFileName(BOOL fMirExe)
{
wchar_t szExe[MAX_PATH], *psz;
- if (GetModuleFileName(fMirExe ? NULL : hInst, szExe, _countof(szExe))) {
+ if (GetModuleFileName(fMirExe ? nullptr : hInst, szExe, _countof(szExe))) {
psz = wcsrchr(szExe, '\\');
- if (psz != NULL) ++psz;
+ if (psz != nullptr) ++psz;
else psz = szExe;
return mir_wstrdup(psz);
}
- return NULL;
+ return nullptr;
}
/************************* Helpers ********************************/
@@ -232,12 +232,12 @@ static LONG DeleteRegSubTree(HKEY hKey, const wchar_t *pszSubKey) wchar_t *pszSubKeyBuf;
HKEY hSubKey;
if ((res = RegOpenKeyEx(hKey, pszSubKey, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | DELETE, &hSubKey)) == ERROR_SUCCESS) {
- if ((res = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, &nMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegQueryInfoKey(hSubKey, nullptr, nullptr, nullptr, nullptr, &nMaxSubKeyLen, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) {
pszSubKeyBuf = (wchar_t*)mir_alloc((nMaxSubKeyLen + 1) * sizeof(wchar_t));
- if (pszSubKeyBuf == NULL) res = ERROR_NOT_ENOUGH_MEMORY;
+ if (pszSubKeyBuf == nullptr) res = ERROR_NOT_ENOUGH_MEMORY;
while (!res) {
cchSubKey = nMaxSubKeyLen + 1;
- if ((res = RegEnumKeyEx(hSubKey, 0, pszSubKeyBuf, &cchSubKey, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS)
+ if ((res = RegEnumKeyEx(hSubKey, 0, pszSubKeyBuf, &cchSubKey, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS)
res = DeleteRegSubTree(hSubKey, pszSubKeyBuf); // recursion
}
mir_free(pszSubKeyBuf); // does NULL check
@@ -253,9 +253,9 @@ static LONG DeleteRegSubTree(HKEY hKey, const wchar_t *pszSubKey) static LONG SetRegSubKeyStrDefValue(HKEY hMainKey, const wchar_t *pszSubKey, const wchar_t *pszVal)
{
HKEY hSubKey;
- LONG res = RegCreateKeyEx(hMainKey, pszSubKey, 0, NULL, 0, KEY_SET_VALUE | KEY_QUERY_VALUE, NULL, &hSubKey, NULL);
+ LONG res = RegCreateKeyEx(hMainKey, pszSubKey, 0, nullptr, 0, KEY_SET_VALUE | KEY_QUERY_VALUE, nullptr, &hSubKey, nullptr);
if (!res) {
- res = RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (BYTE*)pszVal, (int)(mir_wstrlen(pszVal) + 1) * sizeof(wchar_t));
+ res = RegSetValueEx(hSubKey, nullptr, 0, REG_SZ, (BYTE*)pszVal, (int)(mir_wstrlen(pszVal) + 1) * sizeof(wchar_t));
RegCloseKey(hSubKey);
}
return res;
@@ -267,7 +267,7 @@ static void SetRegStrPrefixValue(HKEY hKey, const wchar_t *pszValPrefix, const w size_t dwSize = (mir_wstrlen(pszVal) + mir_wstrlen(pszValPrefix) + 1) * sizeof(wchar_t);
wchar_t *pszStr = (wchar_t*)_alloca(dwSize);
mir_wstrcat(mir_wstrcpy(pszStr, pszValPrefix), pszVal); // buffer safe
- RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize);
+ RegSetValueEx(hKey, nullptr, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize);
}
// hKey must have been opened with KEY_QUERY_VALUE access right
@@ -276,11 +276,11 @@ static wchar_t* GetRegStrValue(HKEY hKey, const wchar_t *pszValName) {
// get size
DWORD dwSize, dwType;
- if (!RegQueryValueEx(hKey, pszValName, NULL, NULL, NULL, &dwSize) && dwSize > sizeof(wchar_t)) {
+ if (!RegQueryValueEx(hKey, pszValName, nullptr, nullptr, nullptr, &dwSize) && dwSize > sizeof(wchar_t)) {
wchar_t *pszVal = (wchar_t*)mir_alloc(dwSize + sizeof(wchar_t));
- if (pszVal != NULL) {
+ if (pszVal != nullptr) {
// get value
- if (!RegQueryValueEx(hKey, pszValName, NULL, &dwType, (BYTE*)pszVal, &dwSize)) {
+ if (!RegQueryValueEx(hKey, pszValName, nullptr, &dwType, (BYTE*)pszVal, &dwSize)) {
pszVal[dwSize / sizeof(wchar_t)] = 0;
if (dwType == REG_EXPAND_SZ) {
dwSize = MAX_PATH;
@@ -297,7 +297,7 @@ static wchar_t* GetRegStrValue(HKEY hKey, const wchar_t *pszValName) mir_free(pszVal);
}
}
- return NULL;
+ return nullptr;
}
// hKey must have been opened with KEY_QUERY_VALUE access right
@@ -305,7 +305,7 @@ static BOOL IsRegStrValue(HKEY hKey, const wchar_t *pszValName, const wchar_t *p {
BOOL fSame = FALSE;
wchar_t *pszVal = GetRegStrValue(hKey, pszValName);
- if (pszVal != NULL) {
+ if (pszVal != nullptr) {
fSame = !mir_wstrcmp(pszVal, pszCmpVal);
mir_free(pszVal);
}
@@ -318,9 +318,9 @@ static BOOL IsRegStrValueA(HKEY hKey, const wchar_t *pszValName, const char *psz BOOL fSame = FALSE;
char *pszValA;
wchar_t *pszVal = GetRegStrValue(hKey, pszValName);
- if (pszVal != NULL) {
+ if (pszVal != nullptr) {
pszValA = t2a(pszVal);
- if (pszValA != NULL)
+ if (pszValA != nullptr)
fSame = !mir_strcmp(pszValA, pszCmpVal);
mir_free(pszValA); // does NULL check
mir_free(pszVal);
@@ -377,14 +377,14 @@ static void BackupRegTree_Worker(HKEY hKey, const char *pszSubKey, struct Backup char *pszName;
DWORD nDbPrefixLen;
if ((res = RegOpenKeyExA(hKey, pszSubKey, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey)) == ERROR_SUCCESS) {
- if ((res = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, &nMaxSubKeyLen, NULL, NULL, &nMaxValNameLen, &nMaxValSize, NULL, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegQueryInfoKey(hKey, nullptr, nullptr, nullptr, nullptr, &nMaxSubKeyLen, nullptr, nullptr, &nMaxValNameLen, &nMaxValSize, nullptr, nullptr)) == ERROR_SUCCESS) {
if (nMaxSubKeyLen > nMaxValNameLen) nMaxValNameLen = nMaxSubKeyLen;
// prepare buffer
nDbPrefixLen = (DWORD)(mir_strlen(*param->ppszDbPrefix) + mir_strlen(pszSubKey) + 1);
cchName = nDbPrefixLen + nMaxValNameLen + 3;
if (cchName > *param->pdwDbPrefixSize) {
pszName = (char*)mir_realloc(*param->ppszDbPrefix, cchName);
- if (pszName == NULL) return;
+ if (pszName == nullptr) return;
*param->ppszDbPrefix = pszName;
*param->pdwDbPrefixSize = cchName;
}
@@ -393,17 +393,17 @@ static void BackupRegTree_Worker(HKEY hKey, const char *pszSubKey, struct Backup pszName = (char*)mir_alloc(nMaxValNameLen + 1);
if (nMaxValSize == 0) nMaxValSize = 1;
BYTE *pData = (BYTE*)mir_alloc(nMaxValSize);
- if (pszName != NULL && pData != NULL) {
+ if (pszName != nullptr && pData != nullptr) {
DWORD index = 0;
while (!res) {
cchName = nMaxValNameLen + 1;
cbData = nMaxValSize;
- if ((res = RegEnumValueA(hKey, index++, pszName, &cchName, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegEnumValueA(hKey, index++, pszName, &cchName, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) {
(*param->ppszDbPrefix)[nDbPrefixLen] = 0;
mir_strcat(*param->ppszDbPrefix, pszName); // buffer safe
ptrW ptszName(a2t(pszName));
if (ptszName != NULL)
- if (!RegQueryValueEx(hKey, ptszName, NULL, &dwType, pData, &cbData))
+ if (!RegQueryValueEx(hKey, ptszName, nullptr, &dwType, pData, &cbData))
WriteDbBackupData(*param->ppszDbPrefix, dwType, pData, cbData);
}
}
@@ -412,12 +412,12 @@ static void BackupRegTree_Worker(HKEY hKey, const char *pszSubKey, struct Backup }
mir_free(pData); // does NULL check
// enum subkeys
- if (param->level < 32 && pszName != NULL) {
+ if (param->level < 32 && pszName != nullptr) {
++param->level; // can be max 32 levels deep (after prefix), restriction of RegCreateKeyEx()
DWORD index = 0;
while (!res) {
cchName = nMaxSubKeyLen + 1;
- if ((res = RegEnumKeyExA(hKey, index++, pszName, &cchName, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegEnumKeyExA(hKey, index++, pszName, &cchName, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) {
(*param->ppszDbPrefix)[nDbPrefixLen] = 0;
BackupRegTree_Worker(hKey, pszName, param); // recursion
}
@@ -448,12 +448,12 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr int nDbPrefixLen = (int)mir_strlen(pszDbPrefix);
int nPrefixWithSubKeyLen = nDbPrefixLen + (int)mir_strlen(pszSubKey) + 1;
char *pszPrefixWithSubKey = (char*)mir_alloc(nPrefixWithSubKeyLen + 1);
- if (pszPrefixWithSubKey == NULL)
+ if (pszPrefixWithSubKey == nullptr)
return ERROR_OUTOFMEMORY;
mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey, pszDbPrefix), pszSubKey), "\\"); // buffer safe
LONG res = ERROR_NO_MORE_ITEMS;
- if (pszPrefixWithSubKey != NULL) {
+ if (pszPrefixWithSubKey != nullptr) {
int nSettingsCount;
char **ppszSettings;
if (EnumDbPrefixSettings("AssocMgr", pszPrefixWithSubKey, &ppszSettings, &nSettingsCount)) {
@@ -461,15 +461,15 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr char *pszSuffix = &ppszSettings[i][nDbPrefixLen];
// key hierachy
char *pkeys = mir_strcpy((char*)_alloca(mir_strlen(pszSuffix) + 1), pszSuffix);
- char *pnext = pkeys, *pslash = NULL;
- while ((pnext = strchr(pnext + 1, '\\')) != NULL)
+ char *pnext = pkeys, *pslash = nullptr;
+ while ((pnext = strchr(pnext + 1, '\\')) != nullptr)
pslash = pnext;
- if (pslash != NULL) {
+ if (pslash != nullptr) {
// create subkey
*(pslash++) = 0;
HKEY hSubKey = hKey;
if (pslash != pkeys + 1)
- if ((res = RegCreateKeyExA(hKey, pkeys, 0, NULL, 0, KEY_SET_VALUE, NULL, &hSubKey, NULL)) != ERROR_SUCCESS)
+ if ((res = RegCreateKeyExA(hKey, pkeys, 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hSubKey, nullptr)) != ERROR_SUCCESS)
break;
char *pszValName = pslash;
// read data
@@ -479,7 +479,7 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr // set value
if (!(dwType & REGF_ANSI)) {
WCHAR *pwszValName = a2u(pszValName, FALSE);
- if (pwszValName != NULL) res = RegSetValueExW(hSubKey, pwszValName, 0, dwType, pData, cbData);
+ if (pwszValName != nullptr) res = RegSetValueExW(hSubKey, pwszValName, 0, dwType, pData, cbData);
else res = ERROR_NOT_ENOUGH_MEMORY;
mir_free(pwszValName); // does NULL check
}
@@ -506,9 +506,9 @@ static void DeleteRegTreeBackup(const char *pszSubKey, const char *pszDbPrefix) int nSettingsCount, i;
char *pszPrefixWithSubKey = (char*)mir_alloc(mir_strlen(pszDbPrefix) + mir_strlen(pszSubKey) + 2);
- if (pszPrefixWithSubKey == NULL) return;
+ if (pszPrefixWithSubKey == nullptr) return;
mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey, pszDbPrefix), pszSubKey), "\\"); // buffer safe
- if (pszPrefixWithSubKey != NULL) {
+ if (pszPrefixWithSubKey != nullptr) {
if (EnumDbPrefixSettings("AssocMgr", pszPrefixWithSubKey, &ppszSettings, &nSettingsCount)) {
for (i = 0; i < nSettingsCount; ++i) {
db_unset(NULL, "AssocMgr", ppszSettings[i]);
@@ -531,16 +531,16 @@ void CleanupRegTreeBackupSettings(void) for (int i = 0; i < nSettingsCount; ++i) {
char *pszClassName = &ppszSettings[i][4];
char *pszBuf = strchr(pszClassName, '\\');
- if (pszBuf != NULL) {
+ if (pszBuf != nullptr) {
*pszBuf = '\0';
// remove others in list with same class name
if (i < nSettingsCount - 1) {
for (int j = i + 1; j < nSettingsCount; ++j) {
pszBuf = strchr(&ppszSettings[j][4], '\\');
- if (pszBuf != NULL) *pszBuf = '\0';
+ if (pszBuf != nullptr) *pszBuf = '\0';
if (mir_strcmp(pszClassName, &ppszSettings[j][4])) {
- if (pszBuf != NULL) *pszBuf = '\\';
+ if (pszBuf != nullptr) *pszBuf = '\\';
continue;
}
@@ -582,7 +582,7 @@ BOOL AddRegClass(const char *pszClassName, const wchar_t *pszTypeDescription, co HKEY hRootKey, hClassKey, hShellKey, hVerbKey, hDdeKey;
// some error checking for disallowed values (to avoid errors in registry)
- if (strchr(pszClassName, '\\') != NULL || strchr(pszClassName, ' ') != NULL) {
+ if (strchr(pszClassName, '\\') != nullptr || strchr(pszClassName, ' ') != nullptr) {
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
@@ -591,50 +591,50 @@ BOOL AddRegClass(const char *pszClassName, const wchar_t *pszTypeDescription, co hRootKey = HKEY_CLASSES_ROOT; // might be write protected by security settings
// class
- if ((res = RegCreateKeyExA(hRootKey, pszClassName, 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE | KEY_QUERY_VALUE, NULL, &hClassKey, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegCreateKeyExA(hRootKey, pszClassName, 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE | KEY_QUERY_VALUE, nullptr, &hClassKey, nullptr)) == ERROR_SUCCESS) {
// backup class if shared
if (fUrlProto) BackupRegTree(hRootKey, pszClassName, "bak_");
// type description
if (fUrlProto) SetRegStrPrefixValue(hClassKey, L"URL:", pszTypeDescription);
- else RegSetValueEx(hClassKey, NULL, 0, REG_SZ, (BYTE*)pszTypeDescription, (int)(mir_wstrlen(pszTypeDescription) + 1) * sizeof(wchar_t));
+ else RegSetValueEx(hClassKey, nullptr, 0, REG_SZ, (BYTE*)pszTypeDescription, (int)(mir_wstrlen(pszTypeDescription) + 1) * sizeof(wchar_t));
// default icon
- if (pszIconLoc != NULL) SetRegSubKeyStrDefValue(hClassKey, L"DefaultIcon", pszIconLoc);
+ if (pszIconLoc != nullptr) SetRegSubKeyStrDefValue(hClassKey, L"DefaultIcon", pszIconLoc);
// url protocol
if (!fUrlProto) RegDeleteValue(hClassKey, L"URL Protocol");
- else RegSetValueEx(hClassKey, L"URL Protocol", 0, REG_SZ, NULL, 0);
+ else RegSetValueEx(hClassKey, L"URL Protocol", 0, REG_SZ, nullptr, 0);
// moniker clsid
RegDeleteKey(hClassKey, L"CLSID");
// edit flags
{
DWORD dwFlags = 0, dwSize = sizeof(dwFlags);
- RegQueryValueEx(hClassKey, L"EditFlags", NULL, NULL, (BYTE*)&dwFlags, &dwSize);
+ RegQueryValueEx(hClassKey, L"EditFlags", nullptr, nullptr, (BYTE*)&dwFlags, &dwSize);
if (fBrowserAutoOpen) dwFlags = (dwFlags&~FTA_AlwaysUnsafe) | FTA_OpenIsSafe;
if (!fUrlProto) dwFlags |= FTA_HasExtension;
else dwFlags = (dwFlags&~FTA_HasExtension) | FTA_Show; // show classes without extension
RegSetValueEx(hClassKey, L"EditFlags", 0, REG_DWORD, (BYTE*)&dwFlags, sizeof(dwFlags));
}
if (fIsShortcut) {
- RegSetValueExA(hClassKey, "IsShortcut", 0, REG_SZ, NULL, 0);
- RegSetValueExA(hClassKey, "NeverShowExt", 0, REG_SZ, NULL, 0);
+ RegSetValueExA(hClassKey, "IsShortcut", 0, REG_SZ, nullptr, 0);
+ RegSetValueExA(hClassKey, "NeverShowExt", 0, REG_SZ, nullptr, 0);
}
// shell
- if ((res = RegCreateKeyEx(hClassKey, L"shell", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hShellKey, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegCreateKeyEx(hClassKey, L"shell", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hShellKey, nullptr)) == ERROR_SUCCESS) {
// default verb (when empty "open" is used)
- RegSetValueEx(hShellKey, NULL, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t));
+ RegSetValueEx(hShellKey, nullptr, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t));
// verb
- if ((res = RegCreateKeyEx(hShellKey, L"open", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, NULL, &hVerbKey, NULL)) == ERROR_SUCCESS) {
+ if ((res = RegCreateKeyEx(hShellKey, L"open", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, nullptr, &hVerbKey, nullptr)) == ERROR_SUCCESS) {
// verb description
- if (pszVerbDesc == NULL) RegDeleteValue(hVerbKey, NULL);
- else RegSetValueEx(hVerbKey, NULL, 0, REG_SZ, (BYTE*)pszVerbDesc, (int)(mir_wstrlen(pszVerbDesc) + 1) * sizeof(wchar_t));
+ if (pszVerbDesc == nullptr) RegDeleteValue(hVerbKey, nullptr);
+ else RegSetValueEx(hVerbKey, nullptr, 0, REG_SZ, (BYTE*)pszVerbDesc, (int)(mir_wstrlen(pszVerbDesc) + 1) * sizeof(wchar_t));
// friendly appname (mui string)
RegSetValueEx(hVerbKey, L"FriendlyAppName", 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t));
// command
SetRegSubKeyStrDefValue(hVerbKey, L"command", pszRunCmd);
// ddeexec
- if (pszDdeCmd != NULL) {
- if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, NULL, &hDdeKey, NULL)) {
+ if (pszDdeCmd != nullptr) {
+ if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, nullptr, &hDdeKey, nullptr)) {
// command
- RegSetValueEx(hDdeKey, NULL, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t));
+ RegSetValueEx(hDdeKey, nullptr, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t));
// application
SetRegSubKeyStrDefValue(hDdeKey, L"application", pszDdeApp);
// topic
@@ -684,7 +684,7 @@ BOOL RemoveRegClass(const char *pszClassName) // class name
ptszClassName = a2t(pszClassName);
- if (ptszClassName != NULL)
+ if (ptszClassName != nullptr)
res = DeleteRegSubTree(hRootKey, ptszClassName);
else res = ERROR_OUTOFMEMORY;
mir_free(ptszClassName); // does NULL check
@@ -700,7 +700,7 @@ BOOL RemoveRegClass(const char *pszClassName) if (!RegOpenKeyEx(hShellKey, L"open", 0, KEY_QUERY_VALUE, &hVerbKey)) {
// command
ptszPrevRunCmd = GetRegStrValue(hVerbKey, L"command");
- if (ptszPrevRunCmd != NULL && !IsValidRunCommand(ptszPrevRunCmd))
+ if (ptszPrevRunCmd != nullptr && !IsValidRunCommand(ptszPrevRunCmd))
res = DeleteRegSubTree(hRootKey, ptszClassName); // backup outdated, remove all
mir_free(ptszPrevRunCmd); // does NULL check
RegCloseKey(hVerbKey);
@@ -742,7 +742,7 @@ BOOL IsRegClass(const char *pszClassName, const wchar_t *pszRunCmd) // command
if (!RegOpenKeyEx(hVerbKey, L"command", 0, KEY_QUERY_VALUE, &hCmdKey)) {
// it is enough to check if the command is right
- fSuccess = IsRegStrValue(hCmdKey, NULL, pszRunCmd);
+ fSuccess = IsRegStrValue(hCmdKey, nullptr, pszRunCmd);
RegCloseKey(hCmdKey);
}
RegCloseKey(hVerbKey);
@@ -762,7 +762,7 @@ BOOL IsRegClass(const char *pszClassName, const wchar_t *pszRunCmd) // DestroyIcon() the return value
HICON LoadRegClassSmallIcon(const char *pszClassName)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
HKEY hClassKey, hIconKey;
wchar_t *pszIconLoc, *p;
@@ -772,12 +772,12 @@ HICON LoadRegClassSmallIcon(const char *pszClassName) // default icon
if (!RegOpenKeyEx(hClassKey, L"DefaultIcon", 0, KEY_QUERY_VALUE, &hIconKey)) {
// extract icon
- pszIconLoc = GetRegStrValue(hIconKey, NULL);
- if (pszIconLoc != NULL) {
+ pszIconLoc = GetRegStrValue(hIconKey, nullptr);
+ if (pszIconLoc != nullptr) {
p = wcsrchr(pszIconLoc, ',');
- if (p != NULL) {
+ if (p != nullptr) {
*(p++) = 0;
- ExtractIconEx(pszIconLoc, _wtoi(p), NULL, &hIcon, 1);
+ ExtractIconEx(pszIconLoc, _wtoi(p), nullptr, &hIcon, 1);
}
mir_free(pszIconLoc);
}
@@ -806,7 +806,7 @@ BOOL AddRegFileExt(const char *pszFileExt, const char *pszClassName, const char HKEY hRootKey, hExtKey, hOpenWithKey;
// some error checking for disallowed values (to avoid errors in registry)
- if (strchr(pszFileExt, '\\') != NULL || strchr(pszFileExt, ' ') != NULL)
+ if (strchr(pszFileExt, '\\') != nullptr || strchr(pszFileExt, ' ') != nullptr)
return FALSE;
// try to open interactive user's classes key
@@ -814,24 +814,24 @@ BOOL AddRegFileExt(const char *pszFileExt, const char *pszClassName, const char hRootKey = HKEY_CLASSES_ROOT;
// file ext
- if (!RegCreateKeyExA(hRootKey, pszFileExt, 0, NULL, 0, KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, NULL, &hExtKey, NULL)) {
+ if (!RegCreateKeyExA(hRootKey, pszFileExt, 0, nullptr, 0, KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hExtKey, nullptr)) {
// backup previous app
BackupRegTree(hRootKey, pszFileExt, "bak_");
// remove any no-open flag
RegDeleteValue(hExtKey, L"NoOpen");
// open with progids
- wchar_t *pszPrevClass = GetRegStrValue(hExtKey, NULL);
- if (pszPrevClass != NULL && !IsRegStrValueA(hExtKey, NULL, pszClassName))
- if (!RegCreateKeyEx(hExtKey, L"OpenWithProgids", 0, NULL, 0, KEY_SET_VALUE, NULL, &hOpenWithKey, NULL)) {
+ wchar_t *pszPrevClass = GetRegStrValue(hExtKey, nullptr);
+ if (pszPrevClass != nullptr && !IsRegStrValueA(hExtKey, nullptr, pszClassName))
+ if (!RegCreateKeyEx(hExtKey, L"OpenWithProgids", 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hOpenWithKey, nullptr)) {
// previous class (backup)
- RegSetValueEx(hOpenWithKey, pszPrevClass, 0, REG_NONE, NULL, 0);
+ RegSetValueEx(hOpenWithKey, pszPrevClass, 0, REG_NONE, nullptr, 0);
RegCloseKey(hOpenWithKey);
}
mir_free(pszPrevClass); // does NULL check
// class name
- fSuccess = !RegSetValueExA(hExtKey, NULL, 0, REG_SZ, (BYTE*)pszClassName, (int)mir_strlen(pszClassName) + 1);
+ fSuccess = !RegSetValueExA(hExtKey, nullptr, 0, REG_SZ, (BYTE*)pszClassName, (int)mir_strlen(pszClassName) + 1);
// mime type e.g. "application/x-icq"
- if (pszMimeType != NULL) RegSetValueExA(hExtKey, "Content Type", 0, REG_SZ, (BYTE*)pszMimeType, (int)mir_strlen(pszMimeType) + 1);
+ if (pszMimeType != nullptr) RegSetValueExA(hExtKey, "Content Type", 0, REG_SZ, (BYTE*)pszMimeType, (int)mir_strlen(pszMimeType) + 1);
// perceived type e.g. text (WinXP+)
if (fIsText) RegSetValueEx(hExtKey, L"PerceivedType", 0, REG_SZ, (BYTE*)L"text", 5 * sizeof(wchar_t));
RegCloseKey(hExtKey);
@@ -846,7 +846,7 @@ void RemoveRegFileExt(const char *pszFileExt, const char *pszClassName) {
HKEY hRootKey, hExtKey, hSubKey;
DWORD nOpenWithCount;
- wchar_t *pszPrevClassName = NULL;
+ wchar_t *pszPrevClassName = nullptr;
BOOL fRestored = FALSE;
// try to open interactive user's classes key
@@ -857,25 +857,25 @@ void RemoveRegFileExt(const char *pszFileExt, const char *pszClassName) if (!RegOpenKeyExA(hRootKey, pszFileExt, 0, KEY_QUERY_VALUE | KEY_SET_VALUE | DELETE, &hExtKey)) {
// class name (the important part)
if (!RestoreRegTree(hRootKey, pszFileExt, "bak_")) {
- pszPrevClassName = GetRegStrValue(hExtKey, NULL);
- if (pszPrevClassName != NULL) {
+ pszPrevClassName = GetRegStrValue(hExtKey, nullptr);
+ if (pszPrevClassName != nullptr) {
// previous class name still exists?
// using the merged view classes key for reading
if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, pszPrevClassName, 0, KEY_QUERY_VALUE, &hSubKey)) {
fRestored = TRUE;
RegCloseKey(hSubKey);
}
- else RegDeleteValue(hExtKey, NULL);
+ else RegDeleteValue(hExtKey, nullptr);
mir_free(pszPrevClassName);
}
}
- if (pszPrevClassName == NULL) RegDeleteValue(hExtKey, NULL);
+ if (pszPrevClassName == nullptr) RegDeleteValue(hExtKey, nullptr);
// open with progids (remove if empty)
nOpenWithCount = 0;
if (!RegOpenKeyEx(hExtKey, L"OpenWithProgids", 0, KEY_SET_VALUE | KEY_QUERY_VALUE, &hSubKey)) {
// remove current class (if set by another app)
RegDeleteValueA(hSubKey, pszClassName);
- RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &nOpenWithCount, NULL, NULL, NULL);
+ RegQueryInfoKey(hSubKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &nOpenWithCount, nullptr, nullptr, nullptr);
RegCloseKey(hSubKey);
}
if (!nOpenWithCount) RegDeleteKey(hExtKey, L"OpenWithProgids"); // delete if no values
@@ -904,7 +904,7 @@ BOOL IsRegFileExt(const char *pszFileExt, const char *pszClassName) if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, pszFileExt, 0, KEY_QUERY_VALUE, &hExtKey)) {
// class name
// it is enough to check if the class is right
- fSuccess = IsRegStrValueA(hExtKey, NULL, pszClassName);
+ fSuccess = IsRegStrValueA(hExtKey, nullptr, pszClassName);
RegCloseKey(hExtKey);
}
return fSuccess;
@@ -924,7 +924,7 @@ BOOL AddRegMimeType(const char *pszMimeType, const char *pszFileExt) HKEY hRootKey, hDbKey, hTypeKey;
// some error checking for disallowed values (to avoid errors in registry)
- if (strchr(pszMimeType, '\\') != NULL || strchr(pszMimeType, ' ') != NULL)
+ if (strchr(pszMimeType, '\\') != nullptr || strchr(pszMimeType, ' ') != nullptr)
return FALSE;
// try to open interactive user's classes key
@@ -934,9 +934,9 @@ BOOL AddRegMimeType(const char *pszMimeType, const char *pszFileExt) // database
if (!RegOpenKeyEx(hRootKey, L"MIME\\Database\\Content Type", 0, KEY_CREATE_SUB_KEY, &hDbKey)) {
// mime type
- if (!RegCreateKeyExA(hDbKey, pszMimeType, 0, NULL, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, NULL, &hTypeKey, NULL)) {
+ if (!RegCreateKeyExA(hDbKey, pszMimeType, 0, nullptr, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, nullptr, &hTypeKey, nullptr)) {
// file ext
- if (RegQueryValueExA(hTypeKey, "Extension", NULL, NULL, NULL, NULL)) // only set if not present
+ if (RegQueryValueExA(hTypeKey, "Extension", nullptr, nullptr, nullptr, nullptr)) // only set if not present
fSuccess = !RegSetValueExA(hTypeKey, "Extension", 0, REG_SZ, (BYTE*)pszFileExt, (int)mir_strlen(pszFileExt) + 1);
RegCloseKey(hTypeKey);
}
@@ -989,31 +989,31 @@ void AddRegOpenWith(const wchar_t *pszAppFileName, BOOL fAllowOpenWith, const wc hRootKey = HKEY_CLASSES_ROOT;
// database
- if (!RegCreateKeyEx(hRootKey, L"Applications", 0, NULL, 0, KEY_CREATE_SUB_KEY, NULL, &hAppsKey, NULL)) {
+ if (!RegCreateKeyEx(hRootKey, L"Applications", 0, nullptr, 0, KEY_CREATE_SUB_KEY, nullptr, &hAppsKey, nullptr)) {
// filename
- if (!RegCreateKeyEx(hAppsKey, pszAppFileName, 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hExeKey, NULL)) {
+ if (!RegCreateKeyEx(hAppsKey, pszAppFileName, 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hExeKey, nullptr)) {
// appname
- RegSetValueEx(hExeKey, NULL, 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t));
+ RegSetValueEx(hExeKey, nullptr, 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t));
// no open-with flag
if (fAllowOpenWith) RegDeleteValue(hExeKey, L"NoOpenWith");
- else RegSetValueEx(hExeKey, L"NoOpenWith", 0, REG_SZ, NULL, 0);
+ else RegSetValueEx(hExeKey, L"NoOpenWith", 0, REG_SZ, nullptr, 0);
// default icon
- if (pszIconLoc != NULL) SetRegSubKeyStrDefValue(hExeKey, L"DefaultIcon", pszIconLoc);
+ if (pszIconLoc != nullptr) SetRegSubKeyStrDefValue(hExeKey, L"DefaultIcon", pszIconLoc);
// shell
- if (!RegCreateKeyEx(hExeKey, L"shell", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hShellKey, NULL)) {
+ if (!RegCreateKeyEx(hExeKey, L"shell", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hShellKey, nullptr)) {
// default verb (when empty "open" is used)
- RegSetValueEx(hShellKey, NULL, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t));
+ RegSetValueEx(hShellKey, nullptr, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t));
// verb
- if (!RegCreateKeyEx(hShellKey, L"open", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hVerbKey, NULL)) {
+ if (!RegCreateKeyEx(hShellKey, L"open", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hVerbKey, nullptr)) {
// friendly appname (mui string)
RegSetValueEx(hVerbKey, L"FriendlyAppName", 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t));
// command
SetRegSubKeyStrDefValue(hVerbKey, L"command", pszRunCmd);
// ddeexec
- if (pszDdeCmd != NULL)
- if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hDdeKey, NULL)) {
+ if (pszDdeCmd != nullptr)
+ if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hDdeKey, nullptr)) {
// command
- RegSetValueEx(hDdeKey, NULL, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t));
+ RegSetValueEx(hDdeKey, nullptr, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t));
// application
SetRegSubKeyStrDefValue(hDdeKey, L"application", pszDdeApp);
// topic
@@ -1097,10 +1097,10 @@ void AddRegOpenWithExtEntry(const wchar_t *pszAppFileName, const char *pszFileEx // filename
if (!RegOpenKeyEx(hAppsKey, pszAppFileName, 0, KEY_CREATE_SUB_KEY, &hExeKey)) {
// supported types
- if (!RegCreateKeyEx(hExeKey, L"SupportedTypes", 0, NULL, 0, KEY_SET_VALUE, NULL, &hTypesKey, NULL)) {
+ if (!RegCreateKeyEx(hExeKey, L"SupportedTypes", 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hTypesKey, nullptr)) {
wchar_t *ptszFileExt;
ptszFileExt = a2t(pszFileExt);
- if (ptszFileExt != NULL)
+ if (ptszFileExt != nullptr)
RegSetValueEx(hTypesKey, ptszFileExt, 0, REG_SZ, (BYTE*)pszFileDesc, (int)(mir_wstrlen(pszFileDesc) + 1) * sizeof(wchar_t));
mir_free(ptszFileExt); // does NULL check
RegCloseKey(hTypesKey);
@@ -1152,7 +1152,7 @@ BOOL AddRegRunEntry(const wchar_t *pszAppName, const wchar_t *pszRunCmd) HKEY hRunKey;
// run
- if (!RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, 0, KEY_SET_VALUE, NULL, &hRunKey, NULL)) {
+ if (!RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hRunKey, nullptr)) {
// appname
fSuccess = !RegSetValueEx(hRunKey, pszAppName, 0, REG_SZ, (BYTE*)pszRunCmd, (int)(mir_wstrlen(pszRunCmd) + 1) * sizeof(wchar_t));
RegCloseKey(hRunKey);
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp index 6f2a90b8d1..21cd8de4f6 100644 --- a/plugins/AssocMgr/src/utils.cpp +++ b/plugins/AssocMgr/src/utils.cpp @@ -29,15 +29,15 @@ WCHAR* a2u(const char *pszAnsi,BOOL fMirCp) UINT codepage,cch;
WCHAR *psz;
- if(pszAnsi==NULL) return NULL;
+ if(pszAnsi==nullptr) return nullptr;
codepage = fMirCp ? Langpack_GetDefaultCodePage() : CP_ACP;
- cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,NULL,0);
- if (!cch) return NULL;
+ cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,nullptr,0);
+ if (!cch) return nullptr;
psz=(WCHAR*)mir_alloc(cch*sizeof(WCHAR));
- if(psz!=NULL && !MultiByteToWideChar(codepage,0,pszAnsi,-1,psz,cch)) {
+ if(psz!=nullptr && !MultiByteToWideChar(codepage,0,pszAnsi,-1,psz,cch)) {
mir_free(psz);
- return NULL;
+ return nullptr;
}
return psz;
}
@@ -49,17 +49,17 @@ char* u2a(const WCHAR *pszUnicode,BOOL fMirCp) char *psz;
DWORD flags;
- if(pszUnicode==NULL) return NULL;
+ if(pszUnicode==nullptr) return nullptr;
codepage = fMirCp ? Langpack_GetDefaultCodePage() : CP_ACP;
/* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */
- cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,NULL,0,NULL,NULL);
- if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,NULL,0,NULL,NULL);
- if (!cch) return NULL;
+ cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,nullptr,0,nullptr,nullptr);
+ if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,nullptr,0,nullptr,nullptr);
+ if (!cch) return nullptr;
psz=(char*)mir_alloc(cch);
- if(psz!=NULL && !WideCharToMultiByte(codepage,flags,pszUnicode,-1,psz,cch,NULL,NULL)) {
+ if(psz!=nullptr && !WideCharToMultiByte(codepage,flags,pszUnicode,-1,psz,cch,nullptr,nullptr)) {
mir_free(psz);
- return NULL;
+ return nullptr;
}
return psz;
}
@@ -98,10 +98,10 @@ static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam) char **buf;
/* resize storage array */
buf = (char**)mir_realloc(param->settings,(param->nSettingsCount+1)*sizeof(char*));
- if(buf!=NULL) {
+ if(buf!=nullptr) {
param->settings=buf;
buf[param->nSettingsCount]=mir_strdup(pszSetting);
- if(buf[param->nSettingsCount]!=NULL) ++param->nSettingsCount;
+ if(buf[param->nSettingsCount]!=nullptr) ++param->nSettingsCount;
}
}
return 0;
@@ -111,7 +111,7 @@ static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam) BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,char ***pSettings,int *pnSettingsCount)
{
struct EnumPrefixSettingsParams param;
- param.settings = NULL;
+ param.settings = nullptr;
param.nSettingsCount = 0;
param.pszPrefix = pszSettingPrefix;
param.nPrefixLen = (int)mir_strlen(pszSettingPrefix);
@@ -141,11 +141,11 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) mir_vsnprintf(szText,_countof(szText),pszTextFmt,va);
va_end(va);
- if (!Clist_TrayNotifyA(NULL, pszTitle, szText, flags, 30000)) // success
+ if (!Clist_TrayNotifyA(nullptr, pszTitle, szText, flags, 30000)) // success
return;
MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp));
- if(mbp == NULL)
+ if(mbp == nullptr)
return;
mbp->cbSize = sizeof(*mbp);
@@ -164,10 +164,10 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) // LocalFree() the return value
char* GetWinErrorDescription(DWORD dwLastError)
{
- char *buf=NULL;
+ char *buf=nullptr;
DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM;
- if (!FormatMessageA(flags,NULL,dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()),(char*)&buf,0,NULL))
+ if (!FormatMessageA(flags,nullptr,dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()),(char*)&buf,0,nullptr))
if(GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND)
- FormatMessageA(flags,NULL,dwLastError,0,(char*)&buf,0,NULL);
+ FormatMessageA(flags,nullptr,dwLastError,0,(char*)&buf,0,nullptr);
return buf;
}
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 9d971a72c7..db2de1db13 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -99,7 +99,7 @@ int onExtraImageApplying(WPARAM hContact, LPARAM lParam) if (hContact == NULL)
return 0;
int iIcon = getIconToUse((MCONTACT)hContact, lParam);
- ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)hContact, iIcon == -1 ? NULL : iconList[iIcon].hIcolib);
+ ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)hContact, iIcon == -1 ? nullptr : iconList[iIcon].hIcolib);
return 0;
}
diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 0923879dab..559f636240 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -28,7 +28,7 @@ void GetProfilePath(wchar_t *res, size_t resLen) {
wchar_t dbname[MAX_PATH], exename[MAX_PATH];
Profile_GetNameW(_countof(dbname), dbname);
- GetModuleFileName(NULL, exename, _countof(exename));
+ GetModuleFileName(nullptr, exename, _countof(exename));
wchar_t *p = wcsrchr(dbname, '.');
if (p) *p = 0;
@@ -42,7 +42,7 @@ static void SetAutorun(BOOL autorun) DWORD dw;
switch (autorun) {
case TRUE:
- if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) {
+ if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, nullptr, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,nullptr,&hKey,&dw) == ERROR_SUCCESS) {
wchar_t result[MAX_PATH];
GetProfilePath(result, _countof(result));
RegSetValueEx(hKey, L"MirandaNG", 0, REG_SZ, (BYTE*)result, sizeof(wchar_t)*(DWORD)mir_wstrlen(result));
@@ -66,7 +66,7 @@ static BOOL CmpCurrentAndRegistry() wchar_t result[MAX_PATH], dbpath[MAX_PATH];
DWORD dwBufLen = MAX_PATH;
- if ( RegQueryValueEx(hKey, L"MirandaNG", NULL, NULL, (LPBYTE)dbpath, &dwBufLen) != ERROR_SUCCESS)
+ if ( RegQueryValueEx(hKey, L"MirandaNG", nullptr, nullptr, (LPBYTE)dbpath, &dwBufLen) != ERROR_SUCCESS)
return FALSE;
GetProfilePath(result, _countof(result));
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp index 555f1c8dbb..2959013407 100644 --- a/plugins/AutoShutdown/src/cpuusage.cpp +++ b/plugins/AutoShutdown/src/cpuusage.cpp @@ -35,7 +35,7 @@ static BOOL WinNT_PerfStatsSwitch(wchar_t *pszServiceName, BOOL fDisable) if (!RegOpenKeyEx(hKeyServices, pszServiceName, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyService)) {
if (!RegOpenKeyEx(hKeyService, L"Performance", 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyPerf)) {
dwDataSize = sizeof(DWORD);
- if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", NULL, NULL, (BYTE*)&dwData, &dwDataSize))
+ if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", nullptr, nullptr, (BYTE*)&dwData, &dwDataSize))
if ((dwData != 0) != fDisable)
fSwitched = !RegSetValueEx(hKeyPerf, L"Disable Performance Counters", 0, REG_DWORD, (BYTE*)&fDisable, dwDataSize);
RegCloseKey(hKeyPerf);
@@ -59,11 +59,11 @@ struct CpuUsageThreadParams static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage)
{
- if (param->hFirstEvent != NULL) {
+ if (param->hFirstEvent != nullptr) {
/* return value for PollCpuUsage() */
*param->pidThread = GetCurrentThreadId();
SetEvent(param->hFirstEvent);
- param->hFirstEvent = NULL;
+ param->hFirstEvent = nullptr;
/* lower priority after first call */
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);
}
@@ -77,8 +77,8 @@ static void WinNT_PollThread(void *vparam) CpuUsageThreadParams *param = (CpuUsageThreadParams*)vparam;
DWORD dwBufferSize = 0, dwCount;
- BYTE *pBuffer = NULL;
- PERF_DATA_BLOCK *pPerfData = NULL;
+ BYTE *pBuffer = nullptr;
+ PERF_DATA_BLOCK *pPerfData = nullptr;
LONG res, lCount;
PERF_OBJECT_TYPE *pPerfObj;
PERF_COUNTER_DEFINITION *pPerfCounter;
@@ -100,12 +100,12 @@ static void WinNT_PollThread(void *vparam) /* poll */
for (;;) {
/* retrieve data for given object */
- res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, NULL, NULL, (BYTE*)pPerfData, &dwBufferSize);
+ res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, (BYTE*)pPerfData, &dwBufferSize);
while (!pBuffer || res == ERROR_MORE_DATA) {
pBuffer = (BYTE*)mir_realloc(pPerfData, dwBufferSize += 256);
if (!pBuffer) break;
pPerfData = (PERF_DATA_BLOCK*)pBuffer;
- res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, NULL, NULL, pBuffer, &dwBufferSize);
+ res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, pBuffer, &dwBufferSize);
}
if (res != ERROR_SUCCESS) break;
@@ -174,7 +174,7 @@ static void WinNT_PollThread(void *vparam) WinNT_PerfStatsSwitch(L"PerfOS", TRUE);
/* return error for PollCpuUsage() if never succeeded */
- if (param->hFirstEvent != NULL)
+ if (param->hFirstEvent != nullptr)
SetEvent(param->hFirstEvent);
mir_free(param);
}
@@ -188,11 +188,11 @@ DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc, LPARAM lParam, DWORD dwDe /* init params */
CpuUsageThreadParams *param = (struct CpuUsageThreadParams*)mir_alloc(sizeof(struct CpuUsageThreadParams));
- if (param == NULL)
+ if (param == nullptr)
return FALSE;
- HANDLE hFirstEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (hFirstEvent == NULL) {
+ HANDLE hFirstEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (hFirstEvent == nullptr) {
mir_free(param);
return FALSE;
}
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index a450355f22..5908be544f 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -56,7 +56,7 @@ static LOGFONT* GetDefaultFont(LOGFONT *lf) *lf = ncm.lfStatusFont;
return lf;
}
- return (LOGFONT*)NULL;
+ return nullptr;
}
static LRESULT CALLBACK ProgressBarSubclassProc(HWND hwndProgress, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -116,7 +116,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case WM_NCCREATE: /* init window data */
dat = (struct CountdownFrameWndData*)mir_calloc(sizeof(*dat));
SetWindowLongPtr(hwndFrame, GWLP_USERDATA, (LONG_PTR)dat);
- if (dat == NULL) return FALSE; /* creation failed */
+ if (dat == nullptr) return FALSE; /* creation failed */
dat->fTimeFlags = *(WORD*)((CREATESTRUCT*)lParam)->lpCreateParams;
dat->flags = FWPDF_COUNTDOWNINVALID;
break;
@@ -124,26 +124,26 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case WM_CREATE: /* create childs */
{
CREATESTRUCT *params = (CREATESTRUCT*)lParam;
- dat->hwndIcon = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", NULL, WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE | SS_NOTIFY,
- 3, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), hwndFrame, NULL, params->hInstance, NULL);
+ dat->hwndIcon = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", nullptr, WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE | SS_NOTIFY,
+ 3, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), hwndFrame, nullptr, params->hInstance, nullptr);
dat->hwndProgress = CreateWindowEx(WS_EX_NOPARENTNOTIFY, PROGRESS_CLASS, (dat->fTimeFlags&SDWTF_ST_TIME) ? TranslateT("Shutdown at:") : TranslateT("Time left:"),
- WS_CHILD | WS_VISIBLE | PBS_SMOOTH, GetSystemMetrics(SM_CXICON) + 5, 5, 90, (GetSystemMetrics(SM_CXICON) / 2) - 5, hwndFrame, NULL, params->hInstance, NULL);
- if (dat->hwndProgress == NULL) return -1; /* creation failed, calls WM_DESTROY */
+ WS_CHILD | WS_VISIBLE | PBS_SMOOTH, GetSystemMetrics(SM_CXICON) + 5, 5, 90, (GetSystemMetrics(SM_CXICON) / 2) - 5, hwndFrame, nullptr, params->hInstance, nullptr);
+ if (dat->hwndProgress == nullptr) return -1; /* creation failed, calls WM_DESTROY */
SendMessage(dat->hwndProgress, PBM_SETSTEP, 1, 0);
mir_subclassWindow(dat->hwndProgress, ProgressBarSubclassProc);
dat->hwndDesc = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", (dat->fTimeFlags&SDWTF_ST_TIME) ? TranslateT("Shutdown at:") : TranslateT("Time left:"),
WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP | SS_NOTIFY, GetSystemMetrics(SM_CXICON) + 5, (GetSystemMetrics(SM_CXICON) / 2), 75,
- (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, NULL, params->hInstance, NULL);
- dat->hwndTime = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", NULL, WS_CHILD | WS_VISIBLE | SS_RIGHT | SS_NOTIFY | SS_ENDELLIPSIS,
- (GetSystemMetrics(SM_CXICON) + 80), (GetSystemMetrics(SM_CXICON) / 2), 35, (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, NULL, params->hInstance, NULL);
- if (dat->hwndTime == NULL)
+ (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, nullptr, params->hInstance, nullptr);
+ dat->hwndTime = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", nullptr, WS_CHILD | WS_VISIBLE | SS_RIGHT | SS_NOTIFY | SS_ENDELLIPSIS,
+ (GetSystemMetrics(SM_CXICON) + 80), (GetSystemMetrics(SM_CXICON) / 2), 35, (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, nullptr, params->hInstance, nullptr);
+ if (dat->hwndTime == nullptr)
return -1; /* creation failed, calls WM_DESTROY */
// create tooltips
TTTOOLINFO ti;
- dat->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndFrame, NULL, params->hInstance, NULL);
- if (dat->hwndToolTip != NULL) {
+ dat->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndFrame, nullptr, params->hInstance, nullptr);
+ if (dat->hwndToolTip != nullptr) {
SetWindowPos(dat->hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
memset(&ti, 0, sizeof(ti));
ti.cbSize = sizeof(ti);
@@ -155,11 +155,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP ti.uFlags &= ~TTF_TRANSPARENT;
ti.uId = (UINT_PTR)dat->hwndProgress;
SendMessage(dat->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
- if (dat->hwndDesc != NULL) {
+ if (dat->hwndDesc != nullptr) {
ti.uId = (UINT_PTR)dat->hwndDesc;
SendMessage(dat->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
- if (dat->hwndIcon != NULL) {
+ if (dat->hwndIcon != nullptr) {
ti.uId = (UINT_PTR)dat->hwndIcon;
SendMessage(dat->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
@@ -173,26 +173,26 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SendMessage(hwndFrame, M_REFRESH_ICONS, 0, 0);
SendMessage(hwndFrame, M_SET_COUNTDOWN, 0, 0);
SendMessage(hwndFrame, M_UPDATE_COUNTDOWN, 0, 0);
- if (!SetTimer(hwndFrame, 1, 1000, NULL))
+ if (!SetTimer(hwndFrame, 1, 1000, nullptr))
return -1; /* creation failed, calls WM_DESTROY */
}
return 0;
case WM_DESTROY:
- if (dat == NULL) return 0;
+ if (dat == nullptr) return 0;
UnhookEvent(dat->hHookColorsChanged);
UnhookEvent(dat->hHookFontsChanged);
UnhookEvent(dat->hHookIconsChanged);
/* other childs are destroyed automatically */
- if (dat->hwndToolTip != NULL)
+ if (dat->hwndToolTip != nullptr)
DestroyWindow(dat->hwndToolTip);
break;
case WM_NCDESTROY:
- if (dat == NULL) return 0;
- if (dat->hFont != NULL) DeleteObject(dat->hFont);
- if (dat->hbrBackground != NULL) DeleteObject(dat->hbrBackground);
+ if (dat == nullptr) return 0;
+ if (dat->hFont != nullptr) DeleteObject(dat->hFont);
+ if (dat->hbrBackground != nullptr) DeleteObject(dat->hbrBackground);
mir_free(dat);
SetWindowLongPtr(hwndFrame, GWLP_USERDATA, 0);
break;
@@ -208,14 +208,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP /* progress */
LONG width = rc.right - GetSystemMetrics(SM_CXICON) - 10;
LONG height = rc.bottom - (GetSystemMetrics(SM_CYICON) / 2) - 5;
- if (NULL != dat->hwndProgress) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, dat->hwndProgress, NULL, 0, 0, width, height, SWP_NOMOVE | defflg);
+ if (nullptr != dat->hwndProgress) /* Wine fix. */
+ hdwp = DeferWindowPos(hdwp, dat->hwndProgress, nullptr, 0, 0, width, height, SWP_NOMOVE | defflg);
/* desc */
- if (dat->hwndDesc != NULL) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, dat->hwndDesc, NULL, GetSystemMetrics(SM_CXICON) + 5, 5 + height, 0, 0, SWP_NOSIZE | defflg);
+ if (dat->hwndDesc != nullptr) /* Wine fix. */
+ hdwp = DeferWindowPos(hdwp, dat->hwndDesc, nullptr, GetSystemMetrics(SM_CXICON) + 5, 5 + height, 0, 0, SWP_NOSIZE | defflg);
/* time */
- if (NULL != dat->hwndTime) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, dat->hwndTime, NULL, GetSystemMetrics(SM_CXICON) + 85, 5 + height, width - 80, (GetSystemMetrics(SM_CXICON) / 2), defflg);
+ if (nullptr != dat->hwndTime) /* Wine fix. */
+ hdwp = DeferWindowPos(hdwp, dat->hwndTime, nullptr, GetSystemMetrics(SM_CXICON) + 85, 5 + height, width - 80, (GetSystemMetrics(SM_CXICON) / 2), defflg);
EndDeferWindowPos(hdwp);
}
PostMessage(hwndFrame, M_CHECK_CLIPPED, 0, 0);
@@ -231,13 +231,13 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP if (dat->clrBackground == -1)
dat->clrBackground = GetDefaultColor(FRAMEELEMENT_BKGRND);
- if (dat->hbrBackground != NULL)
+ if (dat->hbrBackground != nullptr)
DeleteObject(dat->hbrBackground);
dat->hbrBackground = CreateSolidBrush(dat->clrBackground);
SendMessage(dat->hwndProgress, PBM_SETBARCOLOR, 0, (LPARAM)clrBar);
SendMessage(dat->hwndProgress, PBM_SETBKCOLOR, 0, (LPARAM)dat->clrBackground);
- InvalidateRect(hwndFrame, NULL, TRUE);
+ InvalidateRect(hwndFrame, nullptr, TRUE);
return 0;
case M_REFRESH_ICONS:
@@ -247,13 +247,13 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP {
LOGFONT lf;
dat->clrText = Font_GetW(L"Automatic shutdown", L"Countdown on frame", &lf);
- if (dat->hFont != NULL) DeleteObject(dat->hFont);
+ if (dat->hFont != nullptr) DeleteObject(dat->hFont);
dat->hFont = CreateFontIndirect(&lf);
}
- if (dat->hwndDesc != NULL)
+ if (dat->hwndDesc != nullptr)
SendMessage(dat->hwndDesc, WM_SETFONT, (WPARAM)dat->hFont, FALSE);
SendMessage(dat->hwndTime, WM_SETFONT, (WPARAM)dat->hFont, FALSE);
- InvalidateRect(hwndFrame, NULL, FALSE);
+ InvalidateRect(hwndFrame, nullptr, FALSE);
return 0;
case WM_SYSCOLORCHANGE:
@@ -264,7 +264,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SendMessage(hwndFrame, M_REFRESH_COLORS, 0, 0);
SendMessage(hwndFrame, M_REFRESH_FONTS, 0, 0);
SendMessage(hwndFrame, M_UPDATE_COUNTDOWN, 0, 0);
- RedrawWindow(hwndFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
+ RedrawWindow(hwndFrame, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
break;
case WM_TIMECHANGE: /* windows system clock changed */
@@ -281,7 +281,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case WM_ERASEBKGND:
{
RECT rc;
- if (dat->hbrBackground != NULL && GetClientRect(hwndFrame, &rc)) {
+ if (dat->hbrBackground != nullptr && GetClientRect(hwndFrame, &rc)) {
FillRect((HDC)wParam, &rc, dat->hbrBackground);
return TRUE;
}
@@ -290,7 +290,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case M_SET_COUNTDOWN:
if (dat->fTimeFlags&SDWTF_ST_TIME) {
dat->settingLastTime = (time_t)db_get_dw(NULL, "AutoShutdown", "TimeStamp", SETTING_TIMESTAMP_DEFAULT);
- dat->countdown = time(NULL);
+ dat->countdown = time(nullptr);
if (dat->settingLastTime > dat->countdown) dat->countdown = dat->settingLastTime - dat->countdown;
else dat->countdown = 0;
}
@@ -303,7 +303,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SendMessage(dat->hwndProgress, PBM_SETRANGE32, 0, (LPARAM)dat->countdown);
return 0;
case WM_TIMER:
- if (dat == NULL) return 0;
+ if (dat == nullptr) return 0;
if (dat->countdown != 0 && !(dat->flags&FWPDF_COUNTDOWNINVALID) && !(dat->flags&FWPDF_PAUSED)) {
dat->countdown--;
PostMessage(dat->hwndProgress, PBM_STEPIT, 0, 0);
@@ -332,7 +332,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SetWindowText(dat->hwndTime, szOutput);
PostMessage(hwndFrame, M_CHECK_CLIPPED, 0, 0);
/* update tooltip text (if shown) */
- if (dat->hwndToolTip != NULL && !(dat->flags&FWPDF_PAUSED)) {
+ if (dat->hwndToolTip != nullptr && !(dat->flags&FWPDF_PAUSED)) {
TTTOOLINFO ti;
ti.cbSize = sizeof(ti);
if (SendMessage(dat->hwndToolTip, TTM_GETCURRENTTOOL, 0, (LPARAM)&ti) && (HWND)ti.uId != dat->hwndIcon)
@@ -380,11 +380,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP pt.y = rc.top + ((int)(rc.bottom - rc.top) / 2);
}
HMENU hContextMenu = CreatePopupMenu();
- if (hContextMenu != NULL) {
+ if (hContextMenu != nullptr) {
AppendMenu(hContextMenu, MF_STRING, MENUITEM_PAUSECOUNTDOWN, (dat->flags&FWPDF_PAUSED) ? TranslateT("&Unpause countdown") : TranslateT("&Pause countdown"));
SetMenuDefaultItem(hContextMenu, MENUITEM_PAUSECOUNTDOWN, FALSE);
AppendMenu(hContextMenu, MF_STRING, MENUITEM_STOPCOUNTDOWN, TranslateT("&Cancel countdown"));
- TrackPopupMenuEx(hContextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_HORPOSANIMATION | TPM_VERPOSANIMATION | TPM_RIGHTBUTTON, pt.x, pt.y, hwndFrame, NULL);
+ TrackPopupMenuEx(hContextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_HORPOSANIMATION | TPM_VERPOSANIMATION | TPM_RIGHTBUTTON, pt.x, pt.y, hwndFrame, nullptr);
DestroyMenu(hContextMenu);
}
}
@@ -411,19 +411,19 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP RECT rc;
HDC hdc;
SIZE size;
- HFONT hFontPrev = NULL;
+ HFONT hFontPrev = nullptr;
wchar_t szOutput[256];
dat->flags &= ~FWPDF_TIMEISCLIPPED;
if (GetWindowText(dat->hwndTime, szOutput, _countof(szOutput)))
if (GetClientRect(dat->hwndTime, &rc)) {
hdc = GetDC(dat->hwndTime);
- if (hdc != NULL) {
- if (dat->hFont != NULL)
+ if (hdc != nullptr) {
+ if (dat->hFont != nullptr)
hFontPrev = (HFONT)SelectObject(hdc, dat->hFont);
if (GetTextExtentPoint32(hdc, szOutput, (int)mir_wstrlen(szOutput), &size))
if (size.cx >= (rc.right - rc.left))
dat->flags &= FWPDF_TIMEISCLIPPED;
- if (dat->hFont != NULL)
+ if (dat->hFont != nullptr)
SelectObject(hdc, hFontPrev);
ReleaseDC(dat->hwndTime, hdc);
}
@@ -440,7 +440,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SetWindowLongPtr(dat->hwndToolTip, GWL_STYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_STYLE) | TTS_NOANIMATE);
SetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE) | WS_EX_TRANSPARENT);
SendMessage(dat->hwndToolTip, TTM_ADJUSTRECT, TRUE, (LPARAM)&rc);
- SetWindowPos(dat->hwndToolTip, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(dat->hwndToolTip, nullptr, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
return TRUE; /* self-defined position */
}
}
@@ -450,7 +450,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case TTN_POP:
/* workaround #5: frame does not get redrawn after
* in-place tooltip hidden on dat->hwndTime */
- RedrawWindow(hwndCountdownFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
+ RedrawWindow(hwndCountdownFrame, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
return 0;
case TTN_NEEDTEXT:
{
@@ -483,16 +483,16 @@ void ShowCountdownFrame(WORD fTimeFlags) {
hwndCountdownFrame = CreateWindowEx(WS_EX_CONTROLPARENT | WS_EX_NOPARENTNOTIFY | WS_EX_TRANSPARENT,
COUNTDOWNFRAME_CLASS,
- NULL,
+ nullptr,
WS_CHILD | WS_TABSTOP,
0, 0,
GetSystemMetrics(SM_CXICON) + 103,
GetSystemMetrics(SM_CYICON) + 2,
pcli->hwndContactList,
- NULL,
+ nullptr,
hInst,
&fTimeFlags);
- if (hwndCountdownFrame == NULL) return;
+ if (hwndCountdownFrame == nullptr) return;
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
CLISTFrame clf = { sizeof(clf) };
@@ -517,7 +517,7 @@ void ShowCountdownFrame(WORD fTimeFlags) if (!(CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, hFrame), 0)&F_VISIBLE))
CallService(MS_CLIST_FRAMES_SHFRAME, hFrame, 0);
/* workaround #4: MS_CLIST_FRAMES_SHFRAME does cause redrawing problems when frame was hidden */
- RedrawWindow(hwndCountdownFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
+ RedrawWindow(hwndCountdownFrame, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
/* workaround #5: for in-place tooltip TTN_POP
* workaround #6 and #7: see CloseCountdownFrame() */
}
@@ -526,7 +526,7 @@ void ShowCountdownFrame(WORD fTimeFlags) void CloseCountdownFrame(void)
{
- if (hwndCountdownFrame != NULL) {
+ if (hwndCountdownFrame != nullptr) {
SendMessage(hwndCountdownFrame, M_CLOSE_COUNTDOWN, 0, 0);
if (hFrame) {
/* HACKS TO FIX CLUIFrames:
@@ -540,7 +540,7 @@ void CloseCountdownFrame(void) #endif
}
else DestroyWindow(hwndCountdownFrame);
- hwndCountdownFrame = NULL;
+ hwndCountdownFrame = nullptr;
hFrame = 0;
}
@@ -573,12 +573,12 @@ int InitFrame(void) wcx.style = CS_DBLCLKS | CS_PARENTDC;
wcx.lpfnWndProc = FrameWndProc;
wcx.hInstance = hInst;
- wcx.hCursor = (HCURSOR)LoadImage(NULL, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED);
+ wcx.hCursor = (HCURSOR)LoadImage(nullptr, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED);
wcx.lpszClassName = COUNTDOWNFRAME_CLASS;
if (!RegisterClassEx(&wcx))
return 1;
- hwndCountdownFrame = NULL;
+ hwndCountdownFrame = nullptr;
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, FrameModulesLoaded);
return 0;
}
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp index 7a9f2001fd..c9b8a508ce 100644 --- a/plugins/AutoShutdown/src/options.cpp +++ b/plugins/AutoShutdown/src/options.cpp @@ -76,7 +76,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (LOWORD(wParam)) {
case IDC_EDIT_CONFIRMDLGCOUNTDOWN:
if (HIWORD(wParam) == EN_KILLFOCUS)
- if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, NULL, TRUE) < 3) {
+ if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, TRUE) < 3) {
SendDlgItemMessage(hwndDlg, IDC_SPIN_CONFIRMDLGCOUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(3, 0));
SetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, 3, FALSE);
}
@@ -92,7 +92,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
db_set_b(NULL, "AutoShutdown", "ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
- db_set_w(NULL, "AutoShutdown", "ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, NULL, FALSE));
+ db_set_w(NULL, "AutoShutdown", "ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE));
db_set_b(NULL, "AutoShutdown", "RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
db_set_b(NULL, "AutoShutdown", "SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER)))
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 15bcc187c5..662196b3ca 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -33,7 +33,7 @@ const wchar_t *unitNames[] = { LPGENW("Second(s)"), LPGENW("Minute(s)"), LPGENW( static void EnableDlgItem(HWND hwndDlg, int idCtrl, BOOL fEnable)
{
hwndDlg = GetDlgItem(hwndDlg, idCtrl);
- if (hwndDlg != NULL && IsWindowEnabled(hwndDlg) != fEnable)
+ if (hwndDlg != nullptr && IsWindowEnabled(hwndDlg) != fEnable)
EnableWindow(hwndDlg, fEnable);
}
@@ -80,7 +80,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L lf.lfWeight = FW_BOLD;
hBoldFont = CreateFontIndirect(&lf);
}
- else hBoldFont = NULL;
+ else hBoldFont = nullptr;
SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, (WPARAM)hBoldFont, FALSE);
}
/* read-in watcher flags */
@@ -183,9 +183,9 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L {
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_GETFONT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, 0, FALSE); /* no return value */
- if (hFont != NULL)
+ if (hFont != nullptr)
DeleteObject(hFont);
- hwndSettingsDlg = NULL;
+ hwndSettingsDlg = nullptr;
}
return TRUE;
@@ -258,14 +258,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L GetLocalTime(&stBuf);
if (SystemTimeToTimeStamp(&st, ×tamp)) {
/* set to current date if earlier */
- if (timestamp < time(NULL)) {
+ if (timestamp < time(nullptr)) {
st.wDay = stBuf.wDay;
st.wDayOfWeek = stBuf.wDayOfWeek;
st.wMonth = stBuf.wMonth;
st.wYear = stBuf.wYear;
if (SystemTimeToTimeStamp(&st, ×tamp)) {
/* step one day up if still earlier */
- if (timestamp < time(NULL)) {
+ if (timestamp < time(nullptr)) {
timestamp += 24 * 60 * 60;
TimeStampToSystemTime(timestamp, &st);
}
@@ -307,7 +307,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_EDIT_COUNTDOWN:
if (HIWORD(wParam) == EN_KILLFOCUS) {
- if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, NULL, TRUE) < 1) {
+ if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, TRUE) < 1) {
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(1, 0));
SetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, 1, FALSE);
}
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_EDIT_CPUUSAGE:
if (HIWORD(wParam) == EN_KILLFOCUS) {
- WORD val = (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, NULL, FALSE);
+ WORD val = (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE);
if (val < 1) val = 1;
else if (val>100) val = 100;
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(val, 0));
@@ -342,7 +342,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L HWND hwndEdit = GetDlgItem(hwndDlg, IDC_EDIT_MESSAGE);
int len = GetWindowTextLength(hwndEdit) + 1;
wchar_t *pszText = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
- if (pszText != NULL && GetWindowText(hwndEdit, pszText, len + 1)) {
+ if (pszText != nullptr && GetWindowText(hwndEdit, pszText, len + 1)) {
TrimString(pszText);
db_set_ws(NULL, "AutoShutdown", "Message", pszText);
}
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L time_t timestamp;
DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
if (!SystemTimeToTimeStamp(&st, ×tamp))
- timestamp = time(NULL);
+ timestamp = time(nullptr);
db_set_dw(NULL, "AutoShutdown", "TimeStamp", (DWORD)timestamp);
}
/* shutdown type */
@@ -365,8 +365,8 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
db_set_dw(NULL, "AutoShutdown", "CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
- db_set_dw(NULL, "AutoShutdown", "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, NULL, FALSE));
- db_set_b(NULL, "AutoShutdown", "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, NULL, FALSE));
+ db_set_dw(NULL, "AutoShutdown", "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
+ db_set_b(NULL, "AutoShutdown", "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
}
/* watcher type */
{
@@ -399,11 +399,11 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L static INT_PTR ServiceShowSettingsDialog(WPARAM, LPARAM)
{
- if (hwndSettingsDlg != NULL) { /* already opened, bring to front */
+ if (hwndSettingsDlg != nullptr) { /* already opened, bring to front */
SetForegroundWindow(hwndSettingsDlg);
return 0;
}
- return CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETTINGS), NULL, SettingsDlgProc) == NULL;
+ return CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETTINGS), nullptr, SettingsDlgProc) == nullptr;
}
/************************* Toolbar ************************************/
@@ -412,7 +412,7 @@ static HANDLE hToolbarButton; int ToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconHandleUp = iconList[2].hIcolib;
ttb.hIconHandleDn = iconList[1].hIcolib;
ttb.pszService = "AutoShutdown/MenuCommand";
@@ -450,14 +450,14 @@ void SetShutdownMenuItem(bool fActive) }
mi.pszService = "AutoShutdown/MenuCommand";
mi.flags = CMIF_UNICODE;
- if (hMainMenuItem != NULL)
+ if (hMainMenuItem != nullptr)
Menu_ModifyItem(hMainMenuItem, mi.name.w, mi.hIcolibItem);
else
hMainMenuItem = Menu_AddMainMenuItem(&mi);
/* tray menu */
mi.position = 899999;
- if (hTrayMenuItem != NULL)
+ if (hTrayMenuItem != nullptr)
Menu_ModifyItem(hTrayMenuItem, mi.name.w, mi.hIcolibItem);
else
hTrayMenuItem = Menu_AddTrayMenuItem(&mi);
@@ -479,11 +479,11 @@ void InitSettingsDlg(void) {
/* Menu Item */
CreateServiceFunction("AutoShutdown/MenuCommand", MenuItemCommand);
- hMainMenuItem = hTrayMenuItem = NULL;
+ hMainMenuItem = hTrayMenuItem = nullptr;
SetShutdownMenuItem(false);
/* Hotkey */
AddHotkey();
/* Services */
- hwndSettingsDlg = NULL;
+ hwndSettingsDlg = nullptr;
CreateServiceFunction(MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG, ServiceShowSettingsDialog);
}
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index 095c55d25b..bce97d110c 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -52,10 +52,10 @@ static BOOL WinNT_SetPrivilege(wchar_t *pszPrivName, BOOL bEnable) if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
tkp.PrivilegeCount = 1; /* one privilege is to set */
/* get the LUID for the shutdown privilege */
- if (LookupPrivilegeValue(NULL, pszPrivName, &tkp.Privileges[0].Luid)) {
+ if (LookupPrivilegeValue(nullptr, pszPrivName, &tkp.Privileges[0].Luid)) {
tkp.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
/* get the shutdown privilege for this process */
- bReturn = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
+ bReturn = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, nullptr, nullptr);
}
CloseHandle(hToken);
}
@@ -89,7 +89,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) bReturn = TRUE;
if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
dwSize = sizeof(dwSetting);
- if (RegQueryValueEx(hKey, L"NoLogOff", 0, NULL, (LPBYTE)&dwSetting, &dwSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, L"NoLogOff", nullptr, nullptr, (LPBYTE)&dwSetting, &dwSize) == ERROR_SUCCESS)
if (dwSetting) bReturn = FALSE;
RegCloseKey(hKey);
}
@@ -103,7 +103,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) bReturn = TRUE;
if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
dwSize = sizeof(dwSetting);
- if (!RegQueryValueEx(hKey, L"DisableLockWorkstation", 0, NULL, (LPBYTE)&dwSetting, &dwSize))
+ if (!RegQueryValueEx(hKey, L"DisableLockWorkstation", nullptr, nullptr, (LPBYTE)&dwSetting, &dwSize))
if (dwSetting)
bReturn = FALSE;
RegCloseKey(hKey);
@@ -183,16 +183,16 @@ static DWORD ShutdownNow(BYTE shutdownType) DWORD dwConnItems = 0;
RASCONN *paConn = (RASCONN*)mir_alloc(dwConnSize);
dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
- if (paConn != NULL) {
+ if (paConn != nullptr) {
for (dwRetries = 5; dwRetries != 0; dwRetries--) { /* prevent infinite loop (rare) */
memset(paConn, 0, dwConnSize);
paConn[0].dwSize = sizeof(RASCONN);
dwErrCode = RasEnumConnections(paConn, &dwConnSize, &dwConnItems);
if (dwErrCode != ERROR_BUFFER_TOO_SMALL) break;
RASCONN *paConnBuf = (RASCONN*)mir_realloc(paConn, dwConnSize);
- if (paConnBuf == NULL) {
+ if (paConnBuf == nullptr) {
mir_free(paConn);
- paConn = NULL;
+ paConn = nullptr;
dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
break;
}
@@ -202,11 +202,11 @@ static DWORD ShutdownNow(BYTE shutdownType) for (dw = 0; dw < dwConnItems; ++dw) {
if (dwErrCode) {
if (RasHangUp(paConn[dw].hrasconn))
- paConn[dw].hrasconn = NULL; /* do not wait for on error */
+ paConn[dw].hrasconn = nullptr; /* do not wait for on error */
}
else {
dwErrCode = RasHangUp(paConn[dw].hrasconn);
- if (!dwErrCode) paConn[dw].hrasconn = NULL; /* do not wait for on error */
+ if (!dwErrCode) paConn[dw].hrasconn = nullptr; /* do not wait for on error */
}
}
/* RAS does not allow to quit directly after HangUp (see docs) */
@@ -214,7 +214,7 @@ static DWORD ShutdownNow(BYTE shutdownType) memset(&rcs, 0, sizeof(RASCONNSTATUS));
rcs.dwSize = sizeof(RASCONNSTATUS);
for (dw = 0; dw < dwConnItems; ++dw) {
- if (paConn[dw].hrasconn != NULL) {
+ if (paConn[dw].hrasconn != nullptr) {
while (RasGetConnectStatus(paConn[dw].hrasconn, &rcs) != ERROR_INVALID_HANDLE) {
Sleep(0); /* give rest of time silce to other threads with equal priority */
/* infinite loop protection (3000ms defined in docs) */
@@ -248,7 +248,7 @@ static DWORD ShutdownNow(BYTE shutdownType) BroadcastEndSession(BSM_APPLICATIONS | BSM_ALLDESKTOPS, ENDSESSION_CLOSEAPP); /* app should close itself */
WinNT_SetPrivilege(SE_TCB_NAME, FALSE);
- if (!InitiateSystemShutdownEx(NULL, TranslateT("AutoShutdown"), 0, TRUE, shutdownType == SDSDT_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
+ if (!InitiateSystemShutdownEx(nullptr, TranslateT("AutoShutdown"), 0, TRUE, shutdownType == SDSDT_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
dwErrCode = GetLastError();
/* cleanly close Miranda */
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L lf.lfWeight = FW_BOLD;
hBoldFont = CreateFontIndirect(&lf);
}
- else hBoldFont = NULL;
+ else hBoldFont = nullptr;
SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, (WPARAM)hBoldFont, FALSE);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, (LONG_PTR)hBoldFont);
}
@@ -329,7 +329,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(hwndDlg, M_UPDATE_COUNTDOWN, 0, countdown);
}
Skin_PlaySound("AutoShutdown_Countdown");
- if (!SetTimer(hwndDlg, 1, 1000, NULL))
+ if (!SetTimer(hwndDlg, 1, 1000, nullptr))
PostMessage(hwndDlg, M_START_SHUTDOWN, 0, 0);
Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "AutoShutdown", "ConfirmDlg_");
@@ -343,14 +343,14 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_DESTROY:
{
- hwndShutdownDlg = NULL;
+ hwndShutdownDlg = nullptr;
ShowWindow(hwndDlg, SW_HIDE);
/* reallow foreground window changes (WinMe/2000+) */
LockSetForegroundWindow(LSFW_UNLOCK);
Utils_SaveWindowPosition(hwndDlg, NULL, "AutoShutdown", "ConfirmDlg_");
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_GETFONT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, 0, FALSE); /* no return value */
- if (hFont != NULL) DeleteObject(hFont);
+ if (hFont != nullptr) DeleteObject(hFont);
}
return TRUE;
@@ -361,8 +361,8 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DWORD dwErrCode = ShutdownNow(shutdownType);
if (dwErrCode != ERROR_SUCCESS) {
char *pszErr = GetWinErrorDescription(dwErrCode);
- ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("The shutdown process failed!\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown"));
- if (pszErr != NULL) LocalFree(pszErr);
+ ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("The shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
+ if (pszErr != nullptr) LocalFree(pszErr);
}
DestroyWindow(hwndDlg);
}
@@ -419,7 +419,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam) /* passing 0 as wParam is only to be used internally, undocumented */
if (!wParam) wParam = db_get_b(NULL, "AutoShutdown", "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
if (!IsShutdownTypeEnabled((BYTE)wParam)) return 1; /* does shutdownType range check */
- if ((BOOL)lParam && hwndShutdownDlg != NULL) return 2;
+ if ((BOOL)lParam && hwndShutdownDlg != nullptr) return 2;
/* ask others if allowed */
if (NotifyEventHooks(hEventOkToShutdown, wParam, lParam)) {
@@ -430,15 +430,15 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam) NotifyEventHooks(hEventShutdown, wParam, lParam);
/* show dialog */
if (lParam && db_get_b(NULL, "AutoShutdown", "ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT))
- if (CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHUTDOWNNOW), NULL, ShutdownDlgProc, (BYTE)wParam) != NULL)
+ if (CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHUTDOWNNOW), nullptr, ShutdownDlgProc, (BYTE)wParam) != nullptr)
return 0;
/* show error */
DWORD dwErrCode = ShutdownNow((BYTE)wParam);
if (dwErrCode != ERROR_SUCCESS) {
char *pszErr = GetWinErrorDescription(dwErrCode);
- ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("Initiating the shutdown process failed!\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown"));
- if (pszErr != NULL)
+ ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("Initiating the shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
+ if (pszErr != nullptr)
LocalFree(pszErr);
return 4;
}
@@ -482,7 +482,7 @@ INT_PTR ServiceGetTypeDescription(WPARAM wParam, LPARAM lParam) if (!(lParam&GSTDF_UNICODE)) {
static char szConvBuf[128];
char *buf = u2a(pszDesc);
- if (buf == NULL) return 0;
+ if (buf == nullptr) return 0;
mir_strncpy(szConvBuf, buf, sizeof(szConvBuf));
mir_free(buf);
return (INT_PTR)szConvBuf;
@@ -495,7 +495,7 @@ INT_PTR ServiceGetTypeDescription(WPARAM wParam, LPARAM lParam) void InitShutdownSvc(void)
{
/* Shutdown Dialog */
- hwndShutdownDlg = NULL;
+ hwndShutdownDlg = nullptr;
Skin_AddSound("AutoShutdown_Countdown", LPGENW("Alerts"), LPGENW("Automatic shutdown countdown"));
/* Events */
@@ -511,7 +511,7 @@ void InitShutdownSvc(void) void UninitShutdownSvc(void)
{
/* Shutdown Dialog */
- if (hwndShutdownDlg != NULL)
+ if (hwndShutdownDlg != nullptr)
DestroyWindow(hwndShutdownDlg);
/* Services */
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 32272d33fe..e288740dbb 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -26,23 +26,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // mir_free() the return value
char* u2a(const WCHAR *pszUnicode)
{
- if (pszUnicode == NULL)
- return NULL;
+ if (pszUnicode == nullptr)
+ return nullptr;
int codepage = Langpack_GetDefaultCodePage();
/* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */
DWORD flags;
- int cch = WideCharToMultiByte(codepage, flags = WC_COMPOSITECHECK, pszUnicode, -1, NULL, 0, NULL, NULL);
+ int cch = WideCharToMultiByte(codepage, flags = WC_COMPOSITECHECK, pszUnicode, -1, nullptr, 0, nullptr, nullptr);
if (!cch)
- cch = WideCharToMultiByte(codepage, flags = 0, pszUnicode, -1, NULL, 0, NULL, NULL);
+ cch = WideCharToMultiByte(codepage, flags = 0, pszUnicode, -1, nullptr, 0, nullptr, nullptr);
if (!cch)
- return NULL;
+ return nullptr;
char *psz = (char*)mir_alloc(cch);
- if (psz != NULL && !WideCharToMultiByte(codepage, flags, pszUnicode, -1, psz, cch, NULL, NULL)) {
+ if (psz != nullptr && !WideCharToMultiByte(codepage, flags, pszUnicode, -1, psz, cch, nullptr, nullptr)) {
mir_free(psz);
- return NULL;
+ return nullptr;
}
return psz;
}
@@ -84,11 +84,11 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, . mir_vsnprintf(szText, _countof(szText), pszTextFmt, va);
va_end(va);
- if (!Clist_TrayNotifyA(NULL, pszTitle, szText, flags, 30000)) // success
+ if (!Clist_TrayNotifyA(nullptr, pszTitle, szText, flags, 30000)) // success
return;
MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp));
- if (mbp == NULL) return;
+ if (mbp == nullptr) return;
mbp->cbSize = sizeof(*mbp);
mbp->lpszCaption = mir_strdup(pszTitle);
mbp->lpszText = mir_strdup(szText);
@@ -105,11 +105,11 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, . // LocalFree() the return value
char* GetWinErrorDescription(DWORD dwLastError)
{
- char *buf = NULL;
+ char *buf = nullptr;
DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM;
- if (!FormatMessageA(flags, NULL, dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()), (char*)&buf, 0, NULL))
+ if (!FormatMessageA(flags, nullptr, dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()), (char*)&buf, 0, nullptr))
if (GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND)
- FormatMessageA(flags, NULL, dwLastError, 0, (char*)&buf, 0, NULL);
+ FormatMessageA(flags, nullptr, dwLastError, 0, (char*)&buf, 0, nullptr);
return buf;
}
@@ -160,12 +160,12 @@ BOOL GetFormatedCountdown(wchar_t *pszOut, int nSize, time_t countdown) }
/* WinVista */
- if (pfnGetDurationFormat != NULL) {
+ if (pfnGetDurationFormat != nullptr) {
SYSTEMTIME st;
LCID locale;
locale = Langpack_GetDefaultLocale();
if (TimeStampToSystemTime(countdown, &st))
- if (pfnGetDurationFormat(locale, 0, &st, 0, NULL, pszOut, nSize))
+ if (pfnGetDurationFormat(locale, 0, &st, 0, nullptr, pszOut, nSize))
return TRUE;
return FALSE;
}
@@ -182,13 +182,13 @@ BOOL GetFormatedDateTime(wchar_t *pszOut, int nSize, time_t timestamp, BOOL fSho TimeStampToSystemTime(timestamp, &st);
/* today: no need to show the date */
if (!fShowDateEvenToday && st.wDay == stNow.wDay && st.wMonth == stNow.wMonth && st.wYear == stNow.wYear)
- return GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, NULL, pszOut, nSize) != 0;
+ return GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, nullptr, pszOut, nSize) != 0;
/* show both date and time */
{
wchar_t szDate[128], szTime[128];
- if (!GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, NULL, szTime, _countof(szTime)))
+ if (!GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, nullptr, szTime, _countof(szTime)))
return FALSE;
- if (!GetDateFormat(locale, DATE_SHORTDATE, &st, NULL, szDate, _countof(szDate)))
+ if (!GetDateFormat(locale, DATE_SHORTDATE, &st, nullptr, szDate, _countof(szDate)))
return FALSE;
mir_snwprintf(pszOut, nSize, L"%s %s", szTime, szDate);
return TRUE;
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index d5422b632f..04f8429eb0 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -45,15 +45,15 @@ static void __stdcall MainThreadMapping(void *param) HANDLE *phDoneEvent = (HANDLE*)param;
ServiceShutdown(0, TRUE); /* ensure main thread (for cpu usage shutdown) */
ServiceStopWatcher(0, 0);
- if (*phDoneEvent != NULL)
+ if (*phDoneEvent != nullptr)
SetEvent(*phDoneEvent);
}
static void __inline ShutdownAndStopWatcher(void)
{
- HANDLE hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hDoneEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
CallFunctionAsync(MainThreadMapping, &hDoneEvent);
- if (hDoneEvent != NULL) {
+ if (hDoneEvent != nullptr) {
WaitForSingleObject(hDoneEvent, INFINITE);
CloseHandle(hDoneEvent);
}
@@ -72,13 +72,13 @@ static wchar_t* GetMessageText(BYTE **ppBlob, DWORD *pcbBlob) return (WCHAR*)&(*ppBlob)[cb];
}
/* no Unicode data present, convert from ANSI */
- int len = MultiByteToWideChar(CP_ACP, 0, (char*)*ppBlob, -1, NULL, 0);
+ int len = MultiByteToWideChar(CP_ACP, 0, (char*)*ppBlob, -1, nullptr, 0);
if (!len)
- return NULL;
+ return nullptr;
BYTE *buf = (BYTE*)mir_realloc(*ppBlob, (*pcbBlob) + (len*sizeof(WCHAR)));
- if (buf == NULL)
- return NULL;
+ if (buf == nullptr)
+ return nullptr;
*pcbBlob += len*sizeof(WCHAR);
*ppBlob = buf;
@@ -94,7 +94,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent) DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hDbEvent);
dbe.pBlob = (BYTE*)mir_alloc(dbe.cbBlob + 2); /* ensure term zero */
- if (dbe.pBlob == NULL)
+ if (dbe.pBlob == nullptr)
return 0;
if (!db_event_get(hDbEvent, &dbe))
if (dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) {
@@ -102,7 +102,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent) if (!db_get_ws(NULL, "AutoShutdown", "Message", &dbv)) {
TrimString(dbv.ptszVal);
wchar_t *pszMsg = GetMessageText(&dbe.pBlob, &dbe.cbBlob);
- if (pszMsg != NULL && wcsstr(pszMsg, dbv.ptszVal) != NULL)
+ if (pszMsg != nullptr && wcsstr(pszMsg, dbv.ptszVal) != nullptr)
ShutdownAndStopWatcher(); /* msg with specified text recvd */
mir_free(dbv.ptszVal); /* does NULL check */
}
@@ -131,7 +131,7 @@ static int ProtoAck(WPARAM, LPARAM lParam) break; /* already in list */
/* insert into list */
HANDLE *buf = (HANDLE*)mir_realloc(transfers, (nTransfersCount + 1)*sizeof(HANDLE));
- if (buf != NULL) {
+ if (buf != nullptr) {
transfers = buf;
transfers[nTransfersCount] = ack->hProcess;
++nTransfersCount;
@@ -148,8 +148,8 @@ static int ProtoAck(WPARAM, LPARAM lParam) memmove(&transfers[i], &transfers[i + 1], (nTransfersCount - i - 1)*sizeof(HANDLE));
--nTransfersCount;
HANDLE *buf = (HANDLE*)mir_realloc(transfers, nTransfersCount*sizeof(HANDLE));
- if (buf != NULL) transfers = buf;
- else if (!nTransfersCount) transfers = NULL;
+ if (buf != nullptr) transfers = buf;
+ else if (!nTransfersCount) transfers = nullptr;
/* stop watcher */
if (!nTransfersCount && (currentWatcherType&SDWTF_FILETRANSFER))
ShutdownAndStopWatcher();
@@ -178,7 +178,7 @@ static BOOL CheckAllContactsOffline(void) fSmartCheck = db_get_b(NULL, "AutoShutdown", "SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *pszProto = GetContactProto(hContact);
- if (pszProto != NULL && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) {
+ if (pszProto != nullptr && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) {
if (db_get_b(hContact, pszProto, "ChatRoom", 0)) continue;
if (db_get_w(hContact, pszProto, "Status", 0) != ID_STATUS_OFFLINE) {
if (fSmartCheck) {
@@ -197,9 +197,9 @@ static int StatusSettingChanged(WPARAM wParam, LPARAM lParam) {
if (currentWatcherType&SDWTF_STATUS) {
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam;
- if ((HANDLE)wParam != NULL && dbcws->value.wVal == ID_STATUS_OFFLINE && !strcmp(dbcws->szSetting, "Status")) {
+ if ((HANDLE)wParam != nullptr && dbcws->value.wVal == ID_STATUS_OFFLINE && !strcmp(dbcws->szSetting, "Status")) {
char *pszProto = GetContactProto(wParam);
- if (pszProto != NULL && !strcmp(dbcws->szModule, pszProto))
+ if (pszProto != nullptr && !strcmp(dbcws->szModule, pszProto))
if (CheckAllContactsOffline())
ShutdownAndStopWatcher();
}
@@ -235,7 +235,7 @@ static BOOL CALLBACK CpuUsageWatcherProc(BYTE nCpuUsage, LPARAM lParam) static int WeatherUpdated(WPARAM wParam, LPARAM lParam)
{
char *pszProto = GetContactProto(wParam);
- if ((BOOL)lParam && pszProto != NULL && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == THUNDER)
+ if ((BOOL)lParam && pszProto != nullptr && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == THUNDER)
if (db_get_b(NULL, "AutoShutdown", "WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT))
ServiceShutdown(SDSDT_SHUTDOWN, TRUE);
return 0;
@@ -334,11 +334,11 @@ void InitWatcher(void) /* Idle Shutdown */
hHookIdleChanged = HookEvent(ME_IDLE_CHANGED, IdleChanged);
/* Transfer Shutdown */
- transfers = NULL;
+ transfers = nullptr;
nTransfersCount = 0;
hHookProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck);
/* Weather Shutdown */
- hHookWeatherUpdated = NULL;
+ hHookWeatherUpdated = nullptr;
/* Services */
hEventWatcherChanged = CreateHookableEvent(ME_AUTOSHUTDOWN_WATCHERCHANGED);
CreateServiceFunction(MS_AUTOSHUTDOWN_STARTWATCHER, ServiceStartWatcher);
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 42dbfa80ef..a352efd61b 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -20,7 +20,7 @@ Avatar History Plugin #include "stdafx.h"
-HGENMENU hMenu = NULL;
+HGENMENU hMenu = nullptr;
static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact = NULL);
@@ -49,8 +49,8 @@ public: ListEntry()
{
hDbEvent = NULL;
- filename = NULL;
- filelink = NULL;
+ filename = nullptr;
+ filelink = nullptr;
}
~ListEntry()
@@ -82,7 +82,7 @@ int OpenAvatarDialog(MCONTACT hContact, char* fn) struct AvatarDialogData *avdlg = (struct AvatarDialogData*)malloc(sizeof(struct AvatarDialogData));
memset(avdlg, 0, sizeof(struct AvatarDialogData));
avdlg->hContact = hContact;
- if (fn == NULL)
+ if (fn == nullptr)
avdlg->fn[0] = '\0';
else
MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, _countof(avdlg->fn));
@@ -143,7 +143,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA TranslateDialogDefault(hwnd);
EnableDisableControls(hwnd);
free(data);
- data = NULL;
+ data = nullptr;
}
break;
@@ -204,7 +204,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA POINT p;
p.x = LOWORD(lParam);
p.y = HIWORD(lParam);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwndList, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwndList, nullptr);
DestroyMenu(menu);
ListEntry *le = (ListEntry*)SendMessage(hwndList, LB_GETITEMDATA, pos, 0);
@@ -312,7 +312,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA wchar_t avfolder[MAX_PATH];
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
GetContactFolder(avfolder, hContact);
- ShellExecute(NULL, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? L"explore" : L"open", avfolder, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? L"explore" : L"open", avfolder, nullptr, nullptr, SW_SHOWNORMAL);
return TRUE;
}
break;
@@ -352,7 +352,7 @@ int AddFileToList(wchar_t *path, wchar_t *lnk, wchar_t *filename, HWND list) le->filelink = mir_wstrdup(lnk);
wchar_t *p = wcschr(filename, '.');
- if (p != NULL)
+ if (p != nullptr)
p[0] = '\0';
int max_pos = SendMessage(list, LB_ADDSTRING, 0, (LPARAM)filename);
SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM)le);
@@ -464,7 +464,7 @@ bool UpdateAvatarPic(HWND hwnd) HBITMAP avpic = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)le->filename, IMGL_WCHAR);
- bool found_image = (avpic != NULL);
+ bool found_image = (avpic != nullptr);
avpic = (HBITMAP)SendMessage(hwndpic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)avpic);
if (avpic)
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 0cc29ece82..cc4704a7c2 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -28,12 +28,12 @@ HINSTANCE hInst; DWORD mirVer;
-HANDLE hFolder = NULL;
+HANDLE hFolder = nullptr;
wchar_t profilePath[MAX_PATH]; // database profile path (read at startup only)
wchar_t basedir[MAX_PATH];
int hLangpack = 0;
-MWindowList hAvatarWindowsList = NULL;
+MWindowList hAvatarWindowsList = nullptr;
int OptInit(WPARAM wParam, LPARAM lParam);
@@ -109,7 +109,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) return 0;
char *proto = GetContactProto(hContact);
- if (proto == NULL)
+ if (proto == nullptr)
return 0;
if (mir_strcmp(META_PROTO, proto) == 0)
@@ -119,7 +119,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) bool ret = (db_get_ws(hContact, MODULE_NAME, "AvatarHash", &dbvOldHash) == 0);
CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam;
- if (avatar == NULL) {
+ if (avatar == nullptr) {
if (!ret || !mir_wstrcmp(dbvOldHash.ptszVal, L"-")) {
//avoid duplicate "removed avatar" notifications
//do not notify on an empty profile
@@ -133,7 +133,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) db_set_ws(hContact, MODULE_NAME, "AvatarHash", L"-");
if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed)
- ShowPopup(hContact, NULL, opts.popup_removed);
+ ShowPopup(hContact, nullptr, opts.popup_removed);
}
else {
if (ret && !mir_wstrcmp(dbvOldHash.ptszVal, avatar->hash)) {
@@ -177,7 +177,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) wchar_t *file = GetCachedAvatar(proto, hash);
- if (file != NULL) {
+ if (file != nullptr) {
mir_wstrncpy(history_filename, file, _countof(history_filename));
mir_free(file);
}
@@ -207,7 +207,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) }
if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_changed)
- ShowPopup(hContact, NULL, opts.popup_changed);
+ ShowPopup(hContact, nullptr, opts.popup_changed);
if (ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY)) {
wchar_t rel_path[MAX_PATH];
@@ -217,7 +217,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.eventType = EVENTTYPE_AVATAR_CHANGE;
dbei.cbBlob = (DWORD)mir_strlen(blob) + 1;
dbei.pBlob = blob;
@@ -294,12 +294,12 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- CoInitialize(NULL);
+ CoInitialize(nullptr);
// Is first run?
if (db_get_b(NULL, MODULE_NAME, "FirstRun", 1)) {
// Show dialog
- int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0);
+ int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), nullptr, FirstRunDlgProc, 0);
if (ret == 0)
return -1;
diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index 28cfbb9f6c..38ce5a44a7 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -25,7 +25,7 @@ static void ReleaseIconEx(HICON hIcon) static void IcoLibUpdateMenus()
{
HICON hIcon = createDefaultOverlayedIcon(FALSE);
- Menu_ModifyItem(hMenu, 0, hIcon, 0);
+ Menu_ModifyItem(hMenu, nullptr, hIcon, 0);
DestroyIcon(hIcon);
}
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index 3d94a21e3c..7987f862a4 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -25,18 +25,18 @@ Options opts; // Prototypes /////////////////////////////////////////////////////////////////////////////////////
static OptPageControl optionsControls[] = {
- { NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE }
+ { nullptr, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE }
};
static OptPageControl popupsControls[] = {
- { NULL, CONTROL_CHECKBOX, IDC_POPUPS, "AvatarPopups", AVH_DEF_AVPOPUPS },
+ { nullptr, CONTROL_CHECKBOX, IDC_POPUPS, "AvatarPopups", AVH_DEF_AVPOPUPS },
{ &opts.popup_bkg_color, CONTROL_COLOR, IDC_BGCOLOR, "PopupsBgColor", AVH_DEF_POPUPBG },
{ &opts.popup_text_color, CONTROL_COLOR, IDC_TEXTCOLOR, "PopupsTextColor", AVH_DEF_POPUPFG },
{ &opts.popup_use_win_colors, CONTROL_CHECKBOX, IDC_WINCOLORS, "PopupsWinColors", FALSE },
{ &opts.popup_use_default_colors, CONTROL_CHECKBOX, IDC_DEFAULTCOLORS, "PopupsDefaultColors", AVH_DEF_DEFPOPUPS },
{ &opts.popup_delay_type, CONTROL_RADIO, IDC_DELAYFROMPU, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_DEFAULT },
- { NULL, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM },
- { NULL, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT },
+ { nullptr, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM },
+ { nullptr, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT },
{ &opts.popup_timeout, CONTROL_SPIN, IDC_DELAY, "PopupsTimeout", 10, IDC_DELAY_SPIN, (WORD)1, (WORD)255 },
{ &opts.popup_right_click_action, CONTROL_COMBO, IDC_RIGHT_ACTION, "PopupsRightClick", POPUP_ACTION_CLOSEPOPUP },
{ &opts.popup_left_click_action, CONTROL_COMBO, IDC_LEFT_ACTION, "PopupsLeftClick", POPUP_ACTION_OPENAVATARHISTORY },
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
op.popup_delay_type = POPUP_DELAY_PERMANENT;
- op.popup_timeout = GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
+ op.popup_timeout = GetDlgItemInt(hwndDlg, IDC_DELAY, nullptr, FALSE);
op.popup_bkg_color = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);
op.popup_text_color = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0);
op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0;
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index 9fee0bb3ff..6d4ef5c8ab 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA. LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-HWND hPopupWindow = NULL;
+HWND hPopupWindow = nullptr;
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
@@ -43,7 +43,7 @@ void InitPopups() // window needed for popup commands
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MODULE_NAME) L"_PopupWindow",
0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
- NULL, hInst, NULL);
+ nullptr, hInst, nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
}
@@ -56,14 +56,14 @@ void DeInitPopups() // Show an error popup
void ShowErrPopup(const wchar_t *description, const wchar_t *title)
{
- ShowPopupEx(NULL, title == NULL ? _A2W(MODULE_NAME) L" Error" : title, description,
- NULL, POPUP_TYPE_ERROR, NULL);
+ ShowPopupEx(NULL, title == nullptr ? _A2W(MODULE_NAME) L" Error" : title, description,
+ nullptr, POPUP_TYPE_ERROR, nullptr);
}
void ShowTestPopup(MCONTACT hContact, const wchar_t *title, const wchar_t *description, const Options *op)
{
- ShowPopupEx(hContact, title, description, NULL, POPUP_TYPE_TEST, op);
+ ShowPopupEx(hContact, title, description, nullptr, POPUP_TYPE_TEST, op);
}
@@ -101,13 +101,13 @@ void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *descrip ((PopupDataType*)ppd.PluginData)->plugin_data = plugin_data;
((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon;
- if (title != NULL)
+ if (title != nullptr)
mir_wstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName));
else if (hContact != NULL)
mir_wstrncpy(ppd.lptzContactName, (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0),
_countof(ppd.lptzContactName));
- if (description != NULL)
+ if (description != nullptr)
mir_wstrncpy(ppd.lptzText, description, _countof(ppd.lptzText));
if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) {
@@ -163,7 +163,7 @@ void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *descrip PUAddPopupT(&ppd);
}
else {
- MessageBox(NULL, description, title ? title : (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0),
+ MessageBox(nullptr, description, title ? title : (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0),
MB_OK);
}
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 30f756839b..71214413a2 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -74,9 +74,9 @@ void ConvertToFilename(wchar_t *str, size_t size) wchar_t* GetExtension(wchar_t *file)
{
- if (file == NULL) return L"";
+ if (file == nullptr) return L"";
wchar_t *ext = wcsrchr(file, '.');
- if (ext != NULL)
+ if (ext != nullptr)
ext++;
else
ext = L"";
@@ -86,7 +86,7 @@ wchar_t* GetExtension(wchar_t *file) wchar_t* GetHistoryFolder(wchar_t *fn)
{
- if (fn == NULL) return NULL;
+ if (fn == nullptr) return nullptr;
FoldersGetCustomPathT(hFolder, fn, MAX_PATH, basedir);
CreateDirectoryTreeW(fn);
return fn;
@@ -96,7 +96,7 @@ wchar_t* GetProtocolFolder(wchar_t *fn, char *proto) {
GetHistoryFolder(fn);
- if (proto == NULL)
+ if (proto == nullptr)
proto = Translate("Unknown protocol");
mir_snwprintf(fn, MAX_PATH, L"%s\\%S", fn, proto);
@@ -163,7 +163,7 @@ BOOL CopyImageFile(wchar_t *old_file, wchar_t *new_file) wchar_t* GetCachedAvatar(char *proto, wchar_t *hash)
{
- wchar_t *ret = NULL;
+ wchar_t *ret = nullptr;
wchar_t file[1024] = L"";
wchar_t search[1024] = L"";
if (opts.log_keep_same_folder)
@@ -176,7 +176,7 @@ wchar_t* GetCachedAvatar(char *proto, wchar_t *hash) WIN32_FIND_DATA finddata;
HANDLE hFind = FindFirstFile(search, &finddata);
if (hFind == INVALID_HANDLE_VALUE)
- return NULL;
+ return nullptr;
do {
size_t len = mir_wstrlen(finddata.cFileName);
@@ -198,12 +198,12 @@ wchar_t* GetCachedAvatar(char *proto, wchar_t *hash) BOOL CreateShortcut(wchar_t *file, wchar_t *shortcut)
{
- IShellLink *psl = NULL;
- HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
+ IShellLink *psl = nullptr;
+ HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
if (SUCCEEDED(hr)) {
psl->SetPath(file);
- IPersistFile *ppf = NULL;
+ IPersistFile *ppf = nullptr;
hr = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
if (SUCCEEDED(hr)) {
hr = ppf->Save(shortcut, TRUE);
@@ -218,18 +218,18 @@ BOOL CreateShortcut(wchar_t *file, wchar_t *shortcut) BOOL ResolveShortcut(wchar_t *shortcut, wchar_t *file)
{
- IShellLink* psl = NULL;
+ IShellLink* psl = nullptr;
- HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
+ HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
if (SUCCEEDED(hr)) {
- IPersistFile* ppf = NULL;
+ IPersistFile* ppf = nullptr;
hr = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
if (SUCCEEDED(hr)) {
hr = ppf->Load(shortcut, STGM_READ);
if (SUCCEEDED(hr)) {
- hr = psl->Resolve(NULL, SLR_UPDATE);
+ hr = psl->Resolve(nullptr, SLR_UPDATE);
if (SUCCEEDED(hr)) {
WIN32_FIND_DATA wfd;
hr = psl->GetPath(file, MAX_PATH, &wfd, SLGP_RAWPATH);
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 2630ff4e68..3363a4fb67 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -16,7 +16,7 @@ Copyright (C) 2010, 2011 tico-tico #pragma comment(lib, "src\\bass.lib")
#endif
-static HINSTANCE hBass = NULL;
+static HINSTANCE hBass = nullptr;
FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo dli)
{
@@ -25,7 +25,7 @@ FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo dli) case dliNotePreGetProcAddress:
return GetProcAddress(hBass, dli->dlp.szProcName);
}
- return NULL;
+ return nullptr;
}
extern "C" PfnDliHook __pfnDliNotifyHook2 = delayHook;
@@ -70,11 +70,11 @@ static int Volume; static int device = -1;
static int newBass = 0;
-HWND hwndSlider = NULL, hwndMute = NULL, hwndOptSlider = NULL, hwnd_plugin = NULL;
+HWND hwndSlider = nullptr, hwndMute = nullptr, hwndOptSlider = nullptr, hwnd_plugin = nullptr;
COLORREF clBack = 0;
-HBRUSH hBkgBrush = 0;
-HANDLE frame_id = NULL;
-HANDLE hBASSFolder = NULL, hPlaySound = NULL;
+HBRUSH hBkgBrush = nullptr;
+HANDLE frame_id = nullptr;
+HANDLE hBASSFolder = nullptr, hPlaySound = nullptr;
static int OnPlaySnd(WPARAM wParam, LPARAM lParam)
{
@@ -178,7 +178,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara CheckDlgButton(hwndDlg, IDC_QUIETTIME, BST_CHECKED);
}
- if (hBass == NULL) {
+ if (hBass == nullptr) {
EnableWindow(GetDlgItem(hwndDlg, IDC_VOLUME), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXCHANNEL), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_OUTDEVICE), FALSE);
@@ -208,7 +208,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return TRUE;
case WM_HSCROLL:
- if (hBass != NULL)
+ if (hBass != nullptr)
if (LOWORD(wParam) == SB_ENDSCROLL || LOWORD(wParam) == SB_THUMBTRACK) {
Volume = SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100);
@@ -223,7 +223,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- if (hBass != NULL) {
+ if (hBass != nullptr) {
SYSTEMTIME systime = { 0 };
GetDlgItemText(hwndDlg, IDC_OUTDEVICE, tmp, _countof(tmp));
@@ -269,7 +269,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return 1;
case PSN_RESET:
- if (hBass != NULL)
+ if (hBass != nullptr)
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100);
return 1;
@@ -361,14 +361,14 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR switch (msg) {
case WM_CREATE:
hwndMute = CreateWindow(MIRANDABUTTONCLASS, L"", WS_CHILD | WS_VISIBLE, 1, 1, 16, 16, hwnd,
- 0, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), NULL);
+ nullptr, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), nullptr);
SendMessage(hwndMute, BUTTONSETASFLATBTN, 1, 0);
SendMessage(hwndMute, BUTTONSETCUSTOMPAINT, 0, (LPARAM)&fnPainter);
EnableFrameIcon(db_get_b(NULL, "Skin", "UseSound", 0) != 0);
hwndSlider = CreateWindow(TRACKBAR_CLASS, L"", WS_CHILD | WS_VISIBLE | TBS_NOTICKS | TBS_TOOLTIPS, 21, 1, 100, 20,
- hwnd, (HMENU)0, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), NULL);
+ hwnd, (HMENU)nullptr, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), nullptr);
SendMessage(hwndSlider, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN, SLIDER_MAX));
SendMessage(hwndSlider, TBM_SETPOS, TRUE, Volume);
mir_subclassWindow(hwndSlider, SliderWndProc);
@@ -383,7 +383,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_HSCROLL:
- if (hBass != NULL)
+ if (hBass != nullptr)
if (LOWORD(wParam) == SB_ENDSCROLL || LOWORD(wParam) == SB_THUMBTRACK) {
Volume = (DWORD)SendMessage(hwndSlider, TBM_GETPOS, 0, 0);
db_set_b(NULL, ModuleName, OPT_VOLUME, Volume);
@@ -399,7 +399,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR GetClientRect(hwnd, &rc);
if (hwndMute)
MoveWindow(hwndMute, rc.right - 20, 2, 16, 16, FALSE);
- SetWindowPos(hwndSlider, 0, 1, rc.top + 1 + (20 - 18) / 2, rc.right - rc.left - 1 - 20, 18, SWP_NOZORDER);
+ SetWindowPos(hwndSlider, nullptr, 1, rc.top + 1 + (20 - 18) / 2, rc.right - rc.left - 1 - 20, 18, SWP_NOZORDER);
InvalidateRect(hwnd, &rc, FALSE);
return 0;
@@ -430,9 +430,9 @@ int ReloadColors(WPARAM, LPARAM) DeleteObject(hBkgBrush);
hBkgBrush = CreateSolidBrush(clBack);
HWND hwnd = GetFocus();
- InvalidateRect(hwndSlider, NULL, TRUE);
+ InvalidateRect(hwndSlider, nullptr, TRUE);
SetFocus(hwndSlider);
- RedrawWindow(hwnd_plugin, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
+ RedrawWindow(hwnd_plugin, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
SetFocus(hwnd);
return 0;
}
@@ -445,12 +445,12 @@ void CreateFrame() WNDCLASS wndclass = { 0 };
wndclass.lpfnWndProc = FrameWindowProc;
wndclass.hInstance = hInst;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.lpszClassName = L"BassInterfaceFrame";
RegisterClass(&wndclass);
hwnd_plugin = CreateWindow(L"BassInterfaceFrame", TranslateT("Bass Interface"),
- WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL);
+ WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, nullptr);
CLISTFrame Frame = { sizeof(CLISTFrame) };
Frame.tname = TranslateT("Bass Interface");
@@ -488,7 +488,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) {
hBass = LoadLibrary(ptszPath);
- if (hBass != NULL)
+ if (hBass != nullptr)
{
newBass = (BASS_SetConfig(BASS_CONFIG_DEV_DEFAULT, TRUE) != 0); // will use new "Default" device
@@ -512,7 +512,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) EnPreview = db_get_b(NULL, ModuleName, OPT_PREVIEW, 0);
StatMask = db_get_w(NULL, ModuleName, OPT_STATUS, 0x3ff);
- BASS_Init(device, 44100, 0, pcli->hwndContactList, NULL);
+ BASS_Init(device, 44100, 0, pcli->hwndContactList, nullptr);
Volume = db_get_b(NULL, ModuleName, OPT_VOLUME, 33);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100);
@@ -526,10 +526,10 @@ int OnFoldersChanged(WPARAM, LPARAM) FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, L"");
mir_wstrcat(CurrBassPath, L"\\bass.dll");
- if (hBass != NULL) {
+ if (hBass != nullptr) {
BASS_Free();
FreeLibrary(hBass);
- hBass = NULL;
+ hBass = nullptr;
UnhookEvent(hPlaySound);
DeleteFrame();
}
@@ -580,7 +580,7 @@ int OnSettingChanged(WPARAM wParam, LPARAM lParam) int OnShutdown(WPARAM, LPARAM)
{
- if (hBass != NULL) {
+ if (hBass != nullptr) {
BASS_Free();
FreeLibrary(hBass);
}
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 8b42954c44..b017c33188 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -25,16 +25,16 @@ HINSTANCE hInst; #define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask"
HCURSOR hCurSplitNS, hCurSplitWE;
-HANDLE g_hMainThread = NULL;
+HANDLE g_hMainThread = nullptr;
-HANDLE *hEventIcons = NULL;
+HANDLE *hEventIcons = nullptr;
int iconsNum = 3;
HANDLE hToolbarButton;
HGENMENU hContactMenu, hDeleteContactMenu;
HGENMENU hTaskMainMenu;
std::vector<HGENMENU> taskMenus;
bool g_SmileyAddAvail = false;
-char* metaContactProto = NULL;
+char* metaContactProto = nullptr;
const IID IID_ITextDocument = { 0x8CC497C0, 0xA1DF, 0x11ce, {0x80, 0x98, 0x00, 0xAA, 0x00, 0x47, 0xBE, 0x5D} };
#define MODULE "BasicHistory"
@@ -85,7 +85,7 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) int ToolbarModuleLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
ttb.name = ttb.pszTooltipUp = LPGEN("Open History");
ttb.dwFlags = TTBBF_SHOWTOOLTIP;
@@ -122,7 +122,7 @@ void InitMenuItems() void InitTaskMenuItems()
{
if (Options::instance->taskOptions.size() > 0) {
- if (hTaskMainMenu == NULL) {
+ if (hTaskMainMenu == nullptr) {
CMenuItem mi;
SET_UID(mi, 0xbf66499, 0x1b39, 0x47a2, 0x9b, 0x74, 0xa6, 0xae, 0x89, 0x95, 0x59, 0x59);
mi.position = 500060005;
@@ -151,7 +151,7 @@ void InitTaskMenuItems() taskMenus.push_back(menu);
}
}
- else if (hTaskMainMenu != NULL)
+ else if (hTaskMainMenu != nullptr)
Menu_ShowItem(hTaskMainMenu, false);
}
@@ -178,7 +178,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
- return 0;
+ return nullptr;
}
INT_PTR ShowContactHistory(WPARAM hContact, LPARAM)
@@ -205,12 +205,12 @@ int ModulesLoaded(WPARAM, LPARAM) InitMenuItems();
wchar_t ftpExe[MAX_PATH];
- if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe))) {
+ if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILES, nullptr, SHGFP_TYPE_CURRENT, ftpExe))) {
wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe");
DWORD atr = GetFileAttributes(ftpExe);
if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY) {
#ifdef _WIN64
- if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, SHGFP_TYPE_CURRENT, ftpExe))) {
+ if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILESX86, nullptr, SHGFP_TYPE_CURRENT, ftpExe))) {
wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe");
atr = GetFileAttributes(ftpExe);
if (!(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY))
@@ -246,11 +246,11 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- hTaskMainMenu = NULL;
+ hTaskMainMenu = nullptr;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
- hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
- hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
+ hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS);
+ hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE);
CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowContactHistory);
CreateServiceFunction(MS_HISTORY_DELETEALLCONTACTHISTORY, HistoryWindow::DeleteAllUserHistory);
@@ -271,16 +271,16 @@ extern "C" int __declspec(dllexport) Unload(void) {
if (g_hMainThread)
CloseHandle(g_hMainThread);
- g_hMainThread = NULL;
+ g_hMainThread = nullptr;
HistoryWindow::Deinit();
DestroyCursor(hCurSplitNS);
DestroyCursor(hCurSplitWE);
- if (Options::instance != NULL) {
+ if (Options::instance != nullptr) {
delete Options::instance;
- Options::instance = NULL;
+ Options::instance = nullptr;
}
delete[] hEventIcons;
diff --git a/plugins/BasicHistory/src/BinaryExport.cpp b/plugins/BasicHistory/src/BinaryExport.cpp index 619a9de152..bc67e95756 100644 --- a/plugins/BasicHistory/src/BinaryExport.cpp +++ b/plugins/BasicHistory/src/BinaryExport.cpp @@ -52,9 +52,9 @@ BinaryExport::~BinaryExport() void BinaryExport::WriteString(const std::wstring &str)
{
- int conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL);
+ int conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, nullptr, 0, nullptr, nullptr);
char* buf = new char[conv];
- conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, buf, conv, NULL, NULL);
+ conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, buf, conv, nullptr, nullptr);
EXP_FILE.write(buf, conv);
delete[] buf;
}
@@ -95,7 +95,7 @@ bool BinaryExport::ReadString(std::wstring &str) if (totalSize == 0)
return true;
- int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, NULL, 0);
+ int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, nullptr, 0);
str.resize(sizeW);
MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, (wchar_t*)str.c_str(), sizeW);
return true;
diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 7c8f5af157..c21a030abe 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -58,11 +58,11 @@ DatExport::~DatExport() int DatExport::WriteString(const std::wstring &str)
{
- int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL);
+ int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, nullptr, 0, nullptr, nullptr);
if (conv > (int)memBuf.size())
memBuf.resize(conv);
- conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, (char*)memBuf.c_str(), conv, NULL, NULL);
+ conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, (char*)memBuf.c_str(), conv, nullptr, nullptr);
return conv;
}
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 9378fab352..460fcddac0 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -30,9 +30,9 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true); std::wstring GetName(const std::wstring &path);
HistoryEventList::HistoryEventList() :
- m_hWnd(NULL),
+ m_hWnd(nullptr),
m_isWnd(false),
- m_hContact(NULL),
+ m_hContact(0),
m_deltaTime(0),
m_isFlat(false),
m_useImportedMessages(true)
@@ -42,7 +42,7 @@ HistoryEventList::HistoryEventList() : }
HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter) :
- m_hWnd(NULL),
+ m_hWnd(nullptr),
m_isWnd(false),
m_hContact(_hContact),
m_deltaTime(0),
@@ -242,7 +242,7 @@ void HistoryEventList::RefreshEventList() if (it != m_contactFileMap.end()) {
ExportManager imp(m_hWnd, m_hContact, 1);
imp.SetAutoImport(it->second.file);
- if (!imp.Import(it->second.type, messages, NULL))
+ if (!imp.Import(it->second.type, messages, nullptr))
messages.clear();
}
}
@@ -310,7 +310,7 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, wchar_t *strFind, Comp if (it != m_contactFileMap.end()) {
ExportManager imp(m_hWnd, hContact, 1);
imp.SetAutoImport(it->second.file);
- if (!imp.Import(it->second.type, messages, NULL))
+ if (!imp.Import(it->second.type, messages, nullptr))
messages.clear();
}
}
@@ -364,7 +364,7 @@ void HistoryEventList::AddGroup(const EventIndex& ev) wchar_t eventText[256];
int i;
eventText[0] = 0;
- TimeZone_PrintTimeStamp(NULL, data.timestamp, L"d t", eventText, 64, 0);
+ TimeZone_PrintTimeStamp(nullptr, data.timestamp, L"d t", eventText, 64, 0);
std::wstring time = eventText;
std::wstring user;
if (data.isMe)
@@ -404,9 +404,9 @@ inline std::wstring GetProtocolName(MCONTACT hContact) {
char* ac = Proto_GetBaseAccountName(hContact);
std::wstring proto1;
- if (ac != NULL) {
+ if (ac != nullptr) {
PROTOACCOUNT* acnt = Proto_GetAccount(ac);
- if (acnt != NULL && acnt->szModuleName != NULL) {
+ if (acnt != nullptr && acnt->szModuleName != nullptr) {
wchar_t* proto = mir_a2u(acnt->szProtoName);
proto1 = proto;
mir_free(proto);
@@ -424,7 +424,7 @@ std::wstring HistoryEventList::GetProtocolName() std::string HistoryEventList::GetBaseProtocol()
{
char* proto = GetContactProto(m_hContact);
- return proto == NULL ? "" : proto;
+ return proto == nullptr ? "" : proto;
}
std::wstring HistoryEventList::GetMyId()
@@ -511,9 +511,9 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage> // For now I do not convert event data from string to blob, and event type must be message to handle it properly
dbei.eventType = EVENTTYPE_MESSAGE;
UINT cp = dbei.flags & DBEF_UTF ? CP_UTF8 : CP_ACP;
- dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, NULL, 0, NULL, NULL);
+ dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, nullptr, 0, nullptr, nullptr);
char* buf = new char[dbei.cbBlob];
- dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, NULL, NULL);
+ dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, nullptr, nullptr);
dbei.pBlob = (PBYTE)buf;
db_event_add(m_hContact, &dbei);
delete[] buf;
@@ -564,12 +564,12 @@ void HistoryEventList::GetExtEventDBei(const EventIndex& ev) HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev)
{
if (ev.isExternal)
- return NULL;
+ return nullptr;
HICON ico = DbEvent_GetIcon(&m_dbei, LR_SHARED);
HICON icoMsg = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
if (icoMsg == ico)
- return NULL;
+ return nullptr;
return ico;
}
@@ -614,7 +614,7 @@ void HistoryEventList::Init() m_contactFileDir = temp;
m_contactFileDir += L"BasicHistoryImportDir\\";
DeleteDirectory(m_contactFileDir.c_str());
- CreateDirectory(m_contactFileDir.c_str(), NULL);
+ CreateDirectory(m_contactFileDir.c_str(), nullptr);
}
int HistoryEventList::GetContactMessageNumber(MCONTACT hContact)
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 820abcf64b..111a813ed7 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -90,7 +90,7 @@ std::wstring ReplaceExt(const std::wstring& file, const wchar_t* ext) bool ExportManager::Export(IExport::ExportType type)
{
- m_exp = NULL;
+ m_exp = nullptr;
UINT cp;
std::wstring encoding;
bool isBin = false;
@@ -180,7 +180,7 @@ bool ExportManager::Export(IExport::ExportType type) const wchar_t* ExportManager::GetExt(IImport::ImportType type)
{
- IImport *imp = NULL;
+ IImport *imp = nullptr;
switch (type) {
case IImport::Binary:
imp = new BinaryExport();
@@ -199,7 +199,7 @@ const wchar_t* ExportManager::GetExt(IImport::ImportType type) int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>& contacts)
{
- IImport *imp = NULL;
+ IImport *imp = nullptr;
switch (type) {
case IImport::Binary:
imp = new BinaryExport();
@@ -238,7 +238,7 @@ int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>& bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err, bool* differentContact, std::vector<MCONTACT>* contacts)
{
- IImport *imp = NULL;
+ IImport *imp = nullptr;
switch (type) {
case IImport::Binary:
imp = new BinaryExport();
@@ -269,10 +269,10 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern int contInFile = imp->IsContactInFile(v);
if (contInFile == -1) {
ret = false;
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("File does not contain selected contact");
- if (contacts != NULL && differentContact != NULL) {
+ if (contacts != nullptr && differentContact != nullptr) {
contInFile = imp->IsContactInFile(*contacts);
if (contInFile >= 0) {
*differentContact = true;
@@ -282,12 +282,12 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern }
else if (contInFile == 0 || contInFile == -3) {
ret = imp->GetEventList(eventList);
- if (!ret && err != NULL)
+ if (!ret && err != nullptr)
*err = TranslateT("File is corrupted");
}
else {
ret = false;
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("File is corrupted");
}
stream->close();
@@ -298,7 +298,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int)
{
- if (m_exp == NULL)
+ if (m_exp == nullptr)
return;
m_exp->WriteGroup(isMe, time, user, eventText);
@@ -371,7 +371,7 @@ void ExportManager::DeleteExportedEvents() void ExportManager::SetDeleteWithoutExportEvents(int deltaTime, DWORD now)
{
- m_exp = NULL;
+ m_exp = nullptr;
m_deltaTime = deltaTime;
m_now = now;
RefreshEventList();
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index b12eafe799..f24c7792c3 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -44,22 +44,22 @@ HistoryWindow::HistoryWindow(MCONTACT hContact) : splitterOrgY(0),
splitterX(0),
splitterOrgX(0),
- plusIco(NULL),
- minusIco(NULL),
- findNextIco(NULL),
- findPrevIco(NULL),
- configIco(NULL),
- deleteIco(NULL),
+ plusIco(nullptr),
+ minusIco(nullptr),
+ findNextIco(nullptr),
+ findPrevIco(nullptr),
+ configIco(nullptr),
+ deleteIco(nullptr),
isContactList(false),
isLoading(false),
isGroupImages(false),
allIconNumber(0),
- eventIcons(NULL),
- bkBrush(NULL),
- bkFindBrush(NULL),
+ eventIcons(nullptr),
+ bkBrush(nullptr),
+ bkFindBrush(nullptr),
hSystem(NULL),
- splitterXhWnd(NULL),
- splitterYhWnd(NULL),
+ splitterXhWnd(nullptr),
+ splitterYhWnd(nullptr),
isStartSelect(true)
{
searcher.SetContect(this);
@@ -78,36 +78,36 @@ HistoryWindow::HistoryWindow(MCONTACT hContact) : HistoryWindow::~HistoryWindow()
{
- if (eventIcons != NULL) {
+ if (eventIcons != nullptr) {
for (int i = 0; i < iconsNum; ++i)
- if (eventIcons[i] != NULL)
+ if (eventIcons[i] != nullptr)
IcoLib_ReleaseIcon(eventIcons[i]);
delete[] eventIcons;
}
- if (plusIco != NULL)
+ if (plusIco != nullptr)
IcoLib_ReleaseIcon(plusIco);
- if (minusIco != NULL)
+ if (minusIco != nullptr)
IcoLib_ReleaseIcon(minusIco);
- if (findNextIco != NULL)
+ if (findNextIco != nullptr)
IcoLib_ReleaseIcon(findNextIco);
- if (findPrevIco != NULL)
+ if (findPrevIco != nullptr)
IcoLib_ReleaseIcon(findPrevIco);
- if (himlSmall != NULL)
+ if (himlSmall != nullptr)
ImageList_Destroy(himlSmall);
- if (himlNone != NULL)
+ if (himlNone != nullptr)
ImageList_Destroy(himlNone);
- if (bkBrush != NULL)
+ if (bkBrush != nullptr)
DeleteObject(bkBrush);
- if (bkFindBrush != NULL)
+ if (bkFindBrush != nullptr)
DeleteObject(bkFindBrush);
}
@@ -235,7 +235,7 @@ void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow) void HistoryWindow::Show()
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryWindow::DlgProcHistory, (LPARAM)this);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryWindow::DlgProcHistory, (LPARAM)this);
}
void HistoryWindow::Focus()
@@ -264,10 +264,10 @@ int HistoryWindow::FontsChanged(WPARAM, LPARAM) void HistoryWindow::FontsChanged()
{
- if (bkBrush != NULL)
+ if (bkBrush != nullptr)
DeleteObject(bkBrush);
- if (bkFindBrush != NULL)
+ if (bkFindBrush != nullptr)
DeleteObject(bkFindBrush);
bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground));
@@ -281,8 +281,8 @@ void HistoryWindow::FontsChanged() LOGFONT font;
ListView_SetTextColor(listWindow, Options::instance->GetFont(Options::GroupList, &font));
- InvalidateRect(listWindow, NULL, TRUE);
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(listWindow, nullptr, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
SelectEventGroup(selected);
}
@@ -359,7 +359,7 @@ void HistoryWindow::OptionsSearchingChanged() INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)
{
- HWND hWnd = NULL;
+ HWND hWnd = nullptr;
int count = HistoryEventList::GetContactMessageNumber(hContact);
if (!count)
return FALSE;
@@ -367,7 +367,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) for (auto it = windows.begin(); it != windows.end(); ++it) {
if (!it->second->isDestroyed) {
if (it->second->m_hContact == hContact) {
- if (hWnd == NULL) {
+ if (hWnd == nullptr) {
hWnd = it->second->m_hWnd;
}
else if (GetForegroundWindow() == it->second->m_hWnd) {
@@ -380,7 +380,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
if (!(*it)->isDestroyed) {
if ((*it)->m_hContact == hContact) {
- if (hWnd == NULL)
+ if (hWnd == nullptr)
hWnd = (*it)->m_hWnd;
else if (GetForegroundWindow() == (*it)->m_hWnd)
hWnd = (*it)->m_hWnd;
@@ -535,7 +535,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP DlgReturn(TRUE);
case IDM_CONFIG:
- Options_Open(NULL, LPGENW("History"));
+ Options_Open(nullptr, LPGENW("History"));
DlgReturn(TRUE);
case IDM_DELETE:
@@ -576,7 +576,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP switch (pNmhdr->idFrom) {
case IDC_LIST_CONTACTS:
if (pNmhdr->code == CLN_LISTREBUILT) {
- if (historyWindow != NULL)
+ if (historyWindow != nullptr)
historyWindow->ReloadContacts();
DlgReturn(TRUE);
@@ -646,7 +646,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg);
HMENU hPopupMenu = CreatePopupMenu();
- if (hPopupMenu != NULL) {
+ if (hPopupMenu != nullptr) {
if (chf.dwEffects & CFE_LINK) {
AppendMenu(hPopupMenu, MF_STRING, IDM_OPENNEW, TranslateT("Open in &new window"));
AppendMenu(hPopupMenu, MF_STRING, IDM_OPENEXISTING, TranslateT("&Open in existing window"));
@@ -655,14 +655,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP else {
AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete"));
- AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
+ AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
AppendMenu(hPopupMenu, MF_STRING, IDM_MESSAGE, TranslateT("Send Message"));
AppendMenu(hPopupMenu, MF_STRING, IDM_QUOTE, TranslateT("Reply &Quoted"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
}
- int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, 0);
+ int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, nullptr);
switch (selected) {
case IDM_COPY:
if (chrg.cpMax == chrg.cpMin && historyWindow->currentGroup.size() > 0) {
@@ -831,14 +831,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP if (newSel >= 0) {
HMENU hPopupMenu = CreatePopupMenu();
- if (hPopupMenu != NULL) {
+ if (hPopupMenu != nullptr) {
AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
- AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
+ AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
AppendMenu(hPopupMenu, MF_STRING, IDM_MESSAGE, TranslateT("Send Message"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
- int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, 0);
+ int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, nullptr);
switch (selected) {
case IDM_COPY:
{
@@ -1073,8 +1073,8 @@ void HistoryWindow::Initialise() SetDefFilter(Options::instance->defFilter);
- InvalidateRect(listWindow, NULL, TRUE);
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(listWindow, nullptr, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
SendMessage(m_hWnd, DM_SETDEFID, IDM_FIND, 0);
SendMessage(m_hWnd, WM_SIZE, 0, 0);
SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
@@ -1306,7 +1306,7 @@ void HistoryWindow::SelectEventGroup(int sel) SendMessage(editWindow, EM_SETREADONLY, FALSE, 0);
TextDocument->Freeze(&cnt);
TextDocument->GetSelection(&TextSelection);
- HDC hDC = GetDC(NULL);
+ HDC hDC = GetDC(nullptr);
int caps = GetDeviceCaps(hDC, LOGPIXELSY);
std::deque<EventIndex> revDeq;
std::deque<EventIndex> &deq = m_eventList[sel];
@@ -1338,7 +1338,7 @@ void HistoryWindow::SelectEventGroup(int sel) ico = eventIcons[imId];
else {
ico = GetEventCoreIcon(hDbEvent);
- if (ico == NULL)
+ if (ico == nullptr)
ico = eventIcons[imId];
}
@@ -1429,7 +1429,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM {
HWND hwndParent = GetParent(hwnd);
HistoryWindow *dat = (HistoryWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- if (dat == NULL)
+ if (dat == nullptr)
return FALSE;
switch (msg) {
@@ -1462,7 +1462,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM case WM_LBUTTONUP:
ReleaseCapture();
SendMessage(hwndParent, WM_SIZE, 0, 0);
- RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(hwndParent, nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
return 0;
}
@@ -1497,21 +1497,21 @@ void HistoryWindow::ReloadContacts() }
for (MCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) {
- if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || !db_mc_isSub(_hContact))) {
+ if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == nullptr || !db_mc_isSub(_hContact))) {
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if (hItem == NULL)
+ if (hItem == nullptr)
SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)_hContact, 0);
}
else {
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if (hItem != NULL)
+ if (hItem != nullptr)
SendMessage(contactList, CLM_DELETEITEM, (WPARAM)_hContact, 0);
}
}
if (m_hContact != NULL) {
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, m_hContact, 0);
- if (hItem != NULL) {
+ if (hItem != nullptr) {
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
}
@@ -1656,17 +1656,17 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB) SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
HMENU hPopupMenu = CreatePopupMenu();
- if (hPopupMenu != NULL) {
+ if (hPopupMenu != nullptr) {
AppendMenu(hPopupMenu, MF_STRING, IDM_FINDNEXT, TranslateT("Find Next"));
AppendMenu(hPopupMenu, MF_STRING, IDM_FINDPREV, TranslateT("Find Previous"));
- AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
+ AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
AppendMenu(hPopupMenu, searcher.IsMatchCase() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_MATCHCASE, TranslateT("Match Case"));
AppendMenu(hPopupMenu, searcher.IsMatchWholeWords() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_MATCHWHOLE, TranslateT("Match Whole Word"));
AppendMenu(hPopupMenu, searcher.IsOnlyIn() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYIN, TranslateT("Only Incoming Messages"));
AppendMenu(hPopupMenu, searcher.IsOnlyOut() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYOUT, TranslateT("Only Outgoing Messages"));
AppendMenu(hPopupMenu, searcher.IsOnlyGroup() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYGROUP, TranslateT("Only Selected Group"));
AppendMenu(hPopupMenu, searcher.IsAllUsers() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ALLUSERS, TranslateT("All Contacts"));
- AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
+ AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
HMENU hFilterMenu = CreatePopupMenu();
int filter = GetFilterNr();
AppendMenu(hFilterMenu, filter == 0 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERDEF, TranslateT("Default history events"));
@@ -1684,7 +1684,7 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB) else
SetMenuDefaultItem(hPopupMenu, IDM_FINDNEXT, FALSE);
- int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
+ int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr);
switch (iResult) {
case IDM_FINDNEXT:
searcher.ChangeFindDirection(false);
@@ -1737,12 +1737,12 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB) SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
HMENU hPopupMenu = CreatePopupMenu();
- if (hPopupMenu != NULL) {
+ if (hPopupMenu != nullptr) {
AppendMenu(hPopupMenu, MF_STRING, IDM_OPTIONS, TranslateT("Options"));
AppendMenu(hPopupMenu, MF_STRING, IDM_FONTS, TranslateT("Fonts and colors"));
AppendMenu(hPopupMenu, MF_STRING, IDM_ICONS, TranslateT("Icons"));
AppendMenu(hPopupMenu, MF_STRING, IDM_HOTKEYS, TranslateT("Hotkeys"));
- AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
+ AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
HMENU hExportMenu = CreatePopupMenu();
AppendMenu(hExportMenu, MF_STRING, IDM_EXPORTRHTML, TranslateT("Rich Html"));
@@ -1758,12 +1758,12 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB) AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hExportMenu, TranslateT("Export"));
AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hImportMenu, TranslateT("Import"));
- AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
+ AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOS, TranslateT("Save window position as default"));
AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOSALL, TranslateT("Save window position for all contacts"));
SetMenuDefaultItem(hPopupMenu, IDM_OPTIONS, FALSE);
- int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
+ int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr);
switch (iResult) {
case IDM_OPTIONS:
SendMessage(m_hWnd, WM_COMMAND, IDM_CONFIG, 0);
@@ -1871,13 +1871,13 @@ void HistoryWindow::DeleteToolbarClicked(LPNMTOOLBAR lpnmTB) SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
HMENU hPopupMenu = CreatePopupMenu();
- if (hPopupMenu != NULL) {
+ if (hPopupMenu != nullptr) {
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
SetMenuDefaultItem(hPopupMenu, IDM_DELETE, FALSE);
- int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
+ int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr);
switch (iResult) {
case IDM_DELETE:
Delete(0);
@@ -2016,7 +2016,7 @@ void HistoryWindow::FormatQuote(std::wstring "e, const MessageData &md, cons else
quote += m_contactName;
wchar_t str[32];
- TimeZone_PrintTimeStamp(NULL, md.timestamp, L"d t", str, 32, 0);
+ TimeZone_PrintTimeStamp(nullptr, md.timestamp, L"d t", str, 32, 0);
quote += L", ";
quote += str;
quote += L"\n";
@@ -2090,7 +2090,7 @@ void HistoryWindow::SelectContact(MCONTACT hContact) HWND contactList = GetDlgItem(m_hWnd, IDC_LIST_CONTACTS);
if (hContact != NULL) {
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, hContact, 0);
- if (hItem != NULL) {
+ if (hItem != nullptr) {
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
}
diff --git a/plugins/BasicHistory/src/ImageDataObject.cpp b/plugins/BasicHistory/src/ImageDataObject.cpp index d0cbc85843..481c91f8de 100644 --- a/plugins/BasicHistory/src/ImageDataObject.cpp +++ b/plugins/BasicHistory/src/ImageDataObject.cpp @@ -28,15 +28,15 @@ HBITMAP CacheIconToBMP(HICON hIcon, COLORREF backgroundColor, int sizeX, int siz rc.top = rc.left = 0;
rc.right = sizeY;
rc.bottom = sizeX;
- HDC hdc = GetDC(0);
+ HDC hdc = GetDC(nullptr);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, sizeY, sizeX);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
- DrawIconEx(hdcMem, 0, 0, hIcon, sizeY, sizeX, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdcMem, 0, 0, hIcon, sizeY, sizeX, 0, nullptr, DI_NORMAL);
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
DeleteObject(hBkgBrush);
return hBmp;
}
@@ -72,8 +72,8 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) // Initialize a Storage Object
//
- LPLOCKBYTES lpLockBytes = NULL;
- SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
+ LPLOCKBYTES lpLockBytes = nullptr;
+ SCODE sc = ::CreateILockBytesOnHGlobal(nullptr, TRUE, &lpLockBytes);
if (sc != S_OK) {
pOleClientSite->Release();
return false;
@@ -82,7 +82,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) IStorage *pStorage;
sc = ::StgCreateDocfileOnILockBytes(lpLockBytes, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
if (sc != S_OK) {
- lpLockBytes = NULL;
+ lpLockBytes = nullptr;
pOleClientSite->Release();
return false;
}
@@ -90,7 +90,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) //
IOleObject *pOleObject;
pOleObject = pods->GetOleObject(pOleClientSite, pStorage);
- if (pOleObject == NULL) {
+ if (pOleObject == nullptr) {
pStorage->Release();
pOleClientSite->Release();
return false;
@@ -142,11 +142,11 @@ void ImageDataObject::SetBitmap(HBITMAP hBitmap) STGMEDIUM stgm;
stgm.tymed = TYMED_GDI; // Storage medium = HBITMAP handle
stgm.hBitmap = hBitmap;
- stgm.pUnkForRelease = NULL; // Use ReleaseStgMedium
+ stgm.pUnkForRelease = nullptr; // Use ReleaseStgMedium
FORMATETC fm;
fm.cfFormat = CF_BITMAP; // Clipboard format = CF_BITMAP
- fm.ptd = NULL; // Target Device = Screen
+ fm.ptd = nullptr; // Target Device = Screen
fm.dwAspect = DVASPECT_CONTENT; // Level of detail = Full content
fm.lindex = -1; // Index = Not applicaple
fm.tymed = TYMED_GDI; // Storage medium = HBITMAP handle
@@ -160,6 +160,6 @@ IOleObject *ImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStora IOleObject *pOleObject;
SCODE sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, &m_format, pOleClientSite, pStorage, (void **)& pOleObject);
if (sc != S_OK)
- pOleObject = NULL;
+ pOleObject = nullptr;
return pOleObject;
}
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 61b0da8e06..cb54dcad5d 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -207,24 +207,24 @@ static ColorOptionsList g_ColorOptionsList[] = { static HotkeyOptionsList g_HotkeyOptionsList[] = {
{ "basichistory_hot_showall", LPGENW("Open global history"), LPGENW("History"), MS_HISTORY_SHOWCONTACTHISTORY, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'H') | HKF_MIRANDA_LOCAL, 0 },
- { "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), 0, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND },
- { "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), 0, VK_F3, HISTORY_HK_FINDNEXT },
- { "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), 0, VK_F2, HISTORY_HK_FINDPREV },
- { "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHCASE },
- { "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHWHOLE },
- { "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_SHOWCONTACTS },
- { "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYIN },
- { "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYOUT },
- { "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYGROUP },
- { "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_ALLCONTACTS },
- { "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), 0, VK_DELETE, HISTORY_HK_DELETE },
- { "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXRHTML },
- { "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXPHTML },
- { "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), 0, 0, HISTORY_HK_EXTXT },
- { "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), 0, 0, HISTORY_HK_EXBIN },
- { "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), 0, 0, HISTORY_HK_IMPBIN },
- { "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_EXDAT },
- { "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_IMPDAT },
+ { "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND },
+ { "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), nullptr, VK_F3, HISTORY_HK_FINDNEXT },
+ { "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), nullptr, VK_F2, HISTORY_HK_FINDPREV },
+ { "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), nullptr, 0, HISTORY_HK_MATCHCASE },
+ { "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), nullptr, 0, HISTORY_HK_MATCHWHOLE },
+ { "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), nullptr, 0, HISTORY_HK_SHOWCONTACTS },
+ { "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYIN },
+ { "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYOUT },
+ { "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYGROUP },
+ { "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), nullptr, 0, HISTORY_HK_ALLCONTACTS },
+ { "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), nullptr, VK_DELETE, HISTORY_HK_DELETE },
+ { "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXRHTML },
+ { "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXPHTML },
+ { "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXTXT },
+ { "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXBIN },
+ { "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), nullptr, 0, HISTORY_HK_IMPBIN },
+ { "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXDAT },
+ { "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), nullptr, 0, HISTORY_HK_IMPDAT },
};
const int g_fontsSize = _countof(g_FontOptionsList);
@@ -237,7 +237,7 @@ void Options::Load(void) {
FontIDW fid = { 0 };
ColourIDW cid = { 0 };
- HOTKEYDESC hid = { 0 };
+ HOTKEYDESC hid = {};
fid.cbSize = sizeof(FontIDW);
cid.cbSize = sizeof(ColourIDW);
strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE);
@@ -335,7 +335,7 @@ void Options::Load(void) while (eventsV.pszVal[k]) {
if (eventsV.pszVal[k] == ';') {
eventsV.pszVal[k] = 0;
- fo.events.push_back(strtol(id, NULL, 16));
+ fo.events.push_back(strtol(id, nullptr, 16));
id = eventsV.pszVal + k + 1;
}
@@ -729,7 +729,7 @@ int GetEventCB(HWND hwndCB, bool errorReport, int &eventId) if (selCpIdx < 0) {
wchar_t text[24];
ComboBox_GetText(hwndCB, text, 24);
- wchar_t * stopOn = NULL;
+ wchar_t * stopOn = nullptr;
long cp = wcstol(text, &stopOn, 10);
if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0)) {
MessageBox(GetParent(hwndCB), TranslateT("Invalid event number"), TranslateT("Error"), MB_OK | MB_ICONERROR);
@@ -1300,7 +1300,7 @@ unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int, const st name = str.substr(pos + 1);
}
- wchar_t * stopOn = NULL;
+ wchar_t * stopOn = nullptr;
long cp = wcstol(text, &stopOn, 10);
if ((pos >= str.length() || name.empty() || stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) {
if (errorReport) {
@@ -1569,7 +1569,7 @@ void SaveList(HWND hwnd, MCONTACT hSystem, TaskOptions* to) }
}
-bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL);
+bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr);
#ifndef LOCALE_SSHORTTIME
#define LOCALE_SSHORTTIME 0x00000079
@@ -1808,7 +1808,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- toCp.lastExport = time(NULL);
+ toCp.lastExport = time(nullptr);
*to = toCp;
EndDialog(hwndDlg, IDOK);
diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp index 1f00085b7a..b3eb92f664 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.cpp +++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp @@ -25,7 +25,7 @@ PlainHtmlExport::~PlainHtmlExport() {
}
-extern std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = NULL);
+extern std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = nullptr);
extern std::wstring UrlHighlightHtml(const std::wstring& message, bool& isUrl);
void PlainHtmlExport::WriteHeader(const std::wstring&, const std::wstring &filterName, const std::wstring &myName, const std::wstring &myId, const std::wstring &name1, const std::wstring &proto1, const std::wstring &id1, const std::string&, const std::wstring& encoding)
diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 125aa51a5d..68ab4257b9 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -29,7 +29,7 @@ RichHtmlExport::~RichHtmlExport() extern HINSTANCE hInst;
extern bool g_SmileyAddAvail;
-std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = NULL)
+std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = nullptr)
{
std::wstring ret;
std::wstring search = L"&<>\t\r\n";
@@ -57,7 +57,7 @@ std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<si }
start = find + 1;
- if (positionMap != NULL) {
+ if (positionMap != nullptr) {
size_t len = ret.length() - start - currentAdd;
if (len != 0) {
positionMap->push(std::pair<size_t, size_t>(start + currentAdd, len));
@@ -123,12 +123,12 @@ std::wstring GetName(const std::wstring &path) void ExtractFile(short int iRes, const std::wstring &fileName)
{
HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(iRes), MAKEINTRESOURCE(CUSTOMRES));
- if (rSrc != NULL) {
+ if (rSrc != nullptr) {
HGLOBAL res = LoadResource(hInst, rSrc);
int size = SizeofResource(hInst, rSrc);
- if (res != NULL) {
+ if (res != nullptr) {
char* resData = (char*)LockResource(res);
- if (resData != NULL) {
+ if (resData != nullptr) {
std::ofstream stream(fileName.c_str(), std::ios_base::binary);
if (stream.is_open()) {
stream.write(resData, size);
@@ -196,13 +196,13 @@ void IcoSave(const std::wstring &fileName, HICON hicon) MYBITMAPINFO info1 = { 0 };
MYBITMAPINFO info2 = { 0 };
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
info1.bmiHeader.biSize = sizeof(info1.bmiHeader);
info1.bmiHeader.biWidth = bmiColor.bmWidth;
info1.bmiHeader.biHeight = bmiColor.bmHeight;
info1.bmiHeader.biPlanes = 1;
info1.bmiHeader.biBitCount = bmiColor.bmBitsPixel;
- unsigned int size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, NULL, (BITMAPINFO*)&info1, DIB_RGB_COLORS);
+ unsigned int size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, nullptr, (BITMAPINFO*)&info1, DIB_RGB_COLORS);
char* bits1 = new char[info1.bmiHeader.biSizeImage];
size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, bits1, (BITMAPINFO*)&info1, DIB_RGB_COLORS);
info2.bmiHeader.biSize = sizeof(info2.bmiHeader);
@@ -210,7 +210,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon) info2.bmiHeader.biHeight = bmiMask.bmHeight;
info2.bmiHeader.biPlanes = 1;
info2.bmiHeader.biBitCount = bmiMask.bmBitsPixel;
- size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, NULL, (BITMAPINFO*)&info2, DIB_RGB_COLORS);
+ size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, nullptr, (BITMAPINFO*)&info2, DIB_RGB_COLORS);
char* bits2 = new char[info2.bmiHeader.biSizeImage];
size = GetDIBits(hDC, hbmMask, 0, info2.bmiHeader.biHeight, bits2, (BITMAPINFO*)&info2, DIB_RGB_COLORS);
@@ -263,18 +263,18 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true) pszFrom[len + 1] = 0;
SHFILEOPSTRUCT fileop;
- fileop.hwnd = NULL; // no status display
+ fileop.hwnd = nullptr; // no status display
fileop.wFunc = FO_DELETE; // delete operation
fileop.pFrom = pszFrom; // source file name as double null terminated string
- fileop.pTo = NULL; // no destination needed
+ fileop.pTo = nullptr; // no destination needed
fileop.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; // do not prompt the user
if (!noRecycleBin)
fileop.fFlags |= FOF_ALLOWUNDO;
fileop.fAnyOperationsAborted = FALSE;
- fileop.lpszProgressTitle = NULL;
- fileop.hNameMappings = NULL;
+ fileop.lpszProgressTitle = nullptr;
+ fileop.hNameMappings = nullptr;
int ret = SHFileOperation(&fileop);
delete[] pszFrom;
@@ -287,7 +287,7 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin folder = RemoveExt(fileName) + L"_files";
folderName = GetName(folder);
DeleteDirectory(folder.c_str());
- CreateDirectory(folder.c_str(), NULL);
+ CreateDirectory(folder.c_str(), nullptr);
std::wstring css = folder + L"\\history.css";
BOOL cssCopied = FALSE;
if (!Options::instance->extCssHtml2.empty())
@@ -410,14 +410,14 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg, SMADD_BATCHPARSE2 sp = { 0 };
SMADD_BATCHPARSERES *spr;
sp.cbSize = sizeof(sp);
- sp.Protocolname = baseProto.length() == 0 ? NULL : baseProto.c_str();
+ sp.Protocolname = baseProto.length() == 0 ? nullptr : baseProto.c_str();
sp.str = msgbuf;
sp.flag = SAFL_TCHAR | SAFL_PATH | (isMe ? SAFL_OUTGOING : 0);
spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
delete[] msgbuf;
// Did not find a simley
- if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND)
+ if (spr == nullptr || (INT_PTR)spr == CALLSERVICE_NOTFOUND)
return UrlHighlightHtml(MakeTextHtmled(msg), isUrl);
std::queue<std::pair<size_t, size_t> > positionMap;
@@ -457,7 +457,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg, size_t size = endChar - startChar;
- if (spr[i].filepath != NULL) { // For deffective smileypacks
+ if (spr[i].filepath != nullptr) { // For deffective smileypacks
// Add text
if (startChar - last_pos > 0) {
smileyMsg += newMsg.substr(last_pos, startChar - last_pos);
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index f0adc1f203..2601eeacfa 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern HANDLE g_hMainThread;
bool bPopupsEnabled;
bool DoTask(TaskOptions& to);
-bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL);
+bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr);
std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, std::map<std::wstring, bool>& existingContacts, bool replaceContact);
std::wstring GetDirectoryName(const std::wstring &path);
std::wstring GetName(const std::wstring &path);
@@ -37,7 +37,7 @@ time_t GetNextExportTime(TaskOptions& to); void SchedulerThreadFunc(void*);
volatile bool finishThread = false;
bool initTask = false;
-HANDLE hThread = NULL;
+HANDLE hThread = nullptr;
HANDLE hThreadEvent;
time_t nextExportTime;
void StartThread(bool init);
@@ -99,15 +99,15 @@ int DoLastTask(WPARAM, LPARAM) bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err, std::wstring* errDescr)
{
if (to.taskName.empty()) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Name");
return false;
}
- if (top != NULL) {
+ if (top != nullptr) {
for (std::list<TaskOptions>::iterator it = top->begin(); it != top->end(); ++it) {
if (it->taskName == to.taskName) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Name");
return false;
}
@@ -115,9 +115,9 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err }
if (!to.isSystem && to.contacts.size() == 0) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Contacts");
- if (errDescr != NULL)
+ if (errDescr != nullptr)
*errDescr = TranslateT("At least one contact should be selected.");
return false;
}
@@ -135,7 +135,7 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err }
if (filter < 2) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Filter");
return false;
}
@@ -143,7 +143,7 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err to.filterId = filter;
}
else if (to.filterId < 0) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Filter");
return false;
}
@@ -153,63 +153,63 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err return true;
if (!Options::FTPAvail() && to.useFtp) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Upload to FTP");
return false;
}
if (to.filePath.empty()) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Path to output file");
return false;
}
if (to.useFtp && to.ftpName.empty()) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Session name");
- if (errDescr != NULL)
+ if (errDescr != nullptr)
*errDescr = TranslateT("To create session open WinSCP, click New Session, enter data and save with specific name. Remember if FTP server using password you should save it in WinSCP.");
return false;
}
if (to.useFtp && (to.filePath.find('\\') < to.filePath.length() || to.filePath.find(':') < to.filePath.length() || to.filePath[0] != L'/')) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Path to file");
- if (errDescr != NULL)
+ if (errDescr != nullptr)
*errDescr = TranslateT("FTP path must contain '/' instead '\\' and start with '/'.");
return false;
}
if (isImportTask && to.filePath.find(L"<date>") < to.filePath.length()) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Path to file");
- if (errDescr != NULL)
+ if (errDescr != nullptr)
*errDescr = TranslateT("FTP path cannot contain <date> in import task.");
return false;
}
if (!isImportTask && (to.exportType < IExport::RichHtml || to.exportType > IExport::Dat)) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Export to");
return false;
}
if (isImportTask && (to.importType < IImport::Binary || to.importType > IImport::Dat)) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Import from");
return false;
}
if ((to.trigerType == TaskOptions::Daily || to.trigerType == TaskOptions::Weekly || to.trigerType == TaskOptions::Monthly) && (to.dayTime < 0 || to.dayTime >= 24 * 60)) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Time");
return false;
}
if (to.trigerType == TaskOptions::Weekly && (to.dayOfWeek < 0 || to.dayOfWeek >= 7)) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Day of week");
return false;
}
if (to.trigerType == TaskOptions::Monthly && (to.dayOfMonth <= 0 || to.dayOfMonth >= 32)) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Day");
return false;
}
if ((to.trigerType == TaskOptions::DeltaMin || to.trigerType == TaskOptions::DeltaHour) && (to.deltaTime < 0 || to.deltaTime >= 10000)) {
- if (err != NULL)
+ if (err != nullptr)
*err = TranslateT("Delta time");
return false;
}
@@ -231,7 +231,7 @@ bool DoTask(TaskOptions& to) {
std::wstring err;
std::wstring errDescr;
- if (!IsValidTask(to, NULL, &err, &errDescr)) {
+ if (!IsValidTask(to, nullptr, &err, &errDescr)) {
wchar_t msg[256];
if (err.empty())
wcscpy_s(msg, TranslateT("Some value is invalid"));
@@ -244,7 +244,7 @@ bool DoTask(TaskOptions& to) return true;
}
- DWORD now = time(NULL);
+ DWORD now = time(nullptr);
long long int t = to.eventDeltaTime * 60;
if (to.eventUnit > TaskOptions::Minute)
t *= 60LL;
@@ -260,20 +260,20 @@ bool DoTask(TaskOptions& to) std::list<ExportManager*> managers;
if (to.type == TaskOptions::Delete) {
if (to.isSystem) {
- ExportManager *exp = new ExportManager(NULL, NULL, to.filterId);
+ ExportManager *exp = new ExportManager(nullptr, NULL, to.filterId);
exp->SetDeleteWithoutExportEvents(t, now);
managers.push_back(exp);
}
for (size_t i = 0; i < to.contacts.size(); ++i) {
- ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId);
+ ExportManager *exp = new ExportManager(nullptr, to.contacts[i], to.filterId);
exp->SetDeleteWithoutExportEvents(t, now);
managers.push_back(exp);
}
}
else if (to.type == TaskOptions::Import || to.type == TaskOptions::ImportAndMarge) {
std::map<std::wstring, bool> existingContacts1;
- ExportManager mExp = ExportManager(NULL, NULL, 1);
+ ExportManager mExp = ExportManager(nullptr, NULL, 1);
std::wstring filePath = to.filePath;
std::wstring dir;
std::list<std::wstring> files;
@@ -292,7 +292,7 @@ bool DoTask(TaskOptions& to) dir = dir.substr(0, pos);
DeleteDirectory(dir.c_str());
- CreateDirectory(dir.c_str(), NULL);
+ CreateDirectory(dir.c_str(), nullptr);
}
const wchar_t* ext = ExportManager::GetExt(to.importType);
@@ -384,7 +384,7 @@ bool DoTask(TaskOptions& to) }
else {
std::vector<IImport::ExternalMessage> messages;
- if (mExp.Import(to.importType, messages, NULL)) {
+ if (mExp.Import(to.importType, messages, nullptr)) {
mExp.MargeMessages(messages);
contactList.push_back(mExp.m_hContact);
}
@@ -430,7 +430,7 @@ bool DoTask(TaskOptions& to) if (!to.useFtp && !to.compress) {
dir = GetDirectoryName(filePath);
if (!dir.empty())
- CreateDirectory(dir.c_str(), NULL);
+ CreateDirectory(dir.c_str(), nullptr);
}
else {
filePath = GetName(filePath);
@@ -446,11 +446,11 @@ bool DoTask(TaskOptions& to) dir = dir.substr(0, pos);
DeleteDirectory(dir.c_str());
- CreateDirectory(dir.c_str(), NULL);
+ CreateDirectory(dir.c_str(), nullptr);
filePath = dir + L"\\" + filePath;
}
if (to.isSystem) {
- ExportManager *exp = new ExportManager(NULL, NULL, to.filterId);
+ ExportManager *exp = new ExportManager(nullptr, NULL, to.filterId);
exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now);
exp->m_useImportedMessages = to.exportImported;
if (!exp->Export(to.exportType)) {
@@ -472,7 +472,7 @@ bool DoTask(TaskOptions& to) if (!error) {
for (size_t i = 0; i < to.contacts.size(); ++i) {
- ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId);
+ ExportManager *exp = new ExportManager(nullptr, to.contacts[i], to.filterId);
exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now);
exp->m_useImportedMessages = to.exportImported;
if (!exp->Export(to.exportType)) {
@@ -503,7 +503,7 @@ bool DoTask(TaskOptions& to) if (!to.useFtp) {
zipDir = GetDirectoryName(zipFilePath);
if (!zipDir.empty())
- CreateDirectory(zipDir.c_str(), NULL);
+ CreateDirectory(zipDir.c_str(), nullptr);
}
else {
zipFilePath = GetName(zipFilePath);
@@ -514,7 +514,7 @@ bool DoTask(TaskOptions& to) zipDir += L"zip<date>";
zipDir = GetFileName(zipDir, L"", existingContacts, true);
DeleteDirectory(zipDir.c_str());
- CreateDirectory(zipDir.c_str(), NULL);
+ CreateDirectory(zipDir.c_str(), nullptr);
zipFilePath = zipDir + L"\\" + zipFilePath;
}
error = ZipFiles(dir + L"\\", zipFilePath, to.zipPassword);
@@ -715,7 +715,7 @@ void SchedulerThreadFunc(void*) while (!finishThread) {
DWORD timeWait;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
while (nextExportTime <= now)
if (!ExecuteCurrentTask(now))
return;
@@ -732,25 +732,25 @@ void StartThread(bool init) StopThread();
initTask = false;
- bool isExport = GetNextExportTime(init, time(NULL));
+ bool isExport = GetNextExportTime(init, time(nullptr));
if (isExport) {
finishThread = false;
- hThreadEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- hThread = mir_forkthread(SchedulerThreadFunc, NULL);
+ hThreadEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ hThread = mir_forkthread(SchedulerThreadFunc, nullptr);
}
}
void StopThread()
{
- if (hThread == NULL)
+ if (hThread == nullptr)
return;
finishThread = true;
SetEvent(hThreadEvent);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThreadEvent);
- hThread = NULL;
- hThreadEvent = NULL;
+ hThread = nullptr;
+ hThreadEvent = nullptr;
}
bool GetNextExportTime(bool init, time_t now)
@@ -791,7 +791,7 @@ bool GetNextExportTime(bool init, time_t now) static void CALLBACK DoTaskFinishInMainAPCFunc(ULONG_PTR dwParam)
{
wchar_t *item = (wchar_t*)dwParam;
- MessageBox(NULL, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION);
delete[] item;
}
@@ -803,7 +803,7 @@ bool ExecuteCurrentTask(time_t now) mir_cslock lck(Options::instance->criticalSection);
for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
if (it->forceExecute) {
- it->lastExport = time(NULL);
+ it->lastExport = time(nullptr);
Options::instance->SaveTaskTime(*it);
to = *it;
isExport = true;
@@ -812,7 +812,7 @@ bool ExecuteCurrentTask(time_t now) else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) {
time_t t = GetNextExportTime(*it);
if (t <= now) {
- it->lastExport = time(NULL);
+ it->lastExport = time(nullptr);
Options::instance->SaveTaskTime(*it);
to = *it;
isExport = true;
@@ -869,11 +869,11 @@ bool GetFileCrc(const wchar_t *filenameinzip, unsigned char *buf, unsigned long, {
unsigned long calculate_crc = 0;
bool error = true;
- HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD readed;
do {
- if (!ReadFile(hFile, buf, 1024, &readed, NULL)) {
+ if (!ReadFile(hFile, buf, 1024, &readed, nullptr)) {
error = false;
break;
}
@@ -900,8 +900,8 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri fill_win32_filefunc(&pzlib_filefunc_def);
zipFilePath = GetFileName(zipFilePath, L"", existingContacts, true);
zipFilePath = ReplaceExt(zipFilePath, L"zip");
- zipFile zf = zipOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), APPEND_STATUS_CREATE, NULL, &pzlib_filefunc_def);
- if (zf != NULL) {
+ zipFile zf = zipOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), APPEND_STATUS_CREATE, nullptr, &pzlib_filefunc_def);
+ if (zf != nullptr) {
unsigned char buf[1024];
char bufF[MAX_PATH + 20];
while (files.size() > 0) {
@@ -915,15 +915,15 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri }
BOOL badChar;
- WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, &badChar);
+ WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, nullptr, &badChar);
int flag = 0;
if (badChar) {
flag = 0x800; // UTF
- WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, nullptr, nullptr);
}
unsigned long calculate_crc = 0;
- const char* passwordCh = NULL;
+ const char* passwordCh = nullptr;
if (password.size() > 0) {
if (!GetFileCrc(localDir.c_str(), buf, 1024, &calculate_crc)) {
error = true;
@@ -933,15 +933,15 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri passwordCh = password.c_str();
}
- int err = zipOpenNewFileInZip4_64(zf, bufF, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0,
+ int err = zipOpenNewFileInZip4_64(zf, bufF, &zi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, passwordCh, calculate_crc, 0, flag, 0);
if (err == ZIP_OK) {
- HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD readed;
do {
err = ZIP_OK;
- if (!ReadFile(hFile, buf, 1024, &readed, NULL)) {
+ if (!ReadFile(hFile, buf, 1024, &readed, nullptr)) {
error = true;
break;
}
@@ -965,7 +965,7 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri files.pop_front();
}
- zipClose(zf, NULL);
+ zipClose(zf, nullptr);
}
else error = true;
}
@@ -984,14 +984,14 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s zipFilePath = GetFileName(zipFilePath, L"", existingContacts, true);
zipFilePath = ReplaceExt(zipFilePath, L"zip");
unzFile zf = unzOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), &pzlib_filefunc_def);
- if (zf == NULL)
+ if (zf == nullptr)
return true;
char buf[8192];
char bufF[MAX_PATH + 20];
unz_file_info file_info;
do {
- int err = unzGetCurrentFileInfo(zf, &file_info, bufF, MAX_PATH + 20, buf, 8192, NULL, 0);
+ int err = unzGetCurrentFileInfo(zf, &file_info, bufF, MAX_PATH + 20, buf, 8192, nullptr, 0);
if (err == UNZ_OK) {
UINT cp = CP_OEMCP;
if (file_info.flag & 0x800)// UTF
@@ -1019,7 +1019,7 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s }
int sizeC = (int)mir_strlen(bufF);
- int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, NULL, 0);
+ int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, nullptr, 0);
fileNameInZip.resize(sizeW);
MultiByteToWideChar(cp, 0, bufF, sizeC, (wchar_t*)fileNameInZip.c_str(), sizeW);
fileNameInZip = dir + L"\\" + fileNameInZip;
@@ -1030,14 +1030,14 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s if (file_info.external_fa & FILE_ATTRIBUTE_DIRECTORY)
CreatePath(fileNameInZip.c_str());
else {
- const char* passwordCh = NULL;
+ const char* passwordCh = nullptr;
if (password.size() > 0)
passwordCh = password.c_str();
err = unzOpenCurrentFilePassword(zf, passwordCh);
if (err == UNZ_OK) {
CreatePath(GetDirectoryName(fileNameInZip).c_str());
- HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
+ HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD writed;
for (;;) {
@@ -1116,7 +1116,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: stream.close();
std::wstring &log = Options::instance->ftpLogPath;
- CreateDirectory(GetDirectoryName(log).c_str(), NULL);
+ CreateDirectory(GetDirectoryName(log).c_str(), nullptr);
DeleteFile(log.c_str());
wchar_t cmdLine[MAX_PATH];
@@ -1126,7 +1126,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: startupInfo.cb = sizeof(STARTUPINFO);
PROCESS_INFORMATION processInfo;
- if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) {
+ if (CreateProcess(nullptr, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, dir.c_str(), &startupInfo, &processInfo)) {
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hThread);
CloseHandle(processInfo.hProcess);
@@ -1208,14 +1208,14 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files, stream.close();
std::wstring &log = Options::instance->ftpLogPath;
- CreateDirectory(GetDirectoryName(log).c_str(), NULL);
+ CreateDirectory(GetDirectoryName(log).c_str(), nullptr);
DeleteFile(log.c_str());
wchar_t cmdLine[MAX_PATH];
mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str());
STARTUPINFO startupInfo = { 0 };
PROCESS_INFORMATION processInfo;
startupInfo.cb = sizeof(STARTUPINFO);
- if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) {
+ if (CreateProcess(nullptr, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, dir.c_str(), &startupInfo, &processInfo)) {
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hThread);
CloseHandle(processInfo.hProcess);
@@ -1246,14 +1246,14 @@ void CreatePath(const wchar_t *szDir) return;
pszLastBackslash = wcsrchr(szTestDir, '\\');
- if (pszLastBackslash == NULL)
+ if (pszLastBackslash == nullptr)
return;
*pszLastBackslash = '\0';
CreatePath(szTestDir);
*pszLastBackslash = '\\';
- CreateDirectory(szTestDir, NULL);
+ CreateDirectory(szTestDir, nullptr);
}
INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM)
@@ -1283,13 +1283,13 @@ void DoError(const TaskOptions& to, const std::wstring _error) DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
dbei.flags = DBEF_UTF | DBEF_READ;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
// For now I do not convert event data from string to blob, and event type must be message to handle it properly
dbei.eventType = EVENTTYPE_MESSAGE;
int len = (int)error.length() + 1;
- dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, NULL, 0, NULL, NULL);
+ dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, nullptr, 0, nullptr, nullptr);
char* buf = new char[dbei.cbBlob];
- dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, NULL, NULL);
+ dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, nullptr, nullptr);
dbei.pBlob = (PBYTE)buf;
db_event_add(NULL, &dbei);
}
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index e47007893b..092d927adb 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -27,7 +27,7 @@ Searcher::Searcher() matchWholeWords(false),
onlyIn(false),
onlyOut(false),
- context(NULL)
+ context(nullptr)
{
}
diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp index cfee26fbf0..59ca243b41 100644 --- a/plugins/Boltun/src/Engine/Mind.cpp +++ b/plugins/Boltun/src/Engine/Mind.cpp @@ -102,7 +102,7 @@ void Mind::Load(wstring filename) file.open(filename.c_str(), ios_base::in | ios_base::binary);
wstring s1, st;
- wchar_t *c, *co = NULL;
+ wchar_t *c, *co = nullptr;
size_t count;
int error = 0;
int line = 1;
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index f45a362dd8..ea9b89d215 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -37,7 +37,7 @@ typedef struct _QueueElement { ActionHandler Handler;
bool Sticky;
int TimeOffset;
- _QueueElement(MCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = NULL, bool sticky = false)
+ _QueueElement(MCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = nullptr, bool sticky = false)
:hContact(contact), Handler(handler), TimeOffset(timeOffset), inf(info), Sticky(sticky)
{
}
@@ -66,9 +66,9 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) void UpdateTimer()
{
if (timerID)
- KillTimer(NULL, timerID);
+ KillTimer(nullptr, timerID);
if (actionQueue.size())
- timerID = SetTimer(NULL, 0, actionQueue.front().TimeOffset, TimerProc);
+ timerID = SetTimer(nullptr, 0, actionQueue.front().TimeOffset, TimerProc);
else
timerID = 0;
}
@@ -94,7 +94,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info) dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = BOLTUN_NAME;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
db_event_add(hContact, &dbei);
bot->AnswerGiven(hContact, *info);
@@ -148,7 +148,7 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky = if (!actionQueue.empty() && actionQueue.front().hContact == hContact)
{
needTimerRearrange = true;
- KillTimer(NULL, timerID);
+ KillTimer(nullptr, timerID);
}
if (!actionQueue.empty())
{
@@ -184,7 +184,7 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky = if (actionQueue.empty())
needTimerRearrange = true;
if (thinkTime)
- actionQueue.push_back(QueueElement(hContact, StartTyping, thinkTime, NULL, sticky));
+ actionQueue.push_back(QueueElement(hContact, StartTyping, thinkTime, nullptr, sticky));
actionQueue.push_back(QueueElement(hContact, TimerAnswer, waitTime, info, sticky));
if (needTimerRearrange)
UpdateTimer();
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 920d325940..0c9e889d7b 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -22,7 +22,7 @@ int hLangpack;
-TalkBot* bot = NULL;
+TalkBot* bot = nullptr;
#define MAX_WARN_TEXT 1024
#define MAX_MIND_FILE 1024
@@ -80,7 +80,7 @@ wchar_t* GetFullName(const wchar_t *filename) static bool LoadMind(const wchar_t* filename, int &line)
{
wchar_t* fullname = GetFullName(filename);
- HCURSOR newCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT));
+ HCURSOR newCur = LoadCursor(nullptr, MAKEINTRESOURCE(IDC_WAIT));
HCURSOR oldCur = SetCursor(newCur);
#ifdef DEBUG_LOAD_TIME
unsigned __int64 t = __rdtsc();
@@ -207,7 +207,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) return 0;
dbei.pBlob = (PBYTE)malloc(dbei.cbBlob);
- if (dbei.pBlob == NULL)
+ if (dbei.pBlob == nullptr)
return 0;
db_event_get(hDbEvent, &dbei);
@@ -402,7 +402,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (!bTranslated) {
wchar_t message[5000];
mir_snwprintf(message, TranslateW(FAILED_TO_LOAD_BASE), line, c);
- MessageBox(NULL, message, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
+ MessageBox(nullptr, message, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
}
break;
@@ -508,14 +508,14 @@ static int MessagePrebuild(WPARAM hContact, LPARAM) }
else {
if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
- Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
+ Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
else
- Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
+ Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE))
- Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
+ Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
else
- Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
+ Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
}
return 0;
}
@@ -559,7 +559,7 @@ extern "C" int __declspec(dllexport) Load(void) SET_UID(mi, 0x9e0117f3, 0xb7df, 0x4f1b, 0xae, 0xec, 0xc4, 0x72, 0x59, 0x72, 0xc8, 0x58);
mi.flags = CMIF_NOTOFFLINE;
mi.position = -50010000; //TODO: check the warning
- mi.hIcolibItem = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RECVMSG));
+ mi.hIcolibItem = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_RECVMSG));
mi.name.a = BOLTUN_START_CHATTING;
mi.pszService = SERV_CONTACT_START_CHATTING;
hMenuItemStartChatting = Menu_AddContactMenuItem(&mi);
@@ -570,7 +570,7 @@ extern "C" int __declspec(dllexport) Load(void) if (!blInit) {
wchar_t path[2000];
mir_snwprintf(path, TranslateW(FAILED_TO_LOAD_BASE), line, (const wchar_t*)Config.MindFileName);
- MessageBox(NULL, path, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
+ MessageBox(nullptr, path, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
return 0;
}
@@ -578,7 +578,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
if (pTimer)
- KillTimer(NULL, pTimer);
+ KillTimer(nullptr, pTimer);
if (blInit) {
#if 0 //No need to save, we don't have studying algorithm
if (Config.MindFileName && !SaveMind(Config.MindFileName)) {
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index df57ea1998..9d7df65878 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -75,7 +75,7 @@ static BOOL IsAeroMode() INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static DWORD dwOldIcon = 0;
- HICON hIcon = 0;
+ HICON hIcon = nullptr;
UINT uid;
switch (uMsg){
@@ -91,13 +91,13 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam SetWindowLongPtr(hDlg, GWL_EXSTYLE, GetWindowLongPtr(hDlg, GWL_EXSTYLE) | WS_EX_TOOLWINDOW);
RECT rect;
GetClientRect(hDlg, &rect);
- SetWindowPos(hDlg, 0, 0, 0, rect.right, rect.bottom + GetSystemMetrics(SM_CYCAPTION), SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
+ SetWindowPos(hDlg, nullptr, 0, 0, rect.right, rect.bottom + GetSystemMetrics(SM_CYCAPTION), SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
}
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)hIcon);
TranslateDialogDefault(hDlg);
- oldLangID = 0;
- SetTimer(hDlg, 1, 200, NULL);
+ oldLangID = nullptr;
+ SetTimer(hDlg, 1, 200, nullptr);
oldLayout = GetKeyboardLayout(0);
if (MAKELCID(LOWORD(oldLayout) & 0xffffffff, SORT_DEFAULT) != (LCID)0x00000409)
@@ -240,7 +240,7 @@ static int BackAllProtoStatuses(void) if (oldStatusMsg[i])
{
mir_free(oldStatusMsg[i]);
- oldStatusMsg[i] = 0;
+ oldStatusMsg[i] = nullptr;
}
oldStatus[i] = 0;
}
@@ -320,7 +320,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara DBVARIANT dbVar;
if (g_wMask & OPT_USEDEFMSG || db_get_ws(NULL, MOD_NAME, "statmsg", &dbVar))
{
- wchar_t *ptszDefMsg = GetDefStatusMsg(uMode, 0);
+ wchar_t *ptszDefMsg = GetDefStatusMsg(uMode, nullptr);
ChangeAllProtoStatuses(uMode, ptszDefMsg);
mir_free(ptszDefMsg);
}
@@ -328,7 +328,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara {
if (ServiceExists(MS_VARS_FORMATSTRING))
{
- wchar_t *ptszParsed = variables_parse(dbVar.ptszVal, 0, 0);
+ wchar_t *ptszParsed = variables_parse(dbVar.ptszVal, nullptr, 0);
ChangeAllProtoStatuses(uMode, ptszParsed);
mir_free(ptszParsed);
}
@@ -391,7 +391,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara BackAllProtoStatuses();
HWND_ITEM *pCurWnd = g_pMirWnds;
- while (pCurWnd != NULL)
+ while (pCurWnd != nullptr)
{
HWND_ITEM *pNextWnd = pCurWnd->next;
wchar_t szTemp[32];
@@ -403,12 +403,12 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara delete pCurWnd; // bye-bye
pCurWnd = pNextWnd; // traverse to next item
}
- g_pMirWnds = NULL;
+ g_pMirWnds = nullptr;
if (hOldForegroundWindow)
{
SetForegroundWindow(hOldForegroundWindow);
- hOldForegroundWindow = NULL;
+ hOldForegroundWindow = nullptr;
}
RestoreOldSettings();
@@ -420,7 +420,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara // force a redraw
// should prevent drawing problems
- InvalidateRect(pcli->hwndContactList, NULL, true);
+ InvalidateRect(pcli->hwndContactList, nullptr, true);
UpdateWindow(pcli->hwndContactList);
PostMessage(hWnd, WM_MOUSEMOVE, 0, (LPARAM)MAKELONG(2, 2)); // reset core's IDLE
@@ -544,12 +544,12 @@ void BossKeyMenuItemInit(void) // Add menu item void BossKeyMenuItemUnInit(void) // Remove menu item
{
Menu_RemoveItem(g_hMenuItem);
- g_hMenuItem = 0;
+ g_hMenuItem = nullptr;
}
void RegisterCoreHotKeys(void)
{
- HOTKEYDESC hotkey = { 0 };
+ HOTKEYDESC hotkey = {};
hotkey.pszName = "Hide/Show Miranda";
hotkey.szDescription.a = LPGEN("Hide/Show Miranda");
hotkey.szSection.a = "BossKey";
@@ -561,7 +561,7 @@ void RegisterCoreHotKeys(void) static int TopToolbarInit(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.pszService = MS_BOSSKEY_HIDE;
ttb.pszTooltipUp = ttb.name = LPGEN("Hide Miranda NG");
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
@@ -596,9 +596,9 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM) static wchar_t* VariablesBossKey(ARGUMENTSINFO *ai)
{
if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
+ return nullptr;
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
return GetBossKeyText();
@@ -616,7 +616,7 @@ static int EnumProtos(WPARAM, LPARAM) for (int i = 0; i < protoCount; i++)
{
oldStatus[i] = 0;
- oldStatusMsg[i] = 0;
+ oldStatusMsg[i] = nullptr;
}
return 0;
}
@@ -627,7 +627,7 @@ int MirandaLoaded(WPARAM, LPARAM) RegisterCoreHotKeys();
- g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, NULL, WinEventProc, GetCurrentProcessId(), 0, 0);
+ g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, nullptr, WinEventProc, GetCurrentProcessId(), 0, 0);
HookEvent(ME_TTB_MODULELOADED, TopToolbarInit);
HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
@@ -647,7 +647,7 @@ int MirandaLoaded(WPARAM, LPARAM) if (RegisterClass(&winclass))
{
- g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, NULL, g_hInstance, NULL);
+ g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, nullptr, g_hInstance, nullptr);
WTSRegisterSessionNotification(g_hListenWindow, 0);
}
@@ -717,7 +717,7 @@ extern "C" int __declspec(dllexport) Unload(void) {
UninitIdleTimer();
- if (g_hWinHook != 0)
+ if (g_hWinHook != nullptr)
UnhookWinEvent(g_hWinHook);
if (g_hListenWindow)
@@ -731,7 +731,7 @@ extern "C" int __declspec(dllexport) Unload(void) // free all sessions
HWND_ITEM *pTemp = g_pMirWnds;
- while (pTemp != NULL)
+ while (pTemp != nullptr)
{
HWND_ITEM *pNext = pTemp->next;
delete pTemp;
diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index 5c319ced6d..2bcb7fc61a 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -55,10 +55,10 @@ VOID CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD) void InitIdleTimer()
{
minutes = db_get_b(NULL, MOD_NAME, "time", 10);
- hTimer = SetTimer(NULL, 0, 2000, IdleTimer);
+ hTimer = SetTimer(nullptr, 0, 2000, IdleTimer);
}
void UninitIdleTimer()
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
}
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index 1c9bce5ce4..3ce73335eb 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -115,7 +115,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam BYTE bSelection = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0);
WORD wMode = STATUS_ARR_TO_ID[bSelection];
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_USEDEFMSG) == BST_CHECKED) {
- wchar_t *ptszDefMsg = GetDefStatusMsg(wMode, 0);
+ wchar_t *ptszDefMsg = GetDefStatusMsg(wMode, nullptr);
SetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, ptszDefMsg);
if (ptszDefMsg)
mir_free(ptszDefMsg);
@@ -179,7 +179,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam return true;
case IDC_MAINOPT_VARHELP:
- variables_showhelp(hwndDlg, IDC_MAINOPT_STATMSG, VHF_INPUT | VHF_HELP, 0, 0);
+ variables_showhelp(hwndDlg, IDC_MAINOPT_STATMSG, VHF_INPUT | VHF_HELP, nullptr, nullptr);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
return true;
@@ -246,11 +246,11 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_RESTORE) == BST_CHECKED) wMaskAdv |= OPT_RESTORE;
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_MENUITEM) == BST_CHECKED) {
- if (g_hMenuItem == 0)
+ if (g_hMenuItem == nullptr)
BossKeyMenuItemInit();
wMaskAdv |= OPT_MENUITEM;
}
- else if (g_hMenuItem != 0)
+ else if (g_hMenuItem != nullptr)
BossKeyMenuItemUnInit();
wchar_t szMinutes[4] = { 0 };
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 0814711a6e..d8b1ef3749 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -74,7 +74,7 @@ time_t getLastSeen(MCONTACT hContact) void setLastSeen(MCONTACT hContact)
{
- db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(nullptr));
if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
}
@@ -214,7 +214,7 @@ bool isContactGoneFor(MCONTACT hContact, int days) {
time_t lastSeen = getLastSeen(hContact);
time_t lastInputMsg = getLastInputMsg(hContact);
- time_t currentTime = time(NULL);
+ time_t currentTime = time(nullptr);
int daysSinceOnline = -1;
if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen) / (60 * 60 * 24));
@@ -271,7 +271,7 @@ void ReturnNotify(MCONTACT hContact, wchar_t *message) ppd.colorText = options.iPopupColorFore;
}
ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = options.iPopupDelay;
PUAddPopupT(&ppd);
}
@@ -308,7 +308,7 @@ void GoneNotify(MCONTACT hContact, wchar_t *message) ppd.colorText = options.iPopupColorFore;
}
ppd.PluginWindowProc = PopupDlgProcNoSet;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = options.iPopupDelay;
PUAddPopupT(&ppd);
@@ -463,7 +463,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0;
char *proto = GetContactProto(hContact);
- if (proto == 0 || (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
+ if (proto == nullptr || (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
|| !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 0;
@@ -491,7 +491,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) ppd.colorText = options.iPopupColorFore;
}
ppd.PluginWindowProc = MissYouPopupDlgProc;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = -1;
missyouactions[0].flags = PAF_ENABLED;
@@ -579,7 +579,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) int ModulesLoaded2(WPARAM, LPARAM)
{
// check for 'still absent' contacts on startup
- TimerProc(0, 0, 0, 0);
+ TimerProc(nullptr, 0, 0, 0);
return 0;
}
@@ -597,7 +597,7 @@ int ModulesLoaded(WPARAM, LPARAM) Skin_AddSound("buddyExpectatorMissYou", LPGENW("BuddyExpectator"), LPGENW("Miss you event"));
Skin_AddSound("buddyExpectatorHide", LPGENW("BuddyExpectator"), LPGENW("Hide contact event"));
- timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+ timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2);
@@ -641,7 +641,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) int ContactAdded(WPARAM hContact, LPARAM)
{
- db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(0));
+ db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(nullptr));
return 0;
}
@@ -671,7 +671,7 @@ extern "C" int __declspec(dllexport) Load(void) // ensure all contacts are timestamped
DBVARIANT dbv;
- DWORD current_time = (DWORD)time(0);
+ DWORD current_time = (DWORD)time(nullptr);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (!db_get(hContact, MODULE_NAME, "CreationTime", &dbv))
@@ -693,7 +693,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- KillTimer(0, timer_id);
+ KillTimer(nullptr, timer_id);
return 0;
}
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 158e328583..d431c5af96 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -203,7 +203,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (nmhdr->code) {
case PSN_APPLY:
//iAbsencePeriod
- int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, 0, FALSE);
+ int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, nullptr, FALSE);
switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD, CB_GETCURSEL, 0, 0)) {
case 1: options.iAbsencePeriod = 7 * num; break;
case 2: options.iAbsencePeriod = 30 * num; break;
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, }
//iAbsencePeriod2
- num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, 0, FALSE);
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, nullptr, FALSE);
switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD2, CB_GETCURSEL, 0, 0)) {
case 1: options.iAbsencePeriod2 = 7 * num; break;
case 2: options.iAbsencePeriod2 = 30 * num; break;
@@ -221,7 +221,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, }
//iSilencePeriod
- num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, 0, FALSE);
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, nullptr, FALSE);
switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD3, CB_GETCURSEL, 0, 0)) {
case 1: options.iSilencePeriod = 7 * num; break;
case 2: options.iSilencePeriod = 30 * num; break;
@@ -251,9 +251,9 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
// restart timer & run check
- KillTimer(0, timer_id);
- timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
- TimerProc(0, 0, 0, 0);
+ KillTimer(nullptr, timer_id);
+ timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+ TimerProc(nullptr, 0, 0, 0);
return TRUE;
}
break;
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP memset(&ppd, 0, sizeof(ppd));
//iPopupDelay
- options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, nullptr, FALSE);
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERM) == BST_CHECKED)
options.iPopupDelay = -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED)
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
}
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = options.iPopupDelay;
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NO_HISTORY);
@@ -409,7 +409,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP }
//iPopupDelay
- options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, nullptr, FALSE);
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERM) == BST_CHECKED)
options.iPopupDelay = -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED)
@@ -502,7 +502,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lparam)->lParam;
if (hContact)
{
- db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE));
+ db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, nullptr, FALSE));
db_set_b(hContact, MODULE_NAME, "MissYou", (IsDlgButtonChecked(hdlg, IDC_CHECK_MISSYOU) == BST_CHECKED) ? 1 : 0);
db_set_b(hContact, MODULE_NAME, "MissYouNotifyAlways", (IsDlgButtonChecked(hdlg, IDC_CHECK_NOTIFYALWAYS) == BST_CHECKED) ? 1 : 0);
db_set_b(hContact, MODULE_NAME, "NeverHide", (IsDlgButtonChecked(hdlg, IDC_CHECK_NEVERHIDE) == BST_CHECKED) ? 1 : 0);
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index ed2d9f0a85..024d51f8ad 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -105,12 +105,12 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (!mir_wstrcmp(type, L"Any")) {
if (LOWORD(wParam) == IDOK)
db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", flag);
- wi->SendIfMy = 0;
+ wi->SendIfMy = nullptr;
}
else {
if (LOWORD(wParam) == IDOK)
db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", flag);
- wi->SendWhenThey = 0;
+ wi->SendWhenThey = nullptr;
}
DestroyWindow(hwnd);
}
@@ -129,7 +129,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta return;
}
else {
- hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), 0, StatusModesDlgProc, (LPARAM)wi);
+ hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), nullptr, StatusModesDlgProc, (LPARAM)wi);
statusFlag = db_get_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", 0);
SetWindowText(hwnd, TranslateT("Send If My Status Is"));
SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("Any"));
@@ -150,7 +150,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta return;
}
else {
- hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),0,StatusModesDlgProc, (LPARAM)wi);
+ hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),nullptr,StatusModesDlgProc, (LPARAM)wi);
statusFlag = db_get_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", 0);
SetWindowText(hwnd, TranslateT("Send If Their Status changes"));
SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("From Offline"));
@@ -231,7 +231,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L // fall through
case IDCANCEL:
if (LOWORD(wParam) == IDC_ADVANCED)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), 0, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
DestroyWindow(hwnd);
}
break;
@@ -253,8 +253,8 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM DestroyWindow(hwnd);
}
wi->hContact = lParam;
- wi->SendIfMy = 0;
- wi->SendWhenThey = 0;
+ wi->SendIfMy = nullptr;
+ wi->SendWhenThey = nullptr;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
@@ -296,7 +296,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM saveLastSetting(hContact, hwnd);
} // fall through
if (LOWORD(wParam) == IDC_SIMPLE)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), 0, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
// fall through
case IDCANCEL:
@@ -385,8 +385,8 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, {
windowInfo *wi = (windowInfo *)mir_alloc(sizeof(windowInfo));
wi->hContact = 0;
- wi->SendIfMy = 0;
- wi->SendWhenThey = 0;
+ wi->SendIfMy = nullptr;
+ wi->SendWhenThey = nullptr;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
@@ -517,7 +517,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP db_free(&dbv);
}
}
- SetTimer(hwnd,1,1000,NULL);
+ SetTimer(hwnd,1,1000,nullptr);
SendMessage(hwnd,WM_TIMER,0,0);
break;
@@ -598,7 +598,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess)
{
- HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, hContact);
+ HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, PounceSentDlgProc, hContact);
wchar_t msg[256];
if (SentSuccess) {
mir_snwprintf(msg, TranslateT("Message successfully sent to %s"), pcli->pfnGetContactDisplayName(hContact, 0));
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index ca460f733b..250e76658f 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -64,7 +64,7 @@ int MsgAck(WPARAM, LPARAM lParam) CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS);
if (ack->result == ACKRESULT_SUCCESS) {
// wrtie it to the DB
- DBEVENTINFO dbei = { 0 };
+ DBEVENTINFO dbei = {};
DBVARIANT dbv;
int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
if (!db_get_ws(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
@@ -72,7 +72,7 @@ int MsgAck(WPARAM, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT;
dbei.szModule = (char*)ack->szModule;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)(char*)pszUtf;
db_event_add(ack->hContact, &dbei);
@@ -133,7 +133,7 @@ int statusCheck(int statusFlag, int status) }
int CheckDate(MCONTACT hContact)
{
- time_t curtime = time (NULL);
+ time_t curtime = time (nullptr);
if(!db_get_b(hContact,modname,"GiveUpDays",0))
return 1;
if(db_get_b(hContact,modname,"GiveUpDays",0) && ( abs((time_t)db_get_dw(hContact,modname,"GiveUpDate",0)) > curtime))
@@ -171,7 +171,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) wchar_t *message = mir_wstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
spdps->hContact = hContact;
spdps->message = message;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, SendPounceDlgProc, (LPARAM)spdps);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, SendPounceDlgProc, (LPARAM)spdps);
// set the confirmation window to send the msg when the timeout is done
mir_free(message);
}
@@ -188,9 +188,9 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM)
{
if (db_get_b(NULL, modname, "UseAdvanced", 0) || db_get_b(hContact, modname, "UseAdvanced", 0))
- CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),0,BuddyPounceDlgProc, hContact);
+ CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),nullptr,BuddyPounceDlgProc, hContact);
else
- CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),0,BuddyPounceSimpleDlgProc, hContact);
+ CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),nullptr,BuddyPounceSimpleDlgProc, hContact);
return 0;
}
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 24621383e2..10cfefe065 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -127,7 +127,7 @@ extern "C" __declspec(dllexport) int Load() wchar_t tszFile[MAX_PATH]; GetModuleFileName(g_hInst, tszFile, MAX_PATH); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.defaultFile.w = tszFile; sid.flags = SIDF_ALL_UNICODE; sid.section.w = MODULENAME; @@ -179,7 +179,7 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) return; PROTOACCOUNT* pdescr = Proto_GetAccount(szAccName); - if (pdescr == NULL) + if (pdescr == nullptr) return; if (!ProtoServiceExists(szAccName, PS_SETCUSTOMSTATUSEX)) @@ -195,10 +195,10 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) ics.ptszName = L""; ics.ptszMessage = L""; } - else if (code == IDOK && item != NULL) { + else if (code == IDOK && item != nullptr) { statusToSet = item->m_iIcon + 1; - ics.ptszName = variables_parsedup(item->m_tszTitle, NULL, NULL); - ics.ptszMessage = variables_parsedup(item->m_tszMessage, NULL, NULL); + ics.ptszName = variables_parsedup(item->m_tszTitle, nullptr, NULL); + ics.ptszMessage = variables_parsedup(item->m_tszMessage, nullptr, NULL); } else return; @@ -218,18 +218,18 @@ INT_PTR showList(WPARAM, LPARAM, LPARAM param) } } - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CSLIST), NULL, CSWindowProc, (LPARAM)new CSWindow(szProto)); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CSLIST), nullptr, CSWindowProc, (LPARAM)new CSWindow(szProto)); return 0; } void addProtoStatusMenuItem(char *protoName) { PROTOACCOUNT *pdescr = Proto_GetAccount(protoName); - if (pdescr == NULL || pdescr->ppro == NULL) + if (pdescr == nullptr || pdescr->ppro == nullptr) return; HGENMENU hRoot = Menu_GetProtocolRoot(pdescr->ppro); - if (hRoot == NULL) + if (hRoot == nullptr) return; char buf[200]; @@ -294,13 +294,13 @@ void importCustomStatuses(CSWindow* csw, int result) CSWindow::CSWindow(char *protoName) { m_protoName = protoName; - m_handle = NULL; + m_handle = nullptr; m_bExtraIcons = getByte("AllowExtraIcons", DEFAULT_ALLOW_EXTRA_ICONS); m_itemslist = new CSItemsList(m_protoName); - m_listview = NULL; - m_addModifyDlg = NULL; + m_listview = nullptr; + m_addModifyDlg = nullptr; m_bSomethingChanged = FALSE; - m_filterString = NULL; + m_filterString = nullptr; } void __fastcall SAFE_FREE(void** p) @@ -308,7 +308,7 @@ void __fastcall SAFE_FREE(void** p) if (*p) { free(*p); - *p = NULL; + *p = nullptr; } } @@ -321,11 +321,11 @@ CSWindow::~CSWindow() void CSWindow::initIcons() { PROTOACCOUNT *pdescr = Proto_GetAccount(m_protoName); - if (pdescr == NULL) + if (pdescr == nullptr) return; char *szUniqueID = (char*)CallProtoService(m_protoName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (szUniqueID == NULL) + if (szUniqueID == nullptr) return; DBVARIANT dbv; @@ -341,7 +341,7 @@ void CSWindow::initIcons() return; m_statusCount = (int)iNumStatuses; - if (NULL == (m_icons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, m_statusCount, 0))) + if (nullptr == (m_icons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, m_statusCount, 0))) return; for (int i = 1; i <= m_statusCount; i++) { @@ -448,7 +448,7 @@ CSAMWindow::CSAMWindow(WORD action, CSWindow* parent) m_action = action; m_parent = parent; m_bChanged = FALSE; - m_hCombo = m_hMessage = NULL; + m_hCombo = m_hMessage = nullptr; if (m_action == IDC_ADD) m_item = new StatusItem(); @@ -464,18 +464,18 @@ CSAMWindow::~CSAMWindow() void CSAMWindow::exec() { - DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ADDMODIFY), NULL, CSAMWindowProc, (LPARAM)this); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ADDMODIFY), nullptr, CSAMWindowProc, (LPARAM)this); } void CSAMWindow::setCombo() { PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName); - if (pdescr == NULL) + if (pdescr == nullptr) return; char *szUniqueID = (char*)CallProtoService(pdescr->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (szUniqueID == NULL) + if (szUniqueID == nullptr) return; DBVARIANT dbv; @@ -567,7 +567,7 @@ void CSAMWindow::checkItemValidity() GetDlgItemText(m_handle, IDC_MESSAGE, tszInputMessage, _countof(tszInputMessage)); PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName); - if (pdescr == NULL) + if (pdescr == nullptr) return; WPARAM i = SendMessage(m_hCombo, CB_GETCURSEL, 0, 0) + 1; @@ -648,7 +648,7 @@ void CSListView::addItem(StatusItem* item, int itemNumber) void CSListView::initItems(ListItem< StatusItem >* items) { ListItem< StatusItem >* help = items; - for (int i = 0; help != NULL; help = help->m_next, i++) + for (int i = 0; help != nullptr; help = help->m_next, i++) if (m_parent->itemPassedFilter(help)) addItem(help->m_item, i); } @@ -922,7 +922,7 @@ INT_PTR CALLBACK CSWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa if (LOWORD(wparam) == IDOK && csw->toggleButtons()) SetStatus(IDOK, csw->m_itemslist->m_list->get(csw->m_listview->getPositionInList()), csw->m_protoName); if (LOWORD(wparam) == IDC_CANCEL) - SetStatus(IDC_CANCEL, NULL, csw->m_protoName); + SetStatus(IDC_CANCEL, nullptr, csw->m_protoName); if (csw->m_bSomethingChanged) csw->m_itemslist->saveItems(csw->m_protoName); csw->saveWindowPosition(csw->m_handle); diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index f281d863b4..0ec26cf5f8 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -126,7 +126,7 @@ int ModulesLoaded(WPARAM, LPARAM) Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
// Õóê íà íàæàòèå êëàâèøè
- kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId());
+ kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
CreateServiceFunction(MS_CKL_CHANGELAYOUT, APIChangeLayout);
CreateServiceFunction(MS_CKL_GETLAYOUTOFTEXT, APIGetLayoutOfText);
@@ -174,15 +174,15 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam) // Ïðîâåðêà íà ïóñòîé õîòêåé. Èíà÷å - ïèçäåö, êàê â âåðñèè 1.4
if (lcode != 0) {
if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam & 0x40000000))) {
- ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout);
+ ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout);
return 1;
}
if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam & 0x40000000))) {
- ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout2);
+ ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout2);
return 1;
}
if ((lcode == moOptions.dwHotkey_Case) && (!(lParam & 0x40000000))) {
- ChangeLayout(NULL, TOT_Case, moOptions.CurrentWordCase);
+ ChangeLayout(nullptr, TOT_Case, moOptions.CurrentWordCase);
return 1;
}
}
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 27540781fe..b91115217a 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -224,7 +224,7 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP SetDlgItemText(hWnd, IDC_EDIT_EXAMPLE, ptszMemLay);
UnhookWindowsHookEx(kbHook_All);
- kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId());
+ kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
}
}
break;
@@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, case IDC_EDIT_TIMEOUT:
if (HIWORD(wParam) == EN_CHANGE) {
- dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, NULL, FALSE);
+ dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, nullptr, FALSE);
if (dwTimeOut>255)
poOptionsTemp.bTimeout = 255;
else
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 7df6916a89..90967c017e 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -2,7 +2,7 @@ struct EditStreamData
{
- EditStreamData() { pbBuff = 0; cbBuff = iCurrent = 0; }
+ EditStreamData() { pbBuff = nullptr; cbBuff = iCurrent = 0; }
~EditStreamData() { free(pbBuff); }
PBYTE pbBuff;
@@ -48,7 +48,7 @@ LPTSTR GeTStringFromStreamData(EditStreamData *esd) BOOL CopyTextToClipboard(LPTSTR ptszText)
{
- if (!OpenClipboard(NULL))
+ if (!OpenClipboard(nullptr))
return FALSE;
EmptyClipboard();
@@ -85,7 +85,7 @@ HKL GetNextLayout(HKL hklCurLay) if (hklLayouts[i] == hklCurLay)
return hklLayouts[(i+1)%(bLayNum)];
- return NULL;
+ return nullptr;
}
LPTSTR GenerateLayoutString(HKL hklLayout)
@@ -133,7 +133,7 @@ LPTSTR GetLayoutString(HKL hklLayout) for (DWORD i = 0; i < bLayNum; i++)
if (hklLayouts[i] == hklLayout)
return ptszLayStrings[i];
- return NULL;
+ return nullptr;
}
LPTSTR ChangeTextCase(LPCTSTR ptszInText)
@@ -154,12 +154,12 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
mir_wstrcpy(ptszOutText, ptszInText);
- if (hklCurLay == NULL || hklToLay == NULL)
+ if (hklCurLay == nullptr || hklToLay == nullptr)
return ptszOutText;
LPTSTR ptszKeybCur = GetLayoutString(hklCurLay);
LPTSTR ptszKeybNext = GetLayoutString(hklToLay);
- if (ptszKeybCur == 0 || ptszKeybNext == 0)
+ if (ptszKeybCur == nullptr || ptszKeybNext == nullptr)
return ptszOutText;
for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) {
@@ -189,7 +189,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) DWORD dwMaxSymbols = 0, dwTemp = 0;
for (DWORD j = 0; j < mir_wstrlen(ptszInText); j++)
- if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL)
+ if (wcschr(ptszKeybBuff, ptszInText[j]) != nullptr)
++dwMaxSymbols;
for (DWORD i = 1; i < bLayNum; i++) {
@@ -197,7 +197,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) DWORD dwCountSymbols = 0;
for (DWORD j = 0; j<mir_wstrlen(ptszInText); j++)
- if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL)
+ if (wcschr(ptszKeybBuff, ptszInText[j]) != nullptr)
++dwCountSymbols;
if (dwCountSymbols == dwMaxSymbols)
@@ -216,7 +216,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
{
- HKL hklCurLay = 0, hklToLay = 0;
+ HKL hklCurLay = nullptr, hklToLay = nullptr;
ptrW ptszInText;
CHARRANGE crSelection = { 0 }, crTemp = { 0 };
@@ -226,10 +226,10 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) BYTE WindowType = WTYPE_Unknown;
BOOL WindowIsReadOnly, TwoWay;
- if (hTextWnd == NULL)
+ if (hTextWnd == nullptr)
hTextWnd = GetFocus();
- if (hTextWnd == NULL)
+ if (hTextWnd == nullptr)
return 0;
//--------------Îïðåäåëÿåì òèï îêíà-----------------
@@ -260,7 +260,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) i = GetClassName(hTextWnd, ptszTemp, 255);
ptszTemp[i] = 0;
- if (wcsstr(CharUpper(ptszTemp), L"RICHEDIT") != NULL) {
+ if (wcsstr(CharUpper(ptszTemp), L"RICHEDIT") != nullptr) {
WindowType = WTYPE_RichEdit;
SendMessage(hTextWnd, EM_EXGETSEL, 0, (LPARAM)&crSelection);
}
@@ -292,7 +292,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -307,7 +307,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -329,7 +329,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -344,14 +344,14 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
// Ïîëó÷àåì òåêóùåå ñëîâî
if (CurrentWord) {
- for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--);
- for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++);
+ for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == nullptr); dwStartWord--);
+ for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == nullptr); dwEndWord++);
crTemp.cpMin = dwStartWord;
crTemp.cpMax = dwEndWord;
@@ -368,7 +368,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -382,7 +382,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (mir_wstrlen(ptszInText) == 0) {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -432,7 +432,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if ((WindowType == WTYPE_Edit) || (WindowType == WTYPE_RichEdit)) {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
}
if (TextOperation == TOT_Layout)
@@ -488,7 +488,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pdtData, APF_NEWDATA) < 0) {
mir_free(ptszPopupText);
- MessageBox(NULL, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
+ MessageBox(nullptr, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
}
}
}
@@ -519,7 +519,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
// Ïåðåêëþ÷èì ðàñêëàäêó èëè èçìåíèì ñîñòîÿíèå Caps Lock
- if (TextOperation == TOT_Layout && hklToLay != NULL && moOptions.ChangeSystemLayout)
+ if (TextOperation == TOT_Layout && hklToLay != nullptr && moOptions.ChangeSystemLayout)
ActivateKeyboardLayout(hklToLay, KLF_SETFORPROCESS);
else if (TextOperation == TOT_Case) {
// Åñëè íóæíî èíâåðòíóòü
@@ -537,7 +537,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
if (TextOperation == TOT_Layout)
Skin_PlaySound(SND_ChangeLayout);
diff --git a/plugins/ClientChangeNotify/src/CString.cpp b/plugins/ClientChangeNotify/src/CString.cpp index edee2fe0e6..2ed5f49062 100644 --- a/plugins/ClientChangeNotify/src/CString.cpp +++ b/plugins/ClientChangeNotify/src/CString.cpp @@ -39,7 +39,7 @@ void TString<T>::Free() {
// HeapFree(GetProcessHeap(), 0, pBuf);
free(pBuf);
- pBuf = NULL;
+ pBuf = nullptr;
nBufSize = 0;
nAllocSize = 0;
}
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index cca57b1975..05a4423f30 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -70,12 +70,12 @@ static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) // wParam = hContact
{
POINT pt;
- HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MOD_NAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInstance, NULL);
+ HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MOD_NAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr);
SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc);
HMENU hMenu = Menu_BuildContactMenu(wParam);
GetCursorPos(&pt);
SetForegroundWindow(hMenuWnd);
- Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, NULL), MPCF_CONTACTMENU, wParam);
+ Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, nullptr), MPCF_CONTACTMENU, wParam);
PostMessage(hMenuWnd, WM_NULL, 0, 0);
DestroyMenu(hMenu);
DestroyWindow(hMenuWnd);
@@ -166,7 +166,7 @@ void ShowPopup(SHOWPOPUP_DATA *sd) if (!ppd.lchIcon || (INT_PTR)ppd.lchIcon == CALLSERVICE_NOTFOUND) {
// if we didn't succeed retrieving client icon, show the usual status icon instead
ppd.lchIcon = Skin_LoadProtoIcon(szProto, db_get_w(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE));
- pdata->hIcon = NULL;
+ pdata->hIcon = nullptr;
}
wcsncpy(ppd.lptzContactName, (wchar_t*)pcli->pfnGetContactDisplayName(sd->hContact, 0), _countof(ppd.lptzContactName) - 1);
wcsncpy(ppd.lptzText, PopupText, _countof(ppd.lptzText) - 1);
@@ -344,7 +344,7 @@ int MirandaLoaded(WPARAM, LPARAM) // seems that Fingerprint is not installed
if (!bFingerprintExists && !db_get_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
- CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc);
+ CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), nullptr, CCNErrorDlgProc);
return 0;
}
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 80e1f117e0..21761ed59e 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -21,7 +21,7 @@ // ================================================ Popup options ================================================
-COptPage g_PopupOptPage(MOD_NAME, NULL);
+COptPage g_PopupOptPage(MOD_NAME, nullptr);
void EnablePopupOptDlgControls()
{
@@ -53,7 +53,7 @@ void EnablePopupOptDlgControls() }
SetDlgItemText(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_STATIC_REGEXP, TranslateT("(you can use regular expressions here)"));
g_PopupOptPage.MemToPage(true);
- InvalidateRect(GetDlgItem(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_POPUPDELAY_SPIN), NULL, false); // update spin control
+ InvalidateRect(GetDlgItem(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_POPUPDELAY_SPIN), nullptr, false); // update spin control
}
static struct
@@ -125,13 +125,13 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_POPUPOPTDLG_POPUPPREVIEW:
g_PreviewOptPage = new COptPage(g_PopupOptPage);
g_PreviewOptPage->PageToMem();
- DBCONTACTWRITESETTING cws = { 0 };
+ DBCONTACTWRITESETTING cws = {};
cws.szModule = "ICQ";
cws.szSetting = DB_MIRVER;
db_set_s(NULL, MOD_NAME, DB_OLDMIRVER, "ICQ Lite v5");
ContactSettingChanged(NULL, (LPARAM)&cws); // simulate a version change
delete g_PreviewOptPage;
- g_PreviewOptPage = NULL;
+ g_PreviewOptPage = nullptr;
break;
}
break;
@@ -152,7 +152,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case WM_DESTROY:
- g_PopupOptPage.SetWnd(NULL);
+ g_PopupOptPage.SetWnd(nullptr);
return 0;
}
return 0;
@@ -161,7 +161,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int OptionsDlgInit(WPARAM wParam, LPARAM)
{
if (bPopupExists) {
- OPTIONSDIALOGPAGE optDi = { sizeof(optDi) };
+ OPTIONSDIALOGPAGE optDi = {};
optDi.position = 920000000;
optDi.szGroup.a = LPGEN("Popups");
optDi.szTitle.a = LPGEN("ClientChangeNotify");
diff --git a/plugins/ClientChangeNotify/src/Options.cpp b/plugins/ClientChangeNotify/src/Options.cpp index d5647554f3..05660a21f7 100644 --- a/plugins/ClientChangeNotify/src/Options.cpp +++ b/plugins/ClientChangeNotify/src/Options.cpp @@ -98,7 +98,7 @@ COptItem *COptPage::Find(int m_dlgItemID) return Items[i];
_ASSERT(0);
- return 0;
+ return nullptr;
}
COptPage& COptPage::operator = (const COptPage& Page)
@@ -116,7 +116,7 @@ COptPage& COptPage::operator = (const COptPage& Page) int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*)
{ // default procedure for reading value from DB; used only for integral types
- if (sDBSetting != NULL) {
+ if (sDBSetting != nullptr) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
DBVARIANT dbv;
if (db_get(NULL, sModule, sDBSetting, &dbv))
@@ -129,7 +129,7 @@ int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*) void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*)
{ // default procedure for writing value to the DB; used only for integral types
- if (sDBSetting != NULL && !m_bReadOnly) {
+ if (sDBSetting != nullptr && !m_bReadOnly) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
DBVARIANT dbv;
@@ -141,7 +141,7 @@ void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*) TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix)
{
- if (sDBSetting != NULL) {
+ if (sDBSetting != nullptr) {
_ASSERT(GetDefValue());
return db_get_s(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
}
@@ -150,7 +150,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix)
{
- if (sDBSetting != NULL && !m_bReadOnly) {
+ if (sDBSetting != nullptr && !m_bReadOnly) {
db_set_ws(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
}
}
@@ -282,11 +282,11 @@ int TreeReadEnum(const char *szSetting, LPARAM lParam) pItem.ID = ID;
pItem.ParentID = ParentID;
pItem.Flags = Flags;
- pItem.hItem = NULL;
+ pItem.hItem = nullptr;
pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
- pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
+ pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr :
db_get_s(NULL, pData->sModule,
- *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)NULL);
+ *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)nullptr);
}
}
return 0;
@@ -306,7 +306,7 @@ void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi }
else {
for (int i = 0; i < m_value.GetSize(); i++) {
- if (m_value[i].Title == NULL) {
+ if (m_value[i].Title == nullptr) {
m_value.RemoveElem(i);
i--;
}
@@ -334,7 +334,7 @@ void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)
db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags);
- if (User_Str1_DBName != NULL && m_value[i].User_Str1 != NULL)
+ if (User_Str1_DBName != nullptr && m_value[i].User_Str1 != nullptr)
db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
@@ -372,7 +372,7 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd) SetWindowLongPtr(hTreeView, GWL_STYLE, Style | TVS_CHECKBOXES);
}
- TVINSERTSTRUCT tvIn = { 0 };
+ TVINSERTSTRUCT tvIn = {};
int ScrollPos = GetScrollPos(hTreeView, SB_VERT);
int SelectOrder = IDToOrder(GetSelectedItemID(hWnd));
SendMessage(hTreeView, WM_SETREDRAW, false, 0);
@@ -414,7 +414,7 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd) i--;
}
}
- TreeView_SelectItem(hTreeView, (SelectOrder >= 0) ? m_value[SelectOrder].hItem : ((SelectOrder <= TREECTRL_ROOTORDEROFFS) ? RootItems[ROOT_ORDER_TO_INDEX(SelectOrder)].hItem : NULL));
+ TreeView_SelectItem(hTreeView, (SelectOrder >= 0) ? m_value[SelectOrder].hItem : ((SelectOrder <= TREECTRL_ROOTORDEROFFS) ? RootItems[ROOT_ORDER_TO_INDEX(SelectOrder)].hItem : nullptr));
SendMessage(hTreeView, WM_SETREDRAW, true, 0);
SCROLLBARINFO sbi;
sbi.cbSize = sizeof(sbi);
@@ -460,7 +460,7 @@ int TreeDeleteEnum(const char *szSetting, LPARAM lParam) if (!strncmp(szSetting, CurSetting, CurSetting.GetLen()))
TreeDeleteEnumData->TreeSettings.AddElem(szSetting);
- if (TreeDeleteEnumData->TreeCtrl->User_Str1_DBName != NULL) {
+ if (TreeDeleteEnumData->TreeCtrl->User_Str1_DBName != nullptr) {
CurSetting = *TreeDeleteEnumData->sDBSettingPrefix + TreeDeleteEnumData->TreeCtrl->sDBSetting + TreeDeleteEnumData->TreeCtrl->User_Str1_DBName;
if (!strncmp(szSetting, CurSetting, CurSetting.GetLen()))
TreeDeleteEnumData->TreeSettings.AddElem(szSetting);
@@ -524,7 +524,7 @@ CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item) TVITEM tvi;
int SelOrder = -1;
Item.ParentID = RootItems[0].ID;
- TVINSERTSTRUCT tvIn = { 0 };
+ TVINSERTSTRUCT tvIn = {};
tvIn.hParent = RootItems[0].hItem;
tvIn.hInsertAfter = TVI_FIRST;
if (tvi.hItem = TreeView_GetSelection(hTreeView)) {
@@ -668,7 +668,7 @@ void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value = m_defValue;
else {
for (int i = 0; i < m_value.GetSize(); i++) {
- if (m_value[i].Text == NULL) {
+ if (m_value[i].Text == nullptr) {
m_value.RemoveElem(i);
i--;
}
diff --git a/plugins/ClientChangeNotify/src/pcre.cpp b/plugins/ClientChangeNotify/src/pcre.cpp index c7954f265f..d1796cfe81 100644 --- a/plugins/ClientChangeNotify/src/pcre.cpp +++ b/plugins/ClientChangeNotify/src/pcre.cpp @@ -59,7 +59,7 @@ void FreePcreCompileData() TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID)
{
TCString Result(L"");
- sPcreCompileData s = {0};
+ sPcreCompileData s = {};
int NewID = PcreCompileData.AddElem(s);
PcreCompileData[NewID].ID = ID;
if (!bAddAsUsualSubstring)
@@ -119,10 +119,10 @@ TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID) Regexp.ReleaseBuffer();
}
- PcreCompileData[NewID].pPcre = pcre16_compile(Regexp, PCRE_UTF8 | PCRE_NO_UTF8_CHECK | Flags, &Err, &ErrOffs, NULL);
+ PcreCompileData[NewID].pPcre = pcre16_compile(Regexp, PCRE_UTF8 | PCRE_NO_UTF8_CHECK | Flags, &Err, &ErrOffs, nullptr);
if (PcreCompileData[NewID].pPcre) {
- PcreCompileData[NewID].pExtra = NULL;
+ PcreCompileData[NewID].pExtra = nullptr;
PcreCompileData[NewID].pExtra = pcre16_study(PcreCompileData[NewID].pPcre, 0, &Err);
}
else {
@@ -157,7 +157,7 @@ int PcreCheck(TCString Str, int StartingID) if (PcreCompileData[I].pPcre)
{
- int Res = pcre16_exec(PcreCompileData[I].pPcre, PcreCompileData[I].pExtra, Str, Str.GetLen() - 1, 0, PCRE_NOTEMPTY | PCRE_NO_UTF8_CHECK, NULL, 0);
+ int Res = pcre16_exec(PcreCompileData[I].pPcre, PcreCompileData[I].pExtra, Str, Str.GetLen() - 1, 0, PCRE_NOTEMPTY | PCRE_NO_UTF8_CHECK, nullptr, 0);
if (Res >= 0)
{
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 4e726ab299..3721ec3e13 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -88,7 +88,7 @@ static const struct CheckBoxValues_t offlineValues[] = { static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style)
{
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
for (int i = 0; i < nValues; i++) {
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 2da3351ab1..de6c0c2e7c 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -148,7 +148,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE);
int status = GetGeneralisedStatus();
int grey = 0, groupCountsFontTopShift;
- HBRUSH hBrushAlternateGrey = NULL;
+ HBRUSH hBrushAlternateGrey = nullptr;
// yes I know about GetSysColorBrush()
COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
@@ -157,13 +157,13 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS)
grey = 1;
GetClientRect(hwnd, &clRect);
- if (rcPaint == NULL)
+ if (rcPaint == nullptr)
rcPaint = &clRect;
if (IsRectEmpty(rcPaint))
return;
HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
+ HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
{
TEXTMETRIC tm;
@@ -256,7 +256,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (group->scanIndex == group->cl.getCount()) {
group = group->parent;
indent--;
- if (group == NULL)
+ if (group == nullptr)
break;
group->scanIndex++;
continue;
@@ -269,7 +269,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index;
SIZE textSize, countsSize = { 0 }, spaceSize = { 0 };
int width, checkboxWidth;
- wchar_t *szCounts = NULL;
+ wchar_t *szCounts = nullptr;
// alternating grey
if (style & CLS_GREYALTERNATE && index & 1) {
@@ -398,7 +398,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) SetHotTrackColour(hdcMem, dat);
rc.right--;
ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText,
- (int)mir_wstrlen(cc->szText), NULL);
+ (int)mir_wstrlen(cc->szText), nullptr);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index 1eb7292daa..b2866b67e4 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -30,7 +30,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
MCONTACT hContact = (MCONTACT)wParam;
DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL &&
+ if (hContact == NULL && ws != nullptr && ws->szModule != nullptr && ws->szSetting != nullptr &&
strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg))
CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED);
}
@@ -159,7 +159,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0);
- if (pa == NULL)
+ if (pa == nullptr)
db_unset(NULL, "CList", "PrimaryStatus");
else
db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName);
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 1fc8925d6c..3dc4c83b17 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -153,7 +153,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
+ db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
@@ -189,11 +189,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW);
if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) {
- HWND hProgMan = FindWindowA("Progman", NULL);
+ HWND hProgMan = FindWindowA("Progman", nullptr);
if (IsWindow(hProgMan))
SetParent(pcli->hwndContactList, hProgMan);
}
- else SetParent(pcli->hwndContactList, NULL);
+ else SetParent(pcli->hwndContactList, nullptr);
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION))
SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE,
@@ -202,11 +202,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE,
GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX));
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU))
- SetMenu(pcli->hwndContactList, NULL);
+ SetMenu(pcli->hwndContactList, nullptr);
else
SetMenu(pcli->hwndContactList, pcli->hMenuMain);
- SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
- RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+ SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW);
if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
@@ -283,7 +283,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DestroyWindow(pcli->hwndStatus);
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL);
+ pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
ShowWindow(pcli->hwndStatus, SW_SHOW);
diff --git a/plugins/Clist_blind/src/contact.cpp b/plugins/Clist_blind/src/contact.cpp index 4dc6cbf55f..6270630213 100644 --- a/plugins/Clist_blind/src/contact.cpp +++ b/plugins/Clist_blind/src/contact.cpp @@ -63,7 +63,7 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) return 2 * (statusa == ID_STATUS_OFFLINE) - 1;
}
/* both are online, now check protocols */
- if (c1->proto != NULL && c2->proto != NULL) {
+ if (c1->proto != nullptr && c2->proto != nullptr) {
int rc = mir_strcmp(c1->proto, c2->proto);
if (rc != 0)
return rc;
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 011c8574aa..eac2270f0d 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInst = 0;
-CLIST_INTERFACE *pcli = NULL, coreCli;
-HIMAGELIST himlCListClc = NULL;
+HINSTANCE g_hInst = nullptr;
+CLIST_INTERFACE *pcli = nullptr, coreCli;
+HIMAGELIST himlCListClc = nullptr;
LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -189,13 +189,13 @@ wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* set MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, (int)len);
else if (dbv.type == DBVT_WCHAR)
mir_wstrncpy(out, dbv.pwszVal, (int)len);
- else if (def != NULL)
+ else if (def != nullptr)
mir_wstrncpy(out, def, (int)len);
db_free(&dbv);
}
else {
- if (def != NULL)
+ if (def != nullptr)
mir_wstrncpy(out, def, (int)len);
}
@@ -219,7 +219,7 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len) if (len == 0)
return 0;
- if (text == NULL)
+ if (text == nullptr)
return 0;
totalSize = str->used + len + 1;
@@ -227,10 +227,10 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len) if (totalSize > str->allocated) {
totalSize += DATA_BLOCK - (totalSize % DATA_BLOCK);
- if (str->text != NULL) {
+ if (str->text != nullptr) {
wchar_t *tmp = (wchar_t *)mir_realloc(str->text, sizeof(wchar_t) * totalSize);
- if (tmp == NULL) {
+ if (tmp == nullptr) {
mir_free(str->text);
return -1;
}
@@ -240,7 +240,7 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len) else {
str->text = (wchar_t *)mir_alloc(sizeof(wchar_t) * totalSize);
- if (str->text == NULL) {
+ if (str->text == nullptr) {
return -2;
}
}
@@ -262,7 +262,7 @@ wchar_t * ParseText(const wchar_t *text, {
size_t length = mir_wstrlen(text);
size_t nextPos = 0;
- StringHelper ret = { 0 };
+ StringHelper ret = {};
size_t i;
// length - 1 because a % in last char will be a % and point
@@ -271,11 +271,11 @@ wchar_t * ParseText(const wchar_t *text, BOOL found = FALSE;
if (CopyData(&ret, &text[nextPos], i - nextPos))
- return NULL;
+ return nullptr;
if (text[i + 1] == '%') {
if (CopyData(&ret, L"%", 1))
- return NULL;
+ return nullptr;
i++;
@@ -291,7 +291,7 @@ wchar_t * ParseText(const wchar_t *text, if (wcsnicmp(&text[i], variables[j], vlen) == 0) {
if (CopyData(&ret, data[j], mir_wstrlen(data[j])))
- return NULL;
+ return nullptr;
i += vlen - 1;
@@ -311,7 +311,7 @@ wchar_t * ParseText(const wchar_t *text, if (nextPos < length)
if (CopyData(&ret, &text[nextPos], length - nextPos))
- return NULL;
+ return nullptr;
return ret.text;
}
@@ -343,16 +343,16 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->hwnd_list = CreateWindow(L"LISTBOX", L"",
(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_VSCROLL),
- 0, 0, 0, 0, hwnd, NULL, g_hInst, 0);
+ 0, 0, 0, 0, hwnd, nullptr, g_hInst, nullptr);
dat->need_rebuild = FALSE;
GetClientRect(hwnd, &r);
- SetWindowPos(dat->hwnd_list, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
break;
case WM_SIZE:
GetClientRect(hwnd, &r);
- SetWindowPos(dat->hwnd_list, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
break;
case WM_PRINTCLIENT:
@@ -396,7 +396,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
dat->szQuickSearch[0] = 0;
- pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
+ pcli->pfnInvalidateRect(hwnd, nullptr, FALSE);
pcli->pfnEnsureVisible(hwnd, (ClcData*)dat, dat->selection, 0);
UpdateWindow(hwnd);
break;
@@ -416,11 +416,11 @@ wchar_t* GetStatusName(struct ClcContact *item) int status;
status_name[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL)
+ if (item->hContact == NULL || item->proto == nullptr)
return status_name;
// Get XStatusName
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), nullptr);
if (status_name[0] != '\0')
return status_name;
@@ -436,16 +436,16 @@ wchar_t status_message[256]; wchar_t* GetStatusMessage(struct ClcContact *item)
{
status_message[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL)
+ if (item->hContact == NULL || item->proto == nullptr)
return status_message;
// Get XStatusMsg
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), nullptr);
if (status_message[0] != '\0')
return status_message;
// Get status message
- MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), nullptr);
return status_message;
}
@@ -459,13 +459,13 @@ wchar_t* GetProtoName(struct ClcContact *item) #endif
proto_name[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL) {
+ if (item->hContact == NULL || item->proto == nullptr) {
mir_wstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
PROTOACCOUNT *acc = Proto_GetAccount(item->proto);
- if (acc == NULL) {
+ if (acc == nullptr) {
#ifdef UNICODE
CallProtoService(item->proto, PS_GETNAME, sizeof(description), (LPARAM)description);
mir_snwprintf(proto_name, L"%S", description);
@@ -516,7 +516,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) size_t size = _countof(tmp);
while (true) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
text -= 2;
size += 2;
@@ -547,7 +547,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) count[0] = '\0';
wchar_t *txt = ParseText(template_group, t, _countof(t), v, _countof(v));
- if (txt != NULL)
+ if (txt != nullptr)
mir_wstrncpy(text, txt, size);
mir_free(txt);
}
@@ -569,7 +569,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) };
wchar_t *txt = ParseText(template_contact, t, _countof(t), v, _countof(v));
- if (txt != NULL)
+ if (txt != nullptr)
mir_wstrncpy(text, txt, size);
mir_free(txt);
}
@@ -599,7 +599,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) }
SendMessage(dat->hwnd_list, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(dat->hwnd_list, NULL, TRUE);
+ InvalidateRect(dat->hwnd_list, nullptr, TRUE);
dat->selection = selection;
SendMessage(dat->hwnd_list, LB_SETCURSEL, dat->selection, 0);
diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp index e4d223dc9f..f5e130c5e7 100644 --- a/plugins/Clist_modern/src/cluiframes.cpp +++ b/plugins/Clist_modern/src/cluiframes.cpp @@ -68,7 +68,7 @@ static int _iNextFrameId = 100; static HFONT _hTitleBarFont = nullptr;
// menus
-static FrameMenuHandles cont = { nullptr };
+static FrameMenuHandles cont = {};
static LIST<HGENMENU__> g_frameMenus(10);
// others
@@ -163,7 +163,7 @@ int CLUIFrames_RepaintSubContainers() {
for (int i = 0; i < g_nFramesCount; i++) {
FRAMEWND &F = g_pfwFrames[i];
- if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide)
+ if (!F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide)
RedrawWindow(F.hWnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME);
}
@@ -174,7 +174,7 @@ int CLUIFrames_ActivateSubContainers(BOOL active) {
for (int i = 0; i < g_nFramesCount; i++) {
FRAMEWND &F = g_pfwFrames[i];
- if (active && !F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) {
+ if (active && !F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) {
if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) {
SetWindowPos(F.OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
SetWindowPos(F.OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
@@ -191,7 +191,7 @@ int CLUIFrames_SetParentForContainers(HWND parent) for (int i = 0; i < g_nFramesCount; i++) {
FRAMEWND &F = g_pfwFrames[i];
- if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) {
+ if (!F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) {
HWND hwnd = F.OwnerWindow;
SetParent(hwnd, parent);
}
@@ -204,7 +204,7 @@ int CLUIFrames_OnShowHide(int mode) int prevFrameCount;
for (int i = 0; i < g_nFramesCount; i++) {
FRAMEWND &F = g_pfwFrames[i];
- if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2) {
+ if (!F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2) {
// Try to avoid crash on exit due to unlock.
HWND owner = F.OwnerWindow;
HWND Frmhwnd = F.hWnd;
@@ -289,7 +289,7 @@ int QueueAllFramesUpdating(bool queue) if (F.UpdateRgn) {
DeleteObject(F.UpdateRgn);
}
- F.UpdateRgn = 0;
+ F.UpdateRgn = nullptr;
}
}
return queue;
@@ -846,7 +846,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.name.a = LPGEN("&Down");
mi.pszService = CLUIFRAMESMOVEDOWN;
addFrameMenuItem(&mi, frameid, bMain);
- return 0;
+ return nullptr;
}
static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
@@ -1029,7 +1029,7 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) }
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
- SetWindowPos(fw.TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE);
+ SetWindowPos(fw.TitleBar.hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE);
return 0;
case FO_NAME:
@@ -1348,7 +1348,7 @@ static int _us_DoSetFrameBorder(WPARAM wParam, LPARAM lParam) GetWindowRect(hw, &rc);
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags);
- SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME);
+ SetWindowPos(hw, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME);
return 0;
}
@@ -1494,7 +1494,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_SYSTEM | CMIF_UNICODE;
mi.position = separator++;
mi.name.w = F.TitleBar.tbname ? F.TitleBar.tbname : F.name;
- mi.pszService = 0;
+ mi.pszService = nullptr;
g_frameMenus.insert(F.MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi));
CLUIFramesCreateMenuForFrame(F.id, F.MenuHandles.MainMenuItem, separator, true);
CLUIFramesModifyMainMenuItems(F.id, 0);
@@ -1526,7 +1526,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) //char * CustomName = nullptr;
CLISTFrame *clfrm = (CLISTFrame *)wParam;
- if (pcli->hwndContactList == 0) return -1;
+ if (pcli->hwndContactList == nullptr) return -1;
if (_fCluiFramesModuleNotStarted) return -1;
if (clfrm->cbSize != sizeof(CLISTFrame)) return -1;
if (!(_hTitleBarFont)) _hTitleBarFont = CLUILoadTitleBarFont();
@@ -1544,7 +1544,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) if (clfrm->Flags & F_NO_SUBCONTAINER || !g_CluiData.fLayered)
F.OwnerWindow = (HWND)-2;
else
- F.OwnerWindow = 0;
+ F.OwnerWindow = nullptr;
if (db_get_b(0, CLUIFrameModule, "RemoveAllBorders", 0) == 1)
clfrm->Flags |= F_NOBORDER;
@@ -1694,7 +1694,7 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame)
{
- if (Frame->TitleBar.hwnd != 0)
+ if (Frame->TitleBar.hwnd != nullptr)
RedrawWindow(Frame->TitleBar.hwnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
//UpdateWindow(Frame->TitleBar.hwnd);
return 0;
@@ -1702,12 +1702,12 @@ static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame)
{
- if (Frame->hWnd != 0) {
+ if (Frame->hWnd != nullptr) {
RedrawWindow(Frame->hWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE);
UpdateWindow(Frame->hWnd);
}
- if (Frame->floating && Frame->ContainerWnd != 0)
+ if (Frame->floating && Frame->ContainerWnd != nullptr)
RedrawWindow(Frame->ContainerWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
return 0;
}
@@ -2055,7 +2055,7 @@ int CLUIFrames_ApplyNewSizes(int mode) };
}
if (IsWindowVisible(pcli->hwndContactList)) {
- ske_DrawNonFramedObjects(1, 0);
+ ske_DrawNonFramedObjects(1, nullptr);
CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0);
}
g_CluiData.mutexPreventDockMoving = 1;
@@ -2288,8 +2288,8 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) tick = GetTickCount() - tick;
- if (pcli->hwndContactList != 0) cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE);
- if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList);
+ if (pcli->hwndContactList != nullptr) cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE);
+ if (pcli->hwndContactList != nullptr) UpdateWindow(pcli->hwndContactList);
if (lParam == 2) RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE);
@@ -2328,7 +2328,7 @@ int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) sttBackgroundBmpUse = db_get_w(0, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
}
- cliInvalidateRect(pcli->hwndContactList, 0, 0);
+ cliInvalidateRect(pcli->hwndContactList, nullptr, 0);
RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE);
return 0;
@@ -2340,7 +2340,7 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo RECT clRect, *rcPaint;
int yScroll = 0;
- PAINTSTRUCT paintst = { 0 };
+ PAINTSTRUCT paintst = {};
HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
@@ -2559,7 +2559,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam return 1;
case WM_ENABLE:
- if (hwnd != 0)
+ if (hwnd != nullptr)
cliInvalidateRect(hwnd, nullptr, FALSE);
return 0;
@@ -2615,7 +2615,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam AppendMenu(hmenu, g_pfwFrames[framepos].floating ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_floating, TranslateT("Floating"));
}
- TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0);
+ TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(hmenu);
}
break;
@@ -2927,7 +2927,7 @@ static int CLUIFrameResizeFloatingFrame(int framepos) RECT rect;
if (!g_pfwFrames[framepos].floating) { return 0; };
- if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; };
+ if (g_pfwFrames[framepos].ContainerWnd == nullptr) { return 0; };
GetClientRect(g_pfwFrames[framepos].ContainerWnd, &rect);
int width = rect.right - rect.left;
@@ -2951,7 +2951,7 @@ static int CLUIFrameResizeFloatingFrame(int framepos) SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE);
};
- if (g_pfwFrames[framepos].ContainerWnd != 0) UpdateWindow(g_pfwFrames[framepos].ContainerWnd);
+ if (g_pfwFrames[framepos].ContainerWnd != nullptr) UpdateWindow(g_pfwFrames[framepos].ContainerWnd);
GetWindowRect(g_pfwFrames[framepos].hWnd, &g_pfwFrames[framepos].wndSize);
return 0;
};
@@ -2971,7 +2971,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP if (g_bTransparentFlag) {
BYTE alpha;
if ((wParam != WA_INACTIVE || ((HWND)lParam == hwnd) || GetParent((HWND)lParam) == hwnd)) {
- HWND hw = lParam ? GetParent((HWND)lParam) : 0;
+ HWND hw = lParam ? GetParent((HWND)lParam) : nullptr;
alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
if (hw) SetWindowPos(hw, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
CLUI_SmoothAlphaTransition(hwnd, alpha, 1);
@@ -3017,7 +3017,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height)
{
- HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, 0, g_hInst, 0);
+ HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, nullptr, g_hInst, nullptr);
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_BORDER));
if (g_CluiData.fOnDesktop) {
HWND hProgMan = FindWindow(L"Progman", nullptr);
@@ -3045,7 +3045,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid);
if (framepos < 0 || framepos >= g_nFramesCount) { break; };
if (!g_pfwFrames[framepos].minmaxenabled) { break; };
- if (g_pfwFrames[framepos].ContainerWnd == 0) { break; };
+ if (g_pfwFrames[framepos].ContainerWnd == nullptr) { break; };
if (g_pfwFrames[framepos].Locked) {
RECT rct;
@@ -3078,7 +3078,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid);
if (framepos < 0 || framepos >= g_nFramesCount)
break;
- if (g_pfwFrames[framepos].ContainerWnd == 0)
+ if (g_pfwFrames[framepos].ContainerWnd == nullptr)
return 0;
GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect);
@@ -3138,7 +3138,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid);
if (framepos < 0 || framepos >= g_nFramesCount) { break; };
- if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; };
+ if (g_pfwFrames[framepos].ContainerWnd == nullptr) { return 0; };
CLUIFrameResizeFloatingFrame(framepos);
GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect);
@@ -3170,7 +3170,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height)
{
- return CreateWindow(L"FramesContainer", L"FramesContainer", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0);
+ return CreateWindow(L"FramesContainer", L"FramesContainer", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_hInst, nullptr);
}
static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam)
@@ -3183,7 +3183,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) if (g_pfwFrames[pos].floating || (lParam & 2)) {
if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) {
- if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10);
+ if (g_pfwFrames[pos].OwnerWindow == nullptr) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10);
CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE);
SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow);
SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList);
@@ -3191,7 +3191,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) g_pfwFrames[pos].floating = FALSE;
if (!(lParam & 2)) {
DestroyWindow(g_pfwFrames[pos].ContainerWnd);
- g_pfwFrames[pos].ContainerWnd = 0;
+ g_pfwFrames[pos].ContainerWnd = nullptr;
}
}
else {
@@ -3199,7 +3199,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList);
g_pfwFrames[pos].floating = FALSE;
if (g_pfwFrames[pos].ContainerWnd) DestroyWindow(g_pfwFrames[pos].ContainerWnd);
- g_pfwFrames[pos].ContainerWnd = 0;
+ g_pfwFrames[pos].ContainerWnd = nullptr;
}
}
else {
@@ -3222,9 +3222,9 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].ContainerWnd);
SetParent(g_pfwFrames[pos].TitleBar.hwnd, g_pfwFrames[pos].ContainerWnd);
- if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != 0) {
+ if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != nullptr) {
DestroyWindow(g_pfwFrames[pos].OwnerWindow);
- g_pfwFrames[pos].OwnerWindow = 0;
+ g_pfwFrames[pos].OwnerWindow = nullptr;
}
GetBorderSize(g_pfwFrames[pos].ContainerWnd, &border);
@@ -3368,7 +3368,7 @@ int LoadCLUIFramesModule(void) CreateCluiFramesServices();
- hWndExplorerToolBar = FindWindowEx(0, 0, L"Shell_TrayWnd", nullptr);
+ hWndExplorerToolBar = FindWindowEx(nullptr, nullptr, L"Shell_TrayWnd", nullptr);
OnFrameTitleBarBackgroundChange(0, 0);
_fCluiFramesModuleNotStarted = FALSE;
return 0;
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 381136d9d7..1143005d11 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -32,10 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CHECKRES(sub) if (sub != S_OK) return S_FALSE;
-HINSTANCE g_hInst = 0, g_hMirApp = 0;
+HINSTANCE g_hInst = nullptr, g_hMirApp = nullptr;
CLIST_INTERFACE *pcli = nullptr;
CLIST_INTERFACE corecli = { 0 };
-CLUIDATA g_CluiData = { 0 };
+CLUIDATA g_CluiData = {};
int hLangpack;
static HRESULT SubclassClistInterface();
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 8e374b19eb..1cc510b4b5 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -179,7 +179,7 @@ static void _AniAva_AnimationTreadProc(void*) Netlib_Logf(nullptr, "AnimationTreadProc thread start");
// wait forever till hExitEvent signalled
- HANDLE hThread = 0;
+ HANDLE hThread = nullptr;
s_AnimationThreadID = GetCurrentThreadId();
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
s_AnimationThreadHandle = hThread;
@@ -235,7 +235,7 @@ static INT_PTR _AniAva_CreateAvatarWindowSync_Worker(WPARAM tszName, LPARAM) static HWND _AniAva_CreateAvatarWindowSync(wchar_t *szFileName)
{
- if (s_AnimationThreadHandle == 0 || s_AnimationThreadID == 0)
+ if (s_AnimationThreadHandle == nullptr || s_AnimationThreadID == 0)
return nullptr;
ANIAVA_SYNCCALLITEM item = { 0 };
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 7ece765d67..3bb07bcdda 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -90,7 +90,7 @@ static void amThreadProc(void *) ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact);
- HANDLE ACK = 0;
+ HANDLE ACK = nullptr;
if (pdnce->ApparentMode != ID_STATUS_OFFLINE) //don't ask if contact is always invisible (should be done with protocol)
ACK = (HANDLE)ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0);
if (!ACK) {
@@ -152,7 +152,7 @@ void amRequestAwayMsg(MCONTACT hContact) void InitAwayMsgModule()
{
hamProcessEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
- g_hAwayMsgThread = mir_forkthread(amThreadProc, 0);
+ g_hAwayMsgThread = mir_forkthread(amThreadProc, nullptr);
}
void UninitAwayMsgModule()
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 102aed2c9b..3e785d8f18 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -52,7 +52,7 @@ void Cache_GetTimezone(ClcData *dat, MCONTACT hContact) if (dat && dat->hWnd == pcli->hwndContactTree) { DWORD flags = dat->contact_time_show_only_if_different ? TZF_DIFONLY : 0; - pdnce->hTimeZone = TimeZone_CreateByContact(hContact, 0, flags); + pdnce->hTimeZone = TimeZone_CreateByContact(hContact, nullptr, flags); } } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 14aa6ef3be..53e6712c9e 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1198,9 +1198,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group);
int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup);
if (i != -1 && group->groupId != destgroup->groupId) {
- wchar_t *groupName = mir_wstrdup(Clist_GroupGetName(contact->groupId, 0));
+ wchar_t *groupName = mir_wstrdup(Clist_GroupGetName(contact->groupId, nullptr));
wchar_t *shortGroup = nullptr;
- wchar_t *sourceGrName = mir_wstrdup(Clist_GroupGetName(destgroup->groupId, 0));
+ wchar_t *sourceGrName = mir_wstrdup(Clist_GroupGetName(destgroup->groupId, nullptr));
if (groupName) {
int len = (int)mir_wstrlen(groupName);
do { len--; } while (len >= 0 && groupName[len] != '\\');
@@ -1553,7 +1553,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) wchar_t szMyPath[MAX_PATH];
GetModuleFileName(g_hInst, szMyPath, _countof(szMyPath));
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.defaultFile.w = szMyPath;
sid.flags = SIDF_PATH_UNICODE;
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index dde2266bc4..d071c407f0 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -87,7 +87,7 @@ ClcContact* cliFindItem(DWORD dwItem, ClcContact *cc) if (cc->subcontacts[i].hContact == dwItem)
return &cc->subcontacts[i];
- return 0;
+ return nullptr;
}
int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup)
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 1537729272..48ace78fcf 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -254,7 +254,7 @@ tPaintCallbackProc CLCPaint::PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint ClcData *dat = (ClcData*)GetWindowLongPtr(hWnd, 0);
if (dat)
cliPaintClc(hWnd, dat, hDC, rcPaint);
- return 0;
+ return nullptr;
}
void CLCPaint::_FillQuickHash()
@@ -530,7 +530,7 @@ void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWOR MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat)
{
if (Drawing == nullptr)
- return 0;
+ return nullptr;
char buf[BUF2SIZE] = { 0 };
MODERNMASK *mpModernMask = (MODERNMASK*)mir_calloc(sizeof(MODERNMASK));
@@ -1697,7 +1697,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, mpRequest = _GetCLCContactRowBackModernMask(group, Drawing, indent, line_num, selected, hottrack, dat);
RECT mrc = row_rc;
- if (group->parent == 0
+ if (group->parent == nullptr
&& group->scanIndex != 0
&& group->scanIndex < group->cl.getCount()
&& group->cl[group->scanIndex]->type == CLCIT_GROUP) {
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index d7f95d0bfa..382590e0fd 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -103,7 +103,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) for (int j = 0; j < GetMenuItemCount(g_CluiData.hMenuNotify); j++) {
if (GetMenuItemInfo(g_CluiData.hMenuNotify, j, TRUE, &mii) != 0) {
NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
- if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex)
+ if (nmi != nullptr && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex)
return p;
}
}
@@ -322,7 +322,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC) HICON hIcon = (HICON)LoadImage(g_hMirApp, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0);
wchar_t *ptszEvents = TranslateT("No events");
ske_DrawText(hDC, ptszEvents, (int)mir_wstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE);
- ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
+ ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, nullptr, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index c3197d3810..4725dac959 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -220,7 +220,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) int wx = 0;
BYTE *ptr = nullptr;
HRGN rgn = nullptr;
- HBITMAP WindowImage = g_CluiData.fLayered ? ske_GetCurrentWindowImage() : 0;
+ HBITMAP WindowImage = g_CluiData.fLayered ? ske_GetCurrentWindowImage() : nullptr;
if (WindowImage && g_CluiData.fLayered) {
BITMAP bmp;
GetObject(WindowImage, sizeof(BITMAP), &bmp);
@@ -275,7 +275,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) po = (a > 16);
}
- if (po || (!rgn && ptr == 0)) {
+ if (po || (!rgn && ptr == nullptr)) {
BOOL hWndFound = FALSE;
HWND hAuxOld = nullptr;
HWND hAux = WindowFromPoint(pt);
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 53c1edb5b4..fcb72f86dd 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -368,7 +368,7 @@ int cliTrayIconInit(HWND hwnd) case TRAY_ICON_MODE_CYCLE:
pcli->pfnTrayIconAdd(hwnd, nullptr, nullptr, CListTray_GetGlobalStatus(0, 0));
pcli->cycleStep = 0;
- cliTrayCycleTimerProc(0, 0, 0, 0); // force icon update
+ cliTrayCycleTimerProc(nullptr, 0, 0, 0); // force icon update
// Íå ñîõðàíÿåì ID òàéìåðà â pcli, ÷òîáû fnTrayIconUpdateBase íå óáèâàëà åãî.
TimerID = CLUI_SafeSetTimer(nullptr, 0, db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cliTrayCycleTimerProc);
break;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index d9ea40e650..521f49d15d 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -58,7 +58,7 @@ BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND hwnd, UINT msg, WPARAM wParam, LP /* Global variables */
UINT g_dwMainThreadID = 0;
-HANDLE g_hAwayMsgThread = 0, g_hGetTextAsyncThread = 0, g_hSmoothAnimationThread = 0;
+HANDLE g_hAwayMsgThread = nullptr, g_hGetTextAsyncThread = nullptr, g_hSmoothAnimationThread = nullptr;
HMENU g_hMenuMain;
BOOL g_bTransparentFlag = FALSE;
@@ -157,7 +157,7 @@ void CLUI::cliOnCreateClc(void) int CLUI::OnEvent_ModulesLoaded(WPARAM, LPARAM)
{
- cliCluiProtocolStatusChanged(0, 0);
+ cliCluiProtocolStatusChanged(0, nullptr);
SleepEx(0, TRUE);
g_flag_bOnModulesLoadedCalled = TRUE;
@@ -174,7 +174,7 @@ int CLUI::OnEvent_FontReload(WPARAM wParam, LPARAM lParam) g_CluiData.dwKeyColor = db_get_dw(0, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT);
- cliInvalidateRect(pcli->hwndContactList, 0, 0);
+ cliInvalidateRect(pcli->hwndContactList, nullptr, 0);
return 0;
}
@@ -580,7 +580,7 @@ void CLUI_UpdateAeroGlass() if (g_proc_DWMEnableBlurBehindWindow && (tAeroGlass != g_CluiData.fAeroGlass)) {
if (g_CluiData.hAeroGlassRgn) {
DeleteObject(g_CluiData.hAeroGlassRgn);
- g_CluiData.hAeroGlassRgn = 0;
+ g_CluiData.hAeroGlassRgn = nullptr;
}
DWM_BLURBEHIND bb = { 0 };
@@ -974,7 +974,7 @@ static bool StartTicksTimer(PROTOTICKS *pt) DestroyIcon(ic);
}
}
- CLUI_SafeSetTimer(pcli->hwndContactList, TM_STATUSBARUPDATE + pt->nIndex, nAnimatedIconStep, 0);
+ CLUI_SafeSetTimer(pcli->hwndContactList, TM_STATUSBARUPDATE + pt->nIndex, nAnimatedIconStep, nullptr);
pt->bTimerCreated = 1;
pt->nCycleStartTick = GetTickCount();
return true;
@@ -1009,7 +1009,7 @@ static BOOL CALLBACK BroadcastEnumChildProc(HWND hwndChild, LPARAM lParam) static LRESULT BroadCastMessageToChild(HWND hwnd, int message, WPARAM wParam, LPARAM lParam)
{
- MSG msg = { 0 };
+ MSG msg = {};
msg.hwnd = hwnd;
msg.lParam = lParam;
msg.wParam = wParam;
@@ -1498,7 +1498,7 @@ HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDesc wchar_t fileFull[MAX_PATH] = { 0 };
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.a = szSectionName;
sid.pszName = szIcoID;
sid.flags |= SIDF_PATH_UNICODE;
@@ -1805,7 +1805,7 @@ LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) if (!g_CluiData.fLayered && IsWindowVisible(m_hWnd)) {
RECT w = { 0 };
RECT w2 = { 0 };
- PAINTSTRUCT ps = { 0 };
+ PAINTSTRUCT ps = {};
GetClientRect(m_hWnd, &w);
if (!(w.right > 0 && w.bottom > 0))
@@ -1841,7 +1841,7 @@ LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) else {
RECT w = { 0 };
RECT w2 = { 0 };
- PAINTSTRUCT ps = { 0 };
+ PAINTSTRUCT ps = {};
GetWindowRect(m_hWnd, &w);
OffsetRect(&w, -w.left, -w.top);
BeginPaint(m_hWnd, &ps);
@@ -1862,7 +1862,7 @@ LRESULT CLUI::OnCreate(UINT, WPARAM, LPARAM) {
TranslateMenu(GetMenu(m_hWnd));
DrawMenuBar(m_hWnd);
- cliCluiProtocolStatusChanged(0, 0);
+ cliCluiProtocolStatusChanged(0, nullptr);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -2270,7 +2270,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) rcWindow = rcSizingRect;
else
GetWindowRect(m_hWnd, &rcWindow);
- if (!g_CluiData.fAutoSize || pcli->hwndContactTree == 0 || Clist_IsDocked())
+ if (!g_CluiData.fAutoSize || pcli->hwndContactTree == nullptr || Clist_IsDocked())
return FALSE;
maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", SETTING_MAXSIZEHEIGHT_DEFAULT);
@@ -2325,7 +2325,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) }
else bNeedFixSizingRect = 0;
- SetWindowPos(m_hWnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(m_hWnd, nullptr, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE);
nRequiredHeight = 0;
diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index df8ef4b4a4..2661747e72 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -213,7 +213,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rcWindow);
*((LRESULT*)lParam) = TRUE;
g_CluiData.mutexPreventDockMoving = 0;
- SetWindowPos(msg->hwnd, 0, rcWindow.left, rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING);
+ SetWindowPos(msg->hwnd, nullptr, rcWindow.left, rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING);
Sync(CLUIFrames_OnMoving, msg->hwnd, &rcWindow);
ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr);// -= -= -=
g_CluiData.mutexPreventDockMoving = 1;
@@ -293,7 +293,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) g_CluiData.fDocked = 0;
GetCursorPos(&pt);
PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y));
- SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, db_get_dw(0, "CList", "Width", 0), db_get_dw(0, "CList", "Height", 0), SWP_NOZORDER);
+ SetWindowPos(msg->hwnd, nullptr, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, db_get_dw(0, "CList", "Width", 0), db_get_dw(0, "CList", "Height", 0), SWP_NOZORDER);
db_set_b(0, "CList", "Docked", (BYTE)g_CluiData.fDocked);
// ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr);
}
diff --git a/plugins/Clist_modern/src/modern_global.cpp b/plugins/Clist_modern/src/modern_global.cpp index 073f4e948b..43bc2ff63f 100644 --- a/plugins/Clist_modern/src/modern_global.cpp +++ b/plugins/Clist_modern/src/modern_global.cpp @@ -31,4 +31,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //ClcProtoStatus *clcProto = nullptr;
HIMAGELIST g_himlCListClc = nullptr;
HICON g_hListeningToIcon = nullptr;
-char* g_szMetaModuleName = 0;
+char* g_szMetaModuleName = nullptr;
diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp index 191619fe4a..6d0d574b6f 100644 --- a/plugins/Clist_modern/src/modern_newrowopts.cpp +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -167,7 +167,7 @@ BOOL CALLBACK DlgProcItemNewRowOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara res3->pData = i++;
TRACE("*********** Nodes DUMP 1 ***********\n");
TraceTreeLevel(RootNode);
- if (RemoveNode(res1)) res1 = 0;
+ if (RemoveNode(res1)) res1 = nullptr;
TRACE("*********** Nodes DUMP 2 ***********\n");
TraceTreeLevel(RootNode);
//CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(0,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index e69b80025a..3cecdbbdf5 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -27,7 +27,7 @@ Created by Pescuma, modified by Artem Shpynov #include "stdafx.h"
#include "modern_clcpaint.h"
-ROWCELL *gl_RowTabAccess[TC_ELEMENTSCOUNT + 1] = { 0 }; // Ìàññèâ, ÷åðåç êîòîðûé îñóùåñòâëÿåòñÿ äîñòóï ê ýëåìåíòàì êîíòàêòà.
+ROWCELL *gl_RowTabAccess[TC_ELEMENTSCOUNT + 1] = {}; // Ìàññèâ, ÷åðåç êîòîðûé îñóùåñòâëÿåòñÿ äîñòóï ê ýëåìåíòàì êîíòàêòà.
ROWCELL *gl_RowRoot;
void FreeRowCell()
diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index 31c8dcfa01..b957d3f89b 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -75,7 +75,7 @@ int ModernSkinButtonLoadModule() wc.lpfnWndProc = ModernSkinButtonWndProc; wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(ModernSkinButtonCtrl*); - wc.hbrBackground = 0; + wc.hbrBackground = nullptr; wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); ModernSkinButtonModuleIsLoaded = TRUE; @@ -107,7 +107,7 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) if (!g_CluiData.fLayered) ske_BltBackImage(bct->hwnd, hdc, nullptr); { - MODERNMASK Request = { 0 }; + MODERNMASK Request = {}; // int res; //HBRUSH br = CreateSolidBrush(RGB(255,255,255)); char * Value = nullptr; @@ -322,12 +322,12 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - ModernSkinButtonCtrl* bct = (msg != WM_NCCREATE) ? (ModernSkinButtonCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA) : 0; + ModernSkinButtonCtrl* bct = (msg != WM_NCCREATE) ? (ModernSkinButtonCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA) : nullptr; if (bct) { if (bct->HandleService && IsBadStringPtrA(bct->HandleService, 255)) bct->HandleService = nullptr; else if (bct->HandleService && ServiceExists(bct->HandleService)) { - HandleServiceParams MSG = { 0 }; + HandleServiceParams MSG = {}; MSG.hwnd = hwndDlg; MSG.msg = msg; MSG.wParam = wParam; @@ -389,7 +389,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w case WM_PAINT: if (IsWindowVisible(hwndDlg) && !g_CluiData.fLayered) { - PAINTSTRUCT ps = { 0 }; + PAINTSTRUCT ps = {}; BeginPaint(hwndDlg, &ps); ModernSkinButtonPaintWorker(hwndDlg, (HDC)ps.hdc); EndPaint(hwndDlg, &ps); @@ -400,7 +400,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (bct) { bct->hover = 0; bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); } break; @@ -409,7 +409,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (!bct->hover) { SetCapture(bct->hwnd); bct->hover = 1; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); } else { POINT t = UNPACK_POINT(lParam); @@ -424,7 +424,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (bct) { bct->down = 1; SetForegroundWindow(GetParent(bct->hwnd)); - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) bct->CommandService = nullptr; if (bct->fCallOnPress) { @@ -434,7 +434,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w } bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); } } return 0; @@ -444,7 +444,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w ReleaseCapture(); bct->hover = 0; bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) bct->CommandService = nullptr; if (bct->CommandService) @@ -460,7 +460,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w HWND SetToolTip(HWND hwnd, wchar_t * tip) { TOOLINFO ti; - if (!tip) return 0; + if (!tip) return nullptr; mir_cslock lck(csTips); if (!hwndToolTips) { hwndToolTips = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, @@ -625,7 +625,7 @@ int ModernSkinButtonRedrawAll() for (DWORD i = 0; i < ButtonsCount; i++) { if (pcli->hwndContactList && Buttons[i].hwnd == nullptr) Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, pcli->hwndContactList); - ModernSkinButtonPaintWorker(Buttons[i].hwnd, 0); + ModernSkinButtonPaintWorker(Buttons[i].hwnd, nullptr); } g_mutex_bLockUpdating--; return 0; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 109bd8abf7..eaf30819f7 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -985,7 +985,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) HDC memdc = nullptr, glyphdc = nullptr; int k = 0; //BITMAP bmp = {0}; - HBITMAP membmp = 0, oldbmp = 0, oldglyph = 0; + HBITMAP membmp = nullptr, oldbmp = nullptr, oldglyph = nullptr; BYTE Is32Bit = 0; RECT PRect; POINT mode2offset = { 0 }; @@ -2467,7 +2467,7 @@ BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT form HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i) { - IMAGEINFO imi = { 0 }; + IMAGEINFO imi = {}; BITMAP bm = { 0 }; if (i != -1) { ImageList_GetImageInfo(himl, i, &imi); @@ -2712,7 +2712,7 @@ int ske_PrepareImageButDontUpdateIt(RECT *r) int ske_RedrawCompleteWindow() { if (g_CluiData.fLayered) { - ske_DrawNonFramedObjects(TRUE, 0); + ske_DrawNonFramedObjects(TRUE, nullptr); CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); } else RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); @@ -2755,7 +2755,7 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) // else { if (frm->UpdateRgn) { DeleteObject(frm->UpdateRgn); - frm->UpdateRgn = 0; + frm->UpdateRgn = nullptr; } ske_ValidateSingleFrameImage(frm, 0); ske_UpdateWindowImage(); @@ -2810,7 +2810,7 @@ static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam) if (!frm->UpdateRgn) { frm->UpdateRgn = CreateRectRgn(0, 0, 1, 1); - CombineRgn(frm->UpdateRgn, r2, 0, RGN_COPY); + CombineRgn(frm->UpdateRgn, r2, nullptr, RGN_COPY); } else CombineRgn(frm->UpdateRgn, frm->UpdateRgn, r2, RGN_OR); DeleteObject(r2); @@ -2919,7 +2919,7 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) DeleteObject(rgnUpdate); } DeleteObject(Frame->UpdateRgn); - Frame->UpdateRgn = 0; + Frame->UpdateRgn = nullptr; if (!IsRectEmpty(&ru)) { x1 = ru.left; @@ -3060,7 +3060,7 @@ int ske_DrawNonFramedObjects(BOOL Erase, RECT *r) RECT w, wnd; if (r) w = *r; else CLUI_SizingGetWindowRect(pcli->hwndContactList, &w); - if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); + if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, nullptr); if (g_pCachedWindow == nullptr) return ske_ValidateFrameImageProc(&w); @@ -3173,7 +3173,7 @@ int ske_UpdateWindowImage() GetWindowRect(pcli->hwndContactList, &r); return ske_UpdateWindowImageRect(&r); } - else ske_ReCreateBackImage(FALSE, 0); + else ske_ReCreateBackImage(FALSE, nullptr); ske_ApplyTranslucency(); return 0; } @@ -3184,7 +3184,7 @@ int ske_UpdateWindowImageRect(RECT *r) // Up //else Update using current alpha RECT wnd = *r; - if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); + if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, nullptr); if (g_pCachedWindow == nullptr) return ske_ValidateFrameImageProc(&wnd); if (g_pCachedWindow->Width != wnd.right - wnd.left || g_pCachedWindow->Height != wnd.bottom - wnd.top) return ske_ValidateFrameImageProc(&wnd); if (g_flag_bFullRepaint) { diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 58b137f97e..386b268fa1 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -90,7 +90,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_BUTTON_INFO: { HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) + if (hti == nullptr) return 0; TVITEM tvi = { 0 }; @@ -126,7 +126,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_BUTTON_APPLY_SKIN: if (HIWORD(wParam) == BN_CLICKED) { HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) + if (hti == nullptr) return 0; TVITEM tvi = { 0 }; @@ -255,7 +255,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), nullptr, TRUE); else { // prepare text HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) + if (hti == nullptr) return 0; TVITEM tvi = { 0 }; @@ -380,7 +380,7 @@ HTREEITEM AddSkinToList(HWND hwndDlg, wchar_t *path, wchar_t *file) wchar_t fullName[MAX_PATH], defskinname[MAX_PATH]; SkinListData *sd = (SkinListData*)mir_alloc(sizeof(SkinListData)); if (!sd) - return 0; + return nullptr; if (!file || wcschr(file, '%')) { mir_snwprintf(sd->File, L"%%Default Skin%%"); @@ -435,9 +435,9 @@ HTREEITEM AddItemToTree(HWND hTree, wchar_t *itemName, void *data) { HTREEITEM cItem = nullptr; // Insert item node - cItem = FindChild(hTree, 0, itemName, data); + cItem = FindChild(hTree, nullptr, itemName, data); if (!cItem) { - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; tvis.hInsertAfter = TVI_SORT; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_PARAM; tvis.item.pszText = itemName; diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 01b73ea92d..214faf17b9 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -313,7 +313,7 @@ static BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate) BOOL CompareStrWithModernMask(char *szValue, MODERNMASK *mmTemplate)
{
- MODERNMASK mmValue = { 0 };
+ MODERNMASK mmValue = {};
if (!ParseToModernMask(&mmValue, szValue)) {
BOOL res = CompareModernMask(&mmValue, mmTemplate);
SkinSelector_DeleteMask(&mmValue);
@@ -328,7 +328,7 @@ int AddStrModernMaskToList(DWORD maskID, char *szStr, char *objectName, LISTMODE if (!szStr || !mmTemplateList)
return -1;
- MODERNMASK mm = { 0 };
+ MODERNMASK mm = {};
if (ParseToModernMask(&mm, szStr))
return -1;
@@ -356,7 +356,7 @@ SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char *szValue, LISTMODERNMASK *mm if (!mmTemplateList)
return nullptr;
- MODERNMASK mm = { 0 };
+ MODERNMASK mm = {};
ParseToModernMask(&mm, szValue);
SKINOBJECTDESCRIPTOR *res = skin_FindObjectByMask(&mm, mmTemplateList);
SkinSelector_DeleteMask(&mm);
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index ee88bafa9a..8308345840 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -689,7 +689,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa rc = ProtosData[i].protoRect;
if (PtInRect(&rc, pt)) {
NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip, (WPARAM)ProtosData[i].szAccountName, 0);
- CLUI_SafeSetTimer(hwnd, TM_STATUSBARHIDE, db_get_w(0, "CLUIFrames", "HideToolTipTime", SETTING_HIDETOOLTIPTIME_DEFAULT), 0);
+ CLUI_SafeSetTimer(hwnd, TM_STATUSBARHIDE, db_get_w(0, "CLUIFrames", "HideToolTipTime", SETTING_HIDETOOLTIPTIME_DEFAULT), nullptr);
tooltipshoing = TRUE;
ClientToScreen(hwnd, &pt);
ptToolTipShow = pt;
@@ -733,7 +733,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ReleaseCapture();
}
KillTimer(hwnd, TM_STATUSBAR);
- CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(0, "CLC", "InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME), 0);
+ CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(0, "CLC", "InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME), nullptr);
}
return CLUI_TestCursorOnBorders();
@@ -893,7 +893,7 @@ HWND StatusBar_Create(HWND parent) CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)Frame.hWnd, (LPARAM)NewStatusPaintCallbackProc); //$$$$$ register sub for frame
LoadStatusBarData();
- cliCluiProtocolStatusChanged(0, 0);
+ cliCluiProtocolStatusChanged(0, nullptr);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, -1, 0);
return hModernStatusBar;
}
diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp index 76c8b73eb8..43c942c6af 100644 --- a/plugins/Clist_modern/src/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp @@ -38,7 +38,7 @@ typedef struct _StatusBarProtocolOptions int PaddingRight;
} StatusBarProtocolOptions;
-static StatusBarProtocolOptions _GlobalOptions = { 0 };
+static StatusBarProtocolOptions _GlobalOptions = {};
static void UpdateXStatusIconOptions(HWND hwndDlg, StatusBarProtocolOptions &dat)
{
@@ -442,7 +442,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
LoadStatusBarData();
- cliCluiProtocolStatusChanged(0, 0);
+ cliCluiProtocolStatusChanged(0, nullptr);
return TRUE;
}
break;
diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 6cc33a1ecd..35457afc55 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -58,7 +58,7 @@ static void SetButtonPressed(int i, int state) void Modern_InitButtons()
{
for (int i = 0; i < _countof(BTNS); i++) {
- TTBButton tbb = { 0 };
+ TTBButton tbb = {};
if (BTNS[i].pszButtonID) {
tbb.name = LPGEN(BTNS[i].pszButtonName);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 7252400df4..aed452623f 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -34,13 +34,13 @@ $Id: viewmodes.c 2998 2006-06-01 07:11:52Z nightwish2004 $ #define TIMERID_VIEWMODEEXPIRE 100
typedef int(__cdecl *pfnEnumCallback)(char *szName);
-static HWND clvmHwnd = 0;
+static HWND clvmHwnd = nullptr;
static int clvm_curItem = 0;
-HMENU hViewModeMenu = 0;
+HMENU hViewModeMenu = nullptr;
-static HWND hwndSelector = 0;
-static HIMAGELIST himlViewModes = 0;
-static HANDLE hInfoItem = 0;
+static HWND hwndSelector = nullptr;
+static HIMAGELIST himlViewModes = nullptr;
+static HANDLE hInfoItem = nullptr;
static int nullImage;
static DWORD stickyStatusMask = 0;
static char g_szModename[2048];
@@ -676,7 +676,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETEXTRACOLUMNS, ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE, 0);
CLCINFOITEM cii = { sizeof(cii) };
- cii.hParentGroup = 0;
+ cii.hParentGroup = nullptr;
cii.pszText = TranslateT("*** All contacts ***");
hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
@@ -745,7 +745,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case IDC_DELETEVIEWMODE:
- if (MessageBox(0, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
if (iLen) {
wchar_t *szTempBuf = (wchar_t*)_alloca((iLen + 1)*sizeof(wchar_t));
@@ -773,7 +773,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP T2Utf szUTF8Buf(szBuf);
if (db_get_dw(0, CLVM_MODULE, szUTF8Buf, -1) != -1)
- MessageBox(0, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK);
+ MessageBox(nullptr, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK);
else {
int iNewItem = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf);
if (iNewItem != LB_ERR) {
@@ -957,11 +957,11 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcCLVMFrame;
HDWP PosBatch = BeginDeferWindowPos(3);
GetClientRect(hwnd, &rcCLVMFrame);
- PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), 0,
+ PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), nullptr,
rcCLVMFrame.right - 23, 1, 22, 18, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
- PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), 0,
+ PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), nullptr,
rcCLVMFrame.right - 45, 1, 22, 18, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
- PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), 0,
+ PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), nullptr,
1, 1, rcCLVMFrame.right - 46, 18, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
EndDeferWindowPos(PosBatch);
}
@@ -1102,7 +1102,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_CONFIGUREMODES:
clvm_config_command :
if (!g_ViewModeOptDlg)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), nullptr, DlgProcViewModesSetup, 0);
break;
}
@@ -1187,7 +1187,7 @@ void CreateViewModeFrame() wndclass.hInstance = g_hInst;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
- wndclass.lpszMenuName = 0;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = L"CLVMFrameWindow";
RegisterClass(&wndclass);
@@ -1199,7 +1199,7 @@ void CreateViewModeFrame() frame.TBtname = TranslateT("View modes");
frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE;
frame.align = alBottom;
- frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, nullptr);
+ frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr);
g_hwndViewModeFrame = frame.hWnd;
hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS);
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 42ce47c46c..49bbfd86f9 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -26,19 +26,19 @@ HANDLE hToolbarFrame = (HANDLE)-1; struct CluiTopButton BTNS[] =
{
- { IDC_TBTOPMENU, "CLN_topmenu", NULL, LPGEN("Show menu"), 1, 1, 1 },
- { IDC_TBHIDEOFFLINE, "CLN_online", NULL, LPGEN("Show/Hide offline contacts"), 0, 1, 0 },
- { IDC_TBHIDEGROUPS, "CLN_groups", NULL, LPGEN("Use/Disable groups"), 0, 1, 0 },
- { IDC_TBFINDANDADD, "CLN_findadd", NULL, LPGEN("Find and add contacts"), 1, 1, 0 },
- { IDC_TBACCOUNTS, "CLN_accounts", NULL, LPGEN("Accounts"), 1, 1, 0 },
- { IDC_TBOPTIONS, "CLN_options", NULL, LPGEN("Open preferences"), 1, 1, 0 },
+ { IDC_TBTOPMENU, "CLN_topmenu", nullptr, LPGEN("Show menu"), 1, 1, 1 },
+ { IDC_TBHIDEOFFLINE, "CLN_online", nullptr, LPGEN("Show/Hide offline contacts"), 0, 1, 0 },
+ { IDC_TBHIDEGROUPS, "CLN_groups", nullptr, LPGEN("Use/Disable groups"), 0, 1, 0 },
+ { IDC_TBFINDANDADD, "CLN_findadd", nullptr, LPGEN("Find and add contacts"), 1, 1, 0 },
+ { IDC_TBACCOUNTS, "CLN_accounts", nullptr, LPGEN("Accounts"), 1, 1, 0 },
+ { IDC_TBOPTIONS, "CLN_options", nullptr, LPGEN("Open preferences"), 1, 1, 0 },
{ IDC_TBSOUND, "CLN_sound", "CLN_soundsoff", LPGEN("Enable/Disable sounds"), 0, 1, 0 },
- { IDC_TBMINIMIZE, "CLN_minimize", NULL, LPGEN("Minimize contact list"), 1, 0, 0 },
- { IDC_TBTOPSTATUS, "CLN_topstatus", NULL, LPGEN("Status menu"), 1, 0, 1 },
+ { IDC_TBMINIMIZE, "CLN_minimize", nullptr, LPGEN("Minimize contact list"), 1, 0, 0 },
+ { IDC_TBTOPSTATUS, "CLN_topstatus", nullptr, LPGEN("Status menu"), 1, 0, 1 },
- { IDC_TBSELECTVIEWMODE, "CLN_CLVM_select", NULL, LPGEN("Select view mode"), 1, 0, 1 },
- { IDC_TBCONFIGUREVIEWMODE, "CLN_CLVM_options", NULL, LPGEN("Setup view modes"), 1, 0, 0 },
- { IDC_TBCLEARVIEWMODE, "CLN_CLVM_reset", NULL, LPGEN("Clear view mode"), 1, 0, 0 }
+ { IDC_TBSELECTVIEWMODE, "CLN_CLVM_select", nullptr, LPGEN("Select view mode"), 1, 0, 1 },
+ { IDC_TBCONFIGUREVIEWMODE, "CLN_CLVM_options", nullptr, LPGEN("Setup view modes"), 1, 0, 0 },
+ { IDC_TBCLEARVIEWMODE, "CLN_CLVM_reset", nullptr, LPGEN("Clear view mode"), 1, 0, 0 }
};
static int g_index = -1;
@@ -46,7 +46,7 @@ static int g_index = -1; static void InitDefaultButtons()
{
for (int i = 0; i < _countof(BTNS); i++) {
- TTBButton tbb = { 0 };
+ TTBButton tbb = {};
g_index = i;
if (BTNS[i].pszButtonID) {
@@ -85,7 +85,7 @@ HWND ClcGetButtonWindow(int ctrlid) if (BTNS[i].ctrlid == ctrlid)
return BTNS[i].hwndButton;
- return NULL;
+ return nullptr;
}
int ClcGetButtonId(HWND hwnd)
@@ -137,9 +137,9 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (hdcPaint) {
HDC hdcMem;
HBITMAP hbmMem;
- HBITMAP hbmOld = 0;
+ HBITMAP hbmOld = nullptr;
RECT rcClient;
- HFONT hOldFont = 0;
+ HFONT hOldFont = nullptr;
int xOffset = 0;
GetClientRect(ctl->hwnd, &rcClient);
@@ -259,7 +259,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) DeleteObject(hbr);
}
}
- if (!ctl->bIsSkinned && ctl->buttonItem == 0) {
+ if (!ctl->bIsSkinned && ctl->buttonItem == nullptr) {
if (ctl->stateId == PBS_HOT || ctl->focus) {
if (ctl->bIsPushed)
DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT);
@@ -317,12 +317,12 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (ctl->hIcon || ctl->hIconPrivate || ctl->iIcon) {
int ix = (rcClient.right - rcClient.left) / 2 - (g_cxsmIcon / 2);
int iy = (rcClient.bottom - rcClient.top) / 2 - (g_cxsmIcon / 2);
- HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon;
+ HICON hIconNew = ctl->hIconPrivate != nullptr ? ctl->hIconPrivate : ctl->hIcon;
if (ctl->szText[0] == 0) {
if (ctl->iIcon)
ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL);
else
- DrawState(hdcMem, NULL, NULL, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED);
ctl->sLabel.cx = ctl->sLabel.cy = 0;
}
else {
@@ -337,7 +337,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (ctl->iIcon)
ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL);
else
- DrawState(hdcMem, NULL, NULL, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED);
xOffset = ix + g_cxsmIcon + 4;
}
}
@@ -352,7 +352,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ix++;
iy++;
}
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED);
}
if (GetWindowTextLength(ctl->hwnd)) {
// Draw the text and optinally the arrow
@@ -364,8 +364,8 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (!ctl->bIsSkinned)
SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT));
if (ctl->arrow)
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED);
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->szText, 0, xOffset + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->szText, 0, xOffset + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
}
if (hOldFont)
SelectObject(hdcMem, hOldFont);
@@ -400,7 +400,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (!lParam)
break;
- bct->hIml = 0;
+ bct->hIml = nullptr;
bct->iIcon = 0;
if (wParam == IMAGE_ICON) {
ICONINFO ii = { 0 };
@@ -408,7 +408,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (bct->hIconPrivate) {
DestroyIcon(bct->hIconPrivate);
- bct->hIconPrivate = 0;
+ bct->hIconPrivate = nullptr;
}
GetIconInfo((HICON)lParam, &ii);
@@ -420,24 +420,24 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);
ImageList_RemoveAll(hImageList);
ImageList_Destroy(hImageList);
- bct->hIcon = 0;
+ bct->hIcon = nullptr;
}
else {
bct->hIcon = (HICON)lParam;
- bct->hIconPrivate = 0;
+ bct->hIconPrivate = nullptr;
}
DeleteObject(ii.hbmMask);
DeleteObject(ii.hbmColor);
- bct->hBitmap = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ bct->hBitmap = nullptr;
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
else if (wParam == IMAGE_BITMAP) {
bct->hBitmap = (HBITMAP)lParam;
if (bct->hIconPrivate)
DestroyIcon(bct->hIconPrivate);
- bct->hIcon = bct->hIconPrivate = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ bct->hIcon = bct->hIconPrivate = nullptr;
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
return 1;
@@ -446,14 +446,14 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR DestroyIcon(bct->hIconPrivate);
bct->hIml = (HIMAGELIST)wParam;
bct->iIcon = (int)lParam;
- bct->hIcon = bct->hIconPrivate = 0;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ bct->hIcon = bct->hIconPrivate = nullptr;
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONSETSKINNED:
bct->bIsSkinned = wParam != 0;
bct->bIsThemed = bct->bIsSkinned ? FALSE : bct->bIsThemed;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONSETBTNITEM:
@@ -462,7 +462,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case BUTTONSETTTBUTTON:
bct->bIsTTButton = wParam != 0;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_NCHITTEST:
@@ -501,7 +501,7 @@ static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SelectObject(cfg::dat.hdcToolbar, cfg::dat.hbmToolbarOld);
DeleteObject(cfg::dat.hbmToolbar);
DeleteDC(cfg::dat.hdcToolbar);
- cfg::dat.hdcToolbar = NULL;
+ cfg::dat.hdcToolbar = nullptr;
}
cfg::dat.hdcToolbar = CreateCompatibleDC(hdc);
cfg::dat.hbmToolbar = CreateCompatibleBitmap(hdc, rcClient.right, rcClient.bottom);
@@ -546,7 +546,7 @@ static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SelectObject(cfg::dat.hdcToolbar, cfg::dat.hbmToolbarOld);
DeleteObject(cfg::dat.hbmToolbar);
DeleteDC(cfg::dat.hdcToolbar);
- cfg::dat.hdcToolbar = NULL;
+ cfg::dat.hdcToolbar = nullptr;
}
break;
}
diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index b4f3f9c54b..e6732b348d 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -157,7 +157,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if ((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) {
if (!(GetWindowLongPtr(msg->hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) {
SendMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0);
- MessageBox(0, TranslateT("The contact list cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."),
+ MessageBox(nullptr, TranslateT("The contact list cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."),
TranslateT("Contact list docking"), MB_OK);
return 0;
}
@@ -261,7 +261,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) docked = 0;
GetCursorPos(&pt);
PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y));
- SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, cluiPos.right, cluiPos.bottom, SWP_NOZORDER);
+ SetWindowPos(msg->hwnd, nullptr, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, cluiPos.right, cluiPos.bottom, SWP_NOZORDER);
}
}
return 1;
diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index ab74b3363c..63010edbd8 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -48,7 +48,7 @@ DWORD __forceinline argb_from_cola(COLORREF col, UINT32 alpha) void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE)
{
- HPEN hPenOld = 0;
+ HPEN hPenOld = nullptr;
POINT pt;
switch (BORDERSTYLE) {
@@ -81,7 +81,7 @@ void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) }
void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *imageItem)
{
- if (rc == NULL)
+ if (rc == nullptr)
return;
int ulBitmapWidth, ulBitmapHeight;
@@ -215,8 +215,8 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor bmi.bmiHeader.biSizeImage = ulBitmapWidth * ulBitmapHeight * 4;
void *pvBits;
- HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0);
- if (hbitmap == NULL || pvBits == NULL) {
+ HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0);
+ if (hbitmap == nullptr || pvBits == nullptr) {
DeleteDC(hdc);
return;
}
@@ -290,9 +290,9 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor }
// TL+BL CORNER
- hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0);
+ hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0);
- if (hbitmap == 0 || pvBits == NULL) {
+ if (hbitmap == nullptr || pvBits == nullptr) {
DeleteObject(BrMask);
DeleteDC(hdc);
return;
@@ -330,7 +330,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor DeleteObject(hbitmap);
// TR+BR CORNER
- hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0);
+ hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0);
//SelectObject(hdc, BrMask); // already BrMask?
holdbitmap = reinterpret_cast<HBITMAP>(SelectObject(hdc, hbitmap));
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index a939ab948f..756e7ba60d 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -40,7 +40,7 @@ extern int during_sizing; HIMAGELIST hCListImages;
-HANDLE hSvc_GetContactStatusMsg = 0;
+HANDLE hSvc_GetContactStatusMsg = nullptr;
static HRESULT(WINAPI *MyCloseThemeData)(HANDLE);
@@ -67,7 +67,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) {
DWORD new_freq = 0;
- cfg::dat.t_now = time(NULL);
+ cfg::dat.t_now = time(nullptr);
if (hContact && lParam) {
DBEVENTINFO dbei = {};
@@ -80,7 +80,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) db_set_dw(hContact, "CList", "mf_freq", new_freq);
db_set_dw(hContact, "CList", "mf_count", count);
- TExtraCache *p = cfg::getCache(hContact, NULL);
+ TExtraCache *p = cfg::getCache(hContact, nullptr);
if (p) {
p->dwLastMsgTime = dbei.timestamp;
if (new_freq)
@@ -103,7 +103,7 @@ static int ClcMetamodeChanged(WPARAM bMetaEnabled, LPARAM) static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
{
- char *szProto = NULL;
+ char *szProto = nullptr;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
if (hContact) {
@@ -117,15 +117,15 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName"))
ReloadExtraInfo(hContact);
}
- else if (hContact != 0 && (szProto = GetContactProto(hContact)) != NULL) {
+ else if (hContact != 0 && (szProto = GetContactProto(hContact)) != nullptr) {
if (!__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) {
char *szProto_s;
Clist_Broadcast(INTM_PROTOCHANGED, hContact, lParam);
if (cws->value.type == DBVT_DELETED)
- szProto_s = NULL;
+ szProto_s = nullptr;
else
szProto_s = cws->value.pszVal;
- pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, NULL));
+ pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, nullptr));
}
// something is being written to a protocol module
if (!__strcmp(szProto, cws->szModule)) {
@@ -167,7 +167,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) else if (!__strcmp(cws->szModule, "TopToolBar") && !__strcmp(cws->szSetting, "UseFlatButton")) {
SetButtonToSkinned();
}
- else if (szProto == NULL) {
+ else if (szProto == nullptr) {
if (!__strcmp(cws->szSetting, "XStatusId"))
CluiProtocolStatusChanged(0, cws->szModule);
}
@@ -248,7 +248,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->bHideSubcontacts = true;
cfg::clcdat = dat;
if (cfg::dat.bShowLocalTime)
- SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL);
+ SetTimer(hwnd, TIMERID_REFRESH, 65000, nullptr);
}
else
dat->bisEmbedded = TRUE;
@@ -275,16 +275,16 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L {
WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
flags = contact->flags;
}
pcli->pfnDeleteItemFromTree(hwnd, wParam);
- if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(wParam, NULL, dat)) {
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(wParam, nullptr, dat)) {
pcli->pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
@@ -310,10 +310,10 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L WORD status = ID_STATUS_OFFLINE;
int contactRemoved = 0;
MCONTACT hSelItem = NULL;
- ClcContact *selcontact = NULL;
+ ClcContact *selcontact = nullptr;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
status = ID_STATUS_OFFLINE;
else
status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -322,13 +322,13 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L !CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) ||
pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown
- if (!Clist_FindItem(hwnd, dat, hContact, &contact, &group, NULL)) {
+ if (!Clist_FindItem(hwnd, dat, hContact, &contact, &group, nullptr)) {
if (shouldShow && db_is_contact(wParam)) {
- if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
+ if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0);
recalcScrollBar = 1;
- Clist_FindItem(hwnd, dat, hContact, &contact, NULL, NULL);
+ Clist_FindItem(hwnd, dat, hContact, &contact, nullptr, nullptr);
if (contact) {
contact->iImage = (WORD)lParam;
pcli->pfnNotifyNewContact(hwnd, hContact);
@@ -341,7 +341,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (contact->iImage == (WORD)lParam)
break;
if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed
- if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
+ if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0);
contactRemoved = TRUE;
@@ -357,7 +357,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L }
if (hSelItem) {
ClcGroup *selgroup;
- if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
+ if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr))
dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
@@ -371,7 +371,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_METACHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
if (contact->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
@@ -381,7 +381,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (contact->pExtra) {
TExtraCache *pSub = cfg::getCache(contact->hSubContact, contact->metaProto);
ClcContact *subContact;
- if (!Clist_FindItem(hwnd, dat, contact->hSubContact, &subContact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, contact->hSubContact, &subContact, nullptr, nullptr))
break;
contact->pExtra->proto_status_item = GetProtocolStatusItem(contact->metaProto);
@@ -395,14 +395,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_METACHANGEDEVENT:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
if (lParam == 0)
pcli->pfnInitAutoRebuild(hwnd);
return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_NAMECHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
mir_wstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
@@ -413,7 +413,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_CODEPAGECHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
contact->codePage = db_get_dw(wParam, "Tab_SRMsg", "ANSIcodepage", db_get_dw(wParam, "UserInfo", "ANSIcodepage", CP_ACP));
@@ -421,23 +421,23 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_AVATARCHANGED:
- contact = NULL;
+ contact = nullptr;
{
AVATARCACHEENTRY *cEntry = (struct AVATARCACHEENTRY *)lParam;
if (wParam == 0) {
//RemoveFromImgCache(0, cEntry);
cfg::dat.bForceRefetchOnPaint = TRUE;
- RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
cfg::dat.bForceRefetchOnPaint = FALSE;
return DefWindowProc(hwnd, msg, wParam, lParam);
}
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
contact->ace = cEntry;
- if (cEntry == NULL)
+ if (cEntry == nullptr)
contact->cFlags &= ~ECF_AVATAR;
else {
DWORD dwFlags;
@@ -458,10 +458,10 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case INTM_STATUSMSGCHANGED:
{
TExtraCache *p;
- char *szProto = NULL;
+ char *szProto = nullptr;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
- p = cfg::getCache(wParam, NULL);
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
+ p = cfg::getCache(wParam, nullptr);
else {
p = contact->pExtra;
szProto = contact->proto;
@@ -472,11 +472,11 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_STATUSCHANGED:
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
WORD wStatus = db_get_w(wParam, contact->proto, "Status", ID_STATUS_OFFLINE);
if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) {
contact->wStatus = wStatus;
- if (cfg::dat.bAvatarServiceAvail && contact->ace == NULL)
+ if (cfg::dat.bAvatarServiceAvail && contact->ace == nullptr)
LoadAvatarForContact(contact);
}
contact->wStatus = wStatus;
@@ -485,7 +485,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
case INTM_PROTOCHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
contact->proto = GetContactProto(wParam);
@@ -501,7 +501,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case INTM_INVALIDATE:
if (!dat->bNeedPaint) {
KillTimer(hwnd, TIMERID_PAINT);
- SetTimer(hwnd, TIMERID_PAINT, 100, NULL);
+ SetTimer(hwnd, TIMERID_PAINT, 100, nullptr);
dat->bNeedPaint = true;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -520,10 +520,10 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_IDLECHANGED:
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
char *szProto = (char*)cws->szModule;
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
contact->flags &= ~CONTACTF_IDLE;
@@ -542,7 +542,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MCONTACT hContact = wParam;
TExtraCache *p;
- if (!Clist_FindItem(hwnd, dat, hContact, &contact, NULL, NULL)) {
+ if (!Clist_FindItem(hwnd, dat, hContact, &contact, nullptr, nullptr)) {
p = cfg::getCache(hContact, szProto);
if (!dat->bisEmbedded && szProto) { // may be a subcontact, forward the xstatus
MCONTACT hMasterContact = db_mc_tryMeta(hContact);
@@ -556,7 +556,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L p = contact->pExtra;
}
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
if (contact) {
@@ -582,7 +582,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->lastRepaint = GetTickCount();
}
EndPaint(hwnd, &ps);
- if (dat->selection != dat->oldSelection && !dat->bisEmbedded && g_ButtonItems != NULL) {
+ if (dat->selection != dat->oldSelection && !dat->bisEmbedded && g_ButtonItems != nullptr) {
SetDBButtonStates(0);
dat->oldSelection = dat->selection;
}
@@ -596,12 +596,12 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case WM_TIMER:
if (wParam == TIMERID_PAINT) {
KillTimer(hwnd, TIMERID_PAINT);
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
return DefWindowProc(hwnd, msg, wParam, lParam);
}
if (wParam == TIMERID_REFRESH) {
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
return DefWindowProc(hwnd, msg, wParam, lParam);
}
break;
@@ -614,11 +614,11 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L KillTimer(hwnd, TIMERID_INFOTIP);
DWORD hitFlags;
- dat->selection = HitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, NULL, &hitFlags);
+ dat->selection = HitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
if (hitFlags & CLCHT_ONITEMEXTRA)
break;
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
if (hitFlags & CLCHT_ONAVATAR && cfg::dat.bDblClkAvatars) {
@@ -643,7 +643,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L {
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1 && pt.y == -1) {
- dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
+ dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
if (dat->selection != -1)
pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
pt.x = dat->iconXSpace + 15;
@@ -652,19 +652,19 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L }
else {
ScreenToClient(hwnd, &pt);
- dat->selection = HitTest(hwnd, dat, pt.x, pt.y, &contact, NULL, &hitFlags);
+ dat->selection = HitTest(hwnd, dat, pt.x, pt.y, &contact, nullptr, &hitFlags);
}
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
UpdateWindow(hwnd);
- HMENU hMenu = NULL;
+ HMENU hMenu = nullptr;
if (dat->selection != -1 && hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMCHECK | CLCHT_ONITEMLABEL)) {
if (contact->type == CLCIT_GROUP) {
hMenu = Menu_BuildSubGroupMenu(contact->group);
ClientToScreen(hwnd, &pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr);
CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->hideOffline ? MF_CHECKED : MF_UNCHECKED);
DestroyMenu(hMenu);
return 0;
@@ -679,7 +679,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L }
if (hMenu != nullptr) {
ClientToScreen(hwnd, &pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(hMenu);
}
}
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 2a39378da1..18859042a4 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -38,7 +38,7 @@ static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) DWORD flags = 0;
if (cfg::dat.bShowLocalTimeSelective)
flags |= TZF_DIFONLY;
- c->hTimeZone = TimeZone_CreateByContact(hContact, 0, flags);
+ c->hTimeZone = TimeZone_CreateByContact(hContact, nullptr, flags);
}
//routines for managing adding/removal of items in the list, including sorting
@@ -46,7 +46,7 @@ static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) ClcContact* CreateClcContact(void)
{
ClcContact* p = (ClcContact*)mir_calloc(sizeof(ClcContact));
- if (p != NULL)
+ if (p != nullptr)
p->avatarLeft = p->extraIconRightBegin = p->xStatusIcon = -1;
return p;
@@ -82,15 +82,15 @@ void LoadAvatarForContact(ClcContact *p) else
p->cFlags = (dwFlags & ECF_FORCEAVATAR ? p->cFlags | ECF_AVATAR : p->cFlags & ~ECF_AVATAR);
- p->ace = NULL;
+ p->ace = nullptr;
if (cfg::dat.bAvatarServiceAvail && (p->cFlags & ECF_AVATAR) && (!cfg::dat.bNoOfflineAvatars || p->wStatus != ID_STATUS_OFFLINE)) {
p->ace = (struct AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)p->hContact, 0);
- if (p->ace != NULL && p->ace->cbSize != sizeof(struct AVATARCACHEENTRY))
- p->ace = NULL;
- if (p->ace != NULL)
+ if (p->ace != nullptr && p->ace->cbSize != sizeof(struct AVATARCACHEENTRY))
+ p->ace = nullptr;
+ if (p->ace != nullptr)
p->ace->t_lastAccess = cfg::dat.t_now;
}
- if (p->ace == NULL)
+ if (p->ace == nullptr)
p->cFlags &= ~ECF_AVATAR;
}
@@ -112,14 +112,14 @@ ClcContact* AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hCo }
else {
p->iImage = pcli->pfnGetContactIcon(hContact);
- p->metaProto = NULL;
+ p->metaProto = nullptr;
}
p->codePage = db_get_dw(hContact, "Tab_SRMsg", "ANSIcodepage", db_get_dw(hContact, "UserInfo", "ANSIcodepage", CP_ACP));
p->bSecondLine = db_get_b(hContact, "CList", "CLN_2ndline", cfg::dat.dualRowMode);
if (dat->bisEmbedded)
- p->pExtra = 0;
+ p->pExtra = nullptr;
else {
p->pExtra = cfg::getCache(p->hContact, p->proto);
GetExtendedInfo(p, dat);
@@ -156,7 +156,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto)
{
- if (p == NULL)
+ if (p == nullptr)
return 0;
p->bStatusMsgValid = STATUSMSG_NOTFOUND;
@@ -241,7 +241,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) }
}
- if (p->hTimeZone == NULL)
+ if (p->hTimeZone == nullptr)
TZ_LoadTimeZone(hContact, p);
return p->bStatusMsgValid;
}
@@ -249,10 +249,10 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) void ReloadExtraInfo(MCONTACT hContact)
{
if (hContact && pcli->hwndContactTree) {
- TExtraCache *p = cfg::getCache(hContact, NULL);
+ TExtraCache *p = cfg::getCache(hContact, nullptr);
if (p) {
TZ_LoadTimeZone(hContact, p);
- InvalidateRect(pcli->hwndContactTree, NULL, FALSE);
+ InvalidateRect(pcli->hwndContactTree, nullptr, FALSE);
}
}
}
@@ -270,9 +270,9 @@ void RTL_DetectAndSet(ClcContact *contact, MCONTACT hContact) memset(infoTypeC2, 0, sizeof(infoTypeC2));
- if (contact == NULL) {
+ if (contact == nullptr) {
szText = pcli->pfnGetContactDisplayName(hContact, 0);
- p = cfg::getCache(hContact, NULL);
+ p = cfg::getCache(hContact, nullptr);
}
else {
szText = contact->szText;
@@ -316,14 +316,14 @@ void RTL_DetectGroupName(ClcContact *group) void GetExtendedInfo(ClcContact *contact, ClcData *dat)
{
- if (dat->bisEmbedded || contact == NULL)
+ if (dat->bisEmbedded || contact == nullptr)
return;
- if (contact->proto == NULL || contact->hContact == 0)
+ if (contact->proto == nullptr || contact->hContact == 0)
return;
TExtraCache *p = contact->pExtra;
- if (p == NULL)
+ if (p == nullptr)
return;
p->msgFrequency = db_get_dw(contact->hContact, "CList", "mf_freq", 0x7fffffff);
@@ -339,7 +339,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry) MCONTACT hContact = cEntry->hContact;
if (db_get_b(hContact, "EXTBK", "VALID", 0)) {
- if (cEntry->status_item == NULL)
+ if (cEntry->status_item == nullptr)
cEntry->status_item = reinterpret_cast<StatusItems_t *>(malloc(sizeof(StatusItems_t)));
memset(cEntry->status_item, 0, sizeof(StatusItems_t));
mir_strcpy(cEntry->status_item->szName, "{--CONTACT--}"); // mark as "per contact" item
@@ -363,7 +363,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry) }
else if (cEntry->status_item) {
free(cEntry->status_item);
- cEntry->status_item = NULL;
+ cEntry->status_item = nullptr;
}
}
@@ -378,13 +378,13 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, struct ClcData int dbHidden = db_get_b(hContact, "CList", "Hidden", 0); // default hidden state, always respect it.
// always hide subcontacts (but show them on embedded contact lists)
- if (dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact))
+ if (dat != nullptr && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact))
return 1;
if (!cfg::dat.bFilterEffective)
return dbHidden;
- if (szProto == NULL)
+ if (szProto == nullptr)
szProto = GetContactProto(hContact);
// check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set).
if (cfg::dat.bFilterEffective & CLVM_STICKY_CONTACTS) {
diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 3250d07ef1..d7f776e607 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -33,7 +33,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM {
ClcContact *contact;
ClcGroup *group;
- if (wParam == 0 || !Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL))
+ if (wParam == 0 || !Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr))
return 0;
if (lParam)
@@ -45,8 +45,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_GETSTATUSMSG:
if (wParam) {
- ClcContact *contact = NULL;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ ClcContact *contact = nullptr;
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
if (contact->type != CLCIT_CONTACT)
@@ -64,8 +64,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEPRIORITYCONTACT:
if (wParam) {
- ClcContact *contact = NULL;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ ClcContact *contact = nullptr;
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
if (contact->type != CLCIT_CONTACT)
return 0;
@@ -77,8 +77,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_QUERYPRIORITYCONTACT:
if (wParam) {
- ClcContact *contact = NULL;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ ClcContact *contact = nullptr;
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
if (contact->type != CLCIT_CONTACT)
return 0;
@@ -96,7 +96,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM RowHeight::getMaxRowHeight(dat, hwnd);
if (LOWORD(lParam))
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
return 0;
case CLM_ISMULTISELECT:
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 6a9b10a5b8..199026fc71 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -83,7 +83,7 @@ static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *value TVINSERTSTRUCT tvis;
int i;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
for (i = 0; i < nValues; i++) {
@@ -457,7 +457,7 @@ static INT_PTR CALLBACK DlgProcDspAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam KillTimer(pcli->hwndContactTree, TIMERID_REFRESH);
if (cfg::dat.bShowLocalTime)
- SetTimer(pcli->hwndContactTree, TIMERID_REFRESH, 65000, NULL);
+ SetTimer(pcli->hwndContactTree, TIMERID_REFRESH, 65000, nullptr);
cfg::dat.dualRowMode = (BYTE)SendDlgItemMessage(hwndDlg, IDC_DUALROWMODE, CB_GETCURSEL, 0, 0);
if (cfg::dat.dualRowMode == CB_ERR)
@@ -750,7 +750,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 78d4f341fa..28c0c73405 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -225,7 +225,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc) else {
HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
DrawText(hDC, TranslateT("No events..."), -1, rc, DT_VCENTER | DT_SINGLELINE);
- DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
+ DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, nullptr, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
}
@@ -251,7 +251,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int LONG bmWidth, bmHeight;
float dAspect;
HBITMAP hbm, hbmOldAV;
- HRGN rgn = 0;
+ HRGN rgn = nullptr;
int avatar_size = cfg::dat.avatarSize;
DWORD av_saved_left;
StatusItems_t *item = contact->wStatus == ID_STATUS_OFFLINE ? arStatusItems[ID_EXTBKAVATARFRAMEOFFLINE - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKAVATARFRAME - ID_STATUS_OFFLINE];
@@ -262,7 +262,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int if (!cfg::dat.bAvatarServiceAvail || dat->bisEmbedded)
return 0;
- if (contact->ace != NULL && contact->ace->cbSize == sizeof(struct AVATARCACHEENTRY)) {
+ if (contact->ace != nullptr && contact->ace->cbSize == sizeof(struct AVATARCACHEENTRY)) {
if (contact->ace->dwFlags & AVS_HIDEONCLIST)
return (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? avatar_size + 2 : 0;
@@ -277,7 +277,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int }
else return (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? avatar_size + 2 : 0;
- if (bmHeight == 0 || bmWidth == 0 || hbm == 0)
+ if (bmHeight == 0 || bmWidth == 0 || hbm == nullptr)
return 0;
g_maxAV_X = max(bmWidth, g_maxAV_X);
@@ -344,15 +344,15 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int fOverlay = (dwFlags & ECF_FORCEOVERLAY) ? 1 : 0;
if (fOverlay && cstatus && (int)newHeight >= g_cysmIcon)
- DrawIconEx(hdcMem, rc->left + (int)newWidth - 15, y + topoffset + (int)newHeight - 15, overlayicons[cstatus - ID_STATUS_OFFLINE], g_cxsmIcon, g_cysmIcon, 0, 0, DI_NORMAL | DI_COMPAT);
+ DrawIconEx(hdcMem, rc->left + (int)newWidth - 15, y + topoffset + (int)newHeight - 15, overlayicons[cstatus - ID_STATUS_OFFLINE], g_cxsmIcon, g_cysmIcon, 0, nullptr, DI_NORMAL | DI_COMPAT);
- SelectClipRgn(hdcMem, NULL);
+ SelectClipRgn(hdcMem, nullptr);
DeleteObject(rgn);
if (!item->IGNORED) {
RECT rcFrame;
BOOL inClCPaint_save = g_inCLCpaint;
- HDC hdcTemp = 0;
+ HDC hdcTemp = nullptr;
HBITMAP hbmOld, hbmTemp;
g_inCLCpaint = FALSE;
@@ -412,7 +412,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in DWORD leftOffset = 0, rightOffset = 0;
int iconXSpace = dat->iconXSpace;
//BOOL xStatusValid = 0;
- HFONT hPreviousFont = 0;
+ HFONT hPreviousFont = nullptr;
COLORREF oldGroupColor = -1;
DWORD qLeft = 0;
int leftX = dat->leftMargin + indent * dat->groupIndent;
@@ -426,7 +426,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in rowHeight -= cfg::dat.bRowSpacing;
savedCORNER = -1;
- if (group == NULL || contact == NULL)
+ if (group == nullptr || contact == nullptr)
return;
g_RTL = FALSE;
@@ -499,7 +499,7 @@ set_bg_l: else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- wchar_t *szCounts = NULL;
+ wchar_t *szCounts = nullptr;
if (type == CLCIT_GROUP) {
GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_wstrlen(contact->szText), &textSize);
int width = textSize.cx;
@@ -589,7 +589,7 @@ set_bg_l: // check for special cases (first item, single item, last item)
// this will only change the shape for this status. Color will be blended over with ALPHA value
- if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.getCount() == 1 && group->parent != NULL) {
+ if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.getCount() == 1 && group->parent != nullptr) {
rc.left = ssingleitem->MARGIN_LEFT + bg_indent_l;
rc.top = y + ssingleitem->MARGIN_TOP;
rc.right = clRect->right - ssingleitem->MARGIN_RIGHT - bg_indent_r;
@@ -613,7 +613,7 @@ set_bg_l: if (check_selected)
DrawAlpha(hdcMem, &rc, ssingleitem->COLOR, ssingleitem->ALPHA, ssingleitem->COLOR2, ssingleitem->COLOR2_TRANSPARENT, ssingleitem->GRADIENT, ssingleitem->CORNER, ssingleitem->BORDERSTYLE, ssingleitem->imageItem);
}
- else if (scanIndex == 0 && group->cl.getCount() > 1 && !sfirstitem->IGNORED && group->parent != NULL) {
+ else if (scanIndex == 0 && group->cl.getCount() > 1 && !sfirstitem->IGNORED && group->parent != nullptr) {
rc.left = sfirstitem->MARGIN_LEFT + bg_indent_l;
rc.top = y + sfirstitem->MARGIN_TOP;
rc.right = clRect->right - sfirstitem->MARGIN_RIGHT - bg_indent_r;
@@ -637,7 +637,7 @@ set_bg_l: if (check_selected)
DrawAlpha(hdcMem, &rc, sfirstitem->COLOR, sfirstitem->ALPHA, sfirstitem->COLOR2, sfirstitem->COLOR2_TRANSPARENT, sfirstitem->GRADIENT, sfirstitem->CORNER, sfirstitem->BORDERSTYLE, sfirstitem->imageItem);
}
- else if (scanIndex == group->cl.getCount() - 1 && !slastitem->IGNORED && group->parent != NULL) {
+ else if (scanIndex == group->cl.getCount() - 1 && !slastitem->IGNORED && group->parent != nullptr) {
// last item of group
rc.left = slastitem->MARGIN_LEFT + bg_indent_l;
rc.top = y + slastitem->MARGIN_TOP;
@@ -663,7 +663,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, slastitem->COLOR, slastitem->ALPHA, slastitem->COLOR2, slastitem->COLOR2_TRANSPARENT, slastitem->GRADIENT, slastitem->CORNER, slastitem->BORDERSTYLE, slastitem->imageItem);
}
// --- Non-grouped items ---
- else if (type != CLCIT_GROUP && group->parent == NULL && !sfirstitem_NG->IGNORED && scanIndex != group->cl.getCount() - 1 && !(*bFirstNGdrawn)) {
+ else if (type != CLCIT_GROUP && group->parent == nullptr && !sfirstitem_NG->IGNORED && scanIndex != group->cl.getCount() - 1 && !(*bFirstNGdrawn)) {
// first NON-grouped
*bFirstNGdrawn = TRUE;
rc.left = sfirstitem_NG->MARGIN_LEFT + bg_indent_l;
@@ -689,7 +689,7 @@ set_bg_l: if (check_selected)
DrawAlpha(hdcMem, &rc, sfirstitem_NG->COLOR, sfirstitem_NG->ALPHA, sfirstitem_NG->COLOR2, sfirstitem_NG->COLOR2_TRANSPARENT, sfirstitem_NG->GRADIENT, sfirstitem_NG->CORNER, sfirstitem->BORDERSTYLE, sfirstitem->imageItem);
}
- else if (type != CLCIT_GROUP && group->parent == NULL && !slastitem_NG->IGNORED && scanIndex == group->cl.getCount() - 1 && (*bFirstNGdrawn)) {
+ else if (type != CLCIT_GROUP && group->parent == nullptr && !slastitem_NG->IGNORED && scanIndex == group->cl.getCount() - 1 && (*bFirstNGdrawn)) {
// last item of list (NON-group)
// last NON-grouped
rc.left = slastitem_NG->MARGIN_LEFT + bg_indent_l;
@@ -715,7 +715,7 @@ set_bg_l: if (check_selected)
DrawAlpha(hdcMem, &rc, slastitem_NG->COLOR, slastitem_NG->ALPHA, slastitem_NG->COLOR2, slastitem_NG->COLOR2_TRANSPARENT, slastitem_NG->GRADIENT, slastitem_NG->CORNER, slastitem->BORDERSTYLE, slastitem->imageItem);
}
- else if (type != CLCIT_GROUP && group->parent == NULL && !slastitem_NG->IGNORED && !(*bFirstNGdrawn)) {
+ else if (type != CLCIT_GROUP && group->parent == nullptr && !slastitem_NG->IGNORED && !(*bFirstNGdrawn)) {
// single item of NON-group
// single NON-grouped
rc.left = ssingleitem_NG->MARGIN_LEFT + bg_indent_l;
@@ -848,11 +848,11 @@ bgskipped: rcContent.right = clRect->right - dat->rightMargin;
twoRows = ((dat->fontInfo[FONTID_STATUS].fontHeight + fontHeight <= rowHeight + 1) && (contact->bSecondLine != MULTIROW_NEVER)) && !dat->bisEmbedded;
- pi_avatar = !dat->bisEmbedded && type == CLCIT_CONTACT && (contact->cFlags & ECF_AVATAR) && contact->ace != 0 && !(contact->ace->dwFlags & AVS_HIDEONCLIST);
+ pi_avatar = !dat->bisEmbedded && type == CLCIT_CONTACT && (contact->cFlags & ECF_AVATAR) && contact->ace != nullptr && !(contact->ace->dwFlags & AVS_HIDEONCLIST);
//checkboxes
if (checkboxWidth) {
- HANDLE hTheme = 0;
+ HANDLE hTheme = nullptr;
if (IS_THEMED)
hTheme = OpenThemeData(hwnd, L"BUTTON");
@@ -864,7 +864,7 @@ bgskipped: if (hTheme) {
DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, flags & CONTACTF_CHECKED ? (g_hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (g_hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc2, &rc2);
CloseThemeData(hTheme);
- hTheme = 0;
+ hTheme = nullptr;
}
else DrawFrameControl(hdcMem, &rc2, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0));
@@ -1136,7 +1136,7 @@ bgskipped: rc2.left = rcContent.right - szTime.cx - 2;
}
DrawText(hdcMem, szResult, -1, &rc2, DT_NOPREFIX | DT_NOCLIP | DT_SINGLELINE);
- ChangeToFont(hdcMem, dat, idOldFont, 0);
+ ChangeToFont(hdcMem, dat, idOldFont, nullptr);
SetTextColor(hdcMem, oldColor);
verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1);
@@ -1278,11 +1278,11 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) hbmTempAV = CreateCompatibleBitmap(g_HDC, g_maxAV_X, g_maxAV_Y);
hbmTempOldAV = reinterpret_cast<HBITMAP>(SelectObject(hdcTempAV, hbmTempAV));
- cfg::dat.t_now = time(NULL);
+ cfg::dat.t_now = time(nullptr);
GetSystemTime(&cfg::dat.st);
SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft);
- cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (GdiGradientFill != 0);
+ cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (GdiGradientFill != nullptr);
av_left = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSLEFT);
av_right = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSRIGHT);
@@ -1300,7 +1300,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS)
grey = 1;
GetClientRect(hwnd, &clRect);
- if (rcPaint == NULL)
+ if (rcPaint == nullptr)
rcPaint = &clRect;
if (IsRectEmpty(rcPaint)) {
SelectObject(hdcTempAV, hbmTempOldAV);
@@ -1313,7 +1313,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) int y = -dat->yScroll;
HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
+ HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr);
HBITMAP hOldBitmap = reinterpret_cast<HBITMAP>(SelectObject(hdcMem, hBmpOsb));
@@ -1414,7 +1414,7 @@ bgdone: ClcGroup *group = &dat->list;
group->scanIndex = 0;
- if (dat->row_heights == NULL)
+ if (dat->row_heights == nullptr)
RowHeight::calcRowHeights(dat, hwnd);
group = &dat->list;
@@ -1423,7 +1423,7 @@ bgdone: g_list_avatars = 0;
while (true) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
group->scanIndex++;
continue;
@@ -1448,7 +1448,7 @@ bgdone: int indent = 0;
for (int index = 0; y < rcPaint->bottom;) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
group->scanIndex++;
indent--;
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 81b1839869..c898aec8c3 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -115,7 +115,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac right = clRect.right;
// avatar check
- if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1)
+ if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != nullptr && hitcontact->avatarLeft != -1)
if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize)
if (flags)
*flags |= CLCHT_ONAVATAR;
@@ -196,8 +196,8 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags)
{
- ClcContact *hitcontact = NULL;
- ClcGroup *hitgroup = NULL;
+ ClcContact *hitcontact = nullptr;
+ ClcGroup *hitgroup = nullptr;
int indent, width, i;
int checkboxWidth;
SIZE textSize;
@@ -256,7 +256,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c }
// avatar check
- if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
+ if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != nullptr && hitcontact->avatarLeft != -1) {
if (testx > hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) {
if (flags)
*flags |= CLCHT_ONAVATAR;
@@ -366,10 +366,10 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) if (nowTick >= startTick + dat->scrollTime)
break;
dat->yScroll = oldy + (desty - oldy) * (int)(nowTick - startTick) / dat->scrollTime;
- if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL)
- ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE);
+ if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr)
+ ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
else
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
previousy = dat->yScroll;
if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
@@ -379,14 +379,14 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) }
}
dat->yScroll = desty;
- if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) {
+ if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr) {
if (!noSmooth)
- ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE);
+ ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
else
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
}
else
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
@@ -453,7 +453,7 @@ void SetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newStat return;
group->expanded = newState != 0;
}
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
contentCount = pcli->pfnGetGroupContentsCount(group, 1);
groupy = pcli->pfnGetRowsPriorTo(&dat->list, group, -1);
@@ -536,7 +536,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) if (h < dat->fontInfo[i].fontHeight + 2) h = dat->fontInfo[i].fontHeight + 2;
}
- dat->hwndRenameEdit = CreateWindowEx(0, L"RICHEDIT50W", contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, NULL, g_hInst, NULL);
+ dat->hwndRenameEdit = CreateWindowEx(0, L"RICHEDIT50W", contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, nullptr, g_hInst, nullptr);
{
if ((contact->type == CLCIT_CONTACT && contact->pExtra->dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) {
PARAFORMAT2 pf2;
@@ -599,8 +599,8 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) if (cfg::dat.hdcPic) {
SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld);
DeleteDC(cfg::dat.hdcPic);
- cfg::dat.hdcPic = 0;
- cfg::dat.hbmPicOld = 0;
+ cfg::dat.hdcPic = nullptr;
+ cfg::dat.hbmPicOld = nullptr;
}
}
@@ -618,14 +618,14 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) char wpbuf[MAX_PATH];
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
- dat->hBmpBackground = NULL;
+ dat->hBmpBackground = nullptr;
}
SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, wpbuf, 0);
// we have a wallpaper string
if (wpbuf[0] != 0)
- dat->hBmpBackground = reinterpret_cast<HBITMAP>(LoadImageA(NULL, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE));
+ dat->hBmpBackground = reinterpret_cast<HBITMAP>(LoadImageA(nullptr, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE));
cfg::dat.bmpBackground = dat->hBmpBackground;
if (cfg::dat.bmpBackground) {
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index e2cd2825d2..c56e691fa1 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -25,14 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "cluiframes.h"
-static HWND hwndEventFrame = 0;
+static HWND hwndEventFrame = nullptr;
HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight);
extern FRAMEWND *wndFrameEventArea;
extern HPEN g_hPenCLUIFrames;
-HWND g_hwndEventArea = 0;
+HWND g_hwndEventArea = nullptr;
struct CListImlIcon
{
@@ -71,7 +71,7 @@ static CLISTEVENT* MyGetEvent(int iSelection) if (p.menuId == iSelection)
return &p;
}
- return NULL;
+ return nullptr;
}
LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -110,7 +110,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (dis->hwndItem == (HWND)cfg::dat.hMenuNotify) {
MENUITEMINFOA mii = { 0 };
- struct NotifyMenuItemExData *nmi = 0;
+ struct NotifyMenuItemExData *nmi = nullptr;
int iIcon;
HICON hIcon;
@@ -136,7 +136,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_COMMAND:
if (LOWORD(wParam) == IDC_NOTIFYBUTTON) {
int iSelection;
- struct NotifyMenuItemExData *nmi = 0;
+ struct NotifyMenuItemExData *nmi = nullptr;
int iCount = GetMenuItemCount(cfg::dat.hMenuNotify);
POINT pt;
@@ -146,7 +146,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
if (iCount > 1)
- iSelection = TrackPopupMenu(cfg::dat.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ iSelection = TrackPopupMenu(cfg::dat.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
else
iSelection = GetMenuItemID(cfg::dat.hMenuNotify, 0);
@@ -156,12 +156,12 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (nmi) {
CLISTEVENT *cle = MyGetEvent(iSelection);
if (cle) {
- CLISTEVENT *cle1 = NULL;
+ CLISTEVENT *cle1 = nullptr;
CallService(cle->pszService, (WPARAM)NULL, (LPARAM)cle);
// re-obtain the pointer, it may already be invalid/point to another event if the
// event we're interested in was removed by the service (nasty one...)
cle1 = MyGetEvent(iSelection);
- if (cle1 != NULL)
+ if (cle1 != nullptr)
pcli->pfnRemoveEvent(cle->hContact, cle->hDbEvent);
}
}
@@ -186,7 +186,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa HBITMAP hbmold = reinterpret_cast<HBITMAP>(SelectObject(hdcMem, hbm));
SetBkMode(hdcMem, TRANSPARENT);
- HFONT hFontOld = 0;
+ HFONT hFontOld = nullptr;
if (cfg::clcdat) {
int height;
hFontOld = ChangeToFont(hdcMem, cfg::clcdat, FONTID_EVENTAREA, &height);
@@ -247,7 +247,7 @@ CListEvent* AddEvent(CLISTEVENT *cle) for (int j = 0; j < GetMenuItemCount(cfg::dat.hMenuNotify); j++) {
if (GetMenuItemInfo(cfg::dat.hMenuNotify, j, TRUE, &mii) != 0) {
NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)mii.dwItemData;
- if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex)
+ if (nmi != nullptr && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex)
return p;
}
}
@@ -304,7 +304,7 @@ CListEvent* AddEvent(CLISTEVENT *cle) HideShowNotifyFrame();
}
}
- InvalidateRect(hwndEventFrame, NULL, FALSE);
+ InvalidateRect(hwndEventFrame, nullptr, FALSE);
return p;
}
@@ -363,7 +363,7 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) cfg::dat.hUpdateContact = 0;
if (cfg::dat.notifyActive)
- InvalidateRect(hwndEventFrame, NULL, FALSE);
+ InvalidateRect(hwndEventFrame, nullptr, FALSE);
return res;
}
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 7f33b59866..0aef011081 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -45,7 +45,7 @@ INT_PTR CloseAction(WPARAM, LPARAM) return 0;
}
-static MWindowList hWindowListIGN = 0;
+static MWindowList hWindowListIGN = nullptr;
// dialog procedure for handling the contact ignore dialog (available from the contact menu
static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -56,7 +56,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_INITDIALOG:
{
DWORD dwMask;
- ClcContact *contact = NULL;
+ ClcContact *contact = nullptr;
int pCaps;
HWND hwndAdd;
@@ -91,7 +91,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message"));
if (cfg::clcdat) {
- Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL);
+ Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr);
if (contact && contact->type != CLCIT_CONTACT) {
DestroyWindow(hWnd);
return FALSE;
@@ -192,7 +192,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case IDOK:
{
DWORD newMask = 0;
- ClcContact *contact = NULL;
+ ClcContact *contact = nullptr;
SendMessage(hWnd, WM_USER + 110, 0, (LPARAM)&newMask);
db_set_dw(hContact, "Ignore", "Mask1", newMask);
@@ -203,7 +203,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA DWORD dwFlags = db_get_dw(hContact, "CList", "CLN_Flags", 0), dwXMask = 0;
LRESULT checked = 0;
- Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL);
+ Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr);
if (iSel != CB_ERR) {
dwFlags &= ~(ECF_FORCEAVATAR | ECF_HIDEAVATAR);
@@ -249,7 +249,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA contact->pExtra->dwDFlags = dwFlags;
}
else {
- TExtraCache *p = cfg::getCache(hContact, NULL);
+ TExtraCache *p = cfg::getCache(hContact, nullptr);
if (p)
p->dwDFlags = dwFlags;
}
@@ -289,8 +289,8 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_USER + 120: // set visibility status
{
- ClcContact *contact = NULL;
- if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) {
+ ClcContact *contact = nullptr;
+ if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr)) {
if (contact) {
WORD wApparentMode = db_get_w(contact->hContact, contact->proto, "ApparentMode", 0);
@@ -303,9 +303,9 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_USER + 130: // update apparent mode
{
- ClcContact *contact = NULL;
+ ClcContact *contact = nullptr;
- if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) {
+ if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr)) {
if (contact) {
WORD wApparentMode = 0;
@@ -343,15 +343,15 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM)
{
- HWND hWnd = 0;
+ HWND hWnd = nullptr;
- if (hWindowListIGN == 0)
+ if (hWindowListIGN == nullptr)
hWindowListIGN = WindowList_Create();
hWnd = WindowList_Find(hWindowListIGN, wParam);
if (wParam) {
- if (hWnd == 0)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), 0, IgnoreDialogProc, (LPARAM)wParam);
+ if (hWnd == nullptr)
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), nullptr, IgnoreDialogProc, (LPARAM)wParam);
else if (IsWindow(hWnd))
SetFocus(hWnd);
}
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index f064fe4a3a..782ada2086 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -40,13 +40,13 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON *phIcon)
{
- if (phIcon != NULL)
- *phIcon = NULL;
+ if (phIcon != nullptr)
+ *phIcon = nullptr;
char *szFinalProto;
int finalStatus;
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
MCONTACT hSubContact = db_mc_getMostOnline(hContact);
szFinalProto = GetContactProto(hSubContact);
finalStatus = (status == 0) ? (WORD)db_get_w(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status;
@@ -57,7 +57,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON finalStatus = status;
}
- if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) {
+ if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != nullptr) {
if (szProto) {
char szBuf[128];
mir_snprintf(szBuf, "%s_conn", szProto);
@@ -100,9 +100,9 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) POINT pt = { 0 };
register int i = 0, j = 0, width = 0, height = 0, iCountedDots = 0, iNotCoveredDots = 0;
BOOL bPartiallyCovered = FALSE;
- HWND hAux = 0;
+ HWND hAux = nullptr;
- if (hWnd == NULL) {
+ if (hWnd == nullptr) {
SetLastError(0x00000006); //Wrong handle
return -1;
}
@@ -111,7 +111,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (IsIconic(hWnd) || !IsWindowVisible(hWnd))
return GWVS_HIDDEN;
- HRGN rgn = 0;
+ HRGN rgn = nullptr;
POINT ptOrig;
RECT rcClient;
int clip = (int)cfg::dat.bClipBorder;
@@ -153,7 +153,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) for (j = rc.left + clip; j < rc.right; j += (width / iStepX)) {
pt.x = j;
hAux = WindowFromPoint(pt);
- while (GetParent(hAux) != NULL)
+ while (GetParent(hAux) != nullptr)
hAux = GetParent(hAux);
if (hAux != hWnd && hAux) //There's another window!
bPartiallyCovered = TRUE;
diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index ce0708eb27..c2aa4a74d8 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
MCONTACT hContact = wParam;
DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg))
+ if (hContact == NULL && ws != nullptr && ws->szModule != nullptr && ws->szSetting != nullptr && strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg))
CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED);
}
break;
diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 7196bb68e4..7669cfc678 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -44,31 +44,31 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
return pcli->pfnTrayIconSetBaseInfo(hIcon, szChangedProto);
}
- if (pcli->trayIcon == NULL || pcli->trayIcon[0].szProto == NULL) {
- iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);
+ if (pcli->trayIcon == nullptr || pcli->trayIcon[0].szProto == nullptr) {
+ iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
+ return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr);
}
pcli->pfnTrayIconDestroy(hwnd);
pcli->pfnTrayIconInit(hwnd);
}
else {
- iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);
+ iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
+ return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr);
}
}
else {
switch (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT)) {
case SETTING_TRAYICON_CYCLE:
iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon);
- pcli->cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc);
+ pcli->cycleTimerId = SetTimer(nullptr, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
+ return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr);
case SETTING_TRAYICON_MULTI:
if (!pcli->trayIcon)
- pcli->pfnTrayIconRemove(NULL, NULL);
+ pcli->pfnTrayIconRemove(nullptr, nullptr);
else if (db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) {
iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
@@ -82,14 +82,14 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus"));
iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
+ return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr);
}
}
}
else {
- iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);
+ iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
+ return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr);
}
return -1;
diff --git a/plugins/Clist_nicer/src/clnplus.cpp b/plugins/Clist_nicer/src/clnplus.cpp index b150537963..789f599d34 100644 --- a/plugins/Clist_nicer/src/clnplus.cpp +++ b/plugins/Clist_nicer/src/clnplus.cpp @@ -11,7 +11,7 @@ void RemoveFromTaskBar(HWND hWnd)
{
CComPtr<ITaskbarList> pTaskbarList;
- if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER)))
+ if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER)))
if (SUCCEEDED(pTaskbarList->HrInit()))
pTaskbarList->DeleteTab(hWnd);
}
@@ -19,7 +19,7 @@ void RemoveFromTaskBar(HWND hWnd) void AddToTaskBar(HWND hWnd)
{
CComPtr<ITaskbarList> pTaskbarList;
- if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER)))
+ if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER)))
if (SUCCEEDED(pTaskbarList->HrInit()))
pTaskbarList->AddTab(hWnd);
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 85bd05e0a4..9bdcd016e6 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -79,8 +79,8 @@ POINT g_oldPos = { 0 }; int during_sizing = 0; extern int dock_prevent_moving; -static HDC hdcLockedPoint = 0; -static HBITMAP hbmLockedPoint = 0, hbmOldLockedPoint = 0; +static HDC hdcLockedPoint = nullptr; +static HBITMAP hbmLockedPoint = nullptr, hbmOldLockedPoint = nullptr; HICON overlayicons[10]; @@ -118,7 +118,7 @@ static void LayoutButtons(HWND hwnd, RECT *rc) BYTE delta = left_offset + right_offset; ButtonItem *btnItems = g_ButtonItems; - if (rc == NULL) + if (rc == nullptr) GetClientRect(hwnd, &rect); else rect = *rc; @@ -130,15 +130,15 @@ static void LayoutButtons(HWND hwnd, RECT *rc) LONG x = (btnItems->xOff >= 0) ? rect.left + btnItems->xOff : rect.right - abs(btnItems->xOff); LONG y = (btnItems->yOff >= 0) ? rect.top + btnItems->yOff : rect.bottom - cfg::dat.statusBarHeight; - SetWindowPos(btnItems->hWnd, 0, x, y, btnItems->width, btnItems->height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); + SetWindowPos(btnItems->hWnd, nullptr, x, y, btnItems->width, btnItems->height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); btnItems = btnItems->nextItem; } } - SetWindowPos(hTbMenu, 0, 2 + left_offset, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, + SetWindowPos(hTbMenu, nullptr, 2 + left_offset, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, 21 * 3, 21 + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); - SetWindowPos(hTbGlobalStatus, 0, left_offset + (3 * 21) + 3, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, + SetWindowPos(hTbGlobalStatus, nullptr, left_offset + (3 * 21) + 3, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, rect.right - delta - (3 * 21 + 5), 21 + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); } @@ -152,7 +152,7 @@ static int FS_FontsChanged(WPARAM, LPARAM) g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, clr_cluiframes); pcli->pfnClcOptionsChanged(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -166,7 +166,7 @@ static HWND PreCreateCLC(HWND parent) | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0) | (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0) | CLS_MULTICOLUMN, - 0, 0, 0, 0, parent, NULL, g_hInst, (LPVOID)0xff00ff00); + 0, 0, 0, 0, parent, nullptr, g_hInst, (LPVOID)0xff00ff00); cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); return pcli->hwndContactTree; @@ -187,7 +187,7 @@ static int CreateCLC() frame.height = 20; frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_UNICODE; frame.align = alBottom; - frame.hWnd = CreateWindowExA(0, "EventAreaClass", "evt", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, NULL); + frame.hWnd = CreateWindowExA(0, "EventAreaClass", "evt", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr); g_hwndEventArea = frame.hWnd; hNotifyFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hNotifyFrame, FU_FMPOS); @@ -224,15 +224,15 @@ static int CluiModulesLoaded(WPARAM, LPARAM) return 0; } -static HICON hIconSaved = 0; +static HICON hIconSaved = nullptr; void ClearIcons(int mode) { for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) { - if (overlayicons[i - IDI_OVL_OFFLINE] != 0) { + if (overlayicons[i - IDI_OVL_OFFLINE] != nullptr) { if (mode) DestroyIcon(overlayicons[i - IDI_OVL_OFFLINE]); - overlayicons[i - IDI_OVL_OFFLINE] = 0; + overlayicons[i - IDI_OVL_OFFLINE] = nullptr; } } } @@ -259,7 +259,7 @@ static void InitIcoLib() Icon_RegisterT(g_hInst, LPGENW("Contact list") L"/" LPGENW("Overlay icons"), &icon, 1); } - PROTOACCOUNT **accs = NULL; + PROTOACCOUNT **accs = nullptr; int p_count = 0; Proto_EnumAccounts(&p_count, &accs); for (int k = 0; k < p_count; k++) { @@ -281,14 +281,14 @@ static int IcoLibChanged(WPARAM, LPARAM) void CreateButtonBar(HWND hWnd) { - hTbMenu = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBMENU, g_hInst, NULL); + hTbMenu = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBMENU, g_hInst, nullptr); CustomizeButton(hTbMenu, false, false, false); SetWindowText(hTbMenu, TranslateT("Menu")); SendMessage(hTbMenu, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MAINMENU)); SendMessage(hTbMenu, BUTTONSETSENDONDOWN, TRUE, 0); SendMessage(hTbMenu, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Open main menu"), 0); - hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBGLOBALSTATUS, g_hInst, NULL); + hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBGLOBALSTATUS, g_hInst, nullptr); CustomizeButton(hTbGlobalStatus, false, false, false); SetWindowText(hTbGlobalStatus, TranslateT("Offline")); SendMessage(hTbGlobalStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_STATUS_OFFLINE)); @@ -379,10 +379,10 @@ void SetDBButtonStates(MCONTACT hPassedContact) ButtonItem *buttonItem = g_ButtonItems; MCONTACT hContact = 0, hFinalContact = 0; char *szModule, *szSetting; - ClcContact *contact = 0; + ClcContact *contact = nullptr; if (cfg::clcdat && hPassedContact == 0) { - pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, NULL); + pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, nullptr); if (contact && contact->type == CLCIT_CONTACT) { hContact = contact->hContact; } @@ -475,7 +475,7 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) BITMAP *bmp = &cfg::dat.bminfoBg; LONG clip = cfg::dat.bClipBorder; - if (dat == 0) + if (dat == nullptr) return; SetStretchBltMode(hdc, HALFTONE); @@ -545,7 +545,7 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) for (x = rc->left; x < maxx; x += destw) StretchBlt(hdc, x, y, destw, desth, cfg::dat.hdcPic, bitx, bity, bmp->bmWidth, bmp->bmHeight, SRCCOPY); } - SelectClipRgn(hdc, NULL); + SelectClipRgn(hdc, nullptr); DeleteObject(my_rgn); } @@ -586,7 +586,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) if (Docking_IsDocked(0, 0)) return; - if (hFrameContactTree == 0) + if (hFrameContactTree == nullptr) return; maxHeight = db_get_b(NULL, "CLUI", "MaxSizeHeight", 75); @@ -632,14 +632,14 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) return; } KillTimer(hwnd, TIMERID_AUTOSIZE); - SetTimer(hwnd, TIMERID_AUTOSIZE, 100, 0); + SetTimer(hwnd, TIMERID_AUTOSIZE, 100, nullptr); } int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) { switch (nmcsbcd->hdr.code) { case NM_COOLSB_CUSTOMDRAW: - static HDC hdcScroll = 0; + static HDC hdcScroll = nullptr; static HBITMAP hbmScroll, hbmScrollOld; static LONG scrollLeft, scrollRight, scrollHeight, scrollYmin, scrollYmax; @@ -654,9 +654,9 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) case CDDS_ITEMPREPAINT: HDC hdc = nmcsbcd->hdc; - StatusItems_t *item = 0, *arrowItem = 0; + StatusItems_t *item = nullptr, *arrowItem = nullptr; UINT uItemID = ID_EXTBKSCROLLBACK; - HRGN rgn = 0; + HRGN rgn = nullptr; RECT rc; GetWindowRect(pcli->hwndContactTree, &rc); @@ -709,7 +709,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) DrawFrameControl(hdcScroll, &nmcsbcd->rect, DFC_SCROLL, (nmcsbcd->uItem == HTSCROLL_UP ? DFCS_SCROLLUP : DFCS_SCROLLDOWN) | dfcFlags); if (rgn) { - SelectClipRgn(hdcScroll, NULL); + SelectClipRgn(hdcScroll, nullptr); DeleteObject(rgn); } } @@ -738,7 +738,7 @@ static void ShowCLUI(HWND hwnd) SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); if (!db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) - SetMenu(pcli->hwndContactList, NULL); + SetMenu(pcli->hwndContactList, nullptr); if (state == SETTING_STATE_NORMAL) { SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); ShowWindow(pcli->hwndContactList, SW_SHOWNORMAL); @@ -782,7 +782,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int flags = WS_CHILD | CCS_BOTTOM; flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; - pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, hwnd, NULL, g_hInst, NULL); + pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, g_hInst, nullptr); if (flags & WS_VISIBLE) { ShowWindow(pcli->hwndStatus, SW_SHOW); SendMessage(pcli->hwndStatus, WM_SIZE, 0, 0); @@ -798,7 +798,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (!cfg::dat.bFirstRun) ConfigureEventArea(); ConfigureCLUIGeometry(0); - CluiProtocolStatusChanged(0, 0); + CluiProtocolStatusChanged(0, nullptr); for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) statusNames[i - ID_STATUS_OFFLINE] = pcli->pfnGetStatusModeDescription(i, 0); @@ -853,7 +853,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, style); ApplyCLUIBorderStyle(); - SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); } if (cfg::dat.bSkinnedButtonMode) @@ -906,7 +906,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l PAINTSTRUCT ps; RECT rcFrame, rcClient; HDC hdc; - HRGN rgn = 0; + HRGN rgn = nullptr; HDC hdcReal = BeginPaint(hwnd, &ps); if (during_sizing) @@ -948,7 +948,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l CopyRect(&rcFrame, &rcClient); if (g_CLUISkinnedBkColor) { if (cfg::dat.fOnDesktop) { - HDC dc = GetDC(0); + HDC dc = GetDC(nullptr); RECT rcWin; GetWindowRect(hwnd, &rcWin); @@ -990,7 +990,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l rcFrame.top += (cfg::dat.topOffset - 1); if (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN) { - if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { + if (cfg::dat.bWallpaperMode && cfg::clcdat != nullptr) { InflateRect(&rcFrame, -1, -1); if (cfg::dat.bmpBackground) BlitWallpaper(hdc, &rcFrame, cfg::clcdat); @@ -1002,7 +1002,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l rcFrame.bottom -= (cfg::dat.bottomOffset); DrawEdge(hdc, &rcFrame, BDR_SUNKENOUTER, BF_RECT); } - else if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { + else if (cfg::dat.bWallpaperMode && cfg::clcdat != nullptr) { if (cfg::dat.bmpBackground) BlitWallpaper(hdc, &rcFrame, cfg::clcdat); cfg::dat.ptW.x = cfg::dat.ptW.y = 0; @@ -1011,7 +1011,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l skipbg: BitBlt(hdcReal, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdc, 0, 0, SRCCOPY); if (rgn) { - SelectClipRgn(hdc, NULL); + SelectClipRgn(hdc, nullptr); DeleteObject(rgn); } EndPaint(hwnd, &ps); @@ -1049,12 +1049,12 @@ skipbg: break; case WM_WINDOWPOSCHANGING: - if (pcli->hwndContactList != NULL) { + if (pcli->hwndContactList != nullptr) { WINDOWPOS *wp = (WINDOWPOS *)lParam; if (!wp || (wp->flags & SWP_NOSIZE)) return FALSE; - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); during_sizing = true; new_window_rect.left = 0; @@ -1064,12 +1064,12 @@ skipbg: if (cfg::dat.dwFlags & CLUI_FRAME_SBARSHOW) { RECT rcStatus; - SetWindowPos(pcli->hwndStatus, 0, 0, new_window_rect.bottom - 20, new_window_rect.right, 20, SWP_NOZORDER); + SetWindowPos(pcli->hwndStatus, nullptr, 0, new_window_rect.bottom - 20, new_window_rect.right, 20, SWP_NOZORDER); GetWindowRect(pcli->hwndStatus, &rcStatus); cfg::dat.statusBarHeight = (rcStatus.bottom - rcStatus.top); if (wp->cx != g_oldSize.cx) SendMessage(hwnd, CLUIINTM_STATUSBARUPDATE, 0, 0); - RedrawWindow(pcli->hwndStatus, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(pcli->hwndStatus, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); } else cfg::dat.statusBarHeight = 0; @@ -1093,10 +1093,10 @@ skipbg: if (IsZoomed(hwnd)) ShowWindow(hwnd, SW_SHOWNORMAL); - if (pcli->hwndContactList != 0) { + if (pcli->hwndContactList != nullptr) { SendMessage(hwnd, WM_ENTERSIZEMOVE, 0, 0); GetWindowRect(hwnd, &rc); - WINDOWPOS wp = { 0 }; + WINDOWPOS wp = {}; wp.cx = rc.right - rc.left; wp.cy = rc.bottom - rc.top; wp.x = rc.left; @@ -1151,7 +1151,7 @@ skipbg: if ((HWND)wParam != hwnd) if (cfg::dat.isTransparent) if (transparentFocus) - SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); + SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr); } else { if (cfg::dat.isTransparent) { @@ -1169,7 +1169,7 @@ skipbg: if (!transparentFocus && GetForegroundWindow() != hwnd) { SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); transparentFocus = 1; - SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); + SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr); } } return DefWindowProc(hwnd, msg, wParam, lParam); @@ -1239,7 +1239,7 @@ skipbg: } else if (wParam == TIMERID_AUTOSIZE) { KillTimer(hwnd, wParam); - SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + SetWindowPos(hwnd, nullptr, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); PostMessage(hwnd, WM_SIZE, 0, 0); PostMessage(hwnd, CLUIINTM_REDRAW, 0, 0); } @@ -1273,7 +1273,7 @@ skipbg: SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? (COLORREF)cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)sourceAlpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); noRecurse = 1; ShowWindow(hwnd, SW_SHOW); - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); noRecurse = 0; } else { @@ -1335,11 +1335,11 @@ skipbg: WPARAM wwParam = 0; LPARAM llParam = 0; MCONTACT hContact = 0; - ClcContact *contact = 0; + ClcContact *contact = nullptr; int serviceFailure = FALSE; if (cfg::clcdat) { - pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, NULL); + pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, nullptr); if (contact && contact->type == CLCIT_CONTACT) hContact = contact->hContact; } @@ -1413,11 +1413,11 @@ skipbg: SendMessage(item->hWnd, BM_SETCHECK, 0, 0); } if (!contactOK) - MessageBox(0, TranslateT("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat."), TranslateT("Parameter mismatch"), MB_OK); + MessageBox(nullptr, TranslateT("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat."), TranslateT("Parameter mismatch"), MB_OK); if (serviceFailure) { wchar_t szError[512]; mir_snwprintf(szError, TranslateT("The service %S specified by the %S button definition was not found. You may need to install additional plugins."), item->szService, item->szName); - MessageBox(NULL, szError, TranslateT("Service failure"), MB_OK); + MessageBox(nullptr, szError, TranslateT("Service failure"), MB_OK); } break; } @@ -1431,14 +1431,14 @@ skipbg: case IDC_TBTOPMENU: case IDC_STBTOPMENU: GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc); - TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, nullptr); return 0; case IDC_TBTOPSTATUS: case IDC_STBTOPSTATUS: case IDC_TBGLOBALSTATUS: GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc); - TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, NULL); + TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, nullptr); return 0; case IDC_TBSOUND: @@ -1493,7 +1493,7 @@ buttons_done: case POPUP_NEWGROUP: SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0); SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0); - Clist_GroupCreate(NULL, NULL); + Clist_GroupCreate(NULL, nullptr); break; case POPUP_HIDEOFFLINE: case IDC_TBHIDEOFFLINE: @@ -1530,7 +1530,7 @@ buttons_done: break; } if (dwOldFlags != cfg::dat.dwFlags) { - InvalidateRect(pcli->hwndContactTree, NULL, FALSE); + InvalidateRect(pcli->hwndContactTree, nullptr, FALSE); db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags); if ((dwOldFlags & (CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_CLISTSUNKEN)) != (cfg::dat.dwFlags & (CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_CLISTSUNKEN))) { ConfigureFrame(); @@ -1598,7 +1598,7 @@ buttons_done: } if (PtInRect(&rc, pt)) { HMENU hMenu = Menu_BuildGroupMenu(); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr); Menu_DestroyNestedMenu(hMenu); return 0; } @@ -1609,7 +1609,7 @@ buttons_done: hMenu = Menu_GetMainMenu(); else hMenu = Menu_GetStatusMenu(); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr); return 0; } } @@ -1627,7 +1627,7 @@ buttons_done: { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (hbmLockedPoint == 0) { + if (hbmLockedPoint == nullptr) { hdcLockedPoint = CreateCompatibleDC(dis->hDC); hbmLockedPoint = CreateCompatibleBitmap(dis->hDC, 5, 5); hbmOldLockedPoint = reinterpret_cast<HBITMAP>(SelectObject(hdcLockedPoint, hbmLockedPoint)); @@ -1674,14 +1674,14 @@ buttons_done: x += (cfg::dat.bEqualSections ? (cfg::dat.bCLeft / 2) : cfg::dat.bCLeft); else if (pd->protopos == nParts - 1) x -= (cfg::dat.bCRight / 2); - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); if (db_get_b(NULL, "CLUI", "sbar_showlocked", 1)) { if (db_get_b(NULL, szProto, "LockMainStatus", 0)) { hIcon = Skin_LoadIcon(SKINICON_OTHER_STATUS_LOCKED); - if (hIcon != NULL) { - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, NULL, DI_NORMAL); + if (hIcon != nullptr) { + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); } } @@ -1739,11 +1739,11 @@ buttons_done: show_on_first_autosize = FALSE; ShowCLUI(hwnd); } - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; case CLUIINTM_STATUSBARUPDATE: - CluiProtocolStatusChanged(0, 0); + CluiProtocolStatusChanged(0, nullptr); return 0; case WM_THEMECHANGED: @@ -1755,13 +1755,13 @@ buttons_done: SelectObject(cfg::dat.hdcBg, cfg::dat.hbmBgOld); DeleteObject(cfg::dat.hbmBg); DeleteDC(cfg::dat.hdcBg); - cfg::dat.hdcBg = NULL; + cfg::dat.hdcBg = nullptr; } if (cfg::dat.bmpBackground) { SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld); DeleteDC(cfg::dat.hdcPic); DeleteObject(cfg::dat.bmpBackground); - cfg::dat.bmpBackground = NULL; + cfg::dat.bmpBackground = nullptr; } FreeProtocolData(); if (hdcLockedPoint) { @@ -1795,7 +1795,7 @@ static INT_PTR CLN_ShowMainMenu(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -1803,7 +1803,7 @@ static INT_PTR CLN_ShowStatusMenu(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -1820,10 +1820,10 @@ void LoadCLUIModule(void) wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = g_hInst; - wndclass.hIcon = 0; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hIcon = nullptr; + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)COLOR_3DFACE; - wndclass.lpszMenuName = 0; + wndclass.lpszMenuName = nullptr; wndclass.lpszClassName = L"EventAreaClass"; RegisterClass(&wndclass); @@ -1840,7 +1840,7 @@ void LoadCLUIModule(void) CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU, CLN_ShowStatusMenu); if (db_get_b(NULL, "CLUI", "FloaterMode", 0)) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("You need the FloatingContacts plugin, cause the embedded floating contacts were removed."), TranslateT("Warning"), MB_OK | MB_ICONWARNING); db_unset(NULL, "CLUI", "FloaterMode"); @@ -1887,7 +1887,7 @@ void FS_RegisterFonts() strncpy(fid.dbSettingsGroup, "CLC", 5); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); for (int i = 0; i < _countof(clistFontDescr); i++) { LOGFONT lf; pcli->pfnGetFontSetting(i, &lf, &fid.deffontsettings.colour); @@ -1909,7 +1909,7 @@ void FS_RegisterFonts() fid.order = i; Font_RegisterW(&fid); } - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); // and colours ColourIDW colourid = { 0 }; diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp index b79eb720a5..0a2a2d1499 100644 --- a/plugins/Clist_nicer/src/cluiframes.cpp +++ b/plugins/Clist_nicer/src/cluiframes.cpp @@ -34,7 +34,7 @@ extern HANDLE hThreadMFUpdate; void MF_UpdateThread(LPVOID); HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent; -HANDLE g_hEventThread = 0; +HANDLE g_hEventThread = nullptr; LOGFONT TitleBarLogFont = { 0 }; @@ -59,11 +59,11 @@ int CLUIFrameResizeFloatingFrame(int framepos); static int CLUIFramesReSort(); boolean FramesSysNotStarted = TRUE; -HPEN g_hPenCLUIFrames = 0; +HPEN g_hPenCLUIFrames = nullptr; static SortData g_sd[MAX_FRAMES]; -static HHOOK g_hFrameHook = 0; +static HHOOK g_hFrameHook = nullptr; static int sortfunc(const void *a, const void *b) { @@ -77,9 +77,9 @@ static int sortfunc(const void *a, const void *b) return 0; } -static FRAMEWND *Frames = NULL; +static FRAMEWND *Frames = nullptr; -FRAMEWND *wndFrameCLC = NULL, *wndFrameEventArea = NULL, *wndFrameViewMode = NULL; +FRAMEWND *wndFrameCLC = nullptr, *wndFrameEventArea = nullptr, *wndFrameViewMode = nullptr; static int nFramescount = 0; static int alclientFrame = -1;//for fast access to frame with alclient properties @@ -133,8 +133,8 @@ int __forceinline btoint(bool b) static FRAMEWND* FindFrameByWnd(HWND hwnd) { - if (hwnd == NULL) - return NULL; + if (hwnd == nullptr) + return nullptr; for (int i = 0; i < nFramescount; i++) { FRAMEWND &F = Frames[i]; @@ -142,12 +142,12 @@ static FRAMEWND* FindFrameByWnd(HWND hwnd) return &F; } - return NULL; + return nullptr; } static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL) { - if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { + if ((pThumbRight->dockOpt.hwndLeft == nullptr) && (pThumbLeft->dockOpt.hwndRight == nullptr)) { pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; } @@ -155,20 +155,20 @@ static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL) static void UndockThumbs(FRAMEWND *pThumb1, FRAMEWND *pThumb2) { - if ((pThumb1 == NULL) || (pThumb2 == NULL)) + if ((pThumb1 == nullptr) || (pThumb2 == nullptr)) return; if (pThumb1->dockOpt.hwndRight == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndRight = NULL; + pThumb1->dockOpt.hwndRight = nullptr; if (pThumb1->dockOpt.hwndLeft == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndLeft = NULL; + pThumb1->dockOpt.hwndLeft = nullptr; if (pThumb2->dockOpt.hwndRight == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndRight = NULL; + pThumb2->dockOpt.hwndRight = nullptr; if (pThumb2->dockOpt.hwndLeft == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndLeft = NULL; + pThumb2->dockOpt.hwndLeft = nullptr; } BOOLEAN bMoveTogether; @@ -191,7 +191,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) RECT rcBottom; int frmidx = 0; - if (pThumb == NULL) + if (pThumb == nullptr) return; sizeScreen.cx = GetSystemMetrics(SM_CXSCREEN); @@ -208,7 +208,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) int nNewY = nY < nOffs ? 0 : nY; nNewY = nNewY >(sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - bool bLeading = pThumb->dockOpt.hwndRight != NULL; + bool bLeading = pThumb->dockOpt.hwndRight != nullptr; if (bMoveTogether) { UndockThumbs(pThumb, FindFrameByWnd(pThumb->dockOpt.hwndLeft)); @@ -223,7 +223,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) fakeTaskBarWindow.ContainerWnd = hWndExplorerToolBar; fakeTaskBarWindow.floating = TRUE; - while (pCurThumb != NULL) { + while (pCurThumb != nullptr) { if (pCurThumb->floating) { if (pCurThumb != pThumb) { @@ -359,7 +359,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX; nNewY = nNewY < nOffs ? 0 : nNewY; nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - SetWindowPos(pThumb->ContainerWnd, 0, nNewX, nNewY, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(pThumb->ContainerWnd, nullptr, nNewX, nNewY, 0, 0, SWP_NOSIZE | SWP_NOZORDER); // OK, move all docked thumbs if (bMoveTogether) { @@ -397,7 +397,7 @@ void GetBorderSize(HWND hwnd, RECT *rect) //append string char __forceinline *AS(char *str, const char *setting, char *addstr) { - if (str != NULL) { + if (str != nullptr) { mir_strcpy(str, setting); mir_strcat(str, addstr); } @@ -467,7 +467,7 @@ int DBStoreFrameSettingsAtPos(int pos, int Frameid) int LocateStorePosition(int Frameid, int maxstored) { - if (Frames[Frameid].name == NULL) return -1; + if (Frames[Frameid].name == nullptr) return -1; for (int i = 0; i < maxstored; i++) { char settingname[255]; @@ -572,7 +572,7 @@ int CLUIFramesGetalClientFrame(void) static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) { HGENMENU res = (bMain) ? Menu_AddMainMenuItem(pmi) : Menu_AddContextFrameMenuItem(pmi); - if (pmi->pszService != NULL) + if (pmi->pszService != nullptr) Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, frameid); return res; } @@ -580,7 +580,7 @@ static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, bool bMain) { if (FramesSysNotStarted) - return NULL; + return nullptr; int framepos = id2pos(frameid); FrameMenuHandles &fmh = (frameid == -1) ? cont : Frames[framepos].MenuHandles; @@ -595,7 +595,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo popuppos += 100000; - mi.hIcolibItem = NULL; + mi.hIcolibItem = nullptr; mi.position = popuppos++; mi.name.a = LPGEN("&Visible"); mi.flags = CMIF_SYSTEM | CMIF_CHECKED; @@ -648,7 +648,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo mi.position = popuppos++; mi.name.a = LPGEN("&Align"); mi.flags = CMIF_SYSTEM; - mi.pszService = NULL; + mi.pszService = nullptr; fmh.MIAlignRoot = addFrameMenuItem(&mi, frameid, bMain); // align top @@ -674,7 +674,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo mi.root = root; mi.position = popuppos++; mi.name.a = LPGEN("&Position"); - mi.pszService = NULL; + mi.pszService = nullptr; mi.root = addFrameMenuItem(&mi, frameid, bMain); mi.position = popuppos++; @@ -686,7 +686,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo mi.name.a = LPGEN("&Down"); mi.pszService = CLUIFRAMESMOVEDOWN; addFrameMenuItem(&mi, frameid, bMain); - return 0; + return nullptr; } static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) @@ -858,7 +858,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) lck.unlock(); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - SetWindowPos(Frames[pos].TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(Frames[pos].TitleBar.hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } return 0; @@ -878,7 +878,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) Frames[pos].TitleBar.tbname = (wParam & FO_UNICODETEXT) ? mir_wstrdup((LPWSTR)lParam) : mir_a2u((LPSTR)lParam); lck.unlock(); - if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != NULL)) + if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != nullptr)) SetWindowText(Frames[pos].ContainerWnd, Frames[pos].TitleBar.tbname); return 0; @@ -922,7 +922,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) if (Frames[pos].height != oldHeight) { CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); if (Frames[pos].Skinned) - RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME | RDW_UPDATENOW | RDW_INVALIDATE); + RedrawWindow(Frames[pos].hWnd, nullptr, nullptr, RDW_FRAME | RDW_UPDATENOW | RDW_INVALIDATE); } } else { @@ -983,10 +983,10 @@ INT_PTR CLUIFramesShowAllTitleBars(WPARAM, LPARAM) for (int i = 0; i < nFramescount; i++) { FRAMEWND &F = Frames[i]; F.TitleBar.ShowTitleBar = TRUE; - SetWindowPos(F.hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(F.hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -998,10 +998,10 @@ INT_PTR CLUIFramesHideAllTitleBars(WPARAM, LPARAM) for (int i = 0; i < nFramescount; i++) { FRAMEWND &F = Frames[i]; F.TitleBar.ShowTitleBar = FALSE; - SetWindowPos(F.hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(F.hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1026,7 +1026,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM frameId, LPARAM) if (!Frames[pos].floating) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1040,12 +1040,12 @@ INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM frameId, LPARAM) int pos = id2pos(frameId); if (pos >= 0 && (int)pos < nFramescount) { Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar; - SetWindowPos(Frames[pos].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(Frames[pos].hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1120,7 +1120,7 @@ INT_PTR CLUIFramesSetAlign(WPARAM frameId, LPARAM lParam) CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN, frameId), lParam); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1184,7 +1184,7 @@ INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM) } CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); + SetWindowPos(hw, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); return 0; } @@ -1212,7 +1212,7 @@ INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM) } CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); + SetWindowPos(hw, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); return 0; } @@ -1254,11 +1254,11 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM) Frames[FrameId].collapsed = TRUE; } - SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); CLUIFramesStoreAllFrames(); lck.unlock(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1325,7 +1325,7 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM) contwnd.top -= (oldHeight - Frames[FrameId].height);//newheight SetWindowPos(Frames[FrameId].ContainerWnd, HWND_TOP, 0, 0, contwnd.left, contwnd.top, SWP_SHOWWINDOW | SWP_NOMOVE); } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); CLUIFramesStoreAllFrames(); return 0; } @@ -1349,7 +1349,7 @@ static int CLUIFramesLoadMainMenu() mi.hIcolibItem = F.TitleBar.hicon; mi.position = separator; mi.name.w = F.TitleBar.tbname ? F.TitleBar.tbname : F.name; - mi.pszService = 0; + mi.pszService = nullptr; g_frameMenus.insert(F.MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi)); CLUIFramesCreateMenuForFrame(F.id, F.MenuHandles.MainMenuItem, separator, true); CLUIFramesModifyMainMenuItems(F.id, 0); @@ -1390,7 +1390,7 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO HWND hwndParent = GetParent(hwnd); LRESULT result = 0; - if (pcli == NULL) + if (pcli == nullptr) return 0; if (hwndParent != pcli->hwndContactList || !cfg::dat.bSkinnedScrollbar) result = CallWindowProc(oldWndProc, hwnd, WM_NCPAINT, wParam, lParam); @@ -1398,8 +1398,8 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO return result; if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SKINNEDFRAME) { - StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; - if (item == 0) + StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : nullptr; + if (item == nullptr) return 0; GetWindowRect(hwnd, &rcWindow); @@ -1452,12 +1452,12 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) { - StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; + StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : nullptr; LRESULT orig = oldWndProc ? CallWindowProc(oldWndProc, hwnd, WM_NCCALCSIZE, wParam, lParam) : 0; NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam; DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - if (item == 0 || pcli == NULL) + if (item == nullptr || pcli == nullptr) return orig; if (item->IGNORED || !(dwStyle & CLS_SKINNEDFRAME) || GetParent(hwnd) != pcli->hwndContactList) @@ -1474,7 +1474,7 @@ static LRESULT CALLBACK FramesSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, L { int i; - WNDPROC oldWndProc = 0; + WNDPROC oldWndProc = nullptr; BOOL hasTitleBar = FALSE; for (i = 0; i < nFramescount; i++) { @@ -1550,7 +1550,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) int style; CLISTFrame *clfrm = (CLISTFrame *)wParam; - if (pcli->hwndContactList == 0) return -1; + if (pcli->hwndContactList == nullptr) return -1; if (FramesSysNotStarted) return -1; if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; @@ -1558,7 +1558,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) if (nFramescount >= MAX_FRAMES) return -1; - if (Frames == NULL) { + if (Frames == nullptr) { Frames = (FRAMEWND*)malloc(sizeof(FRAMEWND) * (MAX_FRAMES + 2)); memset(Frames, 0, (sizeof(FRAMEWND) * (MAX_FRAMES + 2))); } @@ -1580,7 +1580,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) SetClassLong(clfrm->hWnd, GCL_STYLE, GetClassLong(clfrm->hWnd, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW)); SetWindowLongPtr(clfrm->hWnd, GWL_STYLE, GetWindowLongPtr(clfrm->hWnd, GWL_STYLE) | WS_CLIPCHILDREN); - if (GetCurrentThreadId() == GetWindowThreadProcessId(clfrm->hWnd, NULL)) { + if (GetCurrentThreadId() == GetWindowThreadProcessId(clfrm->hWnd, nullptr)) { if (clfrm->hWnd != pcli->hwndContactTree && clfrm->hWnd != g_hwndViewModeFrame && clfrm->hWnd != g_hwndEventArea) { Frames[nFramescount].wndProc = (WNDPROC)GetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC); SetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC, (LONG_PTR)FramesSubClassProc); @@ -1596,14 +1596,14 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) Frames[nFramescount].dwFlags = clfrm->Flags; - if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { + if (clfrm->name == nullptr || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { wchar_t ptszClassName[256]; GetClassName(Frames[nFramescount].hWnd, ptszClassName, _countof(ptszClassName)); Frames[nFramescount].name = mir_wstrdup(ptszClassName); } else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->wname) : mir_a2u(clfrm->name); - if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL + if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == nullptr || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) Frames[nFramescount].TitleBar.tbname = mir_wstrdup(Frames[nFramescount].name); else @@ -1624,13 +1624,13 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) CreateWindow(CLUIFrameTitleBarClassName, Frames[nFramescount].name, (db_get_b(NULL, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) | WS_CHILD | WS_CLIPCHILDREN | (Frames[nFramescount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | - WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); + WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_hInst, nullptr); SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWLP_USERDATA, Frames[nFramescount].id); - Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - pcli->hwndContactList, NULL, g_hInst, NULL); + pcli->hwndContactList, nullptr, g_hInst, nullptr); SetWindowPos(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); { @@ -1674,7 +1674,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) Frames[nFramescount - 1].floating = FALSE; CLUIFrameSetFloat(retval, 1);//lparam=1 use stored width and height } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return retval; } @@ -1691,11 +1691,11 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM) FRAMEWND* F = &Frames[pos]; if (F->hWnd == g_hwndEventArea) - wndFrameEventArea = NULL; + wndFrameEventArea = nullptr; else if (F->hWnd == pcli->hwndContactTree) - wndFrameCLC = NULL; + wndFrameCLC = nullptr; else if (F->hWnd == g_hwndViewModeFrame) - wndFrameViewMode = NULL; + wndFrameViewMode = nullptr; mir_free(F->name); mir_free(F->TitleBar.tbname); @@ -1713,27 +1713,27 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM) } if (!cfg::shutDown) { - InvalidateRect(pcli->hwndContactList, NULL, TRUE); + InvalidateRect(pcli->hwndContactList, nullptr, TRUE); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); } return 0; } INT_PTR CLUIFramesForceUpdateTB(const FRAMEWND *Frame) { - if (Frame->TitleBar.hwnd != 0) - RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + if (Frame->TitleBar.hwnd != nullptr) + RedrawWindow(Frame->TitleBar.hwnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } INT_PTR CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) { - if (Frame->hWnd != 0) - RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); + if (Frame->hWnd != nullptr) + RedrawWindow(Frame->hWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); if (Frame->floating) - if (Frame->ContainerWnd != 0) RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + if (Frame->ContainerWnd != nullptr) RedrawWindow(Frame->ContainerWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } @@ -1751,11 +1751,11 @@ int CLUIFrameMoveResize(const FRAMEWND *Frame) return 0; } - SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset, + SetWindowPos(Frame->hWnd, nullptr, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset, (Frame->wndSize.right - Frame->wndSize.left), (Frame->wndSize.bottom - Frame->wndSize.top), SWP_NOZORDER | SWP_NOREDRAW); if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH, + SetWindowPos(Frame->TitleBar.hwnd, nullptr, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH, (Frame->wndSize.right - Frame->wndSize.left), TitleBarH + (Frame->UseBorder ? (!Frame->collapsed ? (Frame->align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER); } @@ -1788,7 +1788,7 @@ bool CLUIFramesFitInSize(void) int CLUIFramesGetMinHeight() { - if (pcli->hwndContactList == NULL) + if (pcli->hwndContactList == nullptr) return 0; int i, tbh, clientfrm, sumheight = 0; @@ -2039,25 +2039,25 @@ int SizeFramesByWindowRect(RECT *r) FRAMEWND &F = Frames[i]; if (!F.floating) { if (F.OwnerWindow && F.OwnerWindow != (HWND)-2) { - SetWindowPos(F.hWnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, + SetWindowPos(F.hWnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, (F.wndSize.right - F.wndSize.left), (F.wndSize.bottom - F.wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); if (F.TitleBar.ShowTitleBar) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, (F.wndSize.right - F.wndSize.left), TitleBarH + (F.UseBorder ? (!F.collapsed ? (F.align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); } } else { // set frame position - SetWindowPos(F.hWnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, + SetWindowPos(F.hWnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, (F.wndSize.right - F.wndSize.left), (F.wndSize.bottom - F.wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOREDRAW); // set titlebar position if (F.TitleBar.ShowTitleBar) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, (F.wndSize.right - F.wndSize.left), TitleBarH + (F.UseBorder ? (!F.collapsed ? (F.align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW); } @@ -2123,9 +2123,9 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) tick = GetTickCount() - tick; - if (pcli->hwndContactList != 0) - InvalidateRect(pcli->hwndContactList, NULL, TRUE); - if (pcli->hwndContactList != 0) + if (pcli->hwndContactList != nullptr) + InvalidateRect(pcli->hwndContactList, nullptr, TRUE); + if (pcli->hwndContactList != nullptr) UpdateWindow(pcli->hwndContactList); Sleep(0); @@ -2150,7 +2150,7 @@ int OnFrameTitleBarBackgroundChange() if (hBmpBackground) { DeleteObject(hBmpBackground); - hBmpBackground = NULL; + hBmpBackground = nullptr; } if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { ptrW tszBitmapName(db_get_wsa(NULL, "FrameTitleBar", "BkBitmap")); @@ -2222,8 +2222,8 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) } if (!AlignCOLLIconToLeft) { - if (Frames[pos].TitleBar.hicon != NULL) { - DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); + if (Frames[pos].TitleBar.hicon != nullptr) { + DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, nullptr, DI_NORMAL); TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); } else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); @@ -2231,9 +2231,9 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); if (!AlignCOLLIconToLeft) - DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, nullptr, DI_NORMAL); else - DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, nullptr, DI_NORMAL); SelectObject(hdcMem, oFont); } } @@ -2272,7 +2272,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return Menu_DrawItem(lParam); case WM_ENABLE: - if (hwnd != 0) InvalidateRect(hwnd, NULL, FALSE); + if (hwnd != nullptr) InvalidateRect(hwnd, nullptr, FALSE); return 0; case WM_SIZE: return 0; @@ -2347,7 +2347,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); + TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr); DestroyMenu(hmenu); } break; @@ -2371,7 +2371,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA lbypos = -1; oldframeheight = -1; ReleaseCapture(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); break; case WM_LBUTTONDOWN: @@ -2536,7 +2536,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (!(wParam & MK_CONTROL)) PositionThumb(&Frames[pos], nLeft, nTop); else - SetWindowPos(Frames[pos].ContainerWnd, 0, nLeft, nTop, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(Frames[pos].ContainerWnd, nullptr, nLeft, nTop, 0, 0, SWP_NOSIZE | SWP_NOZORDER); ptOld = ptNew; @@ -2648,7 +2648,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) { if (!Frames[framepos].floating) return 0; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) return 0; RECT rect; @@ -2667,7 +2667,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) ShowWindow(Frames[framepos].TitleBar.hwnd, SW_SHOWNOACTIVATE); Frames[framepos].height = height - floatingHeight; SetWindowPos(Frames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, floatingHeight, SWP_SHOWWINDOW | SWP_DRAWFRAME | SWP_NOACTIVATE); - InvalidateRect(Frames[framepos].TitleBar.hwnd, NULL, FALSE); + InvalidateRect(Frames[framepos].TitleBar.hwnd, nullptr, FALSE); SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, floatingHeight, width, height - floatingHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE); } @@ -2677,14 +2677,14 @@ int CLUIFrameResizeFloatingFrame(int framepos) SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); } - if (Frames[framepos].ContainerWnd != 0) + if (Frames[framepos].ContainerWnd != nullptr) UpdateWindow(Frames[framepos].ContainerWnd); GetWindowRect(Frames[framepos].hWnd, &Frames[framepos].wndSize); if (Frames[framepos].TitleBar.ShowTitleBar) - RedrawWindow(Frames[framepos].TitleBar.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(Frames[framepos].TitleBar.hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); - RedrawWindow(Frames[framepos].hWnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(Frames[framepos].hWnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); return 0; } @@ -2719,7 +2719,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (!Frames[framepos].minmaxenabled) break; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) break; if (Frames[framepos].Locked) { @@ -2754,7 +2754,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (framepos < 0 || framepos >= nFramescount) break; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) return 0; GetWindowRect(Frames[framepos].ContainerWnd, &rect); @@ -2773,7 +2773,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (framepos < 0 || framepos >= nFramescount) break; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) return 0; CLUIFrameResizeFloatingFrame(framepos); @@ -2800,7 +2800,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height) { - return(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0)); + return(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_hInst, nullptr)); } INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) @@ -2815,7 +2815,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) SetParent(Frames[wParam].TitleBar.hwnd, pcli->hwndContactList); Frames[wParam].floating = FALSE; DestroyWindow(Frames[wParam].ContainerWnd); - Frames[wParam].ContainerWnd = 0; + Frames[wParam].ContainerWnd = nullptr; } else { RECT recttb, rectw, border; @@ -2897,11 +2897,11 @@ wchar_t g_ptszEventName[100]; static int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { mir_snwprintf(g_ptszEventName, L"mf_update_evt_%d", GetCurrentThreadId()); - g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); - hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL); + g_hEventThread = CreateEvent(nullptr, TRUE, FALSE, g_ptszEventName); + hThreadMFUpdate = mir_forkthread(MF_UpdateThread, nullptr); SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, false); + CLUIFramesCreateMenuForFrame(-1, nullptr, 000010000, false); return 0; } @@ -2943,7 +2943,7 @@ int LoadCLUIFramesModule(void) wndclass.style = CS_DBLCLKS; wndclass.lpfnWndProc = CLUIFrameTitleBarProc; wndclass.hInstance = g_hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.lpszClassName = CLUIFrameTitleBarClassName; RegisterClass(&wndclass); @@ -2951,7 +2951,7 @@ int LoadCLUIFramesModule(void) cntclass.style = CS_DBLCLKS | CS_DROPSHADOW; cntclass.lpfnWndProc = CLUIFrameContainerWndProc; cntclass.hInstance = g_hInst; - cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); + cntclass.hCursor = LoadCursor(nullptr, IDC_ARROW); cntclass.lpszClassName = L"FramesContainer"; RegisterClass(&cntclass); @@ -2961,7 +2961,7 @@ int LoadCLUIFramesModule(void) mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); mi.position = 3000090000; mi.name.a = LPGEN("Frames"); - mi.pszService = 0; + mi.pszService = nullptr; cont.MainMenuItem = Menu_AddMainMenuItem(&mi); UNSET_UID(mi); @@ -3023,7 +3023,7 @@ int LoadCLUIFramesModule(void) CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM, CLUIFramesSetAlignalBottom); CreateServiceFunction("Set_Floating", CLUIFrameSetFloat); - hWndExplorerToolBar = FindWindowExA(0, 0, "Shell_TrayWnd", NULL); + hWndExplorerToolBar = FindWindowExA(nullptr, nullptr, "Shell_TrayWnd", nullptr); OnFrameTitleBarBackgroundChange(); FramesSysNotStarted = FALSE; @@ -3055,13 +3055,13 @@ int UnLoadCLUIFramesModule(void) F.ContainerWnd = (HWND)-1; DestroyMenu(F.TitleBar.hmenu); - if (F.name != NULL) + if (F.name != nullptr) mir_free(F.name); - if (F.TitleBar.tbname != NULL) + if (F.TitleBar.tbname != nullptr) mir_free(F.TitleBar.tbname); } free(Frames); - Frames = NULL; + Frames = nullptr; nFramescount = 0; UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); return 0; diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 6e3dacbd9f..f8636fdb21 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ApplyCLUIBorderStyle();
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU))
- SetMenu(pcli->hwndContactList, NULL);
+ SetMenu(pcli->hwndContactList, nullptr);
else
SetMenu(pcli->hwndContactList, pcli->hMenuMain);
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0);
}
- db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
+ db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
@@ -292,8 +292,8 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ConfigureCLUIGeometry(1);
ShowWindow(pcli->hwndContactList, SW_SHOW);
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
- SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
- RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
cfg::dat.fadeinout = oldFading;
opt_clui_changed = 0;
@@ -387,7 +387,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL);
+ pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr);
mir_subclassWindow(pcli->hwndStatus, NewStatusBarWndProc);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
@@ -402,7 +402,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags);
ConfigureCLUIGeometry(1);
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
- CluiProtocolStatusChanged(0, 0);
+ CluiProtocolStatusChanged(0, nullptr);
PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0);
opt_sbar_changed = 0;
return TRUE;
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 7e8b5c8c56..f97d264643 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -33,7 +33,7 @@ void FreeProtocolData(void) int nParts = SendMessage(pcli->hwndStatus, SB_GETPARTS, 0, 0);
for (int nPanel = 0; nPanel < nParts; nPanel++) {
ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus, SB_GETTEXT, nPanel, 0);
- if (PD != NULL && !IsBadCodePtr((FARPROC)PD)) {
+ if (PD != nullptr && !IsBadCodePtr((FARPROC)PD)) {
SendMessage(pcli->hwndStatus, SB_SETTEXT, (WPARAM)nPanel | SBT_OWNERDRAW, 0);
if (PD->RealName) mir_free(PD->RealName);
if (PD) mir_free(PD);
@@ -50,11 +50,11 @@ void CluiProtocolStatusChanged(int, const char*) WORD maxStatus = ID_STATUS_OFFLINE;
DBVARIANT dbv = { 0 };
int iIcon = 0;
- HICON hIcon = 0;
+ HICON hIcon = nullptr;
int rdelta = cfg::dat.bCLeft + cfg::dat.bCRight;
BYTE windowStyle;
- if (pcli->hwndStatus == 0 || cfg::shutDown)
+ if (pcli->hwndStatus == nullptr || cfg::shutDown)
return;
int protoCount;
@@ -101,7 +101,7 @@ void CluiProtocolStatusChanged(int, const char*) BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
wchar_t szName[32];
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HFONT hofont = reinterpret_cast<HFONT>(SelectObject(hdc, (HFONT)SendMessage(pcli->hwndStatus, WM_GETFONT, 0, 0)));
// count down since built in ones tend to go at the end
@@ -135,7 +135,7 @@ void CluiProtocolStatusChanged(int, const char*) partCount++;
}
SelectObject(hdc, hofont);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
}
if (partCount == 0) {
SendMessage(pcli->hwndStatus, SB_SIMPLE, TRUE, 0);
@@ -149,7 +149,7 @@ void CluiProtocolStatusChanged(int, const char*) SendMessage(pcli->hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths);
// count down since built in ones tend to go at the end
- char *szMaxProto = NULL;
+ char *szMaxProto = nullptr;
partCount = 0;
for (int i = 0; i < protoCount; i++) {
int idx = pcli->pfnGetAccountIndexByPos(i);
@@ -195,7 +195,7 @@ void CluiProtocolStatusChanged(int, const char*) }
else {
wStatus = maxStatus;
- iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : NULL, (int)wStatus, 0, &hIcon);
+ iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : nullptr, (int)wStatus, 0, &hIcon);
g_maxStatus = (int)wStatus;
if (szMaxProto)
strncpy_s(g_maxProto, _countof(g_maxProto), szMaxProto, _TRUNCATE);
@@ -221,18 +221,18 @@ void CluiProtocolStatusChanged(int, const char*) SendMessage(hwndClistBtn, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon);
else
SendMessage(hwndClistBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- InvalidateRect(hwndClistBtn, NULL, TRUE);
+ InvalidateRect(hwndClistBtn, nullptr, TRUE);
}
HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS);
if (IsWindow(hwndTtbStatus)) {
- if (g_ButtonItems == NULL) {
+ if (g_ButtonItems == nullptr) {
if (!hIcon)
SendMessage(hwndTtbStatus, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon);
else
SendMessage(hwndTtbStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
}
- InvalidateRect(hwndTtbStatus, NULL, TRUE);
+ InvalidateRect(hwndTtbStatus, nullptr, TRUE);
}
}
}
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 577d813333..18d2844705 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
TCluiData cfg::dat = { 0 };
-ClcData* cfg::clcdat = 0;
+ClcData* cfg::clcdat = nullptr;
static mir_cs cachecs;
LIST<TExtraCache> cfg::arCache(100, NumericKeySortT);
@@ -35,8 +35,8 @@ bool cfg::shutDown = false; TSysConfig API::sysConfig = { 0 };
TSysState API::sysState = { 0 };
-pfnDwmExtendFrameIntoClientArea_t API::pfnDwmExtendFrameIntoClientArea = 0;
-pfnDwmIsCompositionEnabled_t API::pfnDwmIsCompositionEnabled = 0;
+pfnDwmExtendFrameIntoClientArea_t API::pfnDwmExtendFrameIntoClientArea = nullptr;
+pfnDwmIsCompositionEnabled_t API::pfnDwmIsCompositionEnabled = nullptr;
EXCEPTION_RECORD API::exRecord = { 0 };
CONTEXT API::exCtx = { 0 };
@@ -45,7 +45,7 @@ char API::exSzFile[MAX_PATH] = ""; wchar_t API::exReason[256] = L"";
int API::exLine = 0;
bool API::exAllowContinue = false;
-HMODULE API::hDwm = 0;
+HMODULE API::hDwm = nullptr;
TExtraCache* cfg::getCache(const MCONTACT hContact, const char *szProto)
{
@@ -82,10 +82,10 @@ void CSH_Destroy() StatusItems_t *item = p->status_item;
free(p->status_item);
- p->status_item = 0;
+ p->status_item = nullptr;
for (int j = i; j < cfg::arCache.getCount(); j++) // avoid duplicate free()'ing status item pointers (there are references from sub to master contacts, so compare the pointers...
if (cfg::arCache[j]->status_item == item)
- cfg::arCache[j]->status_item = 0;
+ cfg::arCache[j]->status_item = nullptr;
}
free(p);
}
@@ -204,7 +204,7 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, wch mir_snprintf(exSzFile, "%s%s", szName, szExt);
mir_snwprintf(exReason, L"An application error has occured: %s", szReason);
exLine = line;
- exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0);
+ exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), nullptr, Ex_DlgProc, 0);
exAllowContinue = fAllowContinue;
if (IDCANCEL == exLastResult)
ExitProcess(1);
@@ -233,7 +233,7 @@ void TSAPI Utils::showDlgControl(const HWND hwnd, UINT id, int showCmd) HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename, bool useGetHandle)
{
wchar_t sysPathName[MAX_PATH + 2];
- HMODULE _h = 0;
+ HMODULE _h = nullptr;
try {
if (0 == ::GetSystemDirectory(sysPathName, MAX_PATH))
@@ -248,12 +248,12 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename, bool useGetHandle) _h = ::GetModuleHandle(sysPathName);
else
_h = LoadLibrary(sysPathName);
- if (0 == _h)
+ if (nullptr == _h)
throw(CRTException("Error while loading system library", szFilename));
}
catch (CRTException& ex) {
ex.display();
- return 0;
+ return nullptr;
}
return (_h);
}
@@ -269,6 +269,6 @@ void CRTException::display() const wchar_t tszBoxMsg[500];
mir_snwprintf(tszBoxMsg, L"%s\n\n(%s)", tszMsg, m_szParam);
- ::MessageBox(0, tszBoxMsg, L"Clist_nicer runtime error", MB_OK | MB_ICONERROR);
+ ::MessageBox(nullptr, tszBoxMsg, L"Clist_nicer runtime error", MB_OK | MB_ICONERROR);
mir_free(tszMsg);
}
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index ed7ddefb5b..49d78b9ab3 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -47,7 +47,7 @@ static int GetContactStatus(MCONTACT hContact) char *szProto;
szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
}
@@ -62,11 +62,11 @@ int __forceinline GetStatusModeOrdering(int statusMode) }
int mf_updatethread_running = TRUE;
-HANDLE hThreadMFUpdate = 0;
+HANDLE hThreadMFUpdate = nullptr;
static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep)
{
- DWORD curTime = time(NULL);
+ DWORD curTime = time(nullptr);
DWORD frequency, eventCount;
MEVENT hEvent = db_event_last(hContact);
@@ -153,7 +153,7 @@ int __forceinline GetProtoIndex(char * szName) return -1;
PROTOACCOUNT *pa = Proto_GetAccount(szName);
- return (pa == NULL) ? -1 : pa->iOrder;
+ return (pa == nullptr) ? -1 : pa->iOrder;
}
int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact* c2, UINT bywhat)
@@ -163,7 +163,7 @@ int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact char *szProto1, *szProto2;
int rc;
- if (c1 == 0 || c2 == 0)
+ if (c1 == nullptr || c2 == nullptr)
return 0;
szProto1 = c1->proto;
@@ -227,7 +227,7 @@ int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact rc = GetProtoIndex(szProto1) - GetProtoIndex(szProto2);
- if (rc != 0 && (szProto1 != NULL && szProto2 != NULL))
+ if (rc != 0 && (szProto1 != nullptr && szProto2 != nullptr))
return rc;
}
return 0;
diff --git a/plugins/Clist_nicer/src/coolsblib.cpp b/plugins/Clist_nicer/src/coolsblib.cpp index 61da1b3567..f669a400a9 100644 --- a/plugins/Clist_nicer/src/coolsblib.cpp +++ b/plugins/Clist_nicer/src/coolsblib.cpp @@ -44,13 +44,13 @@ SCROLLBAR* GetScrollBarFromHwnd(HWND hwnd, UINT nBar) {
SCROLLWND *sw = GetScrollWndFromHwnd(hwnd);
if (!sw)
- return 0;
+ return nullptr;
if (nBar == SB_HORZ)
return &sw->sbarHorz;
if (nBar == SB_VERT)
return &sw->sbarVert;
- return 0;
+ return nullptr;
}
BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd)
@@ -74,7 +74,7 @@ BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); typedef BOOL(WINAPI *WPROC)(HWND, UINT, UINT);
-static WPROC pEnableScrollBar = 0;
+static WPROC pEnableScrollBar = nullptr;
void WINAPI CoolSB_SetESBProc(WPROC proc)
{
@@ -106,7 +106,7 @@ static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) SendMessage(hwnd, WM_NCPAINT, 1, 0);
}
else {
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE
+ SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE
| SWP_FRAMECHANGED | SWP_DRAWFRAME);
}
}
@@ -135,7 +135,7 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) {
SCROLLBAR *sb = GetScrollBarFromHwnd(hwnd, fnBar);
- if (sb == 0)
+ if (sb == nullptr)
return FALSE;
if (fnBar == SB_HORZ) {
@@ -145,7 +145,7 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) return &sb->scrollInfo;
}
else
- return NULL;
+ return nullptr;
}
//
// Initialize the cool scrollbars for a window by subclassing it
@@ -161,14 +161,14 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) DWORD dwCurStyle;
//BOOL fDisabled;
- if (pEnableScrollBar == 0)
+ if (pEnableScrollBar == nullptr)
pEnableScrollBar = EnableScrollBar;
GetClientRect(hwnd, &rect);
//if we have already initialized Cool Scrollbars for this window,
//then stop the user from doing it again
- if (GetScrollWndFromHwnd(hwnd) != 0) {
+ if (GetScrollWndFromHwnd(hwnd) != nullptr) {
return FALSE;
}
@@ -254,7 +254,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) UNREFERENCED_PARAMETER(ice);
UNREFERENCED_PARAMETER(ti);
- sw->hwndToolTip = 0;
+ sw->hwndToolTip = nullptr;
#endif
@@ -385,7 +385,7 @@ int WINAPI CoolSB_SetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fR }
SCROLLBAR *sbar = GetScrollBarFromHwnd(hwnd, fnBar);
- if (sbar == NULL)
+ if (sbar == nullptr)
return 0;
if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) {
@@ -497,7 +497,7 @@ BOOL WINAPI CoolSB_ShowScrollBar(HWND hwnd, int wBar, BOOL fShow) //if (s
//SetWindowLongPtr(hwnd, GWL_STYLE, style);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0,
+ SetWindowPos(hwnd, nullptr, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_NOACTIVATE | SWP_FRAMECHANGED);
diff --git a/plugins/Clist_nicer/src/coolscroll.cpp b/plugins/Clist_nicer/src/coolscroll.cpp index 1e8f5b98ff..cd9f0750e7 100644 --- a/plugins/Clist_nicer/src/coolscroll.cpp +++ b/plugins/Clist_nicer/src/coolscroll.cpp @@ -85,7 +85,7 @@ static RECT MouseOverRect; static UINT uScrollTimerMsg = 0;
static UINT uScrollTimerPortion = HTSCROLL_NONE;
static UINT_PTR uScrollTimerId = 0;
-static HWND hwndCurCoolSB = 0;
+static HWND hwndCurCoolSB = nullptr;
extern int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd);
@@ -105,7 +105,7 @@ BOOL WINAPI CoolSB_IsThumbTracking(HWND hwnd) {
SCROLLWND *sw;
- if ((sw = GetScrollWndFromHwnd(hwnd)) == NULL)
+ if ((sw = GetScrollWndFromHwnd(hwnd)) == nullptr)
return FALSE;
else
return sw->fThumbTracking;
@@ -194,7 +194,7 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO //MONOCHROME bitmap to convert the arrow to black/white mask
hdcmem1 = CreateCompatibleDC(hdc);
- hbm1 = CreateBitmap(width, height, 1, 1, NULL);
+ hbm1 = CreateBitmap(width, height, 1, 1, nullptr);
UnrealizeObject(hbm1);
oldbm1 = reinterpret_cast<HBITMAP>(SelectObject(hdcmem1, hbm1));
@@ -347,7 +347,7 @@ static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) hbr = CreatePatternBrush(hbmp);
UnrealizeObject(hbr);
- SetBrushOrgEx(hdc, rect->left, rect->top, 0);
+ SetBrushOrgEx(hdc, rect->left, rect->top, nullptr);
hbrold = (HBRUSH)SelectObject(hdc, hbr);
@@ -373,7 +373,7 @@ static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) static void PaintRect(HDC hdc, RECT *rect, COLORREF color)
{
COLORREF oldcol = SetBkColor(hdc, color);
- ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, NULL);
+ ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, nullptr);
SetBkColor(hdc, oldcol);
}
@@ -1373,7 +1373,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) SCROLLBAR *sb;
HDC hdc;
RECT winrect, rect;
- HRGN clip = 0;
+ HRGN clip = nullptr;
BOOL fCustomDraw = FALSE;
LRESULT ret;
DWORD dwStyle;
@@ -1481,7 +1481,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) HWND hwndParent = GetParent(hwnd);
GetClientRect(hwndParent, &parent);
- MapWindowPoints(hwndParent, 0, (POINT *)&parent, 2);
+ MapWindowPoints(hwndParent, nullptr, (POINT *)&parent, 2);
CopyRect(&rect2, &rect);
OffsetRect(&rect2, winrect.left, winrect.top);
@@ -1969,7 +1969,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //set a timer going on the first click.
//if this one expires, then we can start off a more regular timer
//to generate the auto-scroll behaviour
- uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, 0);
+ uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, nullptr);
break;
default:
return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCLBUTTONDOWN, wParam, lParam);
@@ -2634,7 +2634,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa uHitTestPortion = HTSCROLL_NONE;
GetScrollRect(sw, SB_HORZ, hwnd, &MouseOverRect);
uMouseOverScrollbar = SB_HORZ;
- uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0);
+ uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, nullptr);
NCPaint(sw, hwnd, 1, 0);
}
@@ -2647,7 +2647,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa uHitTestPortion = HTSCROLL_NONE;
GetScrollRect(sw, SB_VERT, hwnd, &MouseOverRect);
uMouseOverScrollbar = SB_VERT;
- uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0);
+ uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, nullptr);
NCPaint(sw, hwnd, 1, 0);
}
@@ -2731,7 +2731,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM if (wTimerId == COOLSB_TIMERID1)
{
KillTimer(hwnd, uScrollTimerId);
- uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, 0);
+ uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, nullptr);
return 0;
}
//send the scrollbar message repeatedly
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 8fcf49c63e..b575696943 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -31,10 +31,10 @@ extern HWND g_hwndViewModeFrame; extern struct CluiTopButton BTNS[];
LIST<StatusItems_t> arStatusItems(10);
-ImageItem *g_ImageItems = NULL, *g_glyphItem = NULL;
-ButtonItem *g_ButtonItems = NULL;
-ImageItem *g_CLUIImageItem = NULL;
-HBRUSH g_CLUISkinnedBkColor = 0;
+ImageItem *g_ImageItems = nullptr, *g_glyphItem = nullptr;
+ButtonItem *g_ButtonItems = nullptr;
+ImageItem *g_CLUIImageItem = nullptr;
+HBRUSH g_CLUISkinnedBkColor = nullptr;
COLORREF g_CLUISkinnedBkColorRGB = 0;
int ID_EXTBK_LAST = ID_EXTBK_LAST_D;
@@ -257,15 +257,15 @@ BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem) StatusItems_t *GetProtocolStatusItem(const char *szProto)
{
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
for (int i = _countof(_StatusItems); i < arStatusItems.getCount(); i++) {
StatusItems_t *p = arStatusItems[i];
if (!mir_strcmp(p->szName[0] == '{' ? p->szName+3 : p->szName, szProto))
return p;
}
- return NULL;
+ return nullptr;
}
// fills the struct with the settings in the database
@@ -301,7 +301,7 @@ void LoadExtBkSettingsFromDB() if (p->statusID == ID_EXTBKSEPARATOR)
continue;
- p->imageItem = 0;
+ p->imageItem = nullptr;
char buffer[255], *pszEnd = buffer + mir_snprintf(buffer, "%s_", p->szDBname);
mir_strcpy(pszEnd, "IGNORE"); p->IGNORED = (BYTE)db_get_b(NULL, "CLCExt", buffer, p->IGNORED);
mir_strcpy(pszEnd, "GRADIENT"); p->GRADIENT = (BYTE)db_get_dw(NULL, "CLCExt", buffer, p->GRADIENT);
@@ -374,9 +374,9 @@ void SetButtonToSkinned() bool bFlat = bSkinned || (db_get_b(NULL, "TopToolBar", "UseFlatButton", 0) != 0);
for (int i = 0;; i++) {
- if (BTNS[i].pszButtonID == NULL)
+ if (BTNS[i].pszButtonID == nullptr)
break;
- if (BTNS[i].hwndButton != 0 && BTNS[i].ctrlid != IDC_TBGLOBALSTATUS && BTNS[i].ctrlid != IDC_TBMENU)
+ if (BTNS[i].hwndButton != nullptr && BTNS[i].ctrlid != IDC_TBGLOBALSTATUS && BTNS[i].ctrlid != IDC_TBMENU)
CustomizeButton(BTNS[i].hwndButton, bSkinned, !bSkinned, bFlat, true);
}
@@ -450,7 +450,7 @@ struct { char *szModule; char *szSetting; unsigned int size; int defaultval; } _ "WorldTime", "BgColour", 4, 0,
"WorldTime", "FontCol", 4, 0,
- NULL, NULL, 0, 0
+ nullptr, nullptr, 0, 0
};
void extbk_export(char *file)
@@ -520,7 +520,7 @@ void extbk_export(char *file) }
i = 0;
- while (_tagSettings[i].szModule != NULL) {
+ while (_tagSettings[i].szModule != nullptr) {
data = 0;
switch (_tagSettings[i].size) {
case 1:
@@ -569,7 +569,7 @@ static void PreMultiply(HBITMAP hBitmap, int mode) int height = bmp.bmHeight;
DWORD dwLen = width * height * 4;
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
GetBitmapBits(hBitmap, dwLen, p);
@@ -600,7 +600,7 @@ static void CorrectBitmap32Alpha(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE*)calloc(1, dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
GetBitmapBits(hBitmap, dwLen, p);
@@ -627,7 +627,7 @@ static void CorrectBitmap32Alpha(HBITMAP hBitmap) static HBITMAP LoadPNG(const char *szFilename)
{
HBITMAP hBitmap = Bitmap_Load(_A2T(szFilename));
- if (hBitmap != 0)
+ if (hBitmap != nullptr)
CorrectBitmap32Alpha(hBitmap);
return hBitmap;
@@ -657,7 +657,7 @@ static void IMG_CreateItem(ImageItem *item, const char *fileName, HDC hdc) item->dwFlags |= IMAGE_FLAG_DIVIDED;
if (item->inner_height <= 0 || item->inner_width <= 0) {
DeleteObject(hbm);
- item->hbm = 0;
+ item->hbm = nullptr;
return;
}
}
@@ -749,7 +749,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) void IMG_ReadItem(const char *itemname, const char *szFileName)
{
- ImageItem tmpItem, *newItem = NULL;
+ ImageItem tmpItem, *newItem = nullptr;
char buffer[512], szItemNr[30];
char szFinalName[MAX_PATH];
HDC hdc = GetDC(pcli->hwndContactList);
@@ -776,7 +776,7 @@ done_with_glyph: strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName));
tmpItem.szName[sizeof(tmpItem.szName) - 1] = 0;
- _splitpath(szFileName, szDrive, szPath, NULL, NULL);
+ _splitpath(szFileName, szDrive, szPath, nullptr, nullptr);
mir_snprintf(szFinalName, "%s\\%s\\%s", szDrive, szPath, buffer);
tmpItem.alpha = GetPrivateProfileIntA(itemname, "Alpha", 100, szFileName);
tmpItem.alpha = min(tmpItem.alpha, 100);
@@ -811,7 +811,7 @@ done_with_glyph: tmpItem.dwFlags |= IMAGE_FILLSOLID;
}
else
- tmpItem.fillBrush = 0;
+ tmpItem.fillBrush = nullptr;
GetPrivateProfileStringA(itemname, "Stretch", "None", buffer, 500, szFileName);
if (buffer[0] == 'B' || buffer[0] == 'b')
@@ -820,7 +820,7 @@ done_with_glyph: tmpItem.bStretch = IMAGE_STRETCH_V;
else if (buffer[0] == 'w' || buffer[0] == 'W')
tmpItem.bStretch = IMAGE_STRETCH_H;
- tmpItem.hbm = 0;
+ tmpItem.hbm = nullptr;
if (!_stricmp(itemname, "$glyphs")) {
IMG_CreateItem(&tmpItem, szFinalName, hdc);
@@ -840,12 +840,12 @@ done_with_glyph: memset(newItem, 0, sizeof(ImageItem));
*newItem = tmpItem;
- if (g_ImageItems == NULL)
+ if (g_ImageItems == nullptr)
g_ImageItems = newItem;
else {
ImageItem *pItem = g_ImageItems;
- while (pItem->nextItem != 0)
+ while (pItem->nextItem != nullptr)
pItem = pItem->nextItem;
pItem->nextItem = newItem;
}
@@ -893,19 +893,19 @@ done_with_glyph: memset(newItem, 0, sizeof(ImageItem));
*newItem = tmpItem;
p->imageItem = newItem;
- if (g_ImageItems == NULL)
+ if (g_ImageItems == nullptr)
g_ImageItems = newItem;
else {
ImageItem *pItem = g_ImageItems;
- while (pItem->nextItem != 0)
+ while (pItem->nextItem != nullptr)
pItem = pItem->nextItem;
pItem->nextItem = newItem;
}
alloced = TRUE;
}
}
- else if (newItem != NULL)
+ else if (newItem != nullptr)
p->imageItem = newItem;
}
}
@@ -928,29 +928,29 @@ void IMG_DeleteItems() free(pItem);
pItem = pNextItem;
}
- g_ImageItems = NULL;
+ g_ImageItems = nullptr;
while (pbItem) {
DestroyWindow(pbItem->hWnd);
pbNextItem = pbItem->nextItem;
free(pbItem);
pbItem = pbNextItem;
}
- g_ButtonItems = NULL;
+ g_ButtonItems = nullptr;
if (g_CLUIImageItem) {
IMG_DeleteItem(g_CLUIImageItem);
free(g_CLUIImageItem);
}
- g_CLUIImageItem = NULL;
+ g_CLUIImageItem = nullptr;
if (g_glyphItem) {
IMG_DeleteItem(g_glyphItem);
free(g_glyphItem);
}
- g_glyphItem = NULL;
+ g_glyphItem = nullptr;
for (i = 0; i < arStatusItems.getCount(); i++)
- arStatusItems[i]->imageItem = NULL;
+ arStatusItems[i]->imageItem = nullptr;
}
static UINT nextButtonID = IDC_TBFIRSTUID;
@@ -1139,20 +1139,20 @@ static void BTN_ReadItem(char *itemName, char *file) newItem = (ButtonItem *)malloc(sizeof(ButtonItem));
memset(newItem, 0, sizeof(ButtonItem));
- if (g_ButtonItems == NULL) {
+ if (g_ButtonItems == nullptr) {
g_ButtonItems = newItem;
*newItem = tmpItem;
- newItem->nextItem = 0;
+ newItem->nextItem = nullptr;
}
else {
ButtonItem *curItem = g_ButtonItems;
while (curItem->nextItem)
curItem = curItem->nextItem;
*newItem = tmpItem;
- newItem->nextItem = 0;
+ newItem->nextItem = nullptr;
curItem->nextItem = newItem;
}
- newItem->hWnd = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 5, 5, pcli->hwndContactList, (HMENU)newItem->uId, g_hInst, NULL);
+ newItem->hWnd = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 5, 5, pcli->hwndContactList, (HMENU)newItem->uId, g_hInst, nullptr);
CustomizeButton(newItem->hWnd, false, false, true);
SendMessage(newItem->hWnd, BUTTONSETBTNITEM, 0, (LPARAM)newItem);
if (newItem->dwFlags & BUTTON_ISTOGGLE)
@@ -1174,7 +1174,7 @@ void IMG_LoadItems() // TODO: rewrite the skin loading in wchar_t manner
char szFileName[MAX_PATH];
- WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, szFileName, MAX_PATH, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, szFileName, MAX_PATH, nullptr, nullptr);
db_free(&dbv);
@@ -1227,11 +1227,11 @@ void LoadPerContactSkins(wchar_t *tszFileName) ptrA szSections(LPSTR(calloc(3002, 1)));
char *p = szSections;
- StatusItems_t *items = NULL, *this_item;
+ StatusItems_t *items = nullptr, *this_item;
int i = 1;
char file[MAX_PATH];
- WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, file, MAX_PATH, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, file, MAX_PATH, nullptr, nullptr);
file[MAX_PATH - 1] = 0;
ReadItem(&default_item, "%Default", file);
@@ -1262,11 +1262,11 @@ void LoadPerContactSkins(wchar_t *tszFileName) if (items) {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
continue;
char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != NULL) {
+ if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != nullptr) {
DBVARIANT dbv = { 0 };
if (db_get(hContact, szProto, uid, &dbv))
break;
@@ -1405,7 +1405,7 @@ void extbk_import(char *file, HWND hwndDlg) char szString[MAX_PATH];
szString[0] = 0;
- while (_tagSettings[i].szModule != NULL) {
+ while (_tagSettings[i].szModule != nullptr) {
data = 0;
GetPrivateProfileStructA("Global", _tagSettings[i].szSetting, &data, _tagSettings[i].size, file);
switch (_tagSettings[i].size) {
@@ -1435,7 +1435,7 @@ void extbk_import(char *file, HWND hwndDlg) pcli->pfnClcOptionsChanged();
ConfigureCLUIGeometry(1);
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
- RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN);
}
static void ApplyCLUISkin()
@@ -1446,18 +1446,18 @@ static void ApplyCLUISkin() if (!db_get_ws(NULL, "CLC", "AdvancedSkin", &dbv)) {
MY_pathToAbsolute(dbv.ptszVal, tszFinalName);
- WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, nullptr, nullptr);
if (db_get_b(NULL, "CLUI", "skin_changed", 0)) {
- extbk_import(szFinalName, 0);
+ extbk_import(szFinalName, nullptr);
SaveCompleteStructToDB();
db_set_b(NULL, "CLUI", "skin_changed", 0);
}
IMG_LoadItems();
ShowWindow(pcli->hwndContactList, SW_SHOWNORMAL);
- SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
- RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE);
+ RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE);
db_free(&dbv);
}
}
@@ -1528,7 +1528,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = L"*.clist\0";
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_DONTADDTORECENT;
@@ -1600,7 +1600,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int iInit = TRUE;
- static HWND hwndSkinEdit = 0;
+ static HWND hwndSkinEdit = nullptr;
switch (msg) {
case WM_INITDIALOG:
@@ -1662,7 +1662,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwnd;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = "*.clist";
ofn.lpstrFile = str;
ofn.Flags = OFN_HIDEREADONLY;
@@ -1680,7 +1680,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwnd;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = "*.clist";
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST;
@@ -1733,7 +1733,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara }
break;
case WM_DESTROY:
- hwndSkinEdit = 0;
+ hwndSkinEdit = nullptr;
break;
}
return FALSE;
diff --git a/plugins/Clist_nicer/src/groupmenu.cpp b/plugins/Clist_nicer/src/groupmenu.cpp index 9ba48eac12..62b955c8c7 100644 --- a/plugins/Clist_nicer/src/groupmenu.cpp +++ b/plugins/Clist_nicer/src/groupmenu.cpp @@ -51,7 +51,7 @@ static HMENU hMenuOldContext; static INT_PTR GroupMenu_OnAddService(WPARAM wParam, LPARAM lParam)
{
MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
- if (mii == NULL)
+ if (mii == nullptr)
return 0;
if (hGroupMainMenuItemProxy == (HANDLE)lParam) {
@@ -133,7 +133,7 @@ void InitGroupMenus(void) mi.root = Menu_AddGroupMenuItem(&mi);
UNSET_UID(mi);
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.pszService = "CLISTMENUSGroup/CommandHelper";
CreateServiceFunction(mi.pszService, CommandHelper);
for (int i = 0; i < _countof(hAppearanceItems); i++) {
@@ -145,7 +145,7 @@ void InitGroupMenus(void) }
SET_UID(mi, 0xc2895531, 0x98e9, 0x40bc, 0x9b, 0x8e, 0xfb, 0x33, 0xe8, 0xab, 0xcc, 0xef);
- mi.root = NULL;
+ mi.root = nullptr;
mi.position = 400000;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS);
mi.pszService = "Options/OptionsCommand";
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 503d67591b..7bd7c4077b 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma comment(lib, "shlwapi.lib")
-HINSTANCE g_hInst = 0;
+HINSTANCE g_hInst = nullptr;
CLIST_INTERFACE *pcli, coreCli;
int hLangpack;
@@ -115,7 +115,7 @@ static int systemModulesLoaded(WPARAM, LPARAM) static int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hContact)
{
- return IconFromStatusMode(szProto, status, hContact, NULL);
+ return IconFromStatusMode(szProto, status, hContact, nullptr);
}
extern "C" int __declspec(dllexport) CListInitialise()
diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 95f1907c5d..e916ac3b74 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -30,16 +30,16 @@ BOOL RowHeight::Init(ClcData *dat) dat->rowHeight = 0;
dat->row_heights_size = 0;
dat->row_heights_allocated = 0;
- dat->row_heights = NULL;
+ dat->row_heights = nullptr;
return TRUE;
}
void RowHeight::Free(ClcData *dat)
{
- if (dat->row_heights != NULL) {
+ if (dat->row_heights != nullptr) {
free(dat->row_heights);
- dat->row_heights = NULL;
+ dat->row_heights = nullptr;
}
dat->row_heights_allocated = 0;
@@ -60,10 +60,10 @@ BOOL RowHeight::Alloc(ClcData *dat, int size) size_grow += 100 - (size_grow % 100);
- if (dat->row_heights != NULL) {
+ if (dat->row_heights != nullptr) {
int *tmp = (int *)realloc((void *)dat->row_heights, sizeof(int) * size_grow);
- if (tmp == NULL) {
+ if (tmp == nullptr) {
Free(dat);
return FALSE;
}
@@ -73,7 +73,7 @@ BOOL RowHeight::Alloc(ClcData *dat, int size) else {
dat->row_heights = (int *)malloc(sizeof(int) * size_grow);
- if (dat->row_heights == NULL) {
+ if (dat->row_heights == nullptr) {
Free(dat);
return FALSE;
}
@@ -141,7 +141,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) while (true) {
if (group->scanIndex == group->cl.getCount()) {
group = group->parent;
- if (group == NULL) break; // Finished list
+ if (group == nullptr) break; // Finished list
group->scanIndex++;
continue;
}
@@ -216,7 +216,7 @@ int RowHeight::hitTest(ClcData *dat, int pos_y) int RowHeight::getHeight(ClcData *dat, int item)
{
- if (dat->row_heights == 0)
+ if (dat->row_heights == nullptr)
return 0;
return dat->row_heights[item];
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index c63cb5fb27..e69c39732e 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -53,7 +53,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM tooltip_active = FALSE;
}
KillTimer(hwnd, TIMERID_HOVER);
- SetTimer(hwnd, TIMERID_HOVER, 750, 0);
+ SetTimer(hwnd, TIMERID_HOVER, 750, nullptr);
break;
case WM_NCHITTEST:
@@ -150,7 +150,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc);
if (PtInRect(&rc, pt)) {
ProtocolData *PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0);
- if (PD == NULL)
+ if (PD == nullptr)
continue;
if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 9e444712e7..7032fb95b6 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -31,14 +31,14 @@ extern HPEN g_hPenCLUIFrames; extern FRAMEWND *wndFrameViewMode;
typedef int(__cdecl *pfnEnumCallback)(char *szName);
-static HWND sttClvmHwnd = 0;
+static HWND sttClvmHwnd = nullptr;
static int sttClvm_curItem = 0;
-HMENU hViewModeMenu = 0;
+HMENU hViewModeMenu = nullptr;
static int nullImage;
-static HWND hwndSelector = 0;
-static HANDLE hInfoItem = 0;
-static HIMAGELIST himlViewModes = 0;
+static HWND hwndSelector = nullptr;
+static HANDLE hInfoItem = nullptr;
+static HIMAGELIST himlViewModes = nullptr;
static DWORD sttStickyStatusMask = 0;
static char sttModeName[2048];
@@ -60,7 +60,7 @@ static UINT _page2Controls[] = { IDC_CLIST, IDC_STATIC9, IDC_STATIC8, IDC_CLEARA int CLVM_EnumProc(const char *szSetting, LPARAM lParam)
{
pfnEnumCallback EnumCallback = (pfnEnumCallback)lParam;
- if (szSetting != NULL)
+ if (szSetting != nullptr)
EnumCallback((char *)szSetting);
return 0;
}
@@ -109,7 +109,7 @@ static void ShowPage(HWND hwnd, int page) }
if (pageChange) {
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE);
}
}
@@ -161,7 +161,7 @@ static int FillDialog(HWND hwnd) HWND hwndList = GetDlgItem(hwnd, IDC_PROTOCOLS);
LVITEM item = { 0 };
int protoCount = 0, i;
- PROTOACCOUNT **accs = 0;
+ PROTOACCOUNT **accs = nullptr;
CLVM_EnumModes(FillModes);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_CHECKBOXES);
@@ -195,7 +195,7 @@ static int FillDialog(HWND hwnd) SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
wchar_t *grpName;
- for (i = 1; (grpName = Clist_GroupGetName(i, NULL)) != NULL; i++) {
+ for (i = 1; (grpName = Clist_GroupGetName(i, nullptr)) != nullptr; i++) {
item.pszText = grpName;
SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
}
@@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP himlViewModes = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 12, 0);
for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- ImageList_AddIcon(himlViewModes, Skin_LoadProtoIcon(NULL, i));
+ ImageList_AddIcon(himlViewModes, Skin_LoadProtoIcon(nullptr, i));
{
HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, 16, 16, 0);
nullImage = ImageList_AddIcon(himlViewModes, hIcon);
@@ -581,7 +581,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
- cii.hParentGroup = 0;
+ cii.hParentGroup = nullptr;
cii.pszText = LPGENW("*** All contacts ***");
hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
}
@@ -629,7 +629,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
break;
case IDC_DELETEVIEWMODE:
- if (MessageBox(0, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
char szSetting[256];
int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
if (iLen) {
@@ -677,7 +677,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (mir_strlen(szBuf) > 2) {
if (db_get_dw(NULL, CLVM_MODULE, szBuf, -1) != -1)
- MessageBox(0, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK);
+ MessageBox(nullptr, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK);
else {
int iNewItem = SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf);
if (iNewItem != LB_ERR) {
@@ -742,7 +742,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP DWORD hitFlags;
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA))
break;
int iImage = SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
@@ -798,7 +798,7 @@ void BuildViewModeMenu() CLVM_EnumModes(FillMenuCallback);
if (GetMenuItemCount(hViewModeMenu) > 0)
- AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, nullptr);
AppendMenu(hViewModeMenu, MF_STRING, 10001, TranslateT("Setup view modes..."));
AppendMenu(hViewModeMenu, MF_STRING, 10002, TranslateT("Clear current view mode"));
@@ -821,18 +821,18 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) {
case WM_CREATE:
hwndSelector = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
- hwnd, (HMENU)IDC_SELECTMODE, g_hInst, NULL);
+ hwnd, (HMENU)IDC_SELECTMODE, g_hInst, nullptr);
CustomizeButton(hwndSelector, false, false, false);
SendMessage(hwndSelector, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select a view mode"), BATF_UNICODE);
SendMessage(hwndSelector, BUTTONSETSENDONDOWN, TRUE, 0);
{
HWND hwndButton = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
- hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, NULL);
+ hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, nullptr);
CustomizeButton(hwndButton, false, false, false);
SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Setup view modes"), BATF_UNICODE);
hwndButton = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
- hwnd, (HMENU)IDC_RESETMODES, g_hInst, NULL);
+ hwnd, (HMENU)IDC_RESETMODES, g_hInst, nullptr);
CustomizeButton(hwndButton, false, false, false);
SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Clear view mode and return to default display"), BATF_UNICODE);
}
@@ -856,11 +856,11 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
HDWP PosBatch = BeginDeferWindowPos(3);
GetClientRect(hwnd, &rcCLVMFrame);
- PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), 0,
+ PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), nullptr,
rcCLVMFrame.right - 24, 1, 22, 20, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
- PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), 0,
+ PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), nullptr,
rcCLVMFrame.right - 47, 1, 22, 20, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
- PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), 0,
+ PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), nullptr,
2, 1, rcCLVMFrame.right - 50, 20, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
EndDeferWindowPos(PosBatch);
}
@@ -942,7 +942,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM POINT pt;
pt.x = rc.left;
pt.y = rc.bottom;
- int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
+ int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
if (selection) {
if (selection == 10001)
goto clvm_config_command;
@@ -977,7 +977,7 @@ clvm_reset_command: case IDC_CONFIGUREMODES:
clvm_config_command:
if (!g_ViewModeOptDlg)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), nullptr, DlgProcViewModesSetup, 0);
break;
}
break;
@@ -1001,10 +1001,10 @@ void CreateViewModeFrame() wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = g_hInst;
- wndclass.hIcon = 0;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hIcon = nullptr;
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE);
- wndclass.lpszMenuName = 0;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = L"CLVMFrameWindow";
RegisterClass(&wndclass);
@@ -1016,7 +1016,7 @@ void CreateViewModeFrame() frame.height = 22;
frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_UNICODE;
frame.align = alBottom;
- frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", L"CLVM", WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, NULL);
+ frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", L"CLVM", WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr);
g_hwndViewModeFrame = frame.hWnd;
hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS);
@@ -1063,7 +1063,7 @@ void ApplyViewMode(const char *name) timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
cfg::dat.old_viewmode[255] = 0;
- SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
+ SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, nullptr);
}
strncpy_s(cfg::dat.current_viewmode, name, _TRUNCATE);
diff --git a/plugins/Cln_skinedit/src/main.cpp b/plugins/Cln_skinedit/src/main.cpp index a532871ec1..b0a2734abb 100644 --- a/plugins/Cln_skinedit/src/main.cpp +++ b/plugins/Cln_skinedit/src/main.cpp @@ -40,7 +40,7 @@ PLUGININFOEX pluginInfo = { {0x21948c89, 0xb549, 0x4c9d, {0x8b, 0x4f, 0x3f, 0x37, 0x26, 0xec, 0x6b, 0x4b}} }; -HINSTANCE g_hInst = 0; +HINSTANCE g_hInst = nullptr; int hLangpack; StatusItems_t **StatusItems; @@ -542,7 +542,7 @@ static UINT _controls_to_refresh[] = { static void RefreshControls(HWND hwnd) { for(int i = 0; _controls_to_refresh[i]; i++) - InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), NULL, FALSE); + InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), nullptr, FALSE); } // wenn die listbox geändert wurde @@ -604,7 +604,7 @@ static void OnListItemsChange(HWND hwndDlg) } else ChangeControlItems(hwndDlg, 1, 0); FillOptionDialogByStatusItem(hwndDlg, &DialogSettingForMultiSel); - InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), nullptr, FALSE); } SendMessage(hwndDlg, WM_SETREDRAW, TRUE, 0); RefreshControls(hwndDlg); @@ -640,7 +640,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa switch (msg) { case WM_INITDIALOG: psd = (SKINDESCRIPTION *)malloc(sizeof(SKINDESCRIPTION)); - if (psd == NULL) + if (psd == nullptr) return FALSE; memset(psd, 0, sizeof(SKINDESCRIPTION)); memcpy(psd, (void *)lParam, sizeof(SKINDESCRIPTION)); @@ -656,13 +656,13 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa psd->hMenuItems = CreatePopupMenu(); AppendMenu(psd->hMenuItems, MF_STRING | MF_DISABLED, (UINT_PTR)0, LPGENW("Copy from")); - AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, nullptr); { for (int i = ID_EXTBK_FIRST; i < ID_EXTBK_LAST; i++) { int iOff = StatusItems[i - ID_EXTBK_FIRST]->szName[0] == '{' ? 3 : 0; if (iOff) - AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, nullptr); AppendMenuA(psd->hMenuItems, MF_STRING, (UINT_PTR)i, &StatusItems[i - ID_EXTBK_FIRST]->szName[iOff]); } } @@ -689,7 +689,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; int iItem = dis->itemData; - StatusItems_t *item = 0; + StatusItems_t *item = nullptr; SetBkMode(dis->hDC, TRANSPARENT); FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW)); @@ -738,7 +738,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa GetWindowRect(hwndList, &rc); if (PtInRect(&rc, pt)) { - int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (iSelection >= ID_EXTBK_FIRST && iSelection < ID_EXTBK_LAST) { iSelection -= ID_EXTBK_FIRST; 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); diff --git a/plugins/CmdLine/src/CmdLine.cpp b/plugins/CmdLine/src/CmdLine.cpp index f73288f91b..b28fe18a7d 100644 --- a/plugins/CmdLine/src/CmdLine.cpp +++ b/plugins/CmdLine/src/CmdLine.cpp @@ -50,7 +50,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = Clist_GetInterface();
if (InitServer())
- MessageBox(0, TranslateT("Could not initialize CmdLine plugin property"), TranslateT("Error"), MB_ICONEXCLAMATION | MB_OK);
+ MessageBox(nullptr, TranslateT("Could not initialize CmdLine plugin property"), TranslateT("Error"), MB_ICONEXCLAMATION | MB_OK);
HookEvents();
return 0;
diff --git a/plugins/CmdLine/src/hooked_events.cpp b/plugins/CmdLine/src/hooked_events.cpp index 1d7c336e03..663a7fe3b0 100644 --- a/plugins/CmdLine/src/hooked_events.cpp +++ b/plugins/CmdLine/src/hooked_events.cpp @@ -76,7 +76,7 @@ ACKDATA* GetAck(HANDLE hProcess) }
}
- return NULL;
+ return nullptr;
}
int OnProtoAck(WPARAM, LPARAM lParam)
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index d50af580e2..d8f7f39c5e 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -70,7 +70,7 @@ int Get2StateValue(char *state) int AccountName2Protocol(const char *accountName, OUT char *uniqueProtocolName, size_t length)
{
int count;
- PROTOACCOUNT **accounts = NULL;
+ PROTOACCOUNT **accounts = nullptr;
Proto_EnumAccounts(&count, &accounts);
strncpy_s(uniqueProtocolName, length, accountName, _TRUNCATE);
@@ -213,7 +213,7 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep CMStringA perAccountStatus;
int count;
- PROTOACCOUNT **accounts = NULL;
+ PROTOACCOUNT **accounts = nullptr;
Proto_EnumAccounts(&count, &accounts);
char pn[128];
@@ -243,7 +243,7 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep INT_PTR old = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
char po[128];
if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) {
- announce_status_change(NULL, status, NULL);
+ announce_status_change(nullptr, status, nullptr);
}
PrettyStatusMode(old, po, sizeof(po));
@@ -272,7 +272,7 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep INT_PTR old = CallProtoService(protocol, PS_GETSTATUS, 0, 0);
char po[128];
if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) {
- announce_status_change(protocol, status, NULL);
+ announce_status_change(protocol, status, nullptr);
}
PrettyStatusMode(old, po, sizeof(po));
@@ -316,7 +316,7 @@ void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply re {
char *awayMsg = argv[2];
int count = 0;
- PROTOACCOUNT **accounts = NULL;
+ PROTOACCOUNT **accounts = nullptr;
Proto_EnumAccounts(&count, &accounts);
CMStringA szReply;
@@ -704,8 +704,8 @@ void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PRepl {
char *service = argv[2];
if (ServiceExists(service)) {
- void *wParam = NULL;
- void *lParam = NULL;
+ void *wParam = nullptr;
+ void *lParam = nullptr;
INT_PTR res1 = ParseValueParam(argv[3], wParam);
INT_PTR res2 = ParseValueParam(argv[4], lParam);
if ((res1 != 0) && (res2 != 0)) {
@@ -757,8 +757,8 @@ MCONTACT ParseContactParam(char *contact) char account[128];
char protocol[128];
char *p = strrchr(contact, ':');
- if (p == 0)
- return GetContactFromID(contact, (char*)NULL);
+ if (p == nullptr)
+ return GetContactFromID(contact, (char*)nullptr);
*p = 0;
strncpy_s(name, contact, _TRUNCATE);
@@ -775,7 +775,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re ParseMessage(message, argv[argc - 1]); //get the message
CMStringA szReply;
- ACKDATA *ack = NULL;
+ ACKDATA *ack = nullptr;
for (int i = 2; i < argc - 1; i++) {
char *contact = argv[i];
MCONTACT hContact = ParseContactParam(contact);
@@ -788,7 +788,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re HANDLE hProcess = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message);
const int MAX_COUNT = 60;
int counter = 0;
- while (((ack = GetAck(hProcess)) == NULL) && (counter < MAX_COUNT)) {
+ while (((ack = GetAck(hProcess)) == nullptr) && (counter < MAX_COUNT)) {
SleepEx(250, TRUE);
counter++;
}
@@ -799,7 +799,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re if (ack->szModule) {
szReply.AppendFormat(Translate("Message sent to '%s'."), contact);
- DBEVENTINFO e = { 0 };
+ DBEVENTINFO e = {};
char module[128];
e.eventType = EVENTTYPE_MESSAGE;
e.flags = DBEF_SENT;
@@ -809,7 +809,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re strncpy_s(module, ack->szModule, sizeof(module));
e.szModule = module;
- e.timestamp = (DWORD)time(NULL);
+ e.timestamp = (DWORD)time(nullptr);
db_event_add(ack->hContact, &e);
}
@@ -903,8 +903,8 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r char *module = argv[3];
char *key = argv[4];
- void *value = NULL;
- char *wrote = NULL;
+ void *value = nullptr;
+ char *wrote = nullptr;
int type = ParseValueParam(argv[5], value);
switch (type) {
@@ -1130,7 +1130,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe int type = ParseProxyType(argv[4]);
char *host = argv[5];
long port;
- char *stop = NULL;
+ char *stop = nullptr;
port = strtol(argv[6], &stop, 10);
if ((*stop == 0) && (type > 0)) {
@@ -1181,7 +1181,7 @@ void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply repl AccountName2Protocol(account, protocol, sizeof(protocol));
int count = 0;
- PROTOACCOUNT **accounts = NULL;
+ PROTOACCOUNT **accounts = nullptr;
Proto_EnumAccounts(&count, &accounts);
int i;
@@ -1243,7 +1243,7 @@ int ContactMatchSearch(MCONTACT hContact, char *contact, char *id, char *account pos = strstr(lwrKeyword, "account:");
if (pos) {
pos += 8;
- if (strstr(lwrAccount, pos) == NULL) {
+ if (strstr(lwrAccount, pos) == nullptr) {
matches = 0;
break;
@@ -1267,12 +1267,12 @@ int ContactMatchSearch(MCONTACT hContact, char *contact, char *id, char *account pos = strstr(lwrKeyword, "id:");
if (pos) {
pos += 3;
- if (strstr(lwrID, pos) == NULL) {
+ if (strstr(lwrID, pos) == nullptr) {
matches = 0;
break;
}
}
- else if ((strstr(lwrName, lwrKeyword) == NULL)) {
+ else if ((strstr(lwrName, lwrKeyword) == nullptr)) {
matches = 0;
break;
}
@@ -1483,8 +1483,8 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re MCONTACT hContact = ParseContactParam(contact);
if (hContact) {
if (_stricmp(cmd, "show") == 0) {
- char *stop1 = NULL;
- char *stop2 = NULL;
+ char *stop1 = nullptr;
+ char *stop2 = nullptr;
long start = strtol(argv[4], &stop1, 10);
long stop = strtol(argv[5], &stop2, 10);
if (!(*stop1) && !(*stop2)) {
@@ -1619,7 +1619,7 @@ void HandleLuaCommand(PCommand command, TArgument *argv, int argc, PReply reply) if (_stricmp(argv[2], "call") == 0) {
wchar_t *result = argc == 4
- ? lua_call(NULL, _A2T(argv[3]))
+ ? lua_call(nullptr, _A2T(argv[3]))
: lua_call(_A2T(argv[3]), _A2T(argv[4]));
mir_strcpy(reply->message, _T2A(result));
mir_free(result);
diff --git a/plugins/CmdLine/src/mimcmd_ipc.cpp b/plugins/CmdLine/src/mimcmd_ipc.cpp index f61b70eb82..d9cf61a21a 100644 --- a/plugins/CmdLine/src/mimcmd_ipc.cpp +++ b/plugins/CmdLine/src/mimcmd_ipc.cpp @@ -20,14 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-HANDLE hsmCmdLine = NULL;
-HANDLE hmClient = NULL;
-HANDLE heServerExec = NULL;
-HANDLE heServerDone = NULL;
-HANDLE heServerClose = NULL;
-HANDLE heServerBufferFull = NULL;
+HANDLE hsmCmdLine = nullptr;
+HANDLE hmClient = nullptr;
+HANDLE heServerExec = nullptr;
+HANDLE heServerDone = nullptr;
+HANDLE heServerClose = nullptr;
+HANDLE heServerBufferFull = nullptr;
-PSharedData sdCmdLine = NULL;
+PSharedData sdCmdLine = nullptr;
int InitClient()
@@ -60,26 +60,26 @@ int DestroyServer() int CreateSystemEvents()
{
- heServerExec = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_EXEC);
- heServerDone = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_DONE);
- heServerClose = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_CLOSE);
- heServerBufferFull = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_BUFFERFULL);
+ heServerExec = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_EXEC);
+ heServerDone = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_DONE);
+ heServerClose = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_CLOSE);
+ heServerBufferFull = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_BUFFERFULL);
- return (heServerExec == NULL) || (heServerDone == NULL) || (heServerClose == NULL) || (heServerBufferFull == NULL);
+ return (heServerExec == nullptr) || (heServerDone == nullptr) || (heServerClose == nullptr) || (heServerBufferFull == nullptr);
}
int CreateMutexes()
{
- hmClient = CreateMutexA(NULL, FALSE, MUTEX_CLIENT_NAME);
- return (hmClient == NULL);
+ hmClient = CreateMutexA(nullptr, FALSE, MUTEX_CLIENT_NAME);
+ return (hmClient == nullptr);
}
int CreateSharedMem()
{
- hsmCmdLine = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(TSharedData), SHAREDMEM_NAME);
+ hsmCmdLine = CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, sizeof(TSharedData), SHAREDMEM_NAME);
sdCmdLine = (PSharedData) MapViewOfFile(hsmCmdLine, FILE_MAP_WRITE, 0, 0, sizeof(TSharedData));
- return (hsmCmdLine == NULL) || (sdCmdLine == NULL);
+ return (hsmCmdLine == nullptr) || (sdCmdLine == nullptr);
}
int DestroySystemEvents()
diff --git a/plugins/CmdLine/src/services.cpp b/plugins/CmdLine/src/services.cpp index ae146cd8ef..5faff619b9 100644 --- a/plugins/CmdLine/src/services.cpp +++ b/plugins/CmdLine/src/services.cpp @@ -72,11 +72,11 @@ int StartServer() {
if (sdCmdLine->instances == 0)
{
- HANDLE server = mir_forkthread(ServerWorkerThread, 0);
+ HANDLE server = mir_forkthread(ServerWorkerThread, nullptr);
if (server)
{
char path[MIMFOLDER_SIZE];
- GetModuleFileNameA(GetModuleHandle(NULL), path, sizeof(path));
+ GetModuleFileNameA(GetModuleHandle(nullptr), path, sizeof(path));
char *p = strrchr(path, '\\');
if (p) { *p = 0; }
strncpy_s(sdCmdLine->mimFolder, path, _TRUNCATE);
@@ -86,7 +86,7 @@ int StartServer() }
else PUShowMessageT(TranslateT("Could not create CommandLine listening server!"), SM_WARNING);
}
- else MessageBox(NULL, TranslateT("You can only run one instance of CmdLine plugin."), TranslateT("Error"), MB_ICONERROR | MB_OK);
+ else MessageBox(nullptr, TranslateT("You can only run one instance of CmdLine plugin."), TranslateT("Error"), MB_ICONERROR | MB_OK);
}
return failure;
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index df4f62e31d..3e10c68950 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -32,7 +32,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);
}
int MyPUShowMessage(char *lpzText, BYTE kind)
@@ -41,14 +41,14 @@ int MyPUShowMessage(char *lpzText, BYTE kind) return PUShowMessage(lpzText, kind);
char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning");
- return MessageBoxA(NULL, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION);
+ return MessageBoxA(nullptr, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION);
}
#define HEX_SIZE 8
char *BinToHex(int size, PBYTE data)
{
- char *szresult = NULL;
+ char *szresult = nullptr;
int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[ maxSize ];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
@@ -153,14 +153,14 @@ int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, char* GetContactName(MCONTACT hContact, char *szProto)
{
ptrW name(Contact_GetInfo(CNF_DISPLAY, hContact, szProto));
- return (name == NULL) ? NULL : strdup(_T2A(name));
+ return (name == NULL) ? nullptr : strdup(_T2A(name));
}
#pragma warning (default: 4312)
#pragma warning (disable: 4312)
void GetContactProto(MCONTACT hContact, char *szProto, size_t size)
{
- GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size);
+ GetStringFromDatabase(hContact, "Protocol", "p", nullptr, szProto, size);
}
#pragma warning (default: 4312)
@@ -176,7 +176,7 @@ char* GetContactID(MCONTACT hContact) char* GetContactID(MCONTACT hContact, char *szProto)
{
ptrW name(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
- return (name == NULL) ? NULL : strdup(_T2A(name));
+ return (name == NULL) ? nullptr : strdup(_T2A(name));
}
#pragma warning (default: 4312)
@@ -194,7 +194,7 @@ MCONTACT GetContactFromID(char *szID, char *szProto) wchar_t *tmp = pcli->pfnGetContactDisplayName(hContact, 0);
strncpy_s(dispName, _T2A(tmp), _TRUNCATE);
- if ((szHandle) && ((mir_strcmpi(szHandle, szID) == 0) || (mir_strcmpi(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0)))
+ if ((szHandle) && ((mir_strcmpi(szHandle, szID) == 0) || (mir_strcmpi(dispName, szID) == 0)) && ((szProto == nullptr) || (_stricmp(szProto, cProtocol) == 0)))
found = 1;
free(szHandle);
@@ -203,7 +203,7 @@ MCONTACT GetContactFromID(char *szID, char *szProto) return hContact;
}
- return NULL;
+ return 0;
}
#pragma warning (default: 4312)
@@ -211,7 +211,7 @@ MCONTACT GetContactFromID(char *szID, char *szProto) MCONTACT GetContactFromID(char *szID, wchar_t *szProto)
{
char protocol[1024];
- WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), nullptr, nullptr);
return GetContactFromID(szID, protocol);
}
#pragma warning (default: 4312)
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index fe7a0d9aa1..a989e81651 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -4,18 +4,18 @@ HINSTANCE hInst; CLIST_INTERFACE *pcli;
//PLUGINLINK *pluginLink=NULL;
-HANDLE hOptInit = NULL;
-static HWND hTimerWnd = (HWND)NULL;
+HANDLE hOptInit = nullptr;
+static HWND hTimerWnd = (HWND)nullptr;
static UINT TID = (UINT)12021;
//HANDLE hHookModulesLoaded=NULL;
-HANDLE hCheckEvent = NULL;
-HANDLE hCheckHook = NULL;
-HANDLE hHookModulesLoaded = NULL;
-HANDLE hHookPreShutdown = NULL;
-HANDLE hConnectionCheckThread = NULL;
-HANDLE hFilterOptionsThread = NULL;
-HANDLE killCheckThreadEvent = NULL;
-HANDLE hExceptionsMutex = NULL;
+HANDLE hCheckEvent = nullptr;
+HANDLE hCheckHook = nullptr;
+HANDLE hHookModulesLoaded = nullptr;
+HANDLE hHookPreShutdown = nullptr;
+HANDLE hConnectionCheckThread = nullptr;
+HANDLE hFilterOptionsThread = nullptr;
+HANDLE killCheckThreadEvent = nullptr;
+HANDLE hExceptionsMutex = nullptr;
//HANDLE hCurrentEditMutex=NULL;
int hLangpack = 0;
@@ -32,11 +32,11 @@ int settingFiltersCount = 0; BOOL settingDefaultAction = TRUE;
WORD settingStatusMask = 0;
-struct CONNECTION *first = NULL;
-struct CONNECTION *connExceptions = NULL;
+struct CONNECTION *first = nullptr;
+struct CONNECTION *connExceptions = nullptr;
struct CONNECTION *connCurrentEdit;
-struct CONNECTION *connExceptionsTmp = NULL;
-struct CONNECTION *connCurrentEditModal = NULL;
+struct CONNECTION *connExceptionsTmp = nullptr;
+struct CONNECTION *connCurrentEditModal = nullptr;
int currentStatus = ID_STATUS_OFFLINE, diffstat = 0;
BOOL bOptionsOpen = FALSE;
wchar_t *tcpStates[] = { L"CLOSED", L"LISTEN", L"SYN_SENT", L"SYN_RCVD", L"ESTAB", L"FIN_WAIT1", L"FIN_WAIT2", L"CLOSE_WAIT", L"CLOSING", L"LAST_ACK", L"TIME_WAIT", L"DELETE_TCB" };
@@ -94,7 +94,7 @@ void saveSettingsConnections(struct CONNECTION *connHead) char buff[128];
int i = 0;
struct CONNECTION *tmp = connHead;
- while (tmp != NULL) {
+ while (tmp != nullptr) {
mir_snprintf(buff, "%dFilterIntIp", i);
db_set_ws(NULL, PLUGINNAME, buff, tmp->strIntIp);
@@ -119,7 +119,7 @@ void saveSettingsConnections(struct CONNECTION *connHead) //load filters from db
struct CONNECTION* LoadSettingsConnections()
{
- struct CONNECTION *connHead = NULL;
+ struct CONNECTION *connHead = nullptr;
DBVARIANT dbv;
char buff[128];
int i = 0;
@@ -251,12 +251,12 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L if (tmpPort[0] == '*')
connCurrentEditModal->intIntPort = -1;
else
- connCurrentEditModal->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE);
+ connCurrentEditModal->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, nullptr, FALSE);
GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, _countof(tmpPort));
if (tmpPort[0] == '*')
connCurrentEditModal->intExtPort = -1;
else
- connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE);
+ connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, nullptr, FALSE);
GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, _countof(connCurrentEditModal->strIntIp));
GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, _countof(connCurrentEditModal->strExtIp));
@@ -264,12 +264,12 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L connCurrentEditModal->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0);
- connCurrentEditModal = NULL;
+ connCurrentEditModal = nullptr;
EndDialog(hWnd, IDOK);
return TRUE;
}
case ID_CANCEL:
- connCurrentEditModal = NULL;
+ connCurrentEditModal = nullptr;
EndDialog(hWnd, IDCANCEL);
return TRUE;
}
@@ -277,7 +277,7 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L break;
case WM_CLOSE:
{
- connCurrentEditModal = NULL;
+ connCurrentEditModal = nullptr;
EndDialog(hWnd, IDCANCEL);
break;
}
@@ -374,8 +374,8 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case WM_COMMAND://user changed something, so get changes to variables
PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
switch (LOWORD(wParam)) {
- case IDC_INTERVAL: settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break;
- case IDC_INTERVAL1: settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break;
+ case IDC_INTERVAL: settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, nullptr, FALSE); break;
+ case IDC_INTERVAL1: settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, nullptr, TRUE); break;
case IDC_RESOLVEIP: settingResolveIp = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RESOLVEIP); break;
case ID_CHK_DEFAULTACTION: settingDefaultAction = (BYTE)IsDlgButtonChecked(hwndDlg, ID_CHK_DEFAULTACTION); break;
case ID_ADD:
@@ -391,7 +391,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
mir_free(cur);
- cur = NULL;
+ cur = nullptr;
}
else {
cur->next = connExceptionsTmp;
@@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case ID_DELETE:
{
int pos, pos1;
- struct CONNECTION *cur = connExceptionsTmp, *pre = NULL;
+ struct CONNECTION *cur = connExceptionsTmp, *pre = nullptr;
pos = (int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), -1, LVNI_FOCUSED);
if (pos == -1)break;
@@ -416,7 +416,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar pre = cur;
cur = cur->next;
}
- if (pre == NULL)
+ if (pre == nullptr)
connExceptionsTmp = connExceptionsTmp->next;
else
(pre)->next = cur->next;
@@ -429,7 +429,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case ID_UP:
{
int pos, pos1;
- struct CONNECTION *cur = NULL, *pre = NULL, *prepre = NULL;
+ struct CONNECTION *cur = nullptr, *pre = nullptr, *prepre = nullptr;
cur = connExceptionsTmp;
@@ -441,12 +441,12 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar pre = cur;
cur = cur->next;
}
- if (prepre != NULL) {
+ if (prepre != nullptr) {
pre->next = cur->next;
cur->next = pre;
prepre->next = cur;
}
- else if (pre != NULL) {
+ else if (pre != nullptr) {
pre->next = cur->next;
cur->next = pre;
connExceptionsTmp = cur;
@@ -459,7 +459,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case ID_DOWN:
{
int pos, pos1;
- struct CONNECTION *cur = NULL, *pre = NULL;
+ struct CONNECTION *cur = nullptr, *pre = nullptr;
cur = connExceptionsTmp;
@@ -470,12 +470,12 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar pre = cur;
cur = cur->next;
}
- if (cur == connExceptionsTmp&&cur->next != NULL) {
+ if (cur == connExceptionsTmp&&cur->next != nullptr) {
connExceptionsTmp = cur->next;
cur->next = cur->next->next;
connExceptionsTmp->next = cur;
}
- else if (cur->next != NULL) {
+ else if (cur->next != nullptr) {
struct CONNECTION *tmp = cur->next->next;
pre->next = cur->next;
cur->next->next = cur;
@@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case NM_DBLCLK:
{
int pos, pos1;
- struct CONNECTION *cur = NULL;
+ struct CONNECTION *cur = nullptr;
cur = connExceptionsTmp;
@@ -576,7 +576,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case WM_DESTROY:
bOptionsOpen = FALSE;
deleteConnectionsTable(connExceptionsTmp);
- connExceptionsTmp = NULL;
+ connExceptionsTmp = nullptr;
return TRUE;
}
return 0;
@@ -585,7 +585,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar //options page on miranda called
int ConnectionNotifyOptInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG);
odp.szTitle.w = _A2W(PLUGINNAME);
@@ -644,7 +644,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) diffstat = 0;
ResetEvent(killCheckThreadEvent);
if (!hConnectionCheckThread)
- hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, 0, (unsigned int*)&ConnectionCheckThreadId);
+ hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, nullptr, (unsigned int*)&ConnectionCheckThreadId);
}
else {
int retv = 0;
@@ -684,19 +684,19 @@ static unsigned __stdcall checkthread(void *) _OutputDebugString(L"check thread started");
#endif
while (1) {
- struct CONNECTION* conn = NULL, *connOld = first, *cur = NULL;
+ struct CONNECTION* conn = nullptr, *connOld = first, *cur = nullptr;
#ifdef _DEBUG
_OutputDebugString(L"checking connections table...");
#endif
if (WAIT_OBJECT_0 == WaitForSingleObject(killCheckThreadEvent, 100)) {
- hConnectionCheckThread = NULL;
+ hConnectionCheckThread = nullptr;
return 0;
}
conn = GetConnectionsTable();
cur = conn;
- while (cur != NULL) {
- if (searchConnection(first, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state) == NULL && (settingStatusMask & (1 << (cur->state - 1)))) {
+ while (cur != nullptr) {
+ if (searchConnection(first, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state) == nullptr && (settingStatusMask & (1 << (cur->state - 1)))) {
#ifdef _DEBUG
wchar_t msg[1024];
@@ -719,7 +719,7 @@ static unsigned __stdcall checkthread(void *) deleteConnectionsTable(connOld);
Sleep(settingInterval);
}
- hConnectionCheckThread = NULL;
+ hConnectionCheckThread = nullptr;
return 1;
}
@@ -821,7 +821,7 @@ static int modulesloaded(WPARAM, LPARAM) //#ifdef _DEBUG
// _OutputDebugString("started check thread %d",hConnectionCheckThread);
//#endif
- killCheckThreadEvent = CreateEvent(NULL, FALSE, FALSE, L"killCheckThreadEvent");
+ killCheckThreadEvent = CreateEvent(nullptr, FALSE, FALSE, L"killCheckThreadEvent");
hFilterOptionsThread = startFilterThread();
//updaterRegister();
@@ -855,7 +855,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- hExceptionsMutex = CreateMutex(NULL, FALSE, L"ExceptionsMutex");
+ hExceptionsMutex = CreateMutex(nullptr, FALSE, L"ExceptionsMutex");
LoadSettings();
connExceptions = LoadSettingsConnections();
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index db9b205e0f..5d3d778517 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-HWND filterAddDlg = NULL;
+HWND filterAddDlg = nullptr;
extern HINSTANCE hInst;
extern struct CONNECTION *connExceptions;
extern HANDLE hFilterOptionsThread;
@@ -14,7 +14,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM HANDLE startFilterThread()
{
- return (HANDLE)mir_forkthreadex(filterQueue, 0, (unsigned int*)&FilterOptionsThreadId);
+ return (HANDLE)mir_forkthreadex(filterQueue, nullptr, (unsigned int*)&FilterOptionsThreadId);
}
static unsigned __stdcall filterQueue(void *)
@@ -22,21 +22,21 @@ static unsigned __stdcall filterQueue(void *) BOOL bRet;
MSG msg;
//while(1)
- while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
+ while ((bRet = GetMessage(&msg, nullptr, 0, 0)) != 0)
{
if (msg.message == WM_ADD_FILTER)
{
struct CONNECTION *conn = (struct CONNECTION *)msg.lParam;
- filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), NULL, ConnectionFilterEditProc, (LPARAM)conn);
+ filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
ShowWindow(filterAddDlg, SW_SHOW);
}
- if (NULL == filterAddDlg || !IsDialogMessage(filterAddDlg, &msg)) { /* Wine fix. */
+ if (nullptr == filterAddDlg || !IsDialogMessage(filterAddDlg, &msg)) { /* Wine fix. */
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
- hFilterOptionsThread = NULL;
+ hFilterOptionsThread = nullptr;
return TRUE;
}
@@ -62,7 +62,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM }
case WM_ACTIVATE:
if (0 == wParam) // becoming inactive
- filterAddDlg = NULL;
+ filterAddDlg = nullptr;
else // becoming active
filterAddDlg = hWnd;
return FALSE;
@@ -79,7 +79,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM }
if (WAIT_OBJECT_0 == WaitForSingleObject(hExceptionsMutex, 100))
{
- if (connCurrentEdit == NULL)
+ if (connCurrentEdit == nullptr)
{
connCurrentEdit = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION));
connCurrentEdit->next = connExceptions;
@@ -89,19 +89,19 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM if (tmpPort[0] == '*')
connCurrentEdit->intIntPort = -1;
else
- connCurrentEdit->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE);
+ connCurrentEdit->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, nullptr, FALSE);
GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, _countof(tmpPort));
if (tmpPort[0] == '*')
connCurrentEdit->intExtPort = -1;
else
- connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE);
+ connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, nullptr, FALSE);
GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, _countof(connCurrentEdit->strIntIp));
GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, _countof(connCurrentEdit->strExtIp));
GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, _countof(connCurrentEdit->PName));
connCurrentEdit->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0);
- connCurrentEdit = NULL;
+ connCurrentEdit = nullptr;
saveSettingsConnections(connExceptions);
ReleaseMutex(hExceptionsMutex);
}
@@ -110,7 +110,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM return TRUE;
}
case ID_CANCEL:
- connCurrentEdit = NULL;
+ connCurrentEdit = nullptr;
DestroyWindow(hWnd);
//EndDialog(hWnd,IDCANCEL);
return TRUE;
@@ -121,8 +121,8 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM case WM_CLOSE:
DestroyWindow(hWnd);
case WM_DESTROY:
- filterAddDlg = NULL;
- connCurrentEdit = NULL;
+ filterAddDlg = nullptr;
+ connCurrentEdit = nullptr;
//DestroyWindow(hWnd);
//PostQuitMessage(0);
break;
@@ -132,7 +132,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM BOOL checkFilter(struct CONNECTION *head, struct CONNECTION *conn)
{
- for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next)
+ for (struct CONNECTION *cur = head; cur != nullptr; cur = cur->next)
if (wildcmpw(conn->PName, cur->PName) && wildcmpw(conn->strIntIp, cur->strIntIp) && wildcmpw(conn->strExtIp, cur->strExtIp)
&& (cur->intIntPort == -1 || cur->intIntPort == conn->intIntPort) && (cur->intExtPort == -1 || cur->intExtPort == conn->intExtPort))
return cur->Pid;
diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp index 663e22a16e..93d906cc4f 100644 --- a/plugins/ConnectionNotify/src/netstat.cpp +++ b/plugins/ConnectionNotify/src/netstat.cpp @@ -4,9 +4,9 @@ struct CONNECTION *GetConnectionsTable() { // Declare and initialize variables MIB_TCPTABLE_OWNER_PID *pTcpTable = (MIB_TCPTABLE_OWNER_PID *)MALLOC(sizeof(MIB_TCPTABLE_OWNER_PID)); - if (pTcpTable == NULL) { + if (pTcpTable == nullptr) { //printf("Error allocating memory!\n"); - return NULL; + return nullptr; } DWORD dwSize = sizeof(MIB_TCPTABLE_OWNER_PID); @@ -16,9 +16,9 @@ struct CONNECTION *GetConnectionsTable() if (dwRetVal == ERROR_INSUFFICIENT_BUFFER) { FREE(pTcpTable); pTcpTable = (MIB_TCPTABLE_OWNER_PID *)MALLOC(dwSize); - if (pTcpTable == NULL) { + if (pTcpTable == nullptr) { //printf("Error allocating memory\n"); - return NULL; + return nullptr; } } @@ -27,12 +27,12 @@ struct CONNECTION *GetConnectionsTable() if ((dwRetVal = GetExtendedTcpTable(pTcpTable, &dwSize, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0)) != NO_ERROR) { //printf("\tGetTcpTable() failed with return value %d\n", dwRetVal); FREE(pTcpTable); - return NULL; + return nullptr; } //printf("\tLocal Addr\tLocal Port\tRemote Addr\tRemote Port\n"); //printf("Number of entries: %d\n", (int) pTcpTable->dwNumEntries); struct in_addr IpAddr; - struct CONNECTION *connHead = NULL; + struct CONNECTION *connHead = nullptr; for (DWORD i = 0; i < pTcpTable->dwNumEntries; i++) { struct CONNECTION *newConn = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); memset(newConn, 0, sizeof(struct CONNECTION)); @@ -114,18 +114,18 @@ void deleteConnectionsTable(struct CONNECTION *head) { struct CONNECTION *cur = head, *del; - while (cur != NULL) { + while (cur != nullptr) { del = cur; cur = cur->next; mir_free(del); head = cur; } - head = NULL; + head = nullptr; } struct CONNECTION *searchConnection(struct CONNECTION *head, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state) { - for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) { + for (struct CONNECTION *cur = head; cur != nullptr; cur = cur->next) { if (mir_wstrcmp(cur->strIntIp, intIp) == 0 && mir_wstrcmp(cur->strExtIp, extIp) == 0 && cur->intExtPort == extPort && @@ -133,7 +133,7 @@ struct CONNECTION *searchConnection(struct CONNECTION *head, wchar_t *intIp, wch cur->state == state) return cur; } - return NULL; + return nullptr; } void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len) @@ -144,5 +144,5 @@ void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len) iaHost.s_addr = inet_addr(szStrIP); mir_free(szStrIP); hostent *h = gethostbyaddr((char *)&iaHost, sizeof(struct in_addr), AF_INET); - wcsncpy_s(strHostName, len, (h == NULL) ? strIp : _A2T(h->h_name), _TRUNCATE); + wcsncpy_s(strHostName, len, (h == nullptr) ? strIp : _A2T(h->h_name), _TRUNCATE); } diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index f11c0b807b..43c85aea52 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -81,16 +81,16 @@ typedef struct { -static SortedList lModules = { 0 };
+static SortedList lModules = {};
-static LOGWIN *pActive = NULL;
+static LOGWIN *pActive = nullptr;
static int tabCount = 0;
static RECT rcTabs = { 0 };
-static HWND hTabs = NULL;
-static HWND hwndConsole = NULL;
+static HWND hTabs = nullptr;
+static HWND hwndConsole = nullptr;
-static HIMAGELIST gImg = NULL;
-static HFONT hfLogFont = NULL;
+static HIMAGELIST gImg = nullptr;
+static HFONT hfLogFont = nullptr;
static COLORREF colLogFont;
static COLORREF colBackground;
@@ -105,8 +105,8 @@ static DWORD gWrapLen = DEFAULT_WRAPLEN; static DWORD OutMsgs = 0;
static DWORD InMsgs = 0;
-static HICON hIcons[15] = { 0 };
-static HGENMENU hMenu = NULL;
+static HICON hIcons[15] = {};
+static HGENMENU hMenu = nullptr;
static void LoadSettings();
static void ShowConsole(int show);
@@ -115,13 +115,13 @@ static int Openfile(wchar_t *outputFile, int selection); ////////////////////////////////////////////////////////////////////////////////
-static HANDLE hTTBButt = 0;
+static HANDLE hTTBButt = nullptr;
static int OnTTBLoaded(WPARAM, LPARAM)
{
int state = IsWindowVisible(hwndConsole);
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconHandleUp = LoadIcon(IDI_BTN_UP);
ttb.hIconHandleDn = LoadIcon(IDI_BTN_DN);
ttb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
@@ -144,7 +144,7 @@ void ScrollDown(LOGWIN *dat) { static void ShowConsole(int show)
{
- HWND hwnd = NULL;
+ HWND hwnd = nullptr;
if (!hwndConsole || !pActive) return;
@@ -162,7 +162,7 @@ static void ShowConsole(int show) SetForegroundWindow(hwnd);
if (show)
- RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
+ RedrawWindow(pActive->hList, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
if (hMenu)
Menu_ModifyItem(hMenu, show ? LPGENW("Hide Console") : LPGENW("Show Console"));
@@ -238,7 +238,7 @@ static LRESULT CALLBACK SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if (wParam == VK_LEFT && ctrl) {
- NMHDR nmhdr = { 0 };
+ NMHDR nmhdr = {};
int tab = TabCtrl_GetCurSel(hTabs);
if (tab == 0)
@@ -253,7 +253,7 @@ static LRESULT CALLBACK SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if (wParam == VK_RIGHT && ctrl) {
- NMHDR nmhdr = { 0 };
+ NMHDR nmhdr = {};
int tab = TabCtrl_GetCurSel(hTabs);
int count = TabCtrl_GetItemCount(hTabs);
tab = (tab + 1) % count;
@@ -381,7 +381,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP str = wcstok(str, L"\n");
- if (gIcons && str != NULL) {
+ if (gIcons && str != nullptr) {
lvi.mask = LVIF_TEXT | LVIF_IMAGE;
if (wcsstr(str, L"Data received")) {
@@ -402,7 +402,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP }
else lvi.mask = LVIF_TEXT;
- while (str != NULL) {
+ while (str != nullptr) {
lvi.pszText = &str[0];
tmplen = len = (DWORD)mir_wstrlen(lvi.pszText);
@@ -423,7 +423,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP last = ListView_InsertItem(dat->hList, &lvi);
- str = wcstok(NULL, L"\n");
+ str = wcstok(nullptr, L"\n");
if (str) dat->newline = 1;
lvi.iImage = IMG_EMPTY;
@@ -635,7 +635,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam // lParam = DUMPMSG
int idx;
LOGWIN *lw;
- LOGWIN lw2 = { 0 };
+ LOGWIN lw2 = {};
DUMPMSG *dumpMsg = (DUMPMSG *)lParam;
if (!pActive) {
@@ -745,7 +745,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam SetFocus(pActive->hList);
}
else
- pActive = NULL;
+ pActive = nullptr;
}
}
@@ -796,7 +796,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam case HM_RESTART:
{
if (pActive) {
- pActive = NULL;
+ pActive = nullptr;
PostMessage(hwndDlg, HM_RESTART, 0, 0);
return TRUE;
}
@@ -881,7 +881,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam DestroyWindow(hwndDlg);
break;
case WM_DESTROY:
- pActive = NULL;
+ pActive = nullptr;
if (hfLogFont) DeleteObject(hfLogFont);
PostQuitMessage(0);
break;
@@ -899,25 +899,25 @@ void __cdecl ConsoleThread(void*) MSG msg;
HWND hwnd;
- hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONSOLE), NULL, ConsoleDlgProc);
+ hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONSOLE), nullptr, ConsoleDlgProc);
if (!hwnd) return;
- while (GetMessage(&msg, NULL, 0, 0) > 0) {
+ while (GetMessage(&msg, nullptr, 0, 0) > 0) {
switch (msg.message) {
case HM_DUMP:
OutMsgs++;
break;
}
- if (hwnd != NULL && IsDialogMessage(hwnd, &msg)) /* Wine fix. */
+ if (hwnd != nullptr && IsDialogMessage(hwnd, &msg)) /* Wine fix. */
continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- hwndConsole = NULL;
+ hwndConsole = nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -972,7 +972,7 @@ static void LoadSettings() static void SaveSettings(HWND hwndDlg)
{
- int len = GetDlgItemInt(hwndDlg, IDC_WRAP, NULL, FALSE);
+ int len = GetDlgItemInt(hwndDlg, IDC_WRAP, nullptr, FALSE);
if (len < MIN_WRAPLEN)
len = MIN_WRAPLEN;
else if (len > MAX_WRAPLEN)
@@ -982,7 +982,7 @@ static void SaveSettings(HWND hwndDlg) SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE);
db_set_b(NULL, "Console", "Wrap", (BYTE)len);
- len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE);
+ len = GetDlgItemInt(hwndDlg, IDC_LIMIT, nullptr, FALSE);
if (len < MIN_LIMIT)
len = MIN_LIMIT;
else if (len > MAX_LIMIT)
@@ -1082,7 +1082,7 @@ static int OnColourChange(WPARAM, LPARAM) static int OnFontChange(WPARAM, LPARAM)
{
if (hwndConsole) {
- HFONT hf = NULL;
+ HFONT hf = nullptr;
LOGFONT LogFont = { 0 };
colLogFont = Font_GetW(L"Console", L"Text", &LogFont);
@@ -1183,7 +1183,7 @@ static int stringCompare(LOGWIN *lw1, LOGWIN *lw2) static UINT logicons[] = { IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO };
-static HANDLE hConsoleThread = NULL;
+static HANDLE hConsoleThread = nullptr;
void InitConsole()
{
@@ -1215,7 +1215,7 @@ void InitConsole() LoadSettings();
- hConsoleThread = mir_forkthread(ConsoleThread, 0);
+ hConsoleThread = mir_forkthread(ConsoleThread, nullptr);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
diff --git a/plugins/Console/src/init.cpp b/plugins/Console/src/init.cpp index d1aa172b1f..634b6722f9 100644 --- a/plugins/Console/src/init.cpp +++ b/plugins/Console/src/init.cpp @@ -64,7 +64,7 @@ HANDLE LoadIcon(int iIconID) for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iIconID)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
extern "C" __declspec(dllexport) int Load(void)
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 5e3289a06a..66b604553d 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -130,7 +130,7 @@ static int HookPreBuildContactMenu(WPARAM hContact, LPARAM) static int HookModulesLoaded(WPARAM, LPARAM)
{
- char* modules[2] = { 0 };
+ char* modules[2] = {};
modules[0] = MODULENAME;
CallService("DBEditorpp/RegisterModule", (WPARAM)modules, 1);
@@ -179,7 +179,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM) //find window for hContact
HWND hWnd = WindowList_Find(g_hSendWindowList, wParam);
if (!hWnd)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), NULL, SendDlgProc, wParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), nullptr, SendDlgProc, wParam);
else {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
@@ -189,7 +189,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM) static INT_PTR ServiceReceiveCommand(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), NULL, RecvDlgProc, lParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), nullptr, RecvDlgProc, lParam);
return 0;
}
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 511b4c0972..75a07be4fe 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -28,10 +28,10 @@ TRecvContactsData::TRecvContactsData(MCONTACT contact)
{
mhContact = contact;
- hHook = NULL;
+ hHook = nullptr;
cbReceived = 0;
- maReceived = NULL;
- haUin = NULL;
+ maReceived = nullptr;
+ haUin = nullptr;
}
TRecvContactsData::~TRecvContactsData()
@@ -103,12 +103,12 @@ static void EnableGroupCombo(HWND hwndDlg) static void RebuildGroupCombo(HWND hwndDlg)
{
- int bHasGroups = Clist_GroupGetName(0, NULL) != 0;
+ int bHasGroups = Clist_GroupGetName(0, nullptr) != nullptr;
HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS);
if (bHasGroups) {
int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0);
- wchar_t *curst = NULL;
+ wchar_t *curst = nullptr;
EnableDlgItem(hwndDlg, IDC_ENABLEGROUPS, TRUE);
EnableGroupCombo(hwndDlg);
@@ -120,7 +120,7 @@ static void RebuildGroupCombo(HWND hwndDlg) SendMessage(hGroupsCombo, CB_RESETCONTENT, 0, 0);
wchar_t *szGroup;
- for (int i=1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) {
+ for (int i=1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++) {
int nIndex = SendMessage(hGroupsCombo, CB_ADDSTRING, 0, (LPARAM)szGroup);
SendMessage(hGroupsCombo, CB_SETITEMDATA, nIndex, i);
}
@@ -299,7 +299,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS);
HWND hGroupsCheck = GetDlgItem(hwndDlg, IDC_ENABLEGROUPS);
int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0);
- wchar_t* caGroup = NULL;
+ wchar_t* caGroup = nullptr;
int nGroupId = -1;
if (curs != CB_ERR && IsWindowEnabled(hGroupsCheck) && SendMessage(hGroupsCheck, BM_GETCHECK, 0, 0))
{ //got groups, get the one selected in combo
@@ -375,7 +375,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara RECT rc;
GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU), &rc);
HMENU hMenu = Menu_BuildContactMenu(wndData->mhContact);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -413,7 +413,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int ci = ListView_HitTest(hLV, &lvh);
if (ci==-1) break; // mouse is not over any item
wndData->iPopupItem = ci;
- TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, NULL);
+ TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, nullptr);
}
break;
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 1016a386dc..6ddd675442 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -29,7 +29,7 @@ TSendProcessList::TSendProcessList()
{
Count = 0;
- Items = NULL;
+ Items = nullptr;
}
TSendProcessList::~TSendProcessList()
@@ -61,9 +61,9 @@ void TSendProcessList::Remove(HANDLE hProcc) TSendContactsData::TSendContactsData(MCONTACT contact) : uacklist()
{
hContact = contact;
- hHook = NULL;
- hError = NULL;
- aContacts = NULL;
+ hHook = nullptr;
+ hError = nullptr;
+ aContacts = nullptr;
nContacts = 0;
}
@@ -84,7 +84,7 @@ void TSendContactsData::UnhookProtoAck() {
if (hHook) {
UnhookEvent(hHook);
- hHook = NULL;
+ hHook = nullptr;
}
}
@@ -197,7 +197,7 @@ static void SetAllContactChecks(HWND hwndList, MCONTACT hReceiver) // doubtful n binListEvent = TRUE;
char *szProto = GetContactProto(hReceiver);
- if (szProto == NULL)
+ if (szProto == nullptr)
return;
if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT))
@@ -266,7 +266,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case DM_ERRORDECIDED:
EnableWindow(hwndDlg, TRUE);
- wndData->hError = NULL;
+ wndData->hError = nullptr;
switch (wParam) {
case MSGERROR_CANCEL:
wndData->UnhookProtoAck();
@@ -275,7 +275,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara delete g_aAckData.Remove(wndData->uacklist.Items[i]); // remove our ackdata & release structure
mir_free(wndData->uacklist.Items);
- wndData->uacklist.Items = NULL;
+ wndData->uacklist.Items = nullptr;
wndData->uacklist.Count = 0;
}
EnableDlgItem(hwndDlg, IDOK, TRUE);
@@ -333,7 +333,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (!wndData->SendContacts(hwndDlg))
break;
- SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), NULL);
+ SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), nullptr);
}
break;
@@ -358,7 +358,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
HMENU hMenu = Menu_BuildContactMenu(wndData->hContact);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -384,7 +384,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
TAckData *ackData = g_aAckData.Get(ack->hProcess);
- if (ackData == NULL)
+ if (ackData == nullptr)
break; // on unknown hprocc go away
if (ackData->hContact != ack->hContact)
@@ -402,7 +402,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara dbei.szModule = GetContactProto(ackData->hContact);
dbei.eventType = EVENTTYPE_CONTACTS;
dbei.flags = DBEF_SENT | DBEF_UTF;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
//make blob
TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend));
memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend)));
@@ -484,7 +484,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar RECT rc, rcParent;
GetWindowRect(hwndDlg, &rc);
GetWindowRect(GetParent(hwndDlg), &rcParent);
- SetWindowPos(hwndDlg, 0,
+ SetWindowPos(hwndDlg, nullptr,
(rcParent.left + rcParent.right - (rc.right - rc.left)) / 2,
(rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2,
0, 0, SWP_NOZORDER | SWP_NOSIZE);
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 257cdb555f..9ea296f915 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -52,19 +52,19 @@ char* __fastcall null_strdup(const char *string) if (string)
return strdup(string);
- return NULL;
+ return nullptr;
}
wchar_t* GetContactUID(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == 0)
- return NULL;
+ if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == nullptr)
+ return nullptr;
DBVARIANT vrUid;
if (db_get_s(hContact, szProto, uid, &vrUid, 0))
- return NULL;
+ return nullptr;
if (vrUid.type == DBVT_DWORD) {
wchar_t tmp[100];
@@ -84,7 +84,7 @@ wchar_t* GetContactUID(MCONTACT hContact) return res;
}
- return NULL;
+ return nullptr;
}
void DialogAddContactExecute(HWND hwndDlg, MCONTACT hNewContact)
@@ -105,7 +105,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact) HICON hIcon = LoadContactProtoIcon(hContact);
if (hIcon)
{
- DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL);
DestroyIcon(hIcon);
}
}
@@ -162,7 +162,7 @@ HICON LoadContactProtoIcon(MCONTACT hContact) char *szProto = GetContactProto(hContact);
if (szProto)
return (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- return NULL;
+ return nullptr;
}
@@ -187,5 +187,5 @@ wchar_t* __fastcall strdupT(const wchar_t *string) {
if (string)
return (wchar_t*)wcsdup((wchar_t*)string);
- return NULL;
+ return nullptr;
}
diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp index 966af46b11..e0d145dfe7 100644 --- a/plugins/CountryFlags/src/icons.cpp +++ b/plugins/CountryFlags/src/icons.cpp @@ -91,9 +91,9 @@ static int __fastcall CountryNumberToBitmapIndex(int countryNumber) // only operates on color icons, which isn't a problem here
static HICON __fastcall ResizeIconCentered(HICON hIcon,int cx,int cy)
{
- HICON hResIcon = NULL;
- HDC hdc = CreateCompatibleDC(NULL);
- if (hdc != NULL) {
+ HICON hResIcon = nullptr;
+ HDC hdc = CreateCompatibleDC(nullptr);
+ if (hdc != nullptr) {
ICONINFO icoi;
if ( GetIconInfo(hIcon,&icoi)) {
BITMAP bm;
@@ -102,22 +102,22 @@ static HICON __fastcall ResizeIconCentered(HICON hIcon,int cx,int cy) pt.x = (cx-bm.bmWidth)/2;
pt.y = (cy-bm.bmHeight)/2;
HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor);
- if (hbmPrev != NULL) { /* error on select? */
+ if (hbmPrev != nullptr) { /* error on select? */
HBITMAP hbm = icoi.hbmColor;
icoi.hbmColor = CreateCompatibleBitmap(hdc,cx,cy);
- if (icoi.hbmColor != NULL)
- if (SelectObject(hdc,icoi.hbmColor) != NULL) { /* error on select? */
+ if (icoi.hbmColor != nullptr)
+ if (SelectObject(hdc,icoi.hbmColor) != nullptr) { /* error on select? */
DeleteObject(hbm); /* delete prev color (XOR) */
- if (BitBlt(hdc,0,0,cx,cy,NULL,0,0,BLACKNESS)) /* transparency: AND=0, XOR=1 */
- if (DrawIconEx(hdc,pt.x,pt.y,hIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_IMAGE|DI_NOMIRROR)) {
- if (SelectObject(hdc,icoi.hbmMask) != NULL) { /* error on select? */
+ if (BitBlt(hdc,0,0,cx,cy,nullptr,0,0,BLACKNESS)) /* transparency: AND=0, XOR=1 */
+ if (DrawIconEx(hdc,pt.x,pt.y,hIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_IMAGE|DI_NOMIRROR)) {
+ if (SelectObject(hdc,icoi.hbmMask) != nullptr) { /* error on select? */
hbm = icoi.hbmMask;
- icoi.hbmMask = CreateBitmap(cx,cy,1,1,NULL); /* mono */
- if (icoi.hbmMask != NULL)
- if (SelectObject(hdc,icoi.hbmMask) != NULL) { /* error on select? */
+ icoi.hbmMask = CreateBitmap(cx,cy,1,1,nullptr); /* mono */
+ if (icoi.hbmMask != nullptr)
+ if (SelectObject(hdc,icoi.hbmMask) != nullptr) { /* error on select? */
DeleteObject(hbm); /* delete prev mask (AND) */
- if (BitBlt(hdc,0,0,cx,cy,NULL,0,0,WHITENESS)) /* transparency: AND=0, XOR=1 */
- if (DrawIconEx(hdc,pt.x,pt.y,hIcon,0,0,0,NULL,DI_MASK|DI_NOMIRROR)) {
+ if (BitBlt(hdc,0,0,cx,cy,nullptr,0,0,WHITENESS)) /* transparency: AND=0, XOR=1 */
+ if (DrawIconEx(hdc,pt.x,pt.y,hIcon,0,0,0,nullptr,DI_MASK|DI_NOMIRROR)) {
SelectObject(hdc,hbmPrev);
hResIcon = CreateIconIndirect(&icoi); /* bitmaps must not be selected */
}
@@ -142,7 +142,7 @@ HICON __fastcall LoadFlagIcon(int countryNumber) {
/* create identifier */
char *szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber, 0);
- if (szCountry == NULL)
+ if (szCountry == nullptr)
szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber = 0xFFFF, 0);
char szId[20];
@@ -168,7 +168,7 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) {
/* return handle */
if ((BOOL)lParam) {
- if (phIconHandles == NULL)
+ if (phIconHandles == nullptr)
return 0;
return (INT_PTR)phIconHandles[CountryNumberToIndex((int)wParam)];
@@ -179,10 +179,10 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam)
{
- HICON hIcon=NULL;
+ HICON hIcon = nullptr;
/* load both icons */
HICON hLowerIcon = (HICON)ServiceLoadFlagIcon((WPARAM)lParam,0);
- if (hLowerIcon == NULL)
+ if (hLowerIcon == nullptr)
return 0;
HICON hUpperIcon = (HICON)ServiceLoadFlagIcon(wParam,0);
@@ -191,21 +191,21 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) ICONINFO icoi;
if (GetIconInfo(hLowerIcon, &icoi)) {
BITMAP bm;
- if (hUpperIcon != NULL && GetObject(icoi.hbmColor, sizeof(bm), &bm)) {
- HDC hdc = CreateCompatibleDC(NULL);
- if (hdc != NULL) {
+ if (hUpperIcon != nullptr && GetObject(icoi.hbmColor, sizeof(bm), &bm)) {
+ HDC hdc = CreateCompatibleDC(nullptr);
+ if (hdc != nullptr) {
POINT aptTriangle[3] = { 0 };
aptTriangle[1].y = bm.bmHeight-1;
aptTriangle[2].x = bm.bmWidth-1;
HRGN hrgn = CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING);
- if (hrgn != NULL) {
+ if (hrgn != nullptr) {
SelectClipRgn(hdc,hrgn);
DeleteObject(hrgn);
HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor);
- if (hbmPrev != NULL) { /* error on select? */
- if ( DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE))
- if ( SelectObject(hdc,icoi.hbmMask) != NULL) /* error on select? */
- DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_MASK);
+ if (hbmPrev != nullptr) { /* error on select? */
+ if ( DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_IMAGE))
+ if ( SelectObject(hdc,icoi.hbmMask) != nullptr) /* error on select? */
+ DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_MASK);
SelectObject(hdc,hbmPrev);
}
}
@@ -227,7 +227,7 @@ void InitIcons(void) char szId[20];
/* register icons */
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.pszName = szId;
sid.cx = GetSystemMetrics(SM_CXSMICON);
sid.cy = GetSystemMetrics(SM_CYSMICON);
@@ -237,9 +237,9 @@ void InitIcons(void) /* all those flag icons do not need any transparency mask (flags are always opaque),
* storing them in a large bitmap to reduce file size */
HIMAGELIST himl = ImageList_LoadImage(hInst,MAKEINTRESOURCE(IDB_FLAGS),sid.cx,0,CLR_NONE,IMAGE_BITMAP,LR_CREATEDIBSECTION);
- if (himl != NULL) {
+ if (himl != nullptr) {
phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
- if (phIconHandles != NULL) {
+ if (phIconHandles != nullptr) {
for (int i=0; i < nCountriesCount; ++i) {
sid.description.a = (char*)countries[i].szName;
@@ -252,10 +252,10 @@ void InitIcons(void) sid.hDefaultIcon = ResizeIconCentered(hIcon,sid.cx,sid.cy);
DestroyIcon(hIcon);
}
- else sid.hDefaultIcon = NULL;
+ else sid.hDefaultIcon = nullptr;
index = CountryNumberToIndex(countries[i].id);
phIconHandles[index] = IcoLib_AddIcon(&sid);
- if (sid.hDefaultIcon != NULL)
+ if (sid.hDefaultIcon != nullptr)
DestroyIcon(sid.hDefaultIcon);
}
}
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp index 1612d05c6d..d51373e7d2 100644 --- a/plugins/CountryFlags/src/ip2country.cpp +++ b/plugins/CountryFlags/src/ip2country.cpp @@ -34,7 +34,7 @@ static BYTE* GetDataHeader(BYTE *data,DWORD cbDataSize,DWORD *pnDataRecordCount) /* uncompressed size stored in first DWORD */
*pnDataRecordCount=(*(DWORD*)data)/DATARECORD_SIZE;
recordData=(BYTE*)mir_alloc(*(DWORD*)data);
- if (recordData != NULL)
+ if (recordData != nullptr)
Huffman_Uncompress(data+sizeof(DWORD),recordData,cbDataSize-sizeof(DWORD),*(DWORD*)data);
return recordData;
}
@@ -44,7 +44,7 @@ static int GetDataRecord(BYTE *data,DWORD index,DWORD *pdwFrom,DWORD *pdwTo) data+=index*DATARECORD_SIZE;
*pdwFrom=*(DWORD*)data;
data+=sizeof(DWORD);
- if (pdwTo != NULL) *pdwTo=*(DWORD*)data;
+ if (pdwTo != nullptr) *pdwTo=*(DWORD*)data;
data+=sizeof(DWORD);
return (int)*(WORD*)data;
}
@@ -61,7 +61,7 @@ static void CALLBACK UnloadRecordCache(LPARAM) {
mir_cslock lck(csRecordCache);
mir_free(dataRecords);
- dataRecords=NULL;
+ dataRecords=nullptr;
}
// function assumes it has got the csRecordCache mutex
@@ -70,16 +70,16 @@ static BOOL EnsureRecordCacheLoaded(BYTE **pdata,DWORD *pcount) HRSRC hrsrc;
DWORD cb;
mir_cslock lck(csRecordCache);
- if (dataRecords == NULL) {
+ if (dataRecords == nullptr) {
/* load record data list from resources */
hrsrc=FindResource(hInst,MAKEINTRESOURCE(IDR_IPTOCOUNTRY),L"BIN");
cb=SizeofResource(hInst,hrsrc);
dataRecords=(BYTE*)LockResource(LoadResource(hInst,hrsrc));
- if (cb<=sizeof(DWORD) || dataRecords == NULL)
+ if (cb<=sizeof(DWORD) || dataRecords == nullptr)
return FALSE;
/* uncompress record data */
dataRecords=GetDataHeader(dataRecords,cb,&nDataRecordsCount);
- if (dataRecords == NULL || !nDataRecordsCount)
+ if (dataRecords == nullptr || !nDataRecordsCount)
return FALSE;
}
*pdata=dataRecords;
@@ -104,7 +104,7 @@ INT_PTR ServiceIpToCountry(WPARAM wParam, LPARAM) int id;
if (EnsureRecordCacheLoaded(&data,&high)) {
/* binary search in record data */
- GetDataRecord(data,low,&dwFrom,NULL);
+ GetDataRecord(data,low,&dwFrom,nullptr);
--high;
if (wParam>=dwFrom) /* only search if wParam valid */
while (low<=high) {
@@ -301,7 +301,7 @@ static void BinConvThread(void *unused) void InitIpToCountry(void)
{
nDataRecordsCount=0;
- dataRecords=NULL;
+ dataRecords=nullptr;
/* Services */
CreateServiceFunction(MS_FLAGS_IPTOCOUNTRY,ServiceIpToCountry);
#ifdef BINCONV
diff --git a/plugins/CountryFlags/src/utils.cpp b/plugins/CountryFlags/src/utils.cpp index 082f8f256e..96721a2eca 100644 --- a/plugins/CountryFlags/src/utils.cpp +++ b/plugins/CountryFlags/src/utils.cpp @@ -65,11 +65,11 @@ static void CALLBACK BufferedProcTimer(HWND hwnd, UINT, UINT_PTR idTimer, DWORD --i; /* reiterate current */
if (nCallListCount) {
buf = (struct BufferedCallData*)mir_realloc(callList, nCallListCount*sizeof(struct BufferedCallData));
- if (buf != NULL) callList = buf;
+ if (buf != nullptr) callList = buf;
}
else {
mir_free(callList);
- callList = NULL;
+ callList = nullptr;
}
#ifdef _DEBUG
mir_snprintf(szDbgLine, "buffered call: %s(0x%X)\n", pszProcName, lParam); /* all ascii */
@@ -106,7 +106,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, const char *pszProcName, LP void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumulateSameParam, UINT uElapse)
#endif
{
- struct BufferedCallData *data = NULL;
+ struct BufferedCallData *data = nullptr;
int i;
/* find existing */
@@ -117,10 +117,10 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumu break;
}
/* append new */
- if (data == NULL) {
+ if (data == nullptr) {
/* resize storage array */
data = (struct BufferedCallData*)mir_realloc(callList, (nCallListCount + 1)*sizeof(struct BufferedCallData));
- if (data == NULL) return;
+ if (data == nullptr) return;
callList = data;
data = &callList[nCallListCount];
++nCallListCount;
@@ -144,7 +144,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumu #endif
/* set next timer */
if (idBufferedTimer) uElapse = USER_TIMER_MINIMUM; /* will get recalculated */
- idBufferedTimer = SetTimer(NULL, idBufferedTimer, uElapse, BufferedProcTimer);
+ idBufferedTimer = SetTimer(nullptr, idBufferedTimer, uElapse, BufferedProcTimer);
}
// assumes to be called in context of main thread
@@ -152,13 +152,13 @@ void PrepareBufferedFunctions(void) {
idBufferedTimer = 0;
nCallListCount = 0;
- callList = NULL;
+ callList = nullptr;
}
// assumes to be called in context of main thread
void KillBufferedFunctions(void)
{
- if (idBufferedTimer) KillTimer(NULL, idBufferedTimer);
+ if (idBufferedTimer) KillTimer(nullptr, idBufferedTimer);
nCallListCount = 0;
mir_free(callList); /* does NULL check */
}
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 30ff267f06..f31de55e7c 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -70,7 +70,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) wchar_t path[MAX_PATH];
mir_snwprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
- HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hDumpFile != INVALID_HANDLE_VALUE) {
CMStringW buffer;
PrintVersionInfo(buffer, (unsigned int)lParam | VI_FLAG_PRNVAR);
@@ -120,7 +120,7 @@ INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM) }
else {
DWORD dwFlags = wParam ? (VI_FLAG_PRNVAR | VI_FLAG_PRNDLL) : VI_FLAG_PRNVAR;
- hViewWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), NULL, DlgProcView, dwFlags);
+ hViewWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), nullptr, DlgProcView, dwFlags);
}
return 0;
@@ -144,7 +144,7 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM) {
switch (wParam) {
case 0:
- ShellExecute(NULL, TEXT("explore"), CrashLogFolder, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, TEXT("explore"), CrashLogFolder, nullptr, nullptr, SW_SHOW);
break;
case 1:
@@ -166,10 +166,10 @@ INT_PTR CopyLinkToClipboard(WPARAM, LPARAM) LPSTR buf = (LPSTR)GlobalLock(hData);
memcpy(buf, buffer, bufLen);
- OpenClipboard(NULL);
+ OpenClipboard(nullptr);
EmptyClipboard();
- if (SetClipboardData(CF_UNICODETEXT, hData) == NULL)
+ if (SetClipboardData(CF_UNICODETEXT, hData) == nullptr)
GlobalFree(hData);
CloseClipboard();
}
@@ -213,7 +213,7 @@ int OptionsInit(WPARAM wParam, LPARAM) static int ToolbarModulesLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.pszService = MS_CRASHDUMPER_STORETOCLIP;
ttb.name = ttb.pszTooltipUp = LPGEN("Version Information To Clipboard");
ttb.hIconHandleUp = GetIconHandle(IDI_VITOCLIP);
@@ -355,7 +355,7 @@ static int PreShutdown(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void)
{
hMsftedit = LoadLibrary(L"Msftedit.dll");
- if (hMsftedit == NULL)
+ if (hMsftedit == nullptr)
return 1;
clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0;
diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index d3ccc95dff..cbefe71020 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -39,7 +39,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
- return NULL;
+ return nullptr;
}
HANDLE GetIconHandle(int iconId)
@@ -48,5 +48,5 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 2b07c9766c..a96fba0025 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -30,7 +30,7 @@ void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr) exceptionInfo.ClientPointers = false;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
- hDumpFile, MiniDumpNormal, &exceptionInfo, NULL, NULL);
+ hDumpFile, MiniDumpNormal, &exceptionInfo, nullptr, nullptr);
}
@@ -48,8 +48,8 @@ void WriteUtfFile(HANDLE hDumpFile, char* bufu) DWORD bytes;
static const unsigned char bytemark[] = { 0xEF, 0xBB, 0xBF };
- WriteFile(hDumpFile, bytemark, 3, &bytes, NULL);
- WriteFile(hDumpFile, bufu, (DWORD)mir_strlen(bufu), &bytes, NULL);
+ WriteFile(hDumpFile, bytemark, 3, &bytes, nullptr);
+ WriteFile(hDumpFile, bufu, (DWORD)mir_strlen(bufu), &bytes, nullptr);
}
@@ -102,11 +102,11 @@ BOOL CALLBACK LoadedModulesFind64(LPCSTR ModuleName, DWORD64 ModuleBase, ULONG M void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer)
{
- HANDLE hDllFile = CreateFile(moduleName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hDllFile = CreateFile(moduleName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hDllFile == INVALID_HANDLE_VALUE)
return;
- HANDLE hDllMapping = CreateFileMapping(hDllFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ HANDLE hDllMapping = CreateFileMapping(hDllFile, nullptr, PAGE_READONLY, 0, 0, nullptr);
if (hDllMapping == INVALID_HANDLE_VALUE) {
CloseHandle(hDllFile);
return;
@@ -124,8 +124,8 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) IMAGE_DIRECTORY_ENTRY_IMPORT, &tableSize);
if (importData) {
while (importData->Name) {
- char *szImportModule = (char*)ImageRvaToVa(nthdrs, dllAddr, importData->Name, NULL);
- if (!SearchPathA(NULL, szImportModule, NULL, NULL, 0, NULL))
+ char *szImportModule = (char*)ImageRvaToVa(nthdrs, dllAddr, importData->Name, nullptr);
+ if (!SearchPathA(nullptr, szImportModule, nullptr, NULL, nullptr, nullptr))
buffer.AppendFormat(format, szImportModule);
importData++; //go to next record
@@ -136,9 +136,9 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) PIMAGE_EXPORT_DIRECTORY exportData = (PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(dllAddr, FALSE,
IMAGE_DIRECTORY_ENTRY_EXPORT, &tableSize);
if (exportData) {
- ULONG* funcAddr = (ULONG*)ImageRvaToVa(nthdrs, dllAddr, exportData->AddressOfNames, NULL);
+ ULONG* funcAddr = (ULONG*)ImageRvaToVa(nthdrs, dllAddr, exportData->AddressOfNames, nullptr);
for (unsigned i = 0; i < exportData->NumberOfNames; ++i) {
- char* funcName = (char*)ImageRvaToVa(nthdrs, dllAddr, funcAddr[i], NULL);
+ char* funcName = (char*)ImageRvaToVa(nthdrs, dllAddr, funcAddr[i], nullptr);
if (mir_strcmp(funcName, "DatabasePluginInfo") == 0) {
buffer.Append(TEXT(" This dll is a Miranda database plugin, another database is active right now\r\n"));
found = true;
@@ -163,7 +163,7 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) struct ListItem
{
- ListItem() : str(), next(NULL) {}
+ ListItem() : str(), next(nullptr) {}
CMStringW str;
ListItem *next;
@@ -174,10 +174,10 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) buffer.AppendFormat(TEXT("Service Mode: %s\r\n"), servicemode ? TEXT("Yes") : TEXT("No"));
wchar_t path[MAX_PATH];
- GetModuleFileName(NULL, path, MAX_PATH);
+ GetModuleFileName(nullptr, path, MAX_PATH);
LPTSTR fname = wcsrchr(path, TEXT('\\'));
- if (fname == NULL) fname = path;
+ if (fname == nullptr) fname = path;
mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\*.dll"));
WIN32_FIND_DATA FindFileData;
@@ -187,7 +187,7 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) size_t count = 0, ucount = 0;
CMStringW ubuffer;
- ListItem* dlllist = NULL;
+ ListItem* dlllist = nullptr;
static const wchar_t format[] = TEXT("\xa4 %s v.%s%d.%d.%d.%d%s [%s] - %S %s\r\n");
@@ -195,11 +195,11 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) bool loaded = false;
mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
HMODULE hModule = GetModuleHandle(path);
- if (hModule == NULL && servicemode) {
+ if (hModule == nullptr && servicemode) {
hModule = LoadLibrary(path);
loaded = true;
}
- if (hModule == NULL) {
+ if (hModule == nullptr) {
if ((flags & VI_FLAG_PRNVAR) && IsPluginEnabled(FindFileData.cFileName)) {
wchar_t timebuf[30] = TEXT("");
GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30);
@@ -219,7 +219,7 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) }
PLUGININFOEX* pi = GetMirInfo(hModule);
- if (pi != NULL) {
+ if (pi != nullptr) {
wchar_t timebuf[30] = TEXT("");
GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30);
@@ -251,15 +251,15 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) timebuf, pi->shortName ? pi->shortName : "", unica);
ListItem* lsttmp = dlllist;
- ListItem* lsttmppv = NULL;
- while (lsttmp != NULL) {
+ ListItem* lsttmppv = nullptr;
+ while (lsttmp != nullptr) {
if (lsttmp->str.CompareNoCase(lst->str) > 0)
break;
lsttmppv = lsttmp;
lsttmp = lsttmp->next;
}
lst->next = lsttmp;
- if (lsttmppv == NULL)
+ if (lsttmppv == nullptr)
dlllist = lst;
else
lsttmppv->next = lst;
@@ -277,7 +277,7 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), count, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT(""));
ListItem* lsttmp = dlllist;
- while (lsttmp != NULL) {
+ while (lsttmp != nullptr) {
buffer.Append(lsttmp->str);
ListItem* lsttmp1 = lsttmp->next;
delete lsttmp;
@@ -353,10 +353,10 @@ static void GetProtocolStrings(CMStringW& buffer) static void GetWeatherStrings(CMStringW& buffer, unsigned flags)
{
wchar_t path[MAX_PATH];
- GetModuleFileName(NULL, path, MAX_PATH);
+ GetModuleFileName(nullptr, path, MAX_PATH);
LPTSTR fname = wcsrchr(path, TEXT('\\'));
- if (fname == NULL) fname = path;
+ if (fname == nullptr) fname = path;
mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\*.ini"));
WIN32_FIND_DATA FindFileData;
@@ -367,34 +367,34 @@ static void GetWeatherStrings(CMStringW& buffer, unsigned flags) if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
- HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, nullptr,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hDumpFile != INVALID_HANDLE_VALUE) {
char buf[8192];
DWORD bytes = 0;
- ReadFile(hDumpFile, buf, 8190, &bytes, NULL);
+ ReadFile(hDumpFile, buf, 8190, &bytes, nullptr);
buf[bytes] = 0;
char* ver = strstr(buf, "Version=");
- if (ver != NULL) {
+ if (ver != nullptr) {
char *endid = strchr(ver, '\r');
- if (endid != NULL) *endid = 0;
+ if (endid != nullptr) *endid = 0;
else {
endid = strchr(ver, '\n');
- if (endid != NULL) *endid = 0;
+ if (endid != nullptr) *endid = 0;
}
ver += 8;
}
char *id = strstr(buf, "Name=");
- if (id != NULL) {
+ if (id != nullptr) {
char *endid = strchr(id, '\r');
- if (endid != NULL) *endid = 0;
+ if (endid != nullptr) *endid = 0;
else {
endid = strchr(id, '\n');
- if (endid != NULL) *endid = 0;
+ if (endid != nullptr) *endid = 0;
}
id += 5;
}
@@ -420,10 +420,10 @@ static void GetWeatherStrings(CMStringW& buffer, unsigned flags) static void GetIconStrings(CMStringW& buffer)
{
wchar_t path[MAX_PATH];
- GetModuleFileName(NULL, path, MAX_PATH);
+ GetModuleFileName(nullptr, path, MAX_PATH);
LPTSTR fname = wcsrchr(path, TEXT('\\'));
- if (fname == NULL) fname = path;
+ if (fname == nullptr) fname = path;
mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\Icons\\*.*"));
WIN32_FIND_DATA FindFileData;
@@ -475,7 +475,7 @@ void PrintVersionInfo(CMStringW& buffer, unsigned flags) buffer.Append(L"\r\n");
wchar_t path[MAX_PATH], mirtime[30];
- GetModuleFileName(NULL, path, MAX_PATH);
+ GetModuleFileName(nullptr, path, MAX_PATH);
GetLastWriteTime(path, mirtime, 30);
buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime);
@@ -543,7 +543,7 @@ void PrintVersionInfo(CMStringW& buffer, unsigned flags) void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wchar_t* msg)
{
- if (exc_ptr->ContextRecord == NULL || (exc_ptr->ContextRecord->ContextFlags & CONTEXT_CONTROL) == 0)
+ if (exc_ptr->ContextRecord == nullptr || (exc_ptr->ContextRecord->ContextFlags & CONTEXT_CONTROL) == 0)
return;
CONTEXT context = *exc_ptr->ContextRecord;
@@ -574,7 +574,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha const PLUGININFOEX *pluginInfoEx = GetPluginInfoEx();
wchar_t curtime[30];
- GetISO8061Time(NULL, curtime, 30);
+ GetISO8061Time(nullptr, curtime, 30);
CMStringW buffer;
buffer.AppendFormat(TEXT("Miranda Crash Report from %s. Crash Dumper v.%d.%d.%d.%d\r\n"),
@@ -591,7 +591,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (&SymSetOptions)
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
- SymInitialize(hProcess, NULL, TRUE);
+ SymInitialize(hProcess, nullptr, TRUE);
buffer.Append(TEXT("\r\nStack Trace:\r\n---------------------------------------------------------------\r\n"));
@@ -614,7 +614,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha DWORD offsetFromLine = 0;
if (!StackWalk64(IMAGE_FILE_MACHINE, hProcess, GetCurrentThread(), &frame, &context,
- NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL)) break;
+ nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr)) break;
if (frame.AddrPC.Offset == frame.AddrReturn.Offset) break;
@@ -650,7 +650,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (crashpos != 0) {
HMODULE hModule = (HMODULE)Module.BaseOfImage;
PLUGININFOEX *pi = GetMirInfo(hModule);
- if (pi != NULL) {
+ if (pi != nullptr) {
static const wchar_t formatc[] = TEXT("\r\nLikely cause of the crash plugin: %S\r\n\r\n");
if (pi->shortName) {
@@ -673,15 +673,15 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha PrintVersionInfo(buffer, VI_FLAG_PRNDLL);
- int len = WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, NULL, 0, NULL, NULL);
+ int len = WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, nullptr, 0, nullptr, nullptr);
char* dst = (char*)(len > 8192 ? malloc(len) : alloca(len));
- WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, dst, len, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, dst, len, nullptr, nullptr);
WriteUtfFile(hDumpFile, dst);
if (len > 8192) free(dst);
- if (db_get_b(0, PluginName, "ShowCrashMessageBox", 1) && msg && MessageBox(NULL, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES)
+ if (db_get_b(0, PluginName, "ShowCrashMessageBox", 1) && msg && MessageBox(nullptr, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES)
StoreStringToClip(buffer);
}
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 92219a5128..14cc07f3b0 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -18,8 +18,8 @@ void RemoveExceptionHandler(void) if (exchndlrv)
RemoveVectoredExceptionHandler(exchndlrv);
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exchndlr);
- exchndlr = NULL;
- exchndlrv = NULL;
+ exchndlr = nullptr;
+ exchndlrv = nullptr;
}
int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep)
@@ -37,7 +37,7 @@ int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep) else
mir_snprintf(str + off, _countof(str) - off, "Ordinal: %x ", dlld->dlp.dwOrdinal);
- MessageBoxA(NULL, str, "Miranda Crash Dumper", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
+ MessageBoxA(nullptr, str, "Miranda Crash Dumper", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
}
return EXCEPTION_EXECUTE_HANDLER;
@@ -48,7 +48,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) {
wchar_t path[MAX_PATH];
SYSTEMTIME st;
- HANDLE hDumpFile = NULL;
+ HANDLE hDumpFile = nullptr;
GetLocalTime(&st);
CreateDirectoryTreeW(CrashLogFolder);
@@ -56,7 +56,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) __try {
if (dtsubfldr) {
mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
- CreateDirectory(path, NULL);
+ CreateDirectory(path, nullptr);
mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
@@ -64,11 +64,11 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) mir_snwprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
- hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+ hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hDumpFile != INVALID_HANDLE_VALUE)
CreateMiniDump(hDumpFile, exc_ptr);
else if (GetLastError() != ERROR_ALREADY_EXISTS)
- MessageBox(NULL, TranslateT("Crash Report write location is not available"),
+ MessageBox(nullptr, TranslateT("Crash Report write location is not available"),
TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
}
@@ -76,14 +76,14 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) {
}
- bool empty = GetFileSize(hDumpFile, NULL) == 0;
+ bool empty = GetFileSize(hDumpFile, nullptr) == 0;
CloseHandle(hDumpFile);
if (empty) DeleteFile(path);
__try {
if (dtsubfldr) {
mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
- CreateDirectory(path, NULL);
+ CreateDirectory(path, nullptr);
mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
@@ -91,16 +91,16 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) mir_snwprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
- hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+ hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
mir_snwprintf(path, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
if (hDumpFile != INVALID_HANDLE_VALUE)
- CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL);
+ CreateCrashReport(hDumpFile, exc_ptr, notify ? path : nullptr);
}
__except (myDebugFilter(GetExceptionCode(), GetExceptionInformation())) {}
- bool empty1 = GetFileSize(hDumpFile, NULL) == 0;
+ bool empty1 = GetFileSize(hDumpFile, nullptr) == 0;
CloseHandle(hDumpFile);
if (empty1) DeleteFile(path);
}
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 91fa5f9578..65fa95377b 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -23,7 +23,7 @@ extern HINSTANCE hInst; HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndCtrl, int nHorizontalOffset, int nVerticalOffset, int nWidthOffset, int nHeightOffset)
{
- if (NULL == hwndDlg) /* Wine fix. */
+ if (nullptr == hwndDlg) /* Wine fix. */
return hDwp;
// get current bounding rectangle
RECT rcinit;
@@ -35,7 +35,7 @@ HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndCtrl, int nHorizontalOffse pt.y = rcinit.top;
ScreenToClient(hwndDlg, &pt);
- return DeferWindowPos(hDwp, hwndCtrl, NULL,
+ return DeferWindowPos(hDwp, hwndCtrl, nullptr,
pt.x + nHorizontalOffset,
pt.y + nVerticalOffset,
rcinit.right - rcinit.left + nWidthOffset,
@@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (sel.cpMin == sel.cpMax)
EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr)) {
case IDM_COPY:
SendMessage(hView, WM_COPY, 0, 0);
break;
@@ -162,7 +162,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case WM_DESTROY:
- hViewWnd = NULL;
+ hViewWnd = nullptr;
Window_FreeIcon_IcoLib(hwndDlg);
Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_");
if (servicemode)
@@ -175,9 +175,9 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara void DestroyAllWindows(void)
{
- if (hViewWnd != NULL) {
+ if (hViewWnd != nullptr) {
DestroyWindow(hViewWnd);
- hViewWnd = NULL;
+ hViewWnd = nullptr;
}
}
@@ -280,7 +280,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case 3:
wchar_t path[MAX_PATH];
mir_snwprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
- ShellExecute(NULL, TEXT("open"), path, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, TEXT("open"), path, nullptr, nullptr, SW_SHOW);
break;
}
@@ -313,5 +313,5 @@ void ShowMessage(int type, const wchar_t* format, ...) PUAddPopupT(&pi);
}
- else MessageBox(NULL, pi.lptzText, TEXT(PluginName), MB_OK | MB_ICONINFORMATION);
+ else MessageBox(nullptr, pi.lptzText, TEXT(PluginName), MB_OK | MB_ICONINFORMATION);
}
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 49dac93b0e..9b3b501b89 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -90,7 +90,7 @@ void CreateAuthString(char* auth) bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq)
{
int result = 0xBADBAD;
- char* szRedirUrl = NULL;
+ char* szRedirUrl = nullptr;
NETLIBHTTPREQUEST nlhr = { 0 };
// initialize the netlib request
@@ -164,7 +164,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) const char* szPref = strstr(szUrl, "://");
szPref = szPref ? szPref + 3 : szUrl;
szPath = strchr(szPref, '/');
- rlen = szPath != NULL ? szPath - szUrl : mir_strlen(szUrl);
+ rlen = szPath != nullptr ? szPath - szUrl : mir_strlen(szUrl);
}
szRedirUrl = (char*)mir_realloc(szRedirUrl,
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 2fd7e8f815..d46bf807ea 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -45,7 +45,7 @@ int GetTZOffset(void) void GetISO8061Time(SYSTEMTIME *stLocal, LPTSTR lpszString, DWORD dwSize)
{
SYSTEMTIME loctime;
- if (stLocal == NULL) {
+ if (stLocal == nullptr) {
stLocal = &loctime;
GetLocalTime(stLocal);
}
@@ -94,8 +94,8 @@ typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_Info) (DWORD mirandaVersion); PLUGININFOEX* GetMirInfo(HMODULE hModule)
{
Miranda_Plugin_Info bpi = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfoEx");
- if (bpi == NULL)
- return NULL;
+ if (bpi == nullptr)
+ return nullptr;
return bpi(mirandaVersion);
}
@@ -111,15 +111,15 @@ void GetInternetExplorerVersion(CMStringW &buffer) if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey)) {
size = _countof(ieBuild);
- if (RegQueryValueEx(hKey, TEXT("Build"), NULL, NULL, (LPBYTE)ieBuild, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, TEXT("Build"), nullptr, nullptr, (LPBYTE)ieBuild, &size) != ERROR_SUCCESS)
ieBuild[0] = 0;
size = _countof(ieVersion);
- if (RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE)ieVersion, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, TEXT("Version"), nullptr, nullptr, (LPBYTE)ieVersion, &size) != ERROR_SUCCESS)
ieVersion[0] = 0;
size = _countof(iVer);
- if (RegQueryValueEx(hKey, TEXT("IVer"), NULL, NULL, (LPBYTE)iVer, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, TEXT("IVer"), nullptr, nullptr, (LPBYTE)iVer, &size) != ERROR_SUCCESS)
iVer[0] = 0;
RegCloseKey(hKey);
@@ -174,12 +174,12 @@ void GetProcessorString(CMStringW &buffer) if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey)) {
size = _countof(cpuName);
- if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)cpuName, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), nullptr, nullptr, (LPBYTE)cpuName, &size) != ERROR_SUCCESS)
mir_wstrcpy(cpuName, TEXT("Unknown"));
size = _countof(cpuIdent);
- if (RegQueryValueEx(hKey, TEXT("Identifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS)
- if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, TEXT("Identifier"), nullptr, nullptr, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), nullptr, nullptr, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS)
mir_wstrcpy(cpuIdent, TEXT("Unknown"));
RegCloseKey(hKey);
@@ -327,7 +327,7 @@ void GetAdminString(CMStringW &buffer) b = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup);
if (b) {
- if (!CheckTokenMembership(NULL, AdministratorsGroup, &b))
+ if (!CheckTokenMembership(nullptr, AdministratorsGroup, &b))
b = FALSE;
FreeSid(AdministratorsGroup);
}
@@ -385,11 +385,11 @@ void GetWow64String(CMStringW &buffer) void GetVersionInfo(HMODULE hLib, CMStringW& buffer)
{
HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
- if (hVersion != NULL) {
+ if (hVersion != nullptr) {
HGLOBAL hGlobal = LoadResource(hLib, hVersion);
- if (hGlobal != NULL) {
+ if (hGlobal != nullptr) {
LPVOID versionInfo = LockResource(hGlobal);
- if (versionInfo != NULL) {
+ if (versionInfo != nullptr) {
int vl = *(unsigned short*)versionInfo;
unsigned *res = (unsigned*)versionInfo;
while (*res != 0xfeef04bd && ((char*)res - (char*)versionInfo) < vl) ++res;
@@ -416,7 +416,7 @@ void StoreStringToClip(CMStringW& buffer) GlobalUnlock(hData);
- if(OpenClipboard(NULL)) {
+ if(OpenClipboard(nullptr)) {
EmptyClipboard();
diff --git a/plugins/CryptoPP/src/base16.cpp b/plugins/CryptoPP/src/base16.cpp index 689d54c88a..e716b4be4f 100644 --- a/plugins/CryptoPP/src/base16.cpp +++ b/plugins/CryptoPP/src/base16.cpp @@ -40,7 +40,7 @@ char *base16decode(const char *inBuffer, unsigned int *count) if ((c0 | c1) == BERR) {
free(outBuffer);
*count = 0;
- return(NULL);
+ return(nullptr);
}
*outBufferPtr++ = (c0 << 4) | c1;
*count -= 2;
diff --git a/plugins/CryptoPP/src/cpp_cntx.cpp b/plugins/CryptoPP/src/cpp_cntx.cpp index 327890f4ea..9628477124 100644 --- a/plugins/CryptoPP/src/cpp_cntx.cpp +++ b/plugins/CryptoPP/src/cpp_cntx.cpp @@ -12,7 +12,7 @@ pCNTX get_context_on_id(HANDLE context) Sent_NetLog("get_context_on_id: corrupted context %08X", cntx);
#endif
}
- return NULL;
+ return nullptr;
}
// create context, return context id
@@ -71,7 +71,7 @@ PBYTE cpp_alloc_pdata(pCNTX ptr) void cpp_free_keys(pCNTX ptr)
{
mir_free(ptr->tmp);
- ptr->tmp = 0;
+ ptr->tmp = nullptr;
cpp_alloc_pdata(ptr);
if (ptr->mode & MODE_PGP) {
pPGPDATA p = (pPGPDATA)ptr->pdata;
diff --git a/plugins/CryptoPP/src/cpp_gpgw.cpp b/plugins/CryptoPP/src/cpp_gpgw.cpp index a86d2219cd..bda82d6e6f 100644 --- a/plugins/CryptoPP/src/cpp_gpgw.cpp +++ b/plugins/CryptoPP/src/cpp_gpgw.cpp @@ -30,7 +30,7 @@ int __cdecl gpg_done() int r = 0;
if (hgpg) {
r = _gpg_done();
- hgpg = 0;
+ hgpg = nullptr;
}
return r;
}
@@ -68,7 +68,7 @@ LPSTR __cdecl gpg_encrypt(pCNTX ptr, LPCSTR szPlainMsg) LPSTR szEncMsg = _gpg_encrypt(szPlainMsg, (LPCSTR)p->gpgKeyID);
mir_free(ptr->tmp);
if (!szEncMsg) {
- return ptr->tmp = 0;
+ return ptr->tmp = nullptr;
}
else {
ptr->tmp = mir_strdup(szEncMsg);
@@ -93,11 +93,11 @@ LPSTR __cdecl gpg_encode(HANDLE context, LPCSTR szPlainMsg) {
pCNTX ptr = get_context_on_id(context);
if (!ptr)
- return NULL;
+ return nullptr;
pGPGDATA p = (pGPGDATA)cpp_alloc_pdata(ptr);
if (!p->gpgKeyID) {
ptr->error = ERROR_NO_GPG_KEY;
- return NULL;
+ return nullptr;
}
// utf8 message: encrypt.
@@ -106,7 +106,7 @@ LPSTR __cdecl gpg_encode(HANDLE context, LPCSTR szPlainMsg) LPWSTR wszMsg = utf8decode(szPlainMsg);
int wlen = (int)wcslen(wszMsg) + 1;
szUtfMsg = (LPSTR)alloca(wlen);
- WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szUtfMsg, wlen, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szUtfMsg, wlen, nullptr, nullptr);
}
else {
szUtfMsg = (LPSTR)szPlainMsg;
@@ -119,9 +119,9 @@ LPSTR __cdecl gpg_decode(HANDLE context, LPCSTR szEncMsg) {
pCNTX ptr = get_context_on_id(context);
if (!ptr)
- return NULL;
+ return nullptr;
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = gpg_decrypt(ptr, szEncMsg);
if (szOldMsg) {
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp index 37a197d70f..8cfea1c040 100644 --- a/plugins/CryptoPP/src/cpp_keys.cpp +++ b/plugins/CryptoPP/src/cpp_keys.cpp @@ -5,7 +5,7 @@ const unsigned char IV[] = "PSKhell@MIRANDA!"; // generate KeyA pair, return public key as ASCII
LPSTR __cdecl cpp_init_keya(HANDLE context, int features)
{
- pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL;
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr;
pSIMDATA p = (pSIMDATA)cpp_alloc_pdata(ptr);
int send_features = FEATURES;
@@ -156,7 +156,7 @@ int __cdecl cpp_calc_keyx(HANDLE context) // not needed anymore
SAFE_FREE(p->PubA);
SAFE_FREE(p->KeyA);
- mir_free(p->KeyB); p->KeyB = 0;
+ mir_free(p->KeyB); p->KeyB = nullptr;
BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash
memset(buffer, 0, sizeof(buffer));
diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp index 6f9ca08ab4..bdd3f2a645 100644 --- a/plugins/CryptoPP/src/cpp_misc.cpp +++ b/plugins/CryptoPP/src/cpp_misc.cpp @@ -54,7 +54,7 @@ void __cdecl cpp_set_keyx(HANDLE context, BYTE *key) return;
SAFE_FREE(p->PubA);
SAFE_FREE(p->KeyA);
- mir_free(p->KeyB); p->KeyB = 0;
+ mir_free(p->KeyB); p->KeyB = nullptr;
SAFE_FREE(p->KeyX);
p->KeyX = (PBYTE)malloc(Tiger::DIGESTSIZE + 2);
memcpy(p->KeyX, key, Tiger::DIGESTSIZE);
@@ -92,7 +92,7 @@ int __cdecl cpp_keya(HANDLE context) pSIMDATA p;
if (!cpp_get_simdata(context, &ptr, &p))
return 0;
- return p->KeyA != NULL;
+ return p->KeyA != nullptr;
}
int __cdecl cpp_keyb(HANDLE context)
@@ -101,7 +101,7 @@ int __cdecl cpp_keyb(HANDLE context) pSIMDATA p;
if (!cpp_get_simdata(context, &ptr, &p))
return 0;
- return p->KeyB != NULL;
+ return p->KeyB != nullptr;
}
int __cdecl cpp_keyx(HANDLE context)
@@ -110,7 +110,7 @@ int __cdecl cpp_keyx(HANDLE context) pSIMDATA p;
if (!cpp_get_simdata(context, &ptr, &p))
return 0;
- return p->KeyX != NULL;
+ return p->KeyX != nullptr;
}
int __cdecl cpp_keyp(HANDLE context)
@@ -119,5 +119,5 @@ int __cdecl cpp_keyp(HANDLE context) pSIMDATA p;
if (!cpp_get_simdata(context, &ptr, &p))
return 0;
- return p->KeyP != NULL;
+ return p->KeyP != nullptr;
}
diff --git a/plugins/CryptoPP/src/cpp_pgpw.cpp b/plugins/CryptoPP/src/cpp_pgpw.cpp index 366a3776de..d574c2f236 100644 --- a/plugins/CryptoPP/src/cpp_pgpw.cpp +++ b/plugins/CryptoPP/src/cpp_pgpw.cpp @@ -107,7 +107,7 @@ int __cdecl pgp_done() pgpVer = 0;
if (hpgpsdk) {
r = p_pgp_done();
- hpgpsdk = 0;
+ hpgpsdk = nullptr;
}
return r;
}
@@ -140,7 +140,7 @@ LPSTR __cdecl pgp_encrypt(pCNTX ptr, LPCSTR szPlainMsg) LPSTR szEncMsg = (p->pgpKey ? p_pgp_encrypt_key(szPlainMsg, (LPCSTR)p->pgpKey) : p_pgp_encrypt_keydb(szPlainMsg, p->pgpKeyID));
if (!szEncMsg) {
- return ptr->tmp = 0;
+ return ptr->tmp = nullptr;
}
else {
ptr->tmp = mir_strdup(szEncMsg);
@@ -154,7 +154,7 @@ LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg) {
ptr->error = ERROR_NONE;
mir_free(ptr->tmp);
- ptr->tmp = NULL;
+ ptr->tmp = nullptr;
LPSTR szPlainMsg = p_pgp_decrypt_keydb(szEncMsg);
if (!szPlainMsg) {
@@ -165,7 +165,7 @@ LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg) szPlainMsg = p_pgp_decrypt_key(szEncMsg, (LPCSTR)p->pgpKey);
}
if (!szPlainMsg) {
- return NULL;
+ return nullptr;
}
}
@@ -176,11 +176,11 @@ LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg) LPSTR __cdecl pgp_encode(HANDLE context, LPCSTR szPlainMsg)
{
- pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL;
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr;
pPGPDATA p = (pPGPDATA)cpp_alloc_pdata(ptr);
if (!p->pgpKeyID && !p->pgpKey) {
ptr->error = ERROR_NO_PGP_KEY;
- return NULL;
+ return nullptr;
}
// utf8 message: encrypt.
@@ -191,10 +191,10 @@ LPSTR __cdecl pgp_decode(HANDLE context, LPCSTR szEncMsg) {
pCNTX ptr = get_context_on_id(context);
if (!ptr)
- return NULL;
+ return nullptr;
mir_free(ptr->tmp);
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = pgp_decrypt(ptr, szEncMsg);
if (szOldMsg) {
diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp index ebf0564bc6..c2eddf6cc8 100644 --- a/plugins/CryptoPP/src/cpp_rsam.cpp +++ b/plugins/CryptoPP/src/cpp_rsam.cpp @@ -72,9 +72,9 @@ int __cdecl rsa_done(void) pCNTX tmp = (pCNTX)hRSA4096;
pRSAPRIV p = (pRSAPRIV)tmp->pdata;
delete p;
- tmp->pdata = 0;
+ tmp->pdata = nullptr;
cpp_delete_context(hRSA4096);
- hRSA4096 = NULL;
+ hRSA4096 = nullptr;
}
return 1;
@@ -86,18 +86,18 @@ int __cdecl rsa_done(void) pRSAPRIV rsa_gen_keys(HANDLE context)
{
- if (context != hRSA4096) return 0;
+ if (context != hRSA4096) return nullptr;
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_gen_keys: %d", context);
#endif
- pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr;
pRSAPRIV r = (pRSAPRIV)ptr->pdata;
string priv, pub;
GenerateRSAKey(4096, priv, pub);
- StringSource privsrc(priv, true, NULL);
+ StringSource privsrc(priv, true, nullptr);
RSAES_PKCS1v15_Decryptor Decryptor(privsrc);
priv = tlv(1, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModulus())) +
@@ -116,7 +116,7 @@ pRSAPRIV rsa_gen_keys(HANDLE context) pRSAPRIV rsa_get_priv(pCNTX ptr)
{
- pCNTX p = get_context_on_id(hRSA4096); if (!p) return 0;
+ pCNTX p = get_context_on_id(hRSA4096); if (!p) return nullptr;
pRSAPRIV r = (pRSAPRIV)p->pdata;
return r;
}
@@ -316,18 +316,18 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_recv: %s", msg);
#endif
- pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr;
pRSADATA p = (pRSADATA)cpp_alloc_pdata(ptr);
pRSAPRIV r = rsa_get_priv(ptr);
rtrim(msg);
string buf = base64decode(msg);
- if (!buf.length()) return 0;
+ if (!buf.length()) return nullptr;
string data; int type;
un_tlv(buf, type, data);
- if (type == -1) return 0;
+ if (type == -1) return nullptr;
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_recv: %02x %d", type, p->state);
@@ -338,7 +338,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) p->state = 0; p->time = 0;
rsa_free(ptr); // óäàëèì òðýä è î÷åðåäü ñîîáùåíèé
null_msg(context, 0x00, -1); // ñåññèÿ ðàçîðâàíà ïî îøèáêå, íåâåðíûé òèï ñîîáùåíèÿ
- return 0;
+ return nullptr;
}
switch (type) {
@@ -346,7 +346,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) case 0x00: // ïðåðûâàíèå ñåññèè ïî îøèáêå äðóãîé ñòîðîíîé
{
// åñëè ñîåäèíåíèå óñòàíîâëåíî - íè÷åãî íå äåëàåì
- if (p->state == 0 || p->state == 7) return 0;
+ if (p->state == 0 || p->state == 7) return nullptr;
// èíà÷å ñáðàñûâàåì òåêóùåå ñîñòîÿíèå
p->state = 0; p->time = 0;
imp->rsa_notify(context, -2); // ñåññèÿ ðàçîðâàíà ïî îøèáêå äðóãîé ñòîðîíîé
@@ -365,9 +365,9 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) case 0x0D: // çàïðîñ ïàáëèêà
case 0xD0: // îòâåò ïàáëèêîì
if (!p->event) {
- p->event = CreateEvent(NULL, FALSE, FALSE, NULL);
+ p->event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
unsigned int tID;
- p->thread = (HANDLE)_beginthreadex(NULL, 0, sttConnectThread, (PVOID)context, 0, &tID);
+ p->thread = (HANDLE)_beginthreadex(nullptr, 0, sttConnectThread, (PVOID)context, 0, &tID);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_recv: _beginthreadex(sttConnectThread)");
#endif
@@ -383,7 +383,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) if (!decode_msg(p, data).length()) {
p->state = 0; p->time = 0;
null_msg(context, 0x00, -type); // ñåññèÿ ðàçîðâàíà ïî îøèáêå
- return 0;
+ return nullptr;
}
{
PBYTE buffer = (PBYTE)alloca(RAND_SIZE);
@@ -399,7 +399,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) if (!decode_msg(p, data).length()) {
p->state = 0; p->time = 0;
null_msg(context, 0x00, -type); // ñåññèÿ ðàçîðâàíà ïî îøèáêå
- return 0;
+ return nullptr;
}
p->state = 7; p->time = 0;
rsa_free_thread(p); // óäàëèì òðýä è î÷åðåäü ñîîáùåíèé
@@ -414,7 +414,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) return ptr->tmp = mir_strdup(msg.c_str());
else {
imp->rsa_notify(context, -5); // îøèáêà äåêîäèðîâàíèÿ AES ñîîáùåíèÿ
- return ptr->tmp = NULL;
+ return ptr->tmp = nullptr;
}
}
@@ -426,15 +426,15 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) return ptr->tmp = mir_strdup(msg.c_str());
else {
imp->rsa_notify(context, -6); // îøèáêà äåêîäèðîâàíèÿ RSA ñîîáùåíèÿ
- return ptr->tmp = NULL;
+ return ptr->tmp = nullptr;
}
}
case 0xF0: // ðàçðûâ ñîåäèíåíèÿ âðó÷íóþ
{
- if (p->state != 7) return 0;
+ if (p->state != 7) return nullptr;
string msg = decode_msg(p, data);
- if (!msg.length()) return 0;
+ if (!msg.length()) return nullptr;
p->state = 0;
rsa_free(ptr); // óäàëèì òðýä è î÷åðåäü ñîîáùåíèé
imp->rsa_notify(context, -4); // ñîåäèíåíèå ðàçîðâàíî âðó÷íóþ äðóãîé ñòîðîíîé
@@ -451,7 +451,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) if (p->state != 0 && p->state != 7)
p->time = gettime() + timeout;
- return 0;
+ return nullptr;
}
int __cdecl rsa_send(HANDLE context, LPCSTR msg)
@@ -846,7 +846,7 @@ void rsa_alloc(pCNTX ptr) pRSADATA p = new RSADATA;
p->state = 0;
p->time = 0;
- p->thread = p->event = NULL;
+ p->thread = p->event = nullptr;
p->thread_exit = 0;
p->queue = new STRINGQUEUE;
ptr->pdata = (PBYTE)p;
@@ -855,7 +855,7 @@ void rsa_alloc(pCNTX ptr) int rsa_free(pCNTX ptr)
{
pRSADATA p = (pRSADATA)ptr->pdata;
- if (p == NULL)
+ if (p == nullptr)
return true;
if (p->event) {
@@ -866,7 +866,7 @@ int rsa_free(pCNTX ptr) delete p->queue;
delete p;
- ptr->pdata = NULL;
+ ptr->pdata = nullptr;
return true;
}
@@ -879,7 +879,7 @@ void rsa_free_thread(pRSADATA p) WaitForSingleObject(p->thread, INFINITE);
CloseHandle(p->thread);
CloseHandle(p->event);
- p->thread = p->event = NULL;
+ p->thread = p->event = nullptr;
p->thread_exit = 0;
}
p->time = 0;
diff --git a/plugins/CryptoPP/src/cpp_rsau.cpp b/plugins/CryptoPP/src/cpp_rsau.cpp index b2bc42d302..d476c4fb1c 100644 --- a/plugins/CryptoPP/src/cpp_rsau.cpp +++ b/plugins/CryptoPP/src/cpp_rsau.cpp @@ -157,7 +157,7 @@ string hash256(PBYTE b, size_t l) Integer BinaryToInteger(const string& data)
{
- StringSource ss(data, true, NULL);
+ StringSource ss(data, true, nullptr);
SecByteBlock result(ss.MaxRetrievable());
ss.Get(result, result.size());
return Integer(result, result.size());
diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp index ed5af8bdbb..089d535a8f 100644 --- a/plugins/CryptoPP/src/cpp_svcs.cpp +++ b/plugins/CryptoPP/src/cpp_svcs.cpp @@ -93,7 +93,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) Sent_NetLog("cpp_decrypt: error bad_len");
#endif
ptr->error = ERROR_BAD_LEN;
- return NULL;
+ return nullptr;
}
BYTE crc32[CRC32::DIGESTSIZE];
@@ -106,7 +106,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) Sent_NetLog("cpp_decrypt: error bad_crc");
#endif
ptr->error = ERROR_BAD_CRC;
- return NULL;
+ return nullptr;
}
bciphered += CRC32::DIGESTSIZE; // cut CRC32 digest
clen = len;
@@ -138,8 +138,8 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("cpp_decrypt: error seh");
#endif
- mir_free(ptr->tmp); ptr->tmp = 0;
- return NULL;
+ mir_free(ptr->tmp); ptr->tmp = nullptr;
+ return nullptr;
}
}
@@ -148,11 +148,11 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) LPSTR __cdecl cpp_encodeA(HANDLE context, LPCSTR msg)
{
pCNTX ptr = get_context_on_id(context);
- if (!ptr) return NULL;
+ if (!ptr) return nullptr;
cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata;
- if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; }
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = (LPSTR)msg;
if (ptr->features & FEATURES_UTF8) {
@@ -176,11 +176,11 @@ LPSTR __cdecl cpp_encodeA(HANDLE context, LPCSTR msg) LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg)
{
pCNTX ptr = get_context_on_id(context);
- if (!ptr) return NULL;
+ if (!ptr) return nullptr;
cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata;
- if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; }
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = (LPSTR)msg;
if (ptr->features & FEATURES_UTF8) {
@@ -192,7 +192,7 @@ LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg) LPWSTR wstring = utf8decode(szOldMsg);
int wlen = (int)wcslen(wstring) + 1;
LPSTR astring = (LPSTR)alloca(wlen);
- WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, nullptr, nullptr);
szNewMsg = cpp_encrypt(ptr, astring);
}
@@ -203,11 +203,11 @@ LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg) LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg)
{
pCNTX ptr = get_context_on_id(context);
- if (!ptr) return NULL;
+ if (!ptr) return nullptr;
cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata;
- if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; }
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = (LPSTR)msg;
if (ptr->features & FEATURES_UTF8) {
@@ -218,7 +218,7 @@ LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg) // unicode message: convert to ansi and encrypt.
int wlen = (int)wcslen((LPWSTR)szOldMsg) + 1;
LPSTR astring = (LPSTR)alloca(wlen);
- WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, nullptr, nullptr);
szNewMsg = cpp_encrypt(ptr, astring);
}
@@ -230,11 +230,11 @@ LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg) LPSTR __cdecl cpp_decode(HANDLE context, LPCSTR szEncMsg)
{
pCNTX ptr = get_context_on_id(context);
- if (!ptr) return NULL;
+ if (!ptr) return nullptr;
cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata;
- if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; }
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = cpp_decrypt(ptr, szEncMsg);
if (szOldMsg) {
@@ -243,7 +243,7 @@ LPSTR __cdecl cpp_decode(HANDLE context, LPCSTR szEncMsg) LPWSTR wstring = utf8decode(szOldMsg);
int wlen = (int)wcslen(wstring) + 1;
szNewMsg = (LPSTR)mir_alloc(wlen*(sizeof(WCHAR)+2)); // work.zy@gmail.com
- WideCharToMultiByte(CP_ACP, 0, wstring, -1, szNewMsg, wlen, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, wstring, -1, szNewMsg, wlen, nullptr, nullptr);
memcpy(szNewMsg + strlen(szNewMsg) + 1, wstring, wlen*sizeof(WCHAR)); // work.zy@gmail.com
}
else {
@@ -265,12 +265,12 @@ LPSTR __cdecl cpp_decodeU(HANDLE context, LPCSTR szEncMsg) {
pCNTX ptr = get_context_on_id(context);
if (!ptr)
- return NULL;
+ return nullptr;
mir_free(ptr->tmp);
cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata;
- if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; }
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = cpp_decrypt(ptr, szEncMsg);
if (szOldMsg) {
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index dc5e3c67e9..9adee52785 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -5,8 +5,8 @@ LPCSTR szModuleName = MODULENAME; LPCSTR szVersionStr = MODULENAME" DLL (" __VERSION_STRING_DOTS ")";
HINSTANCE g_hInst;
-HANDLE hPGPPRIV = NULL;
-HANDLE hRSA4096 = NULL;
+HANDLE hPGPPRIV = nullptr;
+HANDLE hRSA4096 = nullptr;
mir_cs localQueueMutex;
mir_cs localContextMutex;
@@ -72,15 +72,15 @@ extern "C" __declspec(dllexport) int Unload() BOOL ExtractFileFromResource(HANDLE FH, int ResType, int ResId, DWORD* Size)
{
HRSRC RH = FindResource(g_hInst, MAKEINTRESOURCE(ResId), MAKEINTRESOURCE(ResType));
- if (RH == NULL)
+ if (RH == nullptr)
return FALSE;
PBYTE RP = (PBYTE)LoadResource(g_hInst, RH);
- if (RP == NULL)
+ if (RP == nullptr)
return FALSE;
DWORD x, s = SizeofResource(g_hInst, RH);
- if (!WriteFile(FH, RP, s, &x, NULL)) return FALSE;
+ if (!WriteFile(FH, RP, s, &x, nullptr)) return FALSE;
if (x != s) return FALSE;
if (Size) *Size = s;
return TRUE;
@@ -88,12 +88,12 @@ BOOL ExtractFileFromResource(HANDLE FH, int ResType, int ResId, DWORD* Size) void ExtractFile(char *FileName, int ResType, int ResId)
{
- HANDLE FH = CreateFile(FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ HANDLE FH = CreateFile(FileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr);
if (FH == INVALID_HANDLE_VALUE)
return;
- if (!ExtractFileFromResource(FH, ResType, ResId, NULL))
- MessageBoxA(0, "Can't extract", "!!!", MB_OK);
+ if (!ExtractFileFromResource(FH, ResType, ResId, nullptr))
+ MessageBoxA(nullptr, "Can't extract", "!!!", MB_OK);
CloseHandle(FH);
}
diff --git a/plugins/CryptoPP/src/mmi.cpp b/plugins/CryptoPP/src/mmi.cpp index 321dc1d871..5eb6f4af3e 100644 --- a/plugins/CryptoPP/src/mmi.cpp +++ b/plugins/CryptoPP/src/mmi.cpp @@ -4,7 +4,7 @@ void __fastcall safe_free(void** p) {
if (*p) {
free(*p);
- *p = NULL;
+ *p = nullptr;
}
}
@@ -13,6 +13,6 @@ void __fastcall safe_delete(void** p) {
if (*p) {
delete(*p);
- *p = NULL;
+ *p = nullptr;
}
}
diff --git a/plugins/CryptoPP/src/utf8.cpp b/plugins/CryptoPP/src/utf8.cpp index 77c13fa3bc..83d4e4a97a 100644 --- a/plugins/CryptoPP/src/utf8.cpp +++ b/plugins/CryptoPP/src/utf8.cpp @@ -1,15 +1,15 @@ #include "commonheaders.h"
-LPSTR szOut = NULL;
-LPWSTR wszOut = NULL;
+LPSTR szOut = nullptr;
+LPWSTR wszOut = nullptr;
LPSTR __cdecl utf8encode(LPCWSTR str)
{
LPWSTR wszTemp, w;
int len, i;
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
wszTemp = (LPWSTR)str;
@@ -21,8 +21,8 @@ LPSTR __cdecl utf8encode(LPCWSTR str) }
SAFE_FREE(szOut);
- if ((szOut = (LPSTR)malloc(len + 1)) == NULL)
- return NULL;
+ if ((szOut = (LPSTR)malloc(len + 1)) == nullptr)
+ return nullptr;
i = 0;
for (w = wszTemp; *w; w++) {
@@ -49,13 +49,13 @@ LPWSTR __cdecl utf8decode(LPCSTR str) LPSTR p;
// LPWSTR wszOut;
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
size_t len = strlen(str) + 1;
SAFE_FREE(wszOut);
- if ((wszOut = (LPWSTR)malloc(len*sizeof(WCHAR))) == NULL)
- return NULL;
+ if ((wszOut = (LPWSTR)malloc(len*sizeof(WCHAR))) == nullptr)
+ return nullptr;
p = (LPSTR)str;
i = 0;
while (*p) {
diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index 7eedca1ce1..173696bcbf 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -31,7 +31,7 @@ char *MirandaContact::MENU_ITEM_TEXT = LPGEN("&Transliterate"); char *MirandaContact::MENU_COMMAND_CALLBACK_SERVICE
= "CyrTranslit/ContactMenuCmd";
-HGENMENU MirandaContact::hTransliterateCmdMenuItem = 0;
+HGENMENU MirandaContact::hTransliterateCmdMenuItem = nullptr;
//------------------------------------------------------------------------------
@@ -91,7 +91,7 @@ int MirandaContact::onPreBuildContactMenu(WPARAM wParam, LPARAM) MCONTACT hContact = MCONTACT(wParam);
if (!db_is_contact(wParam)) return 0;
- Menu_ModifyItem(hTransliterateCmdMenuItem, NULL, INVALID_HANDLE_VALUE, bIsActive(hContact) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(hTransliterateCmdMenuItem, nullptr, INVALID_HANDLE_VALUE, bIsActive(hContact) ? CMIF_CHECKED : 0);
return 0;
}
diff --git a/plugins/CyrTranslit/src/TransliterationMap.cpp b/plugins/CyrTranslit/src/TransliterationMap.cpp index f9ac320f44..f8f2169770 100644 --- a/plugins/CyrTranslit/src/TransliterationMap.cpp +++ b/plugins/CyrTranslit/src/TransliterationMap.cpp @@ -23,7 +23,7 @@ namespace CyrTranslit {
TransliterationMap::Guard TransliterationMap::guard;
-const TransliterationMap *TransliterationMap::pInstance = 0;
+const TransliterationMap *TransliterationMap::pInstance = nullptr;
//------------------------------------------------------------------------------
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp index d96086a42a..27b86c38af 100644 --- a/plugins/Db3x_mmap/src/database.cpp +++ b/plugins/Db3x_mmap/src/database.cpp @@ -87,9 +87,9 @@ void __cdecl dbpanic(void *) wchar_t err[256];
mir_snwprintf(err, msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
- MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
}
- else MessageBox(0, TranslateW(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
+ else MessageBox(nullptr, TranslateW(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
TerminateProcess(GetCurrentProcess(), 255);
}
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 66559fff3a..03c6da8385 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -396,7 +396,7 @@ void CDb3Mmap::ToggleEventsEncryption(MCONTACT contactID) size_t len;
DWORD ofsDest;
mir_ptr<BYTE> pBlob;
- BYTE *pSource = DBRead(offset + offsetof(DBEvent, blob), 0);
+ BYTE *pSource = DBRead(offset + offsetof(DBEvent, blob), nullptr);
if (!m_bEncrypted) { // we need more space
if ((pBlob = m_crypto->encodeBuffer(pSource, evt.cbBlob, &len)) == nullptr)
return;
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index aacb29f2da..8fd9a1dde3 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -362,18 +362,18 @@ STDMETHODIMP_(BOOL) CDb3Mmap::GetContactSettingStatic(MCONTACT contactID, LPCSTR STDMETHODIMP_(BOOL) CDb3Mmap::FreeVariant(DBVARIANT *dbv)
{
- if (dbv == 0) return 1;
+ if (dbv == nullptr) return 1;
switch (dbv->type) {
case DBVT_ASCIIZ:
case DBVT_UTF8:
case DBVT_WCHAR:
if (dbv->pszVal) mir_free(dbv->pszVal);
- dbv->pszVal = 0;
+ dbv->pszVal = nullptr;
break;
case DBVT_BLOB:
if (dbv->pbVal) mir_free(dbv->pbVal);
- dbv->pbVal = 0;
+ dbv->pbVal = nullptr;
break;
}
dbv->type = 0;
@@ -801,7 +801,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteContactSetting(MCONTACT contactID, LPCSTR sz }
// notify
- DBCONTACTWRITESETTING dbcws = { 0 };
+ DBCONTACTWRITESETTING dbcws = {};
dbcws.szModule = szModule;
dbcws.szSetting = szSetting;
dbcws.value.type = DBVT_DELETED;
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index d73f95966a..2e088b95d8 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -140,7 +140,7 @@ bool CDb3Mmap::EnterPassword(const BYTE *pKey, const size_t keyLen) CredFree(pCred);
}
else {
- if (IDOK != DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LOGIN), 0, sttEnterPassword, (LPARAM)¶m))
+ if (IDOK != DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LOGIN), nullptr, sttEnterPassword, (LPARAM)¶m))
return false;
m_crypto->setPassword(T2Utf(param.newPass));
}
@@ -258,7 +258,7 @@ static INT_PTR ChangePassword(void* obj, WPARAM, LPARAM) {
CDb3Mmap *db = (CDb3Mmap*)obj;
DlgChangePassParam param = { db };
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), 0, sttChangePassword, (LPARAM)¶m);
+ DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)¶m);
return 0;
}
diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index b4123abe50..1f9ed55889 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -64,7 +64,7 @@ static INT_PTR ServiceMode(WPARAM, LPARAM) {
bLaunchMiranda = bShortMode = bAutoExit = false;
bServiceMode = true;
- DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
+ DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
return (bLaunchMiranda) ? SERVICE_CONTINUE : SERVICE_FAILED;
}
@@ -75,7 +75,7 @@ static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam) bAutoExit = lParam == 2;
bServiceMode = false;
wcsncpy(opts.filename, (wchar_t*)wParam, _countof(opts.filename));
- return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
+ return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
}
extern "C" __declspec(dllexport) int Load(void)
diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp index a5ea7c99a6..3c98c1e8b2 100644 --- a/plugins/DbChecker/src/openerror.cpp +++ b/plugins/DbChecker/src/openerror.cpp @@ -29,7 +29,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case WM_INITDIALOG:
{
wchar_t szError[256];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, opts.error, 0, szError, _countof(szError), NULL);
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, opts.error, 0, szError, _countof(szError), nullptr);
SetDlgItemText(hdlg, IDC_ERRORTEXT, szError);
}
if (opts.error == ERROR_SHARING_VIOLATION) ShowWindow(GetDlgItem(hdlg, IDC_INUSE), SW_SHOW);
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index ffac34c610..5949c9e89c 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void __cdecl WorkerThread(void *unused);
static HWND hwndStatus, hdlgProgress, hwndBar;
static bool bShortModeDone;
-HANDLE hEventRun = NULL, hEventAbort = NULL;
+HANDLE hEventRun = nullptr, hEventAbort = nullptr;
int errorCount;
LRESULT wizardResult;
@@ -39,7 +39,7 @@ void AddToStatus(int flags, const wchar_t* fmt, ...) int i = SendMessage(hwndStatus, LB_ADDSTRING, 0, (LPARAM)str);
SendMessage(hwndStatus, LB_SETITEMDATA, i, flags);
- InvalidateRect(hwndStatus, NULL, FALSE);
+ InvalidateRect(hwndStatus, nullptr, FALSE);
SendMessage(hwndStatus, LB_SETTOPINDEX, i, 0);
#ifdef _DEBUG
@@ -68,7 +68,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM {
static int fontHeight, listWidth;
static int manualAbort;
- static HFONT hBoldFont = NULL;
+ static HFONT hBoldFont = nullptr;
INT_PTR bReturn;
if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
@@ -87,12 +87,12 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM HDC hdc;
HFONT hFont, hoFont;
SIZE s;
- hdc = GetDC(NULL);
+ hdc = GetDC(nullptr);
hFont = (HFONT)SendMessage(hdlg, WM_GETFONT, 0, 0);
hoFont = (HFONT)SelectObject(hdc, hFont);
GetTextExtentPoint32(hdc, L"x", 1, &s);
SelectObject(hdc, hoFont);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
fontHeight = s.cy;
RECT rc;
@@ -105,10 +105,10 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM hBoldFont = CreateFontIndirect(&lf);
}
manualAbort = 0;
- hEventRun = CreateEvent(NULL, TRUE, TRUE, NULL);
- hEventAbort = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hEventRun = CreateEvent(nullptr, TRUE, TRUE, nullptr);
+ hEventAbort = CreateEvent(nullptr, TRUE, FALSE, nullptr);
TranslateDialogDefault(hdlg);
- _beginthread(WorkerThread, 0, NULL);
+ _beginthread(WorkerThread, 0, nullptr);
return TRUE;
case WM_MEASUREITEM:
@@ -124,7 +124,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM {
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
int bold = 0;
- HFONT hoFont = NULL;
+ HFONT hoFont = nullptr;
if ((int)dis->itemID == -1) break;
SendMessage(dis->hwndItem, LB_GETTEXT, dis->itemID, (LPARAM)str);
switch (dis->itemData & STATUS_CLASSMASK) {
@@ -147,7 +147,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break;
}
if (bold) hoFont = (HFONT)SelectObject(dis->hDC, hBoldFont);
- ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_wstrlen(str), NULL);
+ ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_wstrlen(str), nullptr);
if (bold) SelectObject(dis->hDC, hoFont);
}
return TRUE;
@@ -175,7 +175,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM else {
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
CloseHandle(opts.hOutFile);
- opts.hOutFile = NULL;
+ opts.hOutFile = nullptr;
}
break;
}
@@ -231,15 +231,15 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case WM_DESTROY:
if (hEventAbort) {
CloseHandle(hEventAbort);
- hEventAbort = NULL;
+ hEventAbort = nullptr;
}
if (hEventRun) {
CloseHandle(hEventRun);
- hEventRun = NULL;
+ hEventRun = nullptr;
}
if (hBoldFont) {
DeleteObject(hBoldFont);
- hBoldFont = NULL;
+ hBoldFont = nullptr;
}
break;
}
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index 5fe836c21d..559dc5d7fd 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static bool CheckBroken(const wchar_t *ptszFullPath)
{
DATABASELINK *dblink = FindDatabasePlugin(ptszFullPath);
- if (dblink == NULL || dblink->CheckDB == NULL)
+ if (dblink == nullptr || dblink->CheckDB == nullptr)
return true;
return dblink->grokHeader(ptszFullPath) != EGROKPRF_NOERROR;
@@ -33,9 +33,9 @@ int OpenDatabase(HWND hdlg, INT iNextPage) wchar_t tszMsg[1024];
int error = 0;
- if (opts.dbChecker == NULL) {
+ if (opts.dbChecker == nullptr) {
DATABASELINK* dblink = FindDatabasePlugin(opts.filename);
- if (dblink == NULL) {
+ if (dblink == nullptr) {
mir_snwprintf(tszMsg,
TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."),
opts.filename);
@@ -44,7 +44,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage) return false;
}
- if (dblink->CheckDB == NULL) {
+ if (dblink->CheckDB == nullptr) {
mir_snwprintf(tszMsg,
TranslateT("Database driver '%s' doesn't support checking."),
TranslateW(dblink->szFullName));
@@ -52,7 +52,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage) }
opts.dbChecker = dblink->CheckDB(opts.filename, &error);
- if (opts.dbChecker == NULL) {
+ if (opts.dbChecker == nullptr) {
if ((opts.error = GetLastError()) == 0)
opts.error = error;
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
@@ -108,7 +108,7 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di bool isBroken = CheckBroken(filename);
const wchar_t *pName = wcsrchr(filename, '\\');
- if (pName == NULL)
+ if (pName == nullptr)
pName = (LPTSTR)filename;
else
pName++;
@@ -117,7 +117,7 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di mir_snwprintf(szName, L"%s%s", dir, pName);
wchar_t *pDot = wcsrchr(szName, '.');
- if (pDot != NULL && !mir_wstrcmpi(pDot, L".dat"))
+ if (pDot != nullptr && !mir_wstrcmpi(pDot, L".dat"))
*pDot = 0;
lvi.iItem = 0;
@@ -192,9 +192,9 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM ListView_InsertColumn(GetDlgItem(hdlg, IDC_DBLIST), 1, &lvc);
wchar_t szMirandaPath[MAX_PATH];
- GetModuleFileName(NULL, szMirandaPath, _countof(szMirandaPath));
+ GetModuleFileName(nullptr, szMirandaPath, _countof(szMirandaPath));
wchar_t *str2 = wcsrchr(szMirandaPath, '\\');
- if (str2 != NULL)
+ if (str2 != nullptr)
*str2 = 0;
int i = 0;
@@ -217,7 +217,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM // search in profile dir (using registry path + ini file)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\miranda32.exe", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
- if (RegQueryValueEx(hKey, L"Path", NULL, NULL, (PBYTE)szMirandaPath, &cbData) == ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey, L"Path", nullptr, nullptr, (PBYTE)szMirandaPath, &cbData) == ERROR_SUCCESS) {
if (mir_wstrcmp(szProfileDir, szMirandaPath)) {
GetProfileDirectory(szMirandaPath, szProfileDir, _countof(szProfileDir));
FindAdd(hdlg, szProfileDir, L"[reg]\\");
@@ -233,9 +233,9 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM ListView_SetItemState(GetDlgItem(hdlg, IDC_DBLIST), i, LVIS_SELECTED, LVIS_SELECTED);
}
- if (opts.dbChecker != NULL) {
+ if (opts.dbChecker != nullptr) {
opts.dbChecker->Destroy();
- opts.dbChecker = NULL;
+ opts.dbChecker = nullptr;
}
if (bShortMode)
@@ -275,7 +275,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM GetDlgItemText(hdlg, IDC_FILE, str, _countof(str));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hdlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = filter;
ofn.lpstrDefExt = L"dat";
ofn.lpstrFile = str;
diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp index 321eba23a8..5f9f74b4c5 100644 --- a/plugins/DbChecker/src/welcome.cpp +++ b/plugins/DbChecker/src/welcome.cpp @@ -44,11 +44,11 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l TitleLogFont.lfWeight = FW_BOLD;
mir_wstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
INT FontSize = 12;
TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;
hTitleFont = CreateFontIndirect(&TitleLogFont);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
}
SendDlgItemMessage(hdlg, IDC_TITLE, WM_SETFONT, (WPARAM)hTitleFont, 0);
EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE);
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp index 62f30e1c42..86a038ae20 100644 --- a/plugins/DbChecker/src/wizard.cpp +++ b/plugins/DbChecker/src/wizard.cpp @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-static HFONT hBoldFont = NULL;
-static HENHMETAFILE hEmfHeaderLogo = NULL;
+static HFONT hBoldFont = nullptr;
+static HENHMETAFILE hEmfHeaderLogo = nullptr;
static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM)
{
@@ -41,7 +41,7 @@ static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM) makeBold = 1;
}
if (makeBold) {
- if (hBoldFont == NULL) {
+ if (hBoldFont == nullptr) {
LOGFONT lf;
hBoldFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
GetObject(hBoldFont, sizeof(lf), &lf);
@@ -50,7 +50,7 @@ static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM) }
SendMessage(hwnd, WM_SETFONT, (WPARAM)hBoldFont, 0);
SetWindowLongPtr(hwnd, GWL_EXSTYLE, exstyle&~WS_EX_CLIENTEDGE);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
return TRUE;
}
@@ -60,7 +60,7 @@ int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, switch (message) {
case WM_INITDIALOG:
EnumChildWindows(hdlg, MyControlsEnumChildren, 0);
- if (hEmfHeaderLogo == NULL) {
+ if (hEmfHeaderLogo == nullptr) {
HRSRC hRsrc = FindResourceA(hInst, MAKEINTRESOURCEA(IDE_HDRLOGO), "EMF");
HGLOBAL hGlob = LoadResource(hInst, hRsrc);
hEmfHeaderLogo = SetEnhMetaFileBits(SizeofResource(hInst, hRsrc), (PBYTE)LockResource(hGlob));
@@ -97,7 +97,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP switch (message) {
case WM_INITDIALOG:
SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_DBTOOL)));
- hdlgPage = NULL;
+ hdlgPage = nullptr;
if (bShortMode)
SendMessage(hdlg, WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
else
@@ -106,14 +106,14 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP return TRUE;
case WZM_GOTOPAGE:
- if (hdlgPage != NULL) DestroyWindow(hdlgPage);
+ if (hdlgPage != nullptr) DestroyWindow(hdlgPage);
EnableWindow(GetDlgItem(hdlg, IDC_BACK), TRUE);
EnableWindow(GetDlgItem(hdlg, IDOK), TRUE);
EnableWindow(GetDlgItem(hdlg, IDCANCEL), TRUE);
SetDlgItemText(hdlg, IDCANCEL, TranslateT("Cancel"));
hdlgPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam);
TranslateDialogDefault(hdlgPage);
- SetWindowPos(hdlgPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hdlgPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hdlgPage, SW_SHOW);
break;
@@ -136,20 +136,20 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP case WM_DESTROY:
if (opts.dbChecker) {
opts.dbChecker->Destroy();
- opts.dbChecker = NULL;
+ opts.dbChecker = nullptr;
}
if (opts.hOutFile)
CloseHandle(opts.hOutFile);
DestroyWindow(hdlgPage);
- if (hBoldFont != NULL) {
+ if (hBoldFont != nullptr) {
DeleteObject(hBoldFont);
- hBoldFont = NULL;
+ hBoldFont = nullptr;
}
- if (hEmfHeaderLogo != NULL) {
+ if (hEmfHeaderLogo != nullptr) {
DeleteEnhMetaFile(hEmfHeaderLogo);
- hEmfHeaderLogo = NULL;
+ hEmfHeaderLogo = nullptr;
}
break;
}
diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index ab97b54b33..7ae4bdc0b2 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -24,27 +24,27 @@ void ProcessingDone(void); static void Finalize(time_t& ts)
{
opts.dbChecker->Destroy();
- opts.dbChecker = NULL;
+ opts.dbChecker = nullptr;
if (opts.hOutFile) {
CloseHandle(opts.hOutFile);
- opts.hOutFile = NULL;
+ opts.hOutFile = nullptr;
}
if (errorCount && !opts.bBackup && !opts.bCheckOnly) {
- time_t dlg_ts = time(NULL);
- if (IDYES == MessageBox(NULL,
+ time_t dlg_ts = time(nullptr);
+ if (IDYES == MessageBox(nullptr,
TranslateT("Errors were encountered, however you selected not to backup the original database. It is strongly recommended that you do so in case important data was omitted. Do you wish to keep a backup of the original database?"),
TranslateT("Miranda Database Tool"), MB_YESNO))
opts.bBackup = 1;
- ts += time(NULL) - dlg_ts;
+ ts += time(nullptr) - dlg_ts;
}
if (opts.bBackup) {
wchar_t dbPath[MAX_PATH], dbFile[MAX_PATH];
mir_wstrcpy(dbPath, opts.filename);
wchar_t* str2 = wcsrchr(dbPath, '\\');
- if (str2 != NULL) {
+ if (str2 != nullptr) {
mir_wstrcpy(dbFile, str2 + 1);
*str2 = 0;
}
@@ -75,7 +75,7 @@ static void Finalize(time_t& ts) void __cdecl WorkerThread(void *)
{
int task, firstTime;
- time_t ts = time(NULL);
+ time_t ts = time(nullptr);
AddToStatus(STATUS_MESSAGE, TranslateT("Database worker thread activated"));
@@ -89,7 +89,7 @@ void __cdecl WorkerThread(void *) mir_wstrcpy(opts.outputFilename, opts.filename);
*wcsrchr(opts.outputFilename, '.') = 0;
mir_wstrcat(opts.outputFilename, TranslateT(" (Output).dat"));
- opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
if (opts.hOutFile == INVALID_HANDLE_VALUE) {
AddToStatus(STATUS_FATAL, TranslateT("Can't create output file (%u)"), GetLastError());
ProcessingDone();
@@ -129,7 +129,7 @@ void __cdecl WorkerThread(void *) firstTime = 0;
if (ret == ERROR_OUT_OF_PAPER) {
Finalize(ts);
- AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(NULL) - ts);
+ AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(nullptr) - ts);
if (errorCount)
AddToStatus(STATUS_SUCCESS, TranslateT("All tasks completed but with errors (%d)"), errorCount);
else
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index ae2430bb68..95a27b2f68 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -36,13 +36,13 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar if (ApplyProtoFilter(hContact))
continue;
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact);
}
- GetContactName(NULL, NULL, name, _countof(name));
+ GetContactName(NULL, nullptr, name, _countof(name));
int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0);
@@ -61,11 +61,11 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar copyModule(mac->module, mac->hContact, hContact);
}
else {
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
copyModule(mac->module, mac->hContact, hContact);
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
refreshTree(1);
// fall through
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 8ea862845e..62e63426fd 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
volatile BOOL working;
-static HWND hwnd2Delete = NULL;
+static HWND hwnd2Delete = nullptr;
int deleteModule(MCONTACT hContact, const char *module, int confirm)
{
@@ -93,13 +93,13 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) {
char module[FLD_SIZE];
GetDlgItemTextA(hwnd, IDC_CONTACTS, module, _countof(module));
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
deleteModule(hContact, module, 0);
// do the null
deleteModule(NULL, module, 0);
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
refreshTree(1);
}
// fall through
@@ -113,7 +113,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) break;
case WM_DESTROY:
- hwnd2Delete = NULL;
+ hwnd2Delete = nullptr;
break;
}
return 0;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 6f33002d52..e9c6efe468 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -150,20 +150,20 @@ void exportDB(MCONTACT hContact, const char *module) wchar_t fileName[MAX_PATH];
- if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? NULL : module, MAX_PATH)) {
+ if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? nullptr : module, MAX_PATH)) {
FILE *file = _wfopen(fileName, L"wt");
if (!file) {
msg(TranslateT("Couldn't open file for writing"));
return;
}
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
// exporting entire db
if (hContact == INVALID_CONTACT_ID) {
hContact = NULL;
- if (module == NULL) {
+ if (module == nullptr) {
fprintf(file, "SETTINGS:\n");
mod = modlist.first;
while (mod) {
@@ -179,7 +179,7 @@ void exportDB(MCONTACT hContact, const char *module) }
else {
if (*module == 0)
- module = NULL; // reset module for all contacts export
+ module = nullptr; // reset module for all contacts export
}
hContact = db_find_first();
@@ -195,7 +195,7 @@ void exportDB(MCONTACT hContact, const char *module) fprintf(file, "CONTACT: %s\n", NickFromHContact(hContact));
- if (module == NULL) // export all modules
+ if (module == nullptr) // export all modules
{
mod = modlist.first;
while (mod) {
@@ -247,7 +247,7 @@ void exportDB(MCONTACT hContact, const char *module) }
fclose(file);
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
FreeModuleSettingLL(&modlist);
@@ -276,18 +276,18 @@ void importSettings(MCONTACT hContact, char *utf8) importstring = strtok(importstring, "\n");
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
- while (importstring != NULL) {
+ while (importstring != nullptr) {
i = 0;
rtrim(importstring);
if (importstring[i] == '\0') {
- importstring = strtok(NULL, "\n");
+ importstring = strtok(nullptr, "\n");
continue;
}
if (!strncmp(&importstring[i], "SETTINGS:", mir_strlen("SETTINGS:"))) {
- importstring = strtok(NULL, "\n");
+ importstring = strtok(nullptr, "\n");
continue;
}
@@ -414,9 +414,9 @@ void importSettings(MCONTACT hContact, char *utf8) }
}
}
- importstring = strtok(NULL, "\n");
+ importstring = strtok(nullptr, "\n");
}
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -429,7 +429,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara wchar_t name[NAME_SIZE], msg[MSG_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
+ GetContactName((MCONTACT)lParam, nullptr, name, _countof(name));
mir_snwprintf(msg, TranslateT("Import to \"%s\""), name);
SetWindowText(hwnd, msg);
@@ -515,10 +515,10 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) mir_wstrcat(szFile, &szFileNames[index]);
index += (int)mir_wstrlen(&szFileNames[index]) + 1;
- HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
- if (GetFileSize(hFile, NULL) > 0) {
- HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (GetFileSize(hFile, nullptr) > 0) {
+ HANDLE hMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr);
if (hMap) {
char *pFile = (char*)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0, 0);
if (pFile) {
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index b97dd4ab0d..ccfc80060a 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -49,7 +49,7 @@ ColumnsSettings csResultList[] = { { LPGENW("Module"), 2, "Search2width", 100 },
{ LPGENW("Setting"), 3, "Search3width", 100 },
{ LPGENW("Value"), 4, "Search4width", 150 },
- {0}
+ {nullptr}
};
@@ -237,7 +237,7 @@ void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *set else
mode = TranslateT("Found");
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
LVITEM lvi = {0};
lvi.mask = LVIF_PARAM;
@@ -376,13 +376,13 @@ void __cdecl FindSettings(LPVOID param) if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) {
char val[16];
- numsearch = strtoul(search, NULL, 10);
+ numsearch = strtoul(search, nullptr, 10);
_ultoa(numsearch, val, 10);
if (!mir_strcmp(search, val)) {
fi->options |= F_NUMSRCH;
// replace numeric values only entirely
if (replace && (fi->options & F_ENTIRE)) {
- numreplace = strtoul(replace, NULL, 10);
+ numreplace = strtoul(replace, nullptr, 10);
_ultoa(numreplace, val, 10);
if (!replace[0] || !mir_strcmp(replace, val))
fi->options |= F_NUMREPL;
@@ -429,7 +429,7 @@ void __cdecl FindSettings(LPVOID param) // check in settings value
if (fi->options & F_SETVAL) {
- wchar_t *value = NULL;
+ wchar_t *value = nullptr;
switch(dbv.type) {
@@ -527,7 +527,7 @@ void __cdecl FindSettings(LPVOID param) }
}
- ItemFound(fi->hwnd, hContact, module->name, newSetting, NULL, flag);
+ ItemFound(fi->hwnd, hContact, module->name, newSetting, nullptr, flag);
}
db_free(&dbv);
@@ -549,19 +549,19 @@ void __cdecl FindSettings(LPVOID param) if (!newModule[0]) {
deleteModule(hContact, module->name, 0);
- replaceTreeItem(hContact, module->name, NULL);
+ replaceTreeItem(hContact, module->name, nullptr);
flag |= F_DELETED;
newModule = module->name;
deleteCount++;
}
else if (renameModule(hContact, module->name, newModule)) {
- replaceTreeItem(hContact, module->name, NULL);
+ replaceTreeItem(hContact, module->name, nullptr);
flag |= F_REPLACED;
replaceCount++;
}
}
- ItemFound(fi->hwnd, hContact, newModule, 0, 0, flag);
+ ItemFound(fi->hwnd, hContact, newModule, nullptr, nullptr, flag);
}
} // for(module)
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index 3e388b7244..683b90fbe7 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -67,13 +67,13 @@ HIMAGELIST LoadIcons() HICON hIcon;
HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, _countof(dbeIcons), 5);
if (!hil)
- return NULL;
+ return nullptr;
for(int i = 0; i < _countof(dbeIcons); i++)
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i]));
int protoCount = 0;
- PROTOACCOUNT **protocols = NULL;
+ PROTOACCOUNT **protocols = nullptr;
Proto_EnumAccounts(&protoCount, &protocols);
for (int i = 0; i < protoCount; i++) {
@@ -92,7 +92,7 @@ int GetProtoIconIndex(const char *szProto) {
if (szProto && szProto[0]) {
int protoCount = 0;
- PROTOACCOUNT **protocols = NULL;
+ PROTOACCOUNT **protocols = nullptr;
Proto_EnumAccounts(&protoCount, &protocols);
for (int i = 0; i < protoCount; i++)
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index fe31957c25..e3c6084450 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -1,10 +1,10 @@ #include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
MIDatabase *g_db;
-HANDLE hTTBButt = NULL;
+HANDLE hTTBButt = nullptr;
bool g_bServiceMode = false;
bool g_bUsePopups;
@@ -97,7 +97,7 @@ INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM) static int OnTTBLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = "DBEditorpp/MenuCommand";
ttb.name = LPGEN("Database Editor++");
@@ -123,7 +123,7 @@ int ModulesLoaded(WPARAM, LPARAM) Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0x2fed8613, 0xac43, 0x4148, 0xbd, 0x5c, 0x44, 0x88, 0xaf, 0x68, 0x69, 0x10);
- mi.root = NULL;
+ mi.root = nullptr;
mi.hIcolibItem = GetIcoLibHandle(ICO_REGUSER);
mi.name.a = LPGEN("Open user tree in DBE++");
mi.pszService = "DBEditorpp/MenuCommand";
@@ -184,7 +184,7 @@ extern "C" __declspec(dllexport) int Load(void) {
mir_getLP(&pluginInfoEx);
- hwnd2mainWindow = NULL;
+ hwnd2mainWindow = nullptr;
hRestore = NULL;
g_db = db_get_current();
@@ -313,7 +313,7 @@ int setNumericValue(MCONTACT hContact, const char *module, const char *setting, int IsRealUnicode(wchar_t *value)
{
BOOL nonascii = 0;
- WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, NULL, 0, NULL, &nonascii);
+ WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, nullptr, 0, nullptr, &nonascii);
return nonascii;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 6868493943..318a1fc8e1 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -2,7 +2,7 @@ HWND hwnd2mainWindow;
-static HIMAGELIST hImg = 0;
+static HIMAGELIST hImg = nullptr;
int g_Hex;
int g_Mode;
@@ -63,7 +63,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, {
RECT rc;
GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? LoadCursor(NULL, IDC_SIZENS) : LoadCursor(NULL, IDC_SIZEWE));
+ SetCursor(rc.right > rc.bottom ? LoadCursor(nullptr, IDC_SIZENS) : LoadCursor(nullptr, IDC_SIZEWE));
}
return TRUE;
@@ -369,13 +369,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) freeTree(0);
- hwnd2mainWindow = NULL;
- hwnd2Tree = NULL;
- hwnd2List = NULL;
+ hwnd2mainWindow = nullptr;
+ hwnd2Tree = nullptr;
+ hwnd2List = nullptr;
if (hImg) {
ImageList_Destroy(hImg);
- hImg = NULL;
+ hImg = nullptr;
}
FreeResidentSettings();
@@ -416,16 +416,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) freeAllWatches();
break;
case MENU_EXPORTDB: // all db
- exportDB(INVALID_CONTACT_ID, 0);
+ exportDB(INVALID_CONTACT_ID, nullptr);
break;
case MENU_EXPORTCONTACT: // all contacts
exportDB(INVALID_CONTACT_ID, "");
break;
case MENU_EXPORTMODULE: // all settings
- exportDB(NULL, 0);
+ exportDB(NULL, nullptr);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(NULL, NULL);
+ ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_IMPORTFROMTEXT:
ImportSettingsMenuItem(NULL);
@@ -539,5 +539,5 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void openMainWindow()
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc);
}
diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp index e1e7de6e33..551fc3a171 100644 --- a/plugins/DbEditorPP/src/modsettingenum.cpp +++ b/plugins/DbEditorPP/src/modsettingenum.cpp @@ -3,7 +3,7 @@ void FreeModuleSettingLL(ModuleSettingLL *msll)
{
- if (msll == NULL)
+ if (msll == nullptr)
return;
ModSetLinkLinkItem *item = msll->first;
@@ -16,8 +16,8 @@ void FreeModuleSettingLL(ModuleSettingLL *msll) mir_free(temp);
}
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
}
@@ -30,7 +30,7 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam) return 1;
msll->first->name = mir_strdup(setting);
- msll->first->next = 0;
+ msll->first->next = nullptr;
msll->last = msll->first;
}
else {
@@ -41,7 +41,7 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam) msll->last->next = item;
msll->last = item;
item->name = mir_strdup(setting);
- item->next = 0;
+ item->next = nullptr;
}
return 0;
}
@@ -49,8 +49,8 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam) int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail
{
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (db_enum_modules(enumModulesSettingsProc, msll)) {
msg(TranslateT("Error loading module list"));
return 0;
@@ -68,8 +68,8 @@ int enumSettingsProc(const char *setting, LPARAM lParam) int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll)
{
// enum all setting the contact has for the module
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (db_enum_settings(hContact, enumSettingsProc, module, msll)) {
msg(TranslateT("Error loading setting list"));
return 0;
@@ -118,7 +118,7 @@ int enumResidentProc(const char *setting, DWORD, LPARAM) int LoadResidentSettings()
{
if (g_db)
- return !g_db->EnumResidentSettings(enumResidentProc, 0);
+ return !g_db->EnumResidentSettings(enumResidentProc, nullptr);
return 0;
}
@@ -154,8 +154,8 @@ int IsResidentSetting(const char *module, const char *setting) int EnumResidentSettings(const char *module, ModuleSettingLL *msll)
{
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (!module) return 0;
if (!m_lResidentSettings.getCount()) return 0;
@@ -179,8 +179,8 @@ int EnumResidentSettings(const char *module, ModuleSettingLL *msll) int EnumResidentModules(ModuleSettingLL *msll)
{
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (!m_lResidentModules.getCount()) return 0;
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 34c43fb7e8..6abd34c7ec 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-HWND hwnd2Tree = 0;
+HWND hwnd2Tree = nullptr;
volatile BOOL populating = 0;
volatile int Select = 0;
@@ -38,7 +38,7 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec ModuleTreeInfoStruct *lParam;
int itemscount = 0;
int icon = 0;
- HTREEITEM hItem = 0;
+ HTREEITEM hItem = nullptr;
SetWindowText(hwnd2mainWindow, TranslateT("Loading contacts..."));
@@ -155,7 +155,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) wchar_t text[FLD_SIZE];
if (!TreeView_GetCount(hwnd2Tree))
- return 0;
+ return nullptr;
_A2T szModule(module);
@@ -182,7 +182,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) } while (item.hItem);
- return 0;
+ return nullptr;
}
// the following code to go through the whole tree is nicked from codeguru..
@@ -296,7 +296,7 @@ void replaceTreeItem(MCONTACT hContact, const char* module, const char* newModul return;
if (hParent) {
- replaceTreeItem(hContact, newModule, NULL);
+ replaceTreeItem(hContact, newModule, nullptr);
insertItem(hContact, newModule, hParent);
}
}
@@ -374,7 +374,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) /// contact root item
contacts_mtis.type = CONTACT_ROOT_ITEM;
tvi.item.lParam = (LPARAM)&contacts_mtis;
- tvi.hParent = NULL;
+ tvi.hParent = nullptr;
tvi.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_STATE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.state = TVIS_BOLD;
tvi.item.stateMask = TVIS_BOLD;
@@ -391,7 +391,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) tvi.item.lParam = (LPARAM)&settings_mtis;
tvi.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.cChildren = 1;
- tvi.hParent = NULL;
+ tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_FIRST;
tvi.item.pszText = TranslateT("Settings");
tvi.item.iImage = IMAGE_SETTINGS;
@@ -665,11 +665,11 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t case 5: // contact module
{
// check if the setting is being watched and if it is then check the menu item
- int watchIdx = WatchedArrayIndex(hContact, module, NULL, 1);
+ int watchIdx = WatchedArrayIndex(hContact, module, nullptr, 1);
if (watchIdx >= 0)
CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_RENAME_MOD:
TreeView_EditLabel(hwnd2Tree, tvi.hItem);
break;
@@ -688,7 +688,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ////////////////////////////////////////////////////////////////////// divider
case MENU_WATCH_ITEM:
if (watchIdx < 0)
- addSettingToWatchList(hContact, module, 0);
+ addSettingToWatchList(hContact, module, nullptr);
else
freeWatchListItem(watchIdx);
PopulateWatchedWindow();
@@ -710,7 +710,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case 2: // contact
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_CLONE_CONTACT:
if (CloneContact(hContact))
refreshTree(1);
@@ -730,13 +730,13 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ////////////////////////////////////////////////////////////////////// divider
case MENU_EXPORTCONTACT:
- exportDB(hContact, 0);
+ exportDB(hContact, nullptr);
break;
case MENU_IMPORTFROMTEXT:
ImportSettingsMenuItem(hContact);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(hContact, NULL);
+ ImportSettingsFromFileMenuItem(hContact, nullptr);
break;
////////////////////////////////////////////////////////////////////// divider
@@ -752,18 +752,18 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case 3: // NULL contact
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_ADD_MODULE:
addModuleDlg(hContact);
break;
case MENU_EXPORTCONTACT:
- exportDB(NULL, 0);
+ exportDB(NULL, nullptr);
break;
case MENU_IMPORTFROMTEXT:
ImportSettingsMenuItem(NULL);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(NULL, NULL);
+ ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_REFRESH:
refreshTree(1);
@@ -772,7 +772,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case 4: // Contacts root
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_EXPORTCONTACT:
exportDB(INVALID_CONTACT_ID, "");
break;
@@ -780,7 +780,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ImportSettingsMenuItem(NULL);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(NULL, NULL);
+ ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_REFRESH:
refreshTree(1);
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index c6c59a83ad..3e2ca49646 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) db_set_b(NULL, modname, "WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL));
g_bUsePopups = IsDlgButtonChecked(hwnd, IDC_POPUPS) != 0;
db_set_b(NULL, modname, "UsePopUps", (BYTE)g_bUsePopups);
- db_set_w(NULL, modname, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, NULL, 0));
+ db_set_w(NULL, modname, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0));
db_set_dw(NULL, modname, "PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
}
return TRUE;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 1844907aba..3f87c49644 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -31,7 +31,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwnd);
wchar_t msg[MSG_SIZE], name[NAME_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
+ GetContactName((MCONTACT)lParam, nullptr, name, _countof(name));
mir_snwprintf(msg, TranslateT("Add module to \"%s\""), name);
SetWindowText(hwnd, msg);
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 501aa0e75e..8718da8bec 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -2,7 +2,7 @@ SettingListInfo info = {0};
-HWND hwnd2List = 0;
+HWND hwnd2List = nullptr;
static int lastColumn = -1;
@@ -14,7 +14,7 @@ struct ColumnsSettings csSettingList[] = { LPGENW("Type"), 2, "Column2width", 60 },
{ LPGENW("Size"), 3, "Column3width", 80 },
{ LPGENW("#"), 4, "Column4width", 30 },
- { 0 }
+ { nullptr }
};
int ListView_GetItemTextA(HWND hwndLV, int i, int iSubItem, char *pszText, int cchTextMax)
@@ -74,7 +74,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i value = mir_a2u(dbv.pszVal);
if (mir_wstrlen(value) < 11)
- val = wcstoul(value, NULL, NULL);
+ val = wcstoul(value, nullptr, NULL);
}
switch (toType) {
@@ -108,7 +108,7 @@ void EditFinish(int selected) {
if (info.hwnd2Edit) {
SendMessage(info.hwnd2Edit, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
- info.hwnd2Edit = NULL;
+ info.hwnd2Edit = nullptr;
}
info.selectedItem = selected;
}
@@ -157,7 +157,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s }
if (ListView_GetItemCount(hwnd2List) == 0)
- replaceTreeItem(hContact, module, 0);
+ replaceTreeItem(hContact, module, nullptr);
}
@@ -301,7 +301,7 @@ void addListHandle(MCONTACT hContact) lvi.lParam = hContact;
lvi.iImage = IMAGE_HANDLE;
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
lvi.pszText = name;
int index = ListView_InsertItem(hwnd2List, &lvi);
@@ -408,7 +408,7 @@ void settingChanged(MCONTACT hContact, const char *module, const char *setting, if (dbv->type != DBVT_DELETED) {
HTREEITEM hItem = findItemInTree(hContact, module);
if (!hItem) {
- HTREEITEM hParent = findItemInTree(hContact, NULL);
+ HTREEITEM hParent = findItemInTree(hContact, nullptr);
if (hParent)
insertItem(hContact, module, hParent);
}
@@ -510,7 +510,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM switch (value[0]) {
case 'b':
case 'B':
- val = wcstoul(&value[1], NULL, 0);
+ val = wcstoul(&value[1], nullptr, 0);
if (!val || value[1] == '0') {
res = !db_set_b(info.hContact, info.module, info.setting, (BYTE)val);
}
@@ -519,7 +519,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM break;
case 'w':
case 'W':
- val = wcstoul(&value[1], NULL, 0);
+ val = wcstoul(&value[1], nullptr, 0);
if (!val || value[1] == '0')
res = !db_set_w(info.hContact, info.module, info.setting, (WORD)val);
else
@@ -527,7 +527,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM break;
case 'd':
case 'D':
- val = wcstoul(&value[1], NULL, 0);
+ val = wcstoul(&value[1], nullptr, 0);
if (!val || value[1] == '0')
res = !db_set_dw(info.hContact, info.module, info.setting, val);
else
@@ -550,9 +550,9 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM case 'x':
case 'X':
if (value[i] == 'x' || value[i] == 'X')
- val = wcstoul(&value[i + 1], NULL, 16);
+ val = wcstoul(&value[i + 1], nullptr, 16);
else
- val = wcstoul(value, NULL, 10);
+ val = wcstoul(value, nullptr, 10);
switch (dbv.type) {
case DBVT_BYTE:
@@ -608,7 +608,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM return DLGC_WANTALLKEYS;
case WM_DESTROY:
- info.hwnd2Edit = NULL;
+ info.hwnd2Edit = nullptr;
break;
}
return mir_callNextSubclass(hwnd, SettingLabelEditSubClassProc, msg, wParam, lParam);
@@ -622,7 +622,7 @@ void EditLabel(int item, int subitem) if (info.hwnd2Edit) {
SendMessage(info.hwnd2Edit, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); // ignore the new value of the last edit
- info.hwnd2Edit = NULL;
+ info.hwnd2Edit = nullptr;
}
if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, _countof(setting))) return;
@@ -636,9 +636,9 @@ void EditLabel(int item, int subitem) info.subitem = subitem;
if (!subitem)
- info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0);
+ info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr);
else {
- wchar_t *str = NULL, value[16] = { 0 };
+ wchar_t *str = nullptr, value[16] = { 0 };
switch (dbv.type) {
case DBVT_ASCIIZ:
@@ -670,11 +670,11 @@ void EditLabel(int item, int subitem) GetClientRect(hwnd2List, &rclist);
if (rc.top + height > rclist.bottom && rclist.bottom - rclist.top > height)
rc.top = rc.bottom - height;
- info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, 0, hInst, 0);
+ info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, nullptr, hInst, nullptr);
mir_free(str);
}
else if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD)
- info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0);
+ info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr);
}
db_free(&dbv);
@@ -735,7 +735,7 @@ void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam) case LVN_COLUMNCLICK:
LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
- ColumnsSortParams params = { 0 };
+ ColumnsSortParams params = {};
params.hList = hwnd2List;
params.column = lv->iSubItem;
params.last = lastColumn;
@@ -766,7 +766,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to RemoveMenu(hSubMenu, 0, MF_BYPOSITION); // separator
}
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr)) {
case MENU_ADD_BYTE:
newSetting(info.hContact, info.module, DBVT_BYTE);
return;
@@ -869,7 +869,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to if (watchIdx >= 0)
CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr)) {
case MENU_EDIT_SET:
editSetting(info.hContact, info.module, setting);
break;
diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp index bddbc89b0d..0690d65b62 100644 --- a/plugins/DbEditorPP/src/settingsdlg.cpp +++ b/plugins/DbEditorPP/src/settingsdlg.cpp @@ -235,7 +235,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case DBVT_BYTE:
case DBVT_WORD:
case DBVT_DWORD:
- res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, NULL, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type);
+ res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, nullptr, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type);
break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
@@ -328,6 +328,6 @@ void newSetting(MCONTACT hContact, const char *module, int type) dbsetting->dbv.type = type;
dbsetting->hContact = hContact;
dbsetting->module = mir_strdup(module);
- dbsetting->setting = NULL;
+ dbsetting->setting = nullptr;
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
}
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index e4a175d1ff..f438f3dba6 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -1,8 +1,8 @@ #include "stdafx.h"
-HWND hwnd2watchedVarsWindow = NULL;
+HWND hwnd2watchedVarsWindow = nullptr;
-static WatchListArrayStruct WatchListArray = {0};
+static WatchListArrayStruct WatchListArray = {};
static int lastColumn = -1;
@@ -12,7 +12,7 @@ ColumnsSettings csWatchList[] = { { LPGENW("Setting"), 2, "Watch2width", 100 },
{ LPGENW("Value"), 3, "Watch3width", 200 },
{ LPGENW("Type"), 4, "Watch4width", 75 },
- {0}
+ {nullptr}
};
@@ -47,7 +47,7 @@ int addSettingToWatchList(MCONTACT hContact, const char *module, const char *set if (setting)
WatchListArray.item[WatchListArray.count].setting = mir_strdup(setting);
else
- WatchListArray.item[WatchListArray.count].setting = 0;
+ WatchListArray.item[WatchListArray.count].setting = nullptr;
WatchListArray.count++;
return 1;
@@ -61,12 +61,12 @@ void freeWatchListItem(int item) if (WatchListArray.item[item].module)
mir_free(WatchListArray.item[item].module);
- WatchListArray.item[item].module = 0;
+ WatchListArray.item[item].module = nullptr;
if (WatchListArray.item[item].setting)
mir_free(WatchListArray.item[item].setting);
- WatchListArray.item[item].setting = 0;
+ WatchListArray.item[item].setting = nullptr;
db_free(&(WatchListArray.item[item].dbv));
WatchListArray.item[item].hContact = 0;
}
@@ -111,7 +111,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) wchar_t data[32], tmp[16], name[NAME_SIZE];
- GetContactName(lParam->hContact, NULL, name, _countof(name));
+ GetContactName(lParam->hContact, nullptr, name, _countof(name));
lvItem.pszText = name;
int index = ListView_InsertItem(hwnd, &lvItem);
@@ -197,7 +197,7 @@ void freeAllWatches() freeWatchListItem(i);
}
mir_free(WatchListArray.item);
- WatchListArray.item = 0;
+ WatchListArray.item = nullptr;
WatchListArray.count = 0;
}
@@ -274,7 +274,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case MENU_EXIT:
case IDCANCEL:
- hwnd2watchedVarsWindow = NULL;
+ hwnd2watchedVarsWindow = nullptr;
DestroyWindow(hwnd);
break;
case MENU_REFRESH:
@@ -331,7 +331,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_VARS));
saveListSettings(GetDlgItem(hwnd, IDC_VARS), csWatchList);
Utils_SaveWindowPosition(hwnd, NULL, modname, "Watch_");
- hwnd2watchedVarsWindow = NULL;
+ hwnd2watchedVarsWindow = nullptr;
break;
}
return 0;
@@ -340,7 +340,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void openWatchedVarWindow()
{
if (!hwnd2watchedVarsWindow)
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), NULL, WatchDlgProc);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), nullptr, WatchDlgProc);
else
SetForegroundWindow(hwnd2watchedVarsWindow);
}
@@ -353,7 +353,7 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) int timeout = db_get_b(NULL, modname, "PopupDelay", 3);
wchar_t name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE];
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
// 2nd line
int type = GetValue(hContact, module, setting, value, _countof(value));
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 3438427ad8..7ae405fd26 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -10,8 +10,8 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND:
{
wchar_t* ptszPath = (wchar_t*)PUGetPluginData(hWnd);
- if (ptszPath != 0)
- ShellExecute(0, L"open", ptszPath, NULL, NULL, SW_SHOW);
+ if (ptszPath != nullptr)
+ ShellExecute(nullptr, L"open", ptszPath, nullptr, nullptr, SW_SHOW);
PUDeletePopup(hWnd);
break;
@@ -31,7 +31,7 @@ void ShowPopup(wchar_t* ptszText, wchar_t* ptszHeader, wchar_t* ptszPath) wcsncpy_s(ppd.lptzText, ptszText, _TRUNCATE);
wcsncpy_s(ppd.lptzContactName, ptszHeader, _TRUNCATE);
- if (ptszPath != NULL)
+ if (ptszPath != nullptr)
ppd.PluginData = (void*)mir_wstrdup(ptszPath);
ppd.PluginWindowProc = DlgProcPopup;
ppd.lchIcon = IcoLib_GetIcon(iconList[0].szName);
@@ -62,8 +62,8 @@ wchar_t* DoubleSlash(wchar_t *sorce) wchar_t *ret, *r, *s;
ret = (wchar_t*)mir_alloc((MAX_PATH * sizeof(wchar_t)));
- if (ret == NULL)
- return NULL;
+ if (ret == nullptr)
+ return nullptr;
for (s = sorce, r = ret; *s && (r - ret) < (MAX_PATH - 1); s++, r++) {
if (*s != '\\')
*r = *s;
@@ -142,7 +142,7 @@ int Comp(const void *i, const void *j) int RotateBackups(wchar_t *backupfolder, wchar_t *dbname)
{
- backupFile *bf = NULL, *bftmp;
+ backupFile *bf = nullptr, *bftmp;
HANDLE hFind;
wchar_t backupfolderTmp[MAX_PATH];
WIN32_FIND_DATA FindFileData;
@@ -159,7 +159,7 @@ int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
bftmp = (backupFile*)mir_realloc(bf, ((i + 1) * sizeof(backupFile)));
- if (bftmp == NULL)
+ if (bftmp == nullptr)
goto err_out;
bf = bftmp;
wcsncpy_s(bf[i].Name, FindFileData.cFileName, _TRUNCATE);
@@ -183,12 +183,12 @@ int Backup(wchar_t *backup_filename) {
bool bZip = false;
wchar_t dbname[MAX_PATH], source_file[MAX_PATH] = { 0 }, dest_file[MAX_PATH];
- HWND progress_dialog = NULL;
+ HWND progress_dialog = nullptr;
SYSTEMTIME st;
Profile_GetNameW(_countof(dbname), dbname);
- if (backup_filename == NULL) {
+ if (backup_filename == nullptr) {
int err;
wchar_t *backupfolder, buffer[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = _countof(buffer);
@@ -214,10 +214,10 @@ int Backup(wchar_t *backup_filename) bZip = true;
}
if (!options.disable_popups)
- ShowPopup(dbname, TranslateT("Backup in progress"), NULL);
+ ShowPopup(dbname, TranslateT("Backup in progress"), nullptr);
if (!options.disable_progress)
- progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress);
+ progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));
@@ -235,15 +235,15 @@ int Backup(wchar_t *backup_filename) if (res) {
if (!bZip) { // Set the backup file to the current time for rotator's correct work
FILETIME ft;
- HANDLE hFile = CreateFile(dest_file, FILE_WRITE_ATTRIBUTES, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(dest_file, FILE_WRITE_ATTRIBUTES, NULL, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
GetSystemTime(&st);
SystemTimeToFileTime(&st, &ft);
- SetFileTime(hFile, NULL, NULL, &ft);
+ SetFileTime(hFile, nullptr, nullptr, &ft);
CloseHandle(hFile);
}
SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0);
UpdateWindow(progress_dialog);
- db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
+ db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(nullptr));
if (options.use_dropbox)
{
@@ -294,15 +294,15 @@ void BackupThread(void *backup_filename) void BackupStart(wchar_t *backup_filename)
{
- wchar_t *tm = NULL;
+ wchar_t *tm = nullptr;
LONG cur_state;
cur_state = InterlockedCompareExchange(&m_state, 1, 0);
if (cur_state != 0) { /* Backup allready in process. */
- ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), NULL); /* Show error message :) */
+ ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), nullptr); /* Show error message :) */
return;
}
- if (backup_filename != NULL)
+ if (backup_filename != nullptr)
tm = mir_wstrdup(backup_filename);
if (mir_forkthread(BackupThread, (void*)tm) == INVALID_HANDLE_VALUE) {
InterlockedExchange(&m_state, 0); /* Backup done. */
@@ -312,19 +312,19 @@ void BackupStart(wchar_t *backup_filename) VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- time_t t = time(NULL);
+ time_t t = time(nullptr);
time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", 0);
if (diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24)))))
- BackupStart(NULL);
+ BackupStart(nullptr);
}
int SetBackupTimer(void)
{
if (timer_id != 0) {
- KillTimer(0, timer_id);
+ KillTimer(nullptr, timer_id);
timer_id = 0;
}
if (options.backup_types & BT_PERIODIC)
- timer_id = SetTimer(0, 0, (1000 * 60), TimerProc);
+ timer_id = SetTimer(nullptr, 0, (1000 * 60), TimerProc);
return 0;
}
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index aad3eef30a..a0a2e37751 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -28,7 +28,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) static INT_PTR ABService(WPARAM, LPARAM)
{
- BackupStart(NULL);
+ BackupStart(nullptr);
return 0;
}
@@ -90,7 +90,7 @@ static int ModulesLoad(WPARAM, LPARAM) options.use_dropbox = (BOOL)(db_get_b(0, "AutoBackups", "UseDropbox", 0) && ServiceExists(MS_DROPBOX_UPLOAD));
if (options.backup_types & BT_START)
- BackupStart(NULL);
+ BackupStart(nullptr);
return 0;
}
@@ -100,7 +100,7 @@ static int PreShutdown(WPARAM, LPARAM) {
if (options.backup_types & BT_EXIT) {
options.disable_popups = 1; // Don't try to show popups on exit
- BackupStart(NULL);
+ BackupStart(nullptr);
}
return 0;
}
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 575f39ab4b..068c2c5f89 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -8,11 +8,11 @@ Options options; HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle)
{
HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
- TOOLTIPS_CLASS, NULL,
+ TOOLTIPS_CLASS, nullptr,
(WS_POPUP | TTS_NOPREFIX),
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- hwndParent, NULL, g_hInstance, NULL);
+ hwndParent, nullptr, g_hInstance, nullptr);
SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE));
@@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
if (hPathTip)
- SetTimer(hwndDlg, 0, 3000, NULL);
+ SetTimer(hwndDlg, 0, 3000, nullptr);
return TRUE;
case WM_COMMAND:
@@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
BROWSEINFO bi;
bi.hwndOwner = hwndDlg;
- bi.pidlRoot = 0;
+ bi.pidlRoot = nullptr;
bi.pszDisplayName = folder_buff;
bi.lpszTitle = TranslateT("Select backup folder");
bi.ulFlags = BIF_NEWDIALOGSTYLE;
@@ -286,7 +286,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP bi.iImage = 0;
LPCITEMIDLIST pidl = SHBrowseForFolder(&bi);
- if (pidl != 0) {
+ if (pidl != nullptr) {
SHGetPathFromIDList(pidl, folder_buff);
SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff);
@@ -298,7 +298,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
}
case IDC_BUT_NOW:
- BackupStart(NULL);
+ BackupStart(nullptr);
break;
case IDC_CHK_NOPROG:
new_options.disable_progress = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPROG);
@@ -362,8 +362,8 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int err = CreateDirectoryTreeW(backupfolder);
if (err != ERROR_ALREADY_EXISTS && err != 0) {
wchar_t msg_buff[512];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0);
- MessageBox(0, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR);
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, 0, msg_buff, 512, nullptr);
+ MessageBox(nullptr, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR);
folder_ok = FALSE;
}
@@ -386,7 +386,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (hPathTip) {
KillTimer(hwndDlg, 0);
DestroyWindow(hPathTip);
- hPathTip = 0;
+ hPathTip = nullptr;
}
return FALSE;
}
diff --git a/plugins/Db_autobackups/src/zip.cpp b/plugins/Db_autobackups/src/zip.cpp index f3f37e187f..c4a2b145f1 100644 --- a/plugins/Db_autobackups/src/zip.cpp +++ b/plugins/Db_autobackups/src/zip.cpp @@ -3,7 +3,7 @@ int CreateZipFile(const char *szDestPath, OBJLIST<ZipFile> &lstFiles, const std::function<bool(size_t)> &fnCallback)
{
- zipFile hZip = zipOpen2_64(_A2T(szDestPath), APPEND_STATUS_CREATE, NULL, NULL);
+ zipFile hZip = zipOpen2_64(_A2T(szDestPath), APPEND_STATUS_CREATE, nullptr, nullptr);
if (!hZip) return 1;
zip_fileinfo fi = { 0 };
@@ -13,10 +13,10 @@ int CreateZipFile(const char *szDestPath, OBJLIST<ZipFile> &lstFiles, const std: {
ZipFile &zf = lstFiles[i];
- HANDLE hSrcFile = CreateFileA(zf.sPath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hSrcFile = CreateFileA(zf.sPath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hSrcFile != INVALID_HANDLE_VALUE)
{
- int iOpenRes = zipOpenNewFileInZip(hZip, zf.sZipPath.c_str(), &fi, NULL, 0, NULL, 0, "", Z_DEFLATED, Z_BEST_COMPRESSION);
+ int iOpenRes = zipOpenNewFileInZip(hZip, zf.sZipPath.c_str(), &fi, nullptr, 0, nullptr, 0, "", Z_DEFLATED, Z_BEST_COMPRESSION);
if (iOpenRes == ZIP_OK)
{
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);
diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index a60992410f..acf53d85cf 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -46,9 +46,9 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code HRESULT hr = NOERROR;
HRESULT hrT = NOERROR;
SCODE sc = 0;
- LPMAPITABLE lpTable = NULL;
- LPSRowSet lpRows = NULL;
- LPENTRYID lpeid = NULL;
+ LPMAPITABLE lpTable = nullptr;
+ LPSRowSet lpRows = nullptr;
+ LPENTRYID lpeid = nullptr;
ULONG cbeid = 0;
ULONG cRows = 0;
ULONG i = 0;
@@ -68,12 +68,12 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code if (FAILED(hrT))
goto err_out;
// Go to the beginning of the recipient table for the envelope
- hrT = MAPICALL(lpTable)->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
+ hrT = MAPICALL(lpTable)->SeekRow( BOOKMARK_BEGINNING, 0, nullptr);
if (FAILED(hrT))
goto err_out;
// Read all the rows of the table
hrT = MAPICALL(lpTable)->QueryRows( cRows, 0, &lpRows);
- if (SUCCEEDED(hrT) && lpRows != NULL && lpRows->cRows == 0) {
+ if (SUCCEEDED(hrT) && lpRows != nullptr && lpRows->cRows == 0) {
hrT = MAPI_E_NOT_FOUND;
goto err_out;
}
@@ -87,7 +87,7 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code sc = MAPIAllocateBuffer(cbeid, (void **)&lpeid);
if (FAILED(sc)) {
cbeid = 0;
- lpeid = NULL;
+ lpeid = nullptr;
} else {
// Copy entry ID of message store
memcpy(lpeid, lpRows->aRow[i].lpProps[1].Value.bin.lpb, cbeid);
@@ -96,7 +96,7 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code }
err_out:
- if (lpRows != NULL)
+ if (lpRows != nullptr)
FreeProws(lpRows);
UlRelease(lpTable);
*lpcbeid = cbeid;
@@ -108,28 +108,28 @@ err_out: CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID)
{
- m_szSender = NULL ;
- m_szSubject = NULL ;
- m_szEntryID = NULL ;
+ m_szSender = nullptr ;
+ m_szSubject = nullptr ;
+ m_szEntryID = nullptr ;
m_nSizeSender = 0 ;
m_nSizeSubject = 0 ;
m_nSizeEntryID = 0 ;
- if (NULL != szSender) {
+ if (nullptr != szSender) {
m_nSizeSender = (UINT)mir_wstrlen(szSender)+1;
m_szSender = new wchar_t[ m_nSizeSender ];
memset(m_szSender, 0, m_nSizeSender * sizeof(wchar_t));
mir_wstrcpy(m_szSender, szSender);
}
- if (NULL != szSubject) {
+ if (nullptr != szSubject) {
m_nSizeSubject = (UINT)mir_wstrlen(szSubject) +1;
m_szSubject = new wchar_t[m_nSizeSubject];
memset(m_szSubject, 0, m_nSizeSubject * sizeof(wchar_t));
mir_wstrcpy(m_szSubject, szSubject);
}
- if (NULL != szEntryID) {
+ if (nullptr != szEntryID) {
m_nSizeEntryID = (UINT)mir_strlen( szEntryID ) +1;
m_szEntryID = new char[m_nSizeEntryID];
memset(m_szEntryID, 0, m_nSizeEntryID * sizeof(char));
@@ -139,36 +139,36 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) CKeeper::~CKeeper()
{
- if ( m_nSizeSender>0 && NULL != m_szSender )
+ if ( m_nSizeSender>0 && nullptr != m_szSender )
{
m_nSizeSender =0;
delete[] m_szSender;
- m_szSender = NULL;
+ m_szSender = nullptr;
}
- if ( m_nSizeSubject>0 && NULL != m_szSubject )
+ if ( m_nSizeSubject>0 && nullptr != m_szSubject )
{
m_nSizeSubject =0;
delete[] m_szSubject;
- m_szSubject = NULL;
+ m_szSubject = nullptr;
}
- if ( m_nSizeEntryID>0 && NULL != m_szEntryID )
+ if ( m_nSizeEntryID>0 && nullptr != m_szEntryID )
{
m_nSizeEntryID = 0;
delete[] m_szEntryID;
- m_szEntryID = NULL;
+ m_szEntryID = nullptr;
}
}
CMirandaExchange::CMirandaExchange()
{
- m_szUsername = NULL ;
- m_szPassword = NULL ;
- m_szExchangeServer = NULL ;
- m_lpMAPISession = NULL ;
- m_lpInbox = NULL ;
- m_lpMDB = NULL;
+ m_szUsername = nullptr ;
+ m_szPassword = nullptr ;
+ m_szExchangeServer = nullptr ;
+ m_lpMAPISession = nullptr ;
+ m_lpInbox = nullptr ;
+ m_lpMDB = nullptr;
m_bLoginOK = false ;
m_bFolderInboxOK = false ;
m_nNumberOfHeaders = 0 ;
@@ -176,51 +176,51 @@ CMirandaExchange::CMirandaExchange() CMirandaExchange::~CMirandaExchange()
{
- if ( NULL != m_szUsername )
+ if ( nullptr != m_szUsername )
{
delete[] m_szUsername;
- m_szUsername = NULL;
+ m_szUsername = nullptr;
}
- if ( NULL != m_szPassword )
+ if ( nullptr != m_szPassword )
{
delete[] m_szPassword;
- m_szPassword = NULL;
+ m_szPassword = nullptr;
}
- if ( NULL != m_szExchangeServer )
+ if ( nullptr != m_szExchangeServer )
{
delete[] m_szExchangeServer;
- m_szExchangeServer = NULL;
+ m_szExchangeServer = nullptr;
}
- if ( NULL != m_lpInbox )
+ if ( nullptr != m_lpInbox )
{
UlRelease(m_lpInbox);
- m_lpInbox = NULL;
+ m_lpInbox = nullptr;
}
- if ( NULL != m_lpMDB )
+ if ( nullptr != m_lpMDB )
{
UlRelease(m_lpMDB );
- m_lpMDB = NULL;
+ m_lpMDB = nullptr;
}
- if ( NULL!= m_lpMAPISession )
+ if ( nullptr!= m_lpMAPISession )
{
m_lpMAPISession->Logoff(NULL,NULL,NULL);
UlRelease(m_lpMAPISession );
- m_lpMAPISession = NULL;
+ m_lpMAPISession = nullptr;
}
if ( m_nNumberOfHeaders>0)
{
for( UINT i=0; i<m_nNumberOfHeaders; i++ )
{
- if ( NULL != m_HeadersKeeper[i])
+ if ( nullptr != m_HeadersKeeper[i])
{
delete m_HeadersKeeper[i];
- m_HeadersKeeper[i] = NULL;
+ m_HeadersKeeper[i] = nullptr;
}
}
@@ -237,10 +237,10 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (!lppUnk) return MAPI_E_INVALID_PARAMETER;
HRESULT hRes = S_OK;
ULONG ulObjType = NULL;
- LPUNKNOWN lpUnk = NULL;
+ LPUNKNOWN lpUnk = nullptr;
ULONG ulNoCacheFlags = NULL;
- *lppUnk = NULL;
+ *lppUnk = nullptr;
//ulFlags |= MAPI_NO_CACHE;
//in case we need to retry without MAPI_NO_CACHE - do not add MAPI_NO_CACHE to ulFlags after this point
@@ -253,7 +253,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, lpMDB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk);
@@ -261,11 +261,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpMDB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -273,7 +273,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
if (lpAB && !lpUnk)
@@ -283,7 +283,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpAB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk));
@@ -291,11 +291,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpAB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -303,7 +303,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
@@ -314,7 +314,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpContainer->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk));
@@ -322,11 +322,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpContainer->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -334,7 +334,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
@@ -345,7 +345,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpMAPISession->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk));
@@ -353,11 +353,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpMAPISession->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -365,7 +365,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
@@ -382,7 +382,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, LPSBinary lpSBinary, ULONG ulFlags, ULONG* ulObjTypeRet, LPUNKNOWN* lppUnk)
{
return CallOpenEntry( lpMDB, lpAB, lpContainer, lpMAPISession, lpSBinary?lpSBinary->cb:0,
- (LPENTRYID)(lpSBinary?lpSBinary->lpb:0), ulFlags, ulObjTypeRet, lppUnk);
+ (LPENTRYID)(lpSBinary?lpSBinary->lpb:nullptr), ulFlags, ulObjTypeRet, lppUnk);
}
HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPassword, LPCTSTR szExchangeServer )
@@ -391,7 +391,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass UINT nSize = 0;
short nSizeOfTCHAR = sizeof( wchar_t );
- if (m_szUsername == NULL && NULL != szUsername) {
+ if (m_szUsername == nullptr && nullptr != szUsername) {
nSize = (UINT)mir_wstrlen(szUsername);
if (nSize > 0) {
nSize++;
@@ -401,7 +401,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
}
- if (m_szPassword == NULL && NULL != szPassword) {
+ if (m_szPassword == nullptr && nullptr != szPassword) {
nSize = (UINT)mir_wstrlen(szPassword);
if (nSize > 0) {
nSize++;
@@ -411,7 +411,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
}
- if (m_szExchangeServer == NULL && NULL != szExchangeServer) {
+ if (m_szExchangeServer == nullptr && nullptr != szExchangeServer) {
nSize = (UINT)mir_wstrlen(szExchangeServer);
if (nSize > 0) {
nSize++;
@@ -421,7 +421,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
}
- if (!m_bLoginOK || m_lpInbox || NULL == m_lpMAPISession) {
+ if (!m_bLoginOK || m_lpInbox || nullptr == m_lpMAPISession) {
HRESULT hr = S_OK;
MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION , MAPI_MULTITHREAD_NOTIFICATIONS };
@@ -453,10 +453,10 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass return hr;
}
- LPPROFADMIN pProfAdmin = NULL;
+ LPPROFADMIN pProfAdmin = nullptr;
hr = MAPIAdminProfiles( 0, &pProfAdmin );
- if ((FAILED(hr)) || (NULL == pProfAdmin))
+ if ((FAILED(hr)) || (nullptr == pProfAdmin))
{
//Log("Admin profile interface creation failed: 0x%08X", hr);
}
@@ -479,21 +479,21 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass return hr;
// Open default message store
- LPMDB pDefMsgStore = NULL;
- hr = m_lpMAPISession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, NULL,
+ LPMDB pDefMsgStore = nullptr;
+ hr = m_lpMAPISession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, nullptr,
MAPI_BEST_ACCESS, &pDefMsgStore);
HRESULT hRes = S_OK;
ULONG cbInboxEID = NULL;
CMAPIBuffer< LPENTRYID> lpInboxEID = NULL;
- if (NULL == pDefMsgStore )
+ if (nullptr == pDefMsgStore )
return hr;
- hRes = pDefMsgStore->GetReceiveFolder( L"IPM", NULL, &cbInboxEID, &lpInboxEID, NULL);
+ hRes = pDefMsgStore->GetReceiveFolder( L"IPM", NULL, &cbInboxEID, &lpInboxEID, nullptr);
m_lpMDB = pDefMsgStore;
if (cbInboxEID && lpInboxEID) {
- hRes = CallOpenEntry( pDefMsgStore, NULL, NULL, NULL, cbInboxEID, lpInboxEID, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&m_lpInbox);
+ hRes = CallOpenEntry( pDefMsgStore, nullptr, nullptr, nullptr, cbInboxEID, lpInboxEID, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&m_lpInbox);
if ( m_lpInbox && hRes == S_OK)
m_bFolderInboxOK = true;
@@ -510,7 +510,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) CMAPIInterface<LPPROFADMIN> pProfAdmin = NULL;
CMAPIInterface<LPSERVICEADMIN> pMsgSvcAdmin = NULL;
CMAPIInterface<LPMAPITABLE> pMsgSvcTable = NULL;
- LPSRowSet pRows = NULL;
+ LPSRowSet pRows = nullptr;
ULONG ulFlags = 0;
SRestriction sres;
SIZE_T nSize;
@@ -525,24 +525,24 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) };
ulFlags &= ~MAPI_UNICODE;
hr = MAPIAdminProfiles(ulFlags, &pProfAdmin);
- if (FAILED(hr) || pProfAdmin == NULL)
+ if (FAILED(hr) || pProfAdmin == nullptr)
return hr;
- hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags);
+ hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), nullptr, NULL, ulFlags);
if (FAILED(hr)) {
pProfAdmin->DeleteProfile((LPTSTR)mir_u2a(szProfileName), ulFlags);
return hr;
}
- hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags, &pMsgSvcAdmin);
+ hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), nullptr, NULL, ulFlags, &pMsgSvcAdmin);
- if (FAILED(hr) || pMsgSvcAdmin == NULL)
+ if (FAILED(hr) || pMsgSvcAdmin == nullptr)
return hr;
hr = pMsgSvcAdmin->CreateMsgService((LPTSTR)("MSEMS"), (LPTSTR)("")/*"Microsoft Exchange Server"*/, NULL, 0);
if (FAILED(hr))
return hr;
hr = pMsgSvcAdmin->GetMsgServiceTable(0, &pMsgSvcTable);
- if (FAILED(hr) || pMsgSvcTable == NULL)
+ if (FAILED(hr) || pMsgSvcTable == nullptr)
return hr;
sres.rt = RES_CONTENT;
@@ -556,7 +556,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) hr = HrQueryAllRows(pMsgSvcTable,
(LPSPropTagArray) &sptCols,
&sres,
- NULL,
+ nullptr,
0,
&pRows);
@@ -564,7 +564,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) return hr;
nSize = mir_wstrlen(m_szUsername);
szUniqName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (nSize + 4));
- if (szUniqName != NULL) {
+ if (szUniqName != nullptr) {
memcpy(szUniqName, L"=", sizeof(wchar_t));
memcpy((szUniqName + 1), m_szUsername, (sizeof(wchar_t) * (nSize + 1)));
// Set values for PR_PROFILE_UNRESOLVED_NAME and PR_PROFILE_UNRESOLVED_SERVER
@@ -593,14 +593,14 @@ HRESULT CMirandaExchange::isMapiSessionOK( LPMAPISESSION ) HRESULT CMirandaExchange::CheckForNewMails( int &nNewMails)
{
- if ( m_nNumberOfHeaders>0 && NULL != m_HeadersKeeper )
+ if ( m_nNumberOfHeaders>0 && nullptr != m_HeadersKeeper )
{
for( UINT i=0; i<m_nNumberOfHeaders; i++ )
{
- if ( NULL != m_HeadersKeeper[i])
+ if ( nullptr != m_HeadersKeeper[i])
{
delete m_HeadersKeeper[i];
- m_HeadersKeeper[i] = NULL;
+ m_HeadersKeeper[i] = nullptr;
}
}
@@ -612,14 +612,14 @@ HRESULT CMirandaExchange::CheckForNewMails( int &nNewMails) HRESULT hRes;
try
{
- if ( m_lpMAPISession != NULL && (isMapiSessionOK(m_lpMAPISession)== S_OK) && m_lpInbox != NULL && m_bFolderInboxOK )
+ if ( m_lpMAPISession != nullptr && (isMapiSessionOK(m_lpMAPISession)== S_OK) && m_lpInbox != nullptr && m_bFolderInboxOK )
{
hRes= CheckInFolder( m_lpInbox );
}
else
{
m_bLoginOK = 0;
- hRes = InitializeAndLogin(NULL,NULL,NULL);
+ hRes = InitializeAndLogin(nullptr,nullptr,nullptr);
if (hRes == S_OK)
{
@@ -644,33 +644,33 @@ HRESULT CMirandaExchange::LogOFF() {
try
{
- if (NULL != m_lpInbox)
+ if (nullptr != m_lpInbox)
{
UlRelease(m_lpInbox);
- m_lpInbox = NULL;
+ m_lpInbox = nullptr;
}
- if (NULL != m_lpMDB)
+ if (nullptr != m_lpMDB)
{
UlRelease(m_lpMDB);
- m_lpMDB = NULL;
+ m_lpMDB = nullptr;
}
- if ( NULL!= m_lpMAPISession )
+ if ( nullptr!= m_lpMAPISession )
{
m_lpMAPISession->Logoff( NULL, NULL, NULL );
m_lpMAPISession->Release();
- m_lpMAPISession = NULL;
+ m_lpMAPISession = nullptr;
}
- if ( m_nNumberOfHeaders>0 && NULL != m_HeadersKeeper )
+ if ( m_nNumberOfHeaders>0 && nullptr != m_HeadersKeeper )
{
for( UINT i=0; i<m_nNumberOfHeaders; i++ )
{
- if ( NULL != m_HeadersKeeper[i])
+ if ( nullptr != m_HeadersKeeper[i])
{
delete m_HeadersKeeper[i];
- m_HeadersKeeper[i] = NULL;
+ m_HeadersKeeper[i] = nullptr;
}
}
@@ -687,22 +687,22 @@ HRESULT CMirandaExchange::LogOFF() HRESULT CMirandaExchange::MarkAsRead( LPTSTR szEntryID )
{
- LPMESSAGE lpMessage = NULL ;
- LPBYTE lpData = NULL ;
+ LPMESSAGE lpMessage = nullptr ;
+ LPBYTE lpData = nullptr ;
ULONG ulC = 0 ;
HexToBin(szEntryID, ulC, lpData);
- CallOpenEntry( m_lpMDB, NULL, NULL, m_lpMAPISession, ulC, (LPENTRYID) lpData, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpMessage);
+ CallOpenEntry( m_lpMDB, nullptr, nullptr, m_lpMAPISession, ulC, (LPENTRYID) lpData, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&lpMessage);
delete lpData;
- if ( NULL != lpMessage)
+ if ( nullptr != lpMessage)
{
lpMessage->SetReadFlag( 0 );
lpMessage->SaveChanges(FORCE_SAVE);
lpMessage->Release();
- lpMessage = NULL;
+ lpMessage = nullptr;
}
return 0;
@@ -713,14 +713,14 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) {
HRESULT hr = NOERROR;
CMAPIInterface<LPMAPITABLE> lpTable = NULL;
- LPSRowSet lpRow = NULL;
- LPSPropValue lpRowProp = NULL;
+ LPSRowSet lpRow = nullptr;
+ LPSPropValue lpRowProp = nullptr;
ULONG i = 0L;
- wchar_t* szSenderName = NULL;
- wchar_t* szSubject = NULL;
- LPSTR szEntryID = NULL;
+ wchar_t* szSenderName = nullptr;
+ wchar_t* szSubject = nullptr;
+ LPSTR szEntryID = nullptr;
- if ( lpFolder == NULL || !m_bFolderInboxOK )
+ if ( lpFolder == nullptr || !m_bFolderInboxOK )
return hr;
SizedSPropTagArray(5,sptaDETAILS) =
@@ -743,7 +743,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) return -1;
}
- LPSRowSet lpRowsR = NULL;
+ LPSRowSet lpRowsR = nullptr;
//////////////////////////////////////////////////////////////////////////
SRestriction srRoot;
@@ -771,7 +771,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) szSenderName = lpRowsR->aRow[i].lpProps[2].Value.lpszW;
}
- if ( NULL == szSenderName)
+ if ( nullptr == szSenderName)
{
if ( !FAILED(lpRowsR->aRow[i].lpProps[3].Value.err))
{
@@ -791,9 +791,9 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) delete[] szEntryID;
- szEntryID = NULL;
- szSubject = NULL;
- szSenderName = NULL;
+ szEntryID = nullptr;
+ szSubject = nullptr;
+ szSenderName = nullptr;
}
}
FreeProws(lpRowsR);
@@ -815,12 +815,12 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) hr = MAPICALL( lpFolder)->GetHierarchyTable( MAPI_DEFERRED_ERRORS, &lpTable);
if (!FAILED(hr)) {
- hr = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, NULL, NULL, 0L, &lpRow);
+ hr = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, nullptr, nullptr, 0L, &lpRow);
if (!FAILED(hr)) {
for(i = 0; i < lpRow->cRows; i ++) {
lpRowProp = lpRow->aRow[i].lpProps;
CMAPIInterface<LPMAPIFOLDER> lpSubFolder = NULL;
- hr = CallOpenEntry( m_lpMDB, NULL, NULL, NULL, lpRowProp[IENTRYID].Value.bin.cb, (LPENTRYID)lpRowProp[IENTRYID].Value.bin.lpb, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpSubFolder );
+ hr = CallOpenEntry( m_lpMDB, nullptr, nullptr, nullptr, lpRowProp[IENTRYID].Value.bin.cb, (LPENTRYID)lpRowProp[IENTRYID].Value.bin.lpb, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&lpSubFolder );
if ( !FAILED(hr) )
{
hr = CheckInFolder( lpSubFolder );
@@ -828,7 +828,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) }
}
FreeProws(lpRow);
- lpRow = NULL;
+ lpRow = nullptr;
}
}
}
@@ -853,7 +853,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) &hTheKey) == ERROR_SUCCESS
)
{
- LONG lResult = RegQueryValueEx( hTheKey, NULL, NULL, (LPDWORD)&dwType, (LPBYTE)szRegValue, &dwLength);
+ LONG lResult = RegQueryValueEx( hTheKey, nullptr, nullptr, (LPDWORD)&dwType, (LPBYTE)szRegValue, &dwLength);
RegCloseKey( hTheKey );
if ( lResult != ERROR_SUCCESS )
@@ -865,7 +865,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) wchar_t* szTheEnd = wcsstr( szRegValue,L".EXE" );
- if ( NULL != szTheEnd )
+ if ( nullptr != szTheEnd )
{
szRegValue[ mir_wstrlen(szRegValue) - mir_wstrlen(szTheEnd) +5 ] = '\0';
mir_wstrcat( szRegValue, L" /recycle" );
@@ -878,14 +878,14 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWNORMAL;
- if ( CreateProcess ( NULL,
+ if ( CreateProcess ( nullptr,
szRegValue,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
0,
NORMAL_PRIORITY_CLASS,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&si,
&pi
))
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index 6a4d7cc15e..5bb8fab5e5 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -121,17 +121,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara db_set_ws(NULL, ModuleName, "Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, NULL, FALSE));
+ db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
- db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, NULL, FALSE));
- db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, NULL, FALSE));
+ db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE));
+ db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE));
db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
db_set_b(NULL, ModuleName, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
db_set_b(NULL, ModuleName, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, NULL, FALSE));
+ db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
exchangeServer.Reconnect(); //login info may be changed
UpdateTimers(); //interval might get changed
@@ -148,7 +148,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara 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);
@@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam return TRUE;
case WM_DESTROY:
- hEmailsDlg = NULL;
+ hEmailsDlg = nullptr;
break;
case WM_CLOSE:
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 51fdb00455..840885e687 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -134,7 +134,7 @@ void InitSocketAddr(sockaddr_in *addrServer, char *szServer) hostent *hp;
hp = gethostbyname(szServer);
addrServer->sin_family = AF_INET;
- if (hp == NULL)
+ if (hp == nullptr)
addrServer->sin_addr.s_addr = inet_addr(szServer);
else
memcpy(&(addrServer->sin_addr), hp->h_addr, hp->h_length);
@@ -204,14 +204,14 @@ int CExchangeServer::GetEmailHeader(int iUnreadEmail, TEmailHeader *emailInfo) #ifndef NO_EXCHANGE_TEST
- if (NULL != m_HeadersKeeper[iUnreadEmail]) {
+ if (nullptr != m_HeadersKeeper[iUnreadEmail]) {
wchar_t* szSender = m_HeadersKeeper[iUnreadEmail]->m_szSender;
wchar_t* szSubject = m_HeadersKeeper[iUnreadEmail]->m_szSubject;
- if (NULL == szSender)
+ if (nullptr == szSender)
szSender = L"";
- if (NULL == szSubject)
+ if (nullptr == szSubject)
szSubject = L"";
emailInfo->szSender = szSender;
@@ -317,7 +317,7 @@ int ShowPopupMessage(wchar_t *title, wchar_t *message, int cUnreadEmails) int ShowMessageBoxMessage(wchar_t *title, wchar_t *message, int cUnreadEmails)
{
- if (MessageBox(0, message, title, MB_YESNO) == IDYES)
+ if (MessageBox(nullptr, message, title, MB_YESNO) == IDYES)
ShowEmailsWindow(cUnreadEmails);
return 0;
}
@@ -326,7 +326,7 @@ int ShowEmailsWindow(int cUnreadEmails) {
if (cUnreadEmails > 0) { //show window only if there are unread emails
if (!hEmailsDlg)
- hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails);
+ hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), nullptr, DlgProcEmails);
SetWindowLongPtr(hEmailsDlg, GWLP_USERDATA, cUnreadEmails);
if (IsWindowVisible(hEmailsDlg))
diff --git a/plugins/Exchange/src/exchange.cpp b/plugins/Exchange/src/exchange.cpp index d2597ae298..8805bf42e5 100644 --- a/plugins/Exchange/src/exchange.cpp +++ b/plugins/Exchange/src/exchange.cpp @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char ModuleName[] = "ExchangeNotify";
HINSTANCE hInstance;
-HICON hiMailIcon = NULL;
-HWND hEmailsDlg = NULL;
+HICON hiMailIcon = nullptr;
+HWND hEmailsDlg = nullptr;
int hLangpack=0;
CExchangeServer exchangeServer;
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index 5f1b31b62a..fdb239a046 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -69,7 +69,7 @@ int OnModulesLoaded(WPARAM, LPARAM) mi.name.w = LPGENW("Check exchange mailbox");
Menu_AddMainMenuItem(&mi);
- hEmailsDlg = NULL; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
+ hEmailsDlg = nullptr; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
FirstTimeCheck();
// CheckEmail();
return 0;
@@ -104,7 +104,7 @@ int OnSystemPreShutdown(WPARAM, LPARAM) void FirstTimeCheck()
{
- hFirstCheckTimer = SetTimer(NULL, 0, 5 * 1000, OnFirstCheckTimer);
+ hFirstCheckTimer = SetTimer(nullptr, 0, 5 * 1000, OnFirstCheckTimer);
}
int UpdateTimers()
@@ -113,14 +113,14 @@ int UpdateTimers() int interval;
interval = db_get_dw(NULL, ModuleName, "Interval", DEFAULT_INTERVAL);
interval *= 1000; //go from miliseconds to seconds
- hCheckTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnCheckTimer);
+ hCheckTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnCheckTimer);
int bReconnect = db_get_b(NULL, ModuleName, "Reconnect", 0);
if (bReconnect) //user wants to forcefully reconnect every x minutes
{
interval = db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
interval *= 1000 * 60; //go from miliseconds to seconds to minutes
- hReconnectTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnReconnectTimer);
+ hReconnectTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnReconnectTimer);
}
return 0;
@@ -130,12 +130,12 @@ int KillTimers() {
if (hCheckTimer)
{
- KillTimer(NULL, hCheckTimer);
+ KillTimer(nullptr, hCheckTimer);
hCheckTimer = NULL;
}
if (hReconnectTimer)
{
- KillTimer(NULL, hReconnectTimer);
+ KillTimer(nullptr, hReconnectTimer);
hReconnectTimer = NULL;
}
return 0;
@@ -168,7 +168,7 @@ VOID CALLBACK OnReconnectTimer(HWND, UINT, UINT_PTR, DWORD) VOID CALLBACK OnFirstCheckTimer(HWND hWnd, UINT msg, UINT_PTR idEvent, DWORD dwTime)
{
- KillTimer(NULL, hFirstCheckTimer);
+ KillTimer(nullptr, hFirstCheckTimer);
OnCheckTimer(hWnd, msg, idEvent, dwTime);
hFirstCheckTimer = NULL;
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 97fc4cca13..6f9fd24ae9 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -77,14 +77,14 @@ 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);
}
#define HEX_SIZE 8
char *BinToHex(int size, PBYTE data)
{
- char *szresult = NULL;
+ char *szresult = nullptr;
int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[maxSize];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
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;
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 9c6b49543e..d6039f3782 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -30,13 +30,13 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) if (dbei.eventType != EVENTTYPE_MESSAGE)
return 0;
- float weight = GetEventWeight(time(NULL) - dbei.timestamp);
- float q = GetTimeWeight(time(NULL) - m_lastUpdate);
- m_lastUpdate = time(NULL);
+ float weight = GetEventWeight(time(nullptr) - dbei.timestamp);
+ float q = GetTimeWeight(time(nullptr) - m_lastUpdate);
+ m_lastUpdate = time(nullptr);
if (!weight)
return 0;
- TContactInfo *pFound = NULL;
+ TContactInfo *pFound = nullptr;
mir_cslock lck(m_cs);
for (int i = m_cache.getCount()-1; i >= 0; i--) {
TContactInfo *p = m_cache[i];
@@ -77,8 +77,8 @@ float CContactCache::GetTimeWeight(unsigned long age) void CContactCache::Rebuild()
{
- unsigned long timestamp = time(NULL);
- m_lastUpdate = time(NULL);
+ unsigned long timestamp = time(nullptr);
+ m_lastUpdate = time(nullptr);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
TContactInfo *info = new TContactInfo;
@@ -150,7 +150,7 @@ void CContactCache::TContactInfo::LoadInfo() wchar_t *nb_stristr(wchar_t *str, wchar_t *substr)
{
if (!substr || !*substr) return str;
- if (!str || !*str) return NULL;
+ if (!str || !*str) return nullptr;
wchar_t *str_up = NEWWSTR_ALLOCA(str);
wchar_t *substr_up = NEWWSTR_ALLOCA(substr);
@@ -159,7 +159,7 @@ wchar_t *nb_stristr(wchar_t *str, wchar_t *substr) CharUpperBuff(substr_up, (DWORD)mir_wstrlen(substr_up));
wchar_t *p = wcsstr(str_up, substr_up);
- return p ? (str + (p - str_up)) : NULL;
+ return p ? (str + (p - str_up)) : nullptr;
}
bool CContactCache::filter(int rate, wchar_t *str)
diff --git a/plugins/FavContacts/src/cserver.cpp b/plugins/FavContacts/src/cserver.cpp index 18739f8e34..42f35cd687 100644 --- a/plugins/FavContacts/src/cserver.cpp +++ b/plugins/FavContacts/src/cserver.cpp @@ -37,7 +37,7 @@ void CServer::Stop() DWORD CServer::ConnectionAcceptThread()
{
while (1) {
- SOCKET s = accept(m_socket, NULL, NULL);
+ SOCKET s = accept(m_socket, nullptr, nullptr);
if (s == INVALID_SOCKET) break;
mir_forkthread(GlobalConnectionProcessThread, new GlobalConnectionProcessThreadArgs(this, s));
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 22fa356b6c..04d429a82b 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -48,7 +48,7 @@ IconItem iconList[] = { LPGEN("Regular Contact"), "favcontacts_regular", IDI_REGULAR },
};
-CContactCache *g_contactCache = NULL;
+CContactCache *g_contactCache = nullptr;
Options g_Options = { 0 };
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 176f645120..f0c8e1072e 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -25,7 +25,7 @@ float g_widthMultiplier = 0; wchar_t g_filter[1024] = { 0 };
-HWND g_hwndMenuHost = NULL;
+HWND g_hwndMenuHost = nullptr;
static wchar_t* sttGetGroupName(int id)
{
@@ -35,7 +35,7 @@ static wchar_t* sttGetGroupName(int id) return TranslateT("Favorite Contacts");
}
- return Clist_GroupGetName(id - 1, NULL);
+ return Clist_GroupGetName(id - 1, nullptr);
}
static BOOL sttMeasureItem_Group(LPMEASUREITEMSTRUCT lpmis, Options *options)
@@ -72,7 +72,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) if (options->bSecondLine) {
bool bFree = false;
wchar_t *title = db_get_wsa(hContact, "CList", "StatusMsg");
- if (title == NULL) {
+ if (title == nullptr) {
char *proto = GetContactProto(hContact);
int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
title = pcli->pfnGetStatusModeDescription(status, 0);
@@ -137,7 +137,7 @@ BOOL MenuMeasureItem(LPMEASUREITEMSTRUCT lpmis, Options *options) return FALSE;
}
-static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = NULL)
+static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = nullptr)
{
lpdis->rcItem.top++;
lpdis->rcItem.bottom--;
@@ -183,7 +183,7 @@ void ImageList_DrawDimmed(HIMAGELIST himl, int i, HDC hdc, int left, int top, UI DeleteDC(dcMem);
}
-static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL)
+static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = nullptr)
{
MCONTACT hContact = (MCONTACT)lpdis->itemData;
@@ -259,7 +259,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (options->wMaxRecent && db_get_b(hContact, "FavContacts", "IsFavourite", 0)) {
DrawIconEx(hdcTemp, lpdis->rcItem.right - 18, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2,
- IcoLib_GetIconByHandle(iconList[0].hIcolib), 16, 16, 0, NULL, DI_NORMAL);
+ IcoLib_GetIconByHandle(iconList[0].hIcolib), 16, 16, 0, nullptr, DI_NORMAL);
lpdis->rcItem.right -= 20;
}
@@ -316,7 +316,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (options->bSecondLine) {
bool bFree = false;
wchar_t *title = db_get_wsa(hContact, "CList", "StatusMsg");
- if (title == NULL) {
+ if (title == nullptr) {
int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
title = pcli->pfnGetStatusModeDescription(status, 0);
}
@@ -428,7 +428,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, GetCursorPos(&pt);
HWND hwndSave = GetForegroundWindow();
SetForegroundWindow(g_hwndMenuHost);
- int res = TrackPopupMenu(hMenu, TPM_RECURSE | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, NULL);
+ int res = TrackPopupMenu(hMenu, TPM_RECURSE | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, nullptr);
SetForegroundWindow(hwndSave);
DestroyMenu(hMenu);
@@ -444,7 +444,7 @@ int ShowMenu(bool centered) HMENU hMenu = CreatePopupMenu();
SIZE szMenu = { 0 };
SIZE szColumn = { 0 };
- wchar_t *prevGroup = NULL;
+ wchar_t *prevGroup = nullptr;
int idItem = 100;
MCONTACT hContact;
@@ -457,7 +457,7 @@ int ShowMenu(bool centered) if (g_Options.bUseColumns)
g_maxItemWidth /= favList.groupCount();
- prevGroup = NULL;
+ prevGroup = nullptr;
for (int i = 0; i < favList.getCount(); ++i) {
hContact = favList[i]->getHandle();
@@ -517,7 +517,7 @@ int ShowMenu(bool centered) hContact = NULL;
g_filter[0] = 0;
- if (int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, NULL)) {
+ if (int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, nullptr)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
@@ -538,13 +538,13 @@ void InitMenu() WNDCLASSEX wcl = { sizeof(wcl) };
wcl.lpfnWndProc = MenuHostWndProc;
wcl.hInstance = g_hInst;
- wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcl.lpszClassName = L"FavContactsMenuHostWnd";
RegisterClassEx(&wcl);
- g_hwndMenuHost = CreateWindow(L"FavContactsMenuHostWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInst, NULL);
- SetWindowPos(g_hwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
+ g_hwndMenuHost = CreateWindow(L"FavContactsMenuHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr);
+ SetWindowPos(g_hwndMenuHost, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
}
void UninitMenu()
diff --git a/plugins/FavContacts/src/options.cpp b/plugins/FavContacts/src/options.cpp index e479ee58ce..5a5ce392b7 100644 --- a/plugins/FavContacts/src/options.cpp +++ b/plugins/FavContacts/src/options.cpp @@ -133,8 +133,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA options.bCenterHotkey = IsDlgButtonChecked(hwnd, IDC_CHK_CENTERHOTKEY);
options.bRightAvatars = IsDlgButtonChecked(hwnd, IDC_CHK_RIGHTAVATARS);
options.bDimIdle = IsDlgButtonChecked(hwnd, IDC_CHK_DIMIDLE);
- options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, NULL, FALSE);
- options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, NULL, FALSE);
+ options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, nullptr, FALSE);
+ options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, nullptr, FALSE);
mis.CtlID = 0;
mis.CtlType = ODT_MENU;
@@ -168,7 +168,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case IDC_CHK_GROUPCOLUMS:
case IDC_CHK_RIGHTAVATARS:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), nullptr, nullptr, RDW_INVALIDATE);
PostMessage(hwnd, WM_APP, 0, 0);
break;
@@ -178,7 +178,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case IDC_TXT_RADIUS:
if ((HIWORD(wParam) == EN_CHANGE) && bInitialized) {
- RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), nullptr, nullptr, RDW_INVALIDATE);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
break;
@@ -202,8 +202,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA g_Options.bUseColumns = IsDlgButtonChecked(hwnd, IDC_CHK_GROUPCOLUMS);
g_Options.bRightAvatars = IsDlgButtonChecked(hwnd, IDC_CHK_RIGHTAVATARS);
g_Options.bDimIdle = IsDlgButtonChecked(hwnd, IDC_CHK_DIMIDLE);
- g_Options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, NULL, FALSE);
- g_Options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, NULL, FALSE);
+ g_Options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, nullptr, FALSE);
+ g_Options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, nullptr, FALSE);
sttSaveOptions();
@@ -239,7 +239,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, hContact, 0) == iSelection) {
hSelectedContact = hContact;
- RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), nullptr, nullptr, RDW_INVALIDATE);
}
}
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index d562f5e187..c348de82ce 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -62,11 +62,11 @@ int ProcessSrmmEvent(WPARAM, LPARAM lParam) while (HWND hwndParent = GetParent(hwndRoot))
hwndRoot = hwndParent;
- AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), TRUE);
+ AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), nullptr), GetCurrentThreadId(), TRUE);
SetForegroundWindow(hwndRoot);
SetActiveWindow(hwndRoot);
SetFocus(hwndRoot);
- AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), FALSE);
+ AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), nullptr), GetCurrentThreadId(), FALSE);
}
hContactToActivate = NULL;
@@ -112,7 +112,7 @@ static __forceinline COLORREF sttShadeColor(COLORREF clLine1, COLORREF clBack) int ProcessTBLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.pszTooltipUp = ttb.name = LPGEN("Favorite Contacts");
ttb.pszService = MS_FAVCONTACTS_SHOWMENU;
ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index dfb4a1c644..36fbd38780 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -147,7 +147,7 @@ FILEECHO::FILEECHO(MCONTACT Contact) chunkMaxLen = db_get_dw(NULL, SERVICE_NAME, "ChunkSize", 5000);
chunkCount = 0;
- filename = NULL;
+ filename = nullptr;
rgbRecv = db_get_dw(NULL, SERVICE_NAME, "colorRecv", RGB(64, 255, 64));
rgbSent = db_get_dw(NULL, SERVICE_NAME, "colorSent", RGB(255, 255, 64));
@@ -260,38 +260,38 @@ int FILEECHO::createTransfer() {
uint LastError;
hFile = INVALID_HANDLE_VALUE;
- hMapping = NULL;
- lpData = NULL;
+ hMapping = nullptr;
+ lpData = nullptr;
#ifdef DEBUG
overhead = 0;
#endif
BYTE bAuto = db_get_b(NULL, "SRFile", "AutoAccept", 0);
- hFile = CreateFile(filename, inSend ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE), inSend ? FILE_SHARE_READ : 0, NULL, inSend ? OPEN_EXISTING : (bAuto ? CREATE_ALWAYS : CREATE_NEW), FILE_ATTRIBUTE_NORMAL, NULL);
+ hFile = CreateFile(filename, inSend ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE), inSend ? FILE_SHARE_READ : 0, nullptr, inSend ? OPEN_EXISTING : (bAuto ? CREATE_ALWAYS : CREATE_NEW), FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE && !inSend && GetLastError() == ERROR_FILE_EXISTS)
{
if (MessageBox(hDlg, Translate("File already exists. Overwrite?"),
Translate(SERVICE_TITLE),
MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) != IDYES) return 0;
hFile = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0,
- NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
}
if (hFile == INVALID_HANDLE_VALUE) goto createTransfer_FAILED;
if (!inSend)
{
- SetFilePointer(hFile, fileSize, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, fileSize, nullptr, FILE_BEGIN);
SetEndOfFile(hFile);
}
else
- fileSize = GetFileSize(hFile, NULL);
- hMapping = CreateFileMapping(hFile, NULL, inSend ? PAGE_READONLY : PAGE_READWRITE,
- 0, fileSize, NULL);
+ fileSize = GetFileSize(hFile, nullptr);
+ hMapping = CreateFileMapping(hFile, nullptr, inSend ? PAGE_READONLY : PAGE_READWRITE,
+ 0, fileSize, nullptr);
LastError = GetLastError();
- if (hMapping == NULL) goto createTransfer_FAILED;
+ if (hMapping == nullptr) goto createTransfer_FAILED;
lpData = (uchar*)MapViewOfFile(hMapping, inSend ? FILE_MAP_READ : FILE_MAP_WRITE, 0, 0, 0);
LastError = GetLastError();
- if (lpData == NULL) goto createTransfer_FAILED;
+ if (lpData == nullptr) goto createTransfer_FAILED;
if (inSend)
//
@@ -374,8 +374,8 @@ int FILEECHO::createTransfer() return 1;
createTransfer_FAILED:
- if (lpData != NULL) UnmapViewOfFile(lpData);
- if (hMapping != NULL) CloseHandle(hMapping);
+ if (lpData != nullptr) UnmapViewOfFile(lpData);
+ if (hMapping != nullptr) CloseHandle(hMapping);
if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);
return 0;
}
@@ -388,8 +388,8 @@ void FILEECHO::destroyTransfer() if (inSend)
free(chunkPos);
free(chunkAck);
- if (lpData != NULL) UnmapViewOfFile(lpData);
- if (hMapping != NULL) CloseHandle(hMapping);
+ if (lpData != nullptr) UnmapViewOfFile(lpData);
+ if (hMapping != nullptr) CloseHandle(hMapping);
if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);
}
//setState(STATE_IDLE);
@@ -427,7 +427,7 @@ void FILEECHO::incomeRequest(char *param) char buf[MAX_PATH];
// param == &filename
char *p = strchr(param, '?');
- if (p == NULL) return; *p++ = 0;
+ if (p == nullptr) return; *p++ = 0;
CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf);
mir_strncat(buf, param, _countof(buf) - mir_strlen(buf));
free(filename);
@@ -438,7 +438,7 @@ void FILEECHO::incomeRequest(char *param) // p == &COUNT
if (*p == 0) return; param = strchr(p, ':');
// param == &SIZE
- if (param == NULL) return; *param++ = 0;
+ if (param == nullptr) return; *param++ = 0;
if (*param == 0) return;
chunkCountx = atoi(p);
fileSize = atoi(param);
@@ -483,12 +483,12 @@ void FILEECHO::cmdACCEPT() lastTimestamp = GetTickCount();
//PostMessage(hDlg, WM_TIMER, 0,0);
//onSendTimer();
- SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
+ SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr);
}
void FILEECHO::updateProgress()
{
- InvalidateRect(GetDlgItem(hDlg, IDC_PROGRESS), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_PROGRESS), nullptr, TRUE);
updateTitle();
}
//
@@ -576,7 +576,7 @@ void FILEECHO::onSendTimer() {
SetDlgItemText(hDlg, IDC_STATUS, Translate("Requesting of missing chunks"));
setState(STATE_OPERATE);
- sendCmd(0, CMD_END, "", NULL);
+ sendCmd(0, CMD_END, "", nullptr);
chunkIndx = chunkCount + 1;
return;
}
@@ -634,7 +634,7 @@ void FILEECHO::onSendTimer() SetDlgItemText(hDlg, IDC_STATUS, Translate("Sending..."));
updateProgress();
}
- SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
+ SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr);
}
void FILEECHO::cmdDATA(char *param)
{
@@ -703,7 +703,7 @@ cmdDATA_corrupted: }
void FILEECHO::cmdEND()
{
- SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
+ SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr);
}
void FILEECHO::cmdDACK(char *param)
{
@@ -761,7 +761,7 @@ void FILEECHO::cmdDACK(char *param) // retransfer some parts
//
chunkIndx = 0;
- SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
+ SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr);
}
void FILEECHO::perform(char *str)
@@ -845,11 +845,11 @@ void FILEECHO::perform(char *str) int FILEECHO::sendCmd(int, int cmd, char *szParam, char *szPrefix)
{
int buflen = (int)mir_strlen(szServicePrefix) + (int)mir_strlen(szParam) + 2;
- if (szPrefix != NULL)
+ if (szPrefix != nullptr)
buflen += (int)mir_strlen(szPrefix);
char *buf = (char*)malloc(buflen);
- if (szPrefix == NULL)
+ if (szPrefix == nullptr)
mir_snprintf(buf, buflen, "%s%c%s", szServicePrefix, cCmdList[cmd], szParam);
else
mir_snprintf(buf, buflen, "%s%c%s%s", szServicePrefix, cCmdList[cmd], szPrefix, szParam);
@@ -870,13 +870,13 @@ void CreateDirectoryTree(char *szDir) if ((dwAttributes = GetFileAttributes(szTestDir)) != 0xffffffff && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return;
pszLastBackslash = strrchr(szTestDir, '\\');
- if (pszLastBackslash == NULL) {
+ if (pszLastBackslash == nullptr) {
GetCurrentDirectory(MAX_PATH, szDir);
return;
}
*pszLastBackslash = 0;
CreateDirectoryTree(szTestDir);
- CreateDirectory(szTestDir, NULL);
+ CreateDirectory(szTestDir, nullptr);
}
LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -898,12 +898,12 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa //if(dat == NULL)
// return CallSubclassed(hwnd, uMsg, wParam, lParam);
GetClientRect(hwnd, &rc);
- if (dat == NULL || dat->chunkCount == 0)
+ if (dat == nullptr || dat->chunkCount == 0)
{
COLORREF colour;
HBRUSH hbr;
- if (dat == NULL || dat->iState != STATE_FINISHED)
+ if (dat == nullptr || dat->iState != STATE_FINISHED)
{
hbr = (HBRUSH)(COLOR_3DFACE + 1);
}
@@ -980,7 +980,7 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
struct FILEECHO *dat = (struct FILEECHO*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- HWND hwndStatus = NULL;
+ HWND hwndStatus = nullptr;
switch (uMsg)
{
case WM_INITDIALOG:
@@ -1171,7 +1171,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (dat->iState == STATE_PRERECV)
{
SetDlgItemText(hDlg, IDC_STATUS, Translate("Canceled by user"));
- dat->sendCmd(0, CMD_CANCEL, "", NULL);
+ dat->sendCmd(0, CMD_CANCEL, "", nullptr);
dat->setState(STATE_CANCELLED);
}
if (dat->chunkCount)
@@ -1181,7 +1181,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
SetDlgItemText(hDlg, IDC_STATUS, Translate("Canceled by user"));
dat->setState(STATE_CANCELLED);
- dat->sendCmd(0, CMD_CANCEL, "", NULL);
+ dat->sendCmd(0, CMD_CANCEL, "", nullptr);
dat->destroyTransfer();
if (wParam == IDCANCEL)
DestroyWindow(hDlg);
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 15c53a7c35..594e95e395 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -102,11 +102,11 @@ INT_PTR OnSendFile(WPARAM wParam, LPARAM) }
else
{
- if (hwnd != 0) WindowList_Remove(hFileList, hwnd);
+ if (hwnd != nullptr) WindowList_Remove(hFileList, hwnd);
FILEECHO *fe = new FILEECHO(wParam);
fe->inSend = TRUE;
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe);
- if (hwnd == NULL)
+ hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, DialogProc, (LPARAM)fe);
+ if (hwnd == nullptr)
{
delete fe;
return 0;
@@ -128,11 +128,11 @@ INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam) HWND hwnd = WindowList_Find(hFileList, ccs->hContact);
if (!IsWindow(hwnd))
{
- if (hwnd != 0) WindowList_Remove(hFileList, hwnd);
+ if (hwnd != nullptr) WindowList_Remove(hFileList, hwnd);
FILEECHO *fe = new FILEECHO(ccs->hContact);
fe->inSend = FALSE;
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe);
- if (hwnd == NULL)
+ hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, DialogProc, (LPARAM)fe);
+ if (hwnd == nullptr)
{
delete fe;
return 0;
@@ -212,7 +212,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_OPT_INITIALISE, OnOptInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
hHookDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
- hHookSkinIconsChanged = NULL;
+ hHookSkinIconsChanged = nullptr;
return 0;
}
@@ -224,7 +224,7 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
WindowList_Destroy(hFileList);
- if (hHookSkinIconsChanged != NULL)
+ if (hHookSkinIconsChanged != nullptr)
UnhookEvent(hHookSkinIconsChanged);
UnhookEvent(hHookDbSettingChange);
UnhookEvent(hHookContactAdded);
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 1858cde76c..ea594073de 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static UINT g_LPCodePage; static wchar_t g_szSkinLib[MAX_PATH]; -static HANDLE hExtraIcon = NULL; -static HANDLE hFolderChanged = NULL, hIconFolder = NULL; +static HANDLE hExtraIcon = nullptr; +static HANDLE hFolderChanged = nullptr, hIconFolder = nullptr; -static FOUNDINFO* fiList = NULL; +static FOUNDINFO* fiList = nullptr; static int nFICount = 0; static LIST<void> arMonitoredWindows(3, PtrKeySortT); @@ -43,16 +43,16 @@ static wchar_t* getSectionName(int flag) { #include "finger_groups.h" } - return NULL; + return nullptr; } void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) { - mask->szMaskUpper = NULL; + mask->szMaskUpper = nullptr; if (mask->hIcolibItem) IcoLib_RemoveIcon(mask->szIconName); - mask->hIcolibItem = NULL; + mask->hIcolibItem = nullptr; if (!mask->szMask || !bEnable) return; @@ -75,10 +75,10 @@ void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) } LPTSTR SectName = getSectionName(mask->iSectionFlag); - if (SectName == NULL) + if (SectName == nullptr) return; - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE; sid.section.w = SectName; sid.pszName = mask->szIconName; @@ -204,7 +204,7 @@ int OnExtraIconClick(WPARAM wParam, LPARAM, LPARAM) */ BOOL __fastcall WildCompareW(LPWSTR wszName, LPWSTR wszMask) { - if (wszMask == NULL) + if (wszMask == nullptr) return NULL; if (*wszMask != L'|') @@ -243,7 +243,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (i = 0; i < DEFAULT_KN_FP_MASK_COUNT; i++) { KN_FP_MASK& p = def_kn_fp_mask[i]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (!WildCompareW(szMirVer, p.szMaskUpper)) @@ -265,7 +265,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov else if (!def_kn_fp_mask[i].fNotUseOverlay && i < DEFAULT_KN_FP_MASK_COUNT) { for (j = 0; j < DEFAULT_KN_FP_OVERLAYS_COUNT; j++) { KN_FP_MASK& p = def_kn_fp_overlays_mask[j]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (!WildCompare(szMirVer, p.szMaskUpper)) @@ -278,7 +278,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (k = 0; k < DEFAULT_KN_FP_OVERLAYS2_COUNT; k++) { KN_FP_MASK& p = def_kn_fp_overlays2_mask[k]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (WildCompareW(szMirVer, p.szMaskUpper)) @@ -287,7 +287,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (n = 0; n < DEFAULT_KN_FP_OVERLAYS3_COUNT; n++) { KN_FP_MASK& p = def_kn_fp_overlays3_mask[n]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (WildCompareW(szMirVer, p.szMaskUpper)) @@ -296,7 +296,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (m = 0; m < DEFAULT_KN_FP_OVERLAYS4_COUNT; m++) { KN_FP_MASK& p = def_kn_fp_overlays4_mask[m]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (WildCompareW(szMirVer, p.szMaskUpper)) @@ -360,26 +360,26 @@ void __fastcall GetIconsIndexesW(LPWSTR wszMirVer, short *base, short *overlay, HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2, short overlay3, short overlay4) { - HICON hIcon = NULL; // returned HICON - HICON hTmp = NULL; - HICON icMain = NULL; - HICON icOverlay = NULL; - HICON icOverlay2 = NULL; - HICON icOverlay3 = NULL; - HICON icOverlay4 = NULL; + HICON hIcon = nullptr; // returned HICON + HICON hTmp = nullptr; + HICON icMain = nullptr; + HICON icOverlay = nullptr; + HICON icOverlay2 = nullptr; + HICON icOverlay3 = nullptr; + HICON icOverlay4 = nullptr; KN_FP_MASK* mainMask = &(def_kn_fp_mask[base]); icMain = IcoLib_GetIconByHandle(mainMask->hIcolibItem); if (icMain) { - KN_FP_MASK* overlayMask = (overlay != -1) ? &(def_kn_fp_overlays_mask[overlay]) : NULL; - KN_FP_MASK* overlay2Mask = (overlay2 != -1) ? &(def_kn_fp_overlays2_mask[overlay2]) : NULL; - KN_FP_MASK* overlay3Mask = (overlay3 != -1) ? &(def_kn_fp_overlays3_mask[overlay3]) : NULL; - KN_FP_MASK* overlay4Mask = (overlay4 != -1) ? &(def_kn_fp_overlays4_mask[overlay4]) : NULL; - icOverlay = (overlayMask == NULL) ? NULL : IcoLib_GetIconByHandle(overlayMask->hIcolibItem); - icOverlay2 = (overlay2Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay2Mask->hIcolibItem); - icOverlay3 = (overlay3Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay3Mask->hIcolibItem); - icOverlay4 = (overlay4Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay4Mask->hIcolibItem); + KN_FP_MASK* overlayMask = (overlay != -1) ? &(def_kn_fp_overlays_mask[overlay]) : nullptr; + KN_FP_MASK* overlay2Mask = (overlay2 != -1) ? &(def_kn_fp_overlays2_mask[overlay2]) : nullptr; + KN_FP_MASK* overlay3Mask = (overlay3 != -1) ? &(def_kn_fp_overlays3_mask[overlay3]) : nullptr; + KN_FP_MASK* overlay4Mask = (overlay4 != -1) ? &(def_kn_fp_overlays4_mask[overlay4]) : nullptr; + icOverlay = (overlayMask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlayMask->hIcolibItem); + icOverlay2 = (overlay2Mask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlay2Mask->hIcolibItem); + icOverlay3 = (overlay3Mask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlay3Mask->hIcolibItem); + icOverlay4 = (overlay4Mask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlay4Mask->hIcolibItem); hIcon = icMain; @@ -425,7 +425,7 @@ HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2 HBITMAP __inline CreateBitmap32(int cx, int cy) { - return CreateBitmap32Point(cx, cy, NULL); + return CreateBitmap32Point(cx, cy, nullptr); } /* @@ -434,9 +434,9 @@ HBITMAP __inline CreateBitmap32(int cx, int cy) */ HBITMAP __fastcall CreateBitmap32Point(int cx, int cy, LPVOID* bits) { - LPVOID ptPixels = NULL; + LPVOID ptPixels = nullptr; - if (cx < 0 || cy < 0) return NULL; + if (cx < 0 || cy < 0) return nullptr; BITMAPINFO bmpi = { 0 }; bmpi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -444,11 +444,11 @@ HBITMAP __fastcall CreateBitmap32Point(int cx, int cy, LPVOID* bits) bmpi.bmiHeader.biHeight = cy; bmpi.bmiHeader.biPlanes = 1; bmpi.bmiHeader.biBitCount = 32; - HBITMAP DirectBitmap = CreateDIBSection(NULL, &bmpi, DIB_RGB_COLORS, &ptPixels, NULL, 0); + HBITMAP DirectBitmap = CreateDIBSection(nullptr, &bmpi, DIB_RGB_COLORS, &ptPixels, nullptr, 0); GdiFlush(); if (ptPixels) memset(ptPixels, 0, cx * cy * 4); - if (bits != NULL) *bits = ptPixels; + if (bits != nullptr) *bits = ptPixels; return DirectBitmap; } @@ -530,14 +530,14 @@ HICON __fastcall CreateJoinedIcon(HICON hBottom, HICON hTop) { BOOL drawn = FALSE; HDC tempDC, tempDC2, tempDC3; - HICON res = NULL; + HICON res = nullptr; HBITMAP oImage, nImage; HBITMAP nMask, hbm, obmp, obmp2; - LPBYTE ptPixels = NULL; + LPBYTE ptPixels = nullptr; ICONINFO iNew = { 0 }; BYTE p[32] = { 0 }; - tempDC = CreateCompatibleDC(NULL); + tempDC = CreateCompatibleDC(nullptr); nImage = CreateBitmap32Point(16, 16, (LPVOID*)&ptPixels); oImage = (HBITMAP)SelectObject(tempDC, nImage); @@ -658,18 +658,18 @@ HICON __fastcall CreateJoinedIcon(HICON hBottom, HICON hTop) DeleteObject(iciTop.hbmMask); if (!drawn) { - DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, NULL, DI_NORMAL); - DrawIconEx(tempDC, 0, 0, hTop, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, nullptr, DI_NORMAL); + DrawIconEx(tempDC, 0, 0, hTop, 16, 16, 0, nullptr, DI_NORMAL); } nMask = CreateBitmap(16, 16, 1, 1, p); - tempDC2 = CreateCompatibleDC(NULL); - tempDC3 = CreateCompatibleDC(NULL); + tempDC2 = CreateCompatibleDC(nullptr); + tempDC3 = CreateCompatibleDC(nullptr); hbm = CreateCompatibleBitmap(tempDC3, 16, 16); obmp = (HBITMAP)SelectObject(tempDC2, nMask); obmp2 = (HBITMAP)SelectObject(tempDC3, hbm); - DrawIconEx(tempDC2, 0, 0, hBottom, 16, 16, 0, NULL, DI_MASK); - DrawIconEx(tempDC3, 0, 0, hTop, 16, 16, 0, NULL, DI_MASK); + DrawIconEx(tempDC2, 0, 0, hBottom, 16, 16, 0, nullptr, DI_MASK); + DrawIconEx(tempDC3, 0, 0, hTop, 16, 16, 0, nullptr, DI_MASK); BitBlt(tempDC2, 0, 0, 16, 16, tempDC3, 0, 0, SRCAND); GdiFlush(); @@ -721,7 +721,7 @@ HANDLE __fastcall GetIconIndexFromFI(LPTSTR szMirVer) fiList = (FOUNDINFO*)mir_realloc(fiList, sizeof(FOUNDINFO) * (nFICount + 1)); fiList[nFICount].dwArray = val; - if (hIcon != NULL) { + if (hIcon != nullptr) { hFoundImage = ExtraIcon_AddIcon(hIcon); fiList[nFICount].hRegisteredImage = hFoundImage; DestroyIcon(hIcon); @@ -736,9 +736,9 @@ HANDLE __fastcall GetIconIndexFromFI(LPTSTR szMirVer) VOID ClearFI() { - if (fiList != NULL) + if (fiList != nullptr) mir_free(fiList); - fiList = NULL; + fiList = nullptr; nFICount = 0; } @@ -753,13 +753,13 @@ VOID ClearFI() static INT_PTR ServiceGetClientIconW(WPARAM wParam, LPARAM) { LPWSTR wszMirVer = (LPWSTR)wParam; // MirVer value to get client for. - if (wszMirVer == NULL) + if (wszMirVer == nullptr) return 0; short base, overlay, overlay2, overlay3, overlay4; GetIconsIndexesW(wszMirVer, &base, &overlay, &overlay2, &overlay3, &overlay4); - HICON hIcon = NULL; // returned HICON + HICON hIcon = nullptr; // returned HICON if (base != -1) hIcon = CreateIconFromIndexes(base, overlay, overlay2, overlay3, overlay4); @@ -777,7 +777,7 @@ static INT_PTR ServiceGetClientIconW(WPARAM wParam, LPARAM) static INT_PTR ServiceGetClientDescrW(WPARAM wParam, LPARAM) { LPWSTR wszMirVer = (LPWSTR)wParam; // MirVer value to get client for. - if (wszMirVer == NULL) + if (wszMirVer == nullptr) return 0; LPWSTR wszMirVerUp = NEWWSTR_ALLOCA(wszMirVer); _wcsupr(wszMirVerUp); @@ -842,7 +842,7 @@ int OnExtraImageApply(WPARAM hContact, LPARAM) ptrW tszMirver; char *szProto = GetContactProto(hContact); - if (szProto != NULL) + if (szProto != nullptr) tszMirver = db_get_wsa(hContact, szProto, "MirVer"); ApplyFingerprintImage(hContact, tszMirver); @@ -872,7 +872,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) ApplyFingerprintImage(hContact, cws->value.pwszVal); break; default: - ApplyFingerprintImage(hContact, NULL); + ApplyFingerprintImage(hContact, nullptr); } } return 0; @@ -889,13 +889,13 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) return 0; MessageWindowEventData *event = (MessageWindowEventData *)lParam; - if (event == NULL) + if (event == nullptr) return 0; if (event->uType == MSG_WINDOW_EVT_OPEN) { ptrW ptszMirVer; char *szProto = GetContactProto(event->hContact); - if (szProto != NULL) + if (szProto != nullptr) ptszMirVer = db_get_wsa(event->hContact, szProto, "MirVer"); SetSrmmIcon(event->hContact, ptszMirVer); arMonitoredWindows.insert((HANDLE)event->hContact); diff --git a/plugins/FingerprintNG/src/main.cpp b/plugins/FingerprintNG/src/main.cpp index 51e0ad163f..a60f815de1 100644 --- a/plugins/FingerprintNG/src/main.cpp +++ b/plugins/FingerprintNG/src/main.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE g_hInst;
int hLangpack;
-HANDLE hHeap = NULL;
+HANDLE hHeap = nullptr;
//End of header
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index 577bd7ecc7..f49cc3d69c 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -36,30 +36,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(const char *fn, const char *fnAlpha)
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
loadFromFile(fn, fnAlpha);
}
@@ -174,7 +174,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) }
delete[] bitsSave;
- bitsSave = 0;
+ bitsSave = nullptr;
}
void MyBitmap::DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h)
@@ -686,7 +686,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) }
else {
this->saveAlpha(x, y, w, h);
- DrawIconEx(this->getDC(), x, y, hic, w, h, 0, NULL, DI_NORMAL);
+ DrawIconEx(this->getDC(), x, y, hic, w, h, 0, nullptr, DI_NORMAL);
this->restoreAlpha(x, y, w, h);
}
@@ -726,7 +726,7 @@ void MyBitmap::DrawText(wchar_t *str, int x, int y, int blur, int strength) RECT rc; SetRect(&rc, 0, 0, sz.cx, sz.cy);
SetTextColor(tmp.getDC(), RGB(255, 255, 255));
SetBkColor(tmp.getDC(), RGB(0, 0, 0));
- ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, NULL);
+ ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
::DrawText(tmp.getDC(), str, -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
SelectObject(tmp.getDC(), hfnTmp);
@@ -872,7 +872,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque) }
- HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
+ HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
delete[] pRgnData;
return hRgn;
}
@@ -940,9 +940,9 @@ bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha) return false;
BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm);
- SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, NULL);
+ SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr);
- HDC dcTmp = CreateCompatibleDC(0);
+ HDC dcTmp = CreateCompatibleDC(nullptr);
GetBitmapDimensionEx(hBmpLoaded, &sz);
HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded);
@@ -997,8 +997,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);
GdiFlush();
@@ -1011,9 +1011,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/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index 2b3fffc4a6..e9f3c97618 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -12,7 +12,7 @@ HRESULT STDMETHODCALLTYPE CDropTarget::QueryInterface(REFIID riid, LPVOID *ppvOb return S_OK;
}
- *ppvObj = NULL;
+ *ppvObj = nullptr;
return (E_NOINTERFACE);
}
@@ -33,7 +33,7 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD, POINTL, DWORD *pdwEffect) {
*pdwEffect = 0;
- if (hwndCurDrag == NULL) {
+ if (hwndCurDrag == nullptr) {
*pdwEffect = DROPEFFECT_NONE;
}
else {
@@ -44,8 +44,8 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD, POINTL, DWORD *pdwEffect) HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter(IDataObject *pData, DWORD fKeyState, POINTL pt, DWORD *pdwEffect)
{
- FORMATETC feFile = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
- FORMATETC feText = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC feFile = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC feText = { CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
if (S_OK == pData->QueryGetData(&feFile) ||
S_OK == pData->QueryGetData(&feText)) {
@@ -70,11 +70,11 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave() {
ThumbInfo *pThumb = thumbList.FindThumb(hwndCurDrag);
- if (NULL != pThumb) {
+ if (nullptr != pThumb) {
pThumb->ThumbDeselect(TRUE);
}
- hwndCurDrag = NULL;
+ hwndCurDrag = nullptr;
return S_OK;
}
@@ -82,15 +82,15 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave() HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, DWORD *pdwEffect)
{
- FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC fe = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
*pdwEffect = DROPEFFECT_NONE;
- if (hwndCurDrag == NULL)
+ if (hwndCurDrag == nullptr)
return S_OK;
ThumbInfo *pThumb = (ThumbInfo*)GetWindowLongPtr(hwndCurDrag, GWLP_USERDATA);
- if (pThumb == NULL)
+ if (pThumb == nullptr)
return S_OK;
STGMEDIUM stg;
@@ -108,19 +108,19 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D if (!bFormatText) {
HDROP hDrop = (HDROP)stg.hGlobal;
- if (hDrop != NULL) {
+ if (hDrop != nullptr) {
OnDropFiles(hDrop, pThumb);
}
}
else {
wchar_t *pText = (wchar_t*)GlobalLock(stg.hGlobal);
- if (pText != NULL) {
+ if (pText != nullptr) {
SendMsgDialog(hwndCurDrag, pText);
GlobalUnlock(stg.hGlobal);
}
}
- if (stg.pUnkForRelease != NULL) {
+ if (stg.pUnkForRelease != nullptr) {
stg.pUnkForRelease->Release();
}
else {
@@ -137,15 +137,15 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb)
{
- UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
+ UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
char **ppDroppedItems = (char**)malloc(sizeof(char*)*(nDroppedItemsCount + 1));
- if (ppDroppedItems == NULL) {
+ if (ppDroppedItems == nullptr) {
return FALSE;
}
- ppDroppedItems[nDroppedItemsCount] = NULL;
+ ppDroppedItems[nDroppedItemsCount] = nullptr;
char szFilename[MAX_PATH];
for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem) {
@@ -158,8 +158,8 @@ BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb) char **ppFiles = (char**)malloc(sizeof(char *)* (nFilesCount + 1));
BOOL bSuccess = FALSE;
- if (ppFiles != NULL) {
- ppFiles[nFilesCount] = NULL;
+ if (ppFiles != nullptr) {
+ ppFiles[nFilesCount] = nullptr;
ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles);
@@ -198,7 +198,7 @@ static int CountFiles(char *szItem) char szDirName[MAX_PATH];
strncpy(szDirName, szItem, MAX_PATH - 1);
- if (NULL != strstr(szItem, "*.*")) {
+ if (nullptr != strstr(szItem, "*.*")) {
size_t offset = mir_strlen(szDirName) - 3;
mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName);
}
@@ -233,7 +233,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) char szDirName[MAX_PATH];
strncpy(szDirName, szItem, MAX_PATH - 1);
- if (NULL != strstr(szItem, "*.*")) {
+ if (nullptr != strstr(szItem, "*.*")) {
size_t offset = mir_strlen(szDirName) - 3;
mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName);
}
@@ -252,7 +252,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) strncpy(szFile, szItem, nSize - 1);
- if (NULL != strstr(szFile, "*.*")) {
+ if (nullptr != strstr(szFile, "*.*")) {
szFile[mir_strlen(szFile) - 3] = '\0';
mir_strncat(szFile, fd.cFileName, nSize - mir_strlen(szFile));
}
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 9ac311a663..d840c61e62 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -161,7 +161,7 @@ static int OnContactDrag(WPARAM hContact, LPARAM) GetCursorPos(&pt);
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (pThumb == NULL) {
+ if (pThumb == nullptr) {
int idStatus = GetContactStatus(hContact);
if (!fcOpt.bHideAll && !HideOnFullScreen() && (!fcOpt.bHideOffline || IsStatusVisible(idStatus)) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) {
@@ -186,7 +186,7 @@ static int OnContactDrop(WPARAM hContact, LPARAM) ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (hNewContact == hContact && pThumb != NULL) {
+ if (hNewContact == hContact && pThumb != nullptr) {
hNewContact = NULL;
GetWindowRect(hwndMiranda, &rcMiranda);
@@ -200,7 +200,7 @@ static int OnContactDrop(WPARAM hContact, LPARAM) static int OnContactDragStop(WPARAM hContact, LPARAM)
{
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (pThumb != NULL && hNewContact == hContact) {
+ if (pThumb != nullptr && hNewContact == hContact) {
thumbList.RemoveThumb(pThumb);
hNewContact = NULL;
}
@@ -236,7 +236,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
- if (pThumb == NULL)
+ if (pThumb == nullptr)
return 0;
// Only on these 2 events we need to refresh
@@ -278,7 +278,7 @@ static int OnPrebuildContactMenu(WPARAM wParam, LPARAM) {
ThumbInfo *pThumb = thumbList.FindThumbByContact(wParam);
- Menu_ShowItem(hMenuItemRemove, pThumb != NULL);
+ Menu_ShowItem(hMenuItemRemove, pThumb != nullptr);
Menu_ShowItem(hMenuItemHideAll, !fcOpt.bHideAll);
return 0;
}
@@ -313,19 +313,19 @@ static void LoadDBSettings() void SendMsgDialog(HWND hwnd, wchar_t *pText)
{
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- if (pThumb != NULL)
+ if (pThumb != nullptr)
CallService(MS_MSG_SENDMESSAGEW, (WPARAM)pThumb->hContact, (LPARAM)pText);
}
static void ShowContactMenu(HWND hwnd, POINT pt)
{
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- if (pThumb != NULL) {
+ if (pThumb != nullptr) {
hContactMenu = Menu_BuildContactMenu(pThumb->hContact);
- if (hContactMenu == NULL)
+ if (hContactMenu == nullptr)
return;
- int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
Clist_MenuProcessCommand(idCommand, MPCF_CONTACTMENU, pThumb->hContact);
}
}
@@ -358,7 +358,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM BitBlt(hdc, 0, 0, pThumb->bmpContent.getWidth(), pThumb->bmpContent.getHeight(), pThumb->bmpContent.getDC(), 0, 0, SRCCOPY);
//RepaintWindow( hwnd, hdc );
ReleaseDC(hwnd, hdc);
- ValidateRect(hwnd, NULL);
+ ValidateRect(hwnd, nullptr);
return 0;
}
@@ -463,15 +463,15 @@ void ApplyOptionsChanges() CreateBackgroundBrush();
if (!fcOpt.bToTop && ToTopTimerID) {
- KillTimer(NULL, ToTopTimerID);
+ KillTimer(nullptr, ToTopTimerID);
ToTopTimerID = 0;
}
if (fcOpt.bToTop) {
- if (ToTopTimerID) KillTimer(NULL, ToTopTimerID);
+ if (ToTopTimerID) KillTimer(nullptr, ToTopTimerID);
fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime;
fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime;
- ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
+ ToTopTimerID = SetTimer(nullptr, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
OnStatusChanged();
@@ -503,12 +503,12 @@ static void UnregisterWindowClass() static void CreateThumbWnd(wchar_t *ptszName, MCONTACT hContact, int nX, int nY)
{
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (pThumb != NULL)
+ if (pThumb != nullptr)
return;
// Prepare for window creation
- HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName, WS_POPUP, nX, nY, 50, 20, NULL, NULL, hInst, NULL);
- if (hwnd == NULL)
+ HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName, WS_POPUP, nX, nY, 50, 20, nullptr, nullptr, hInst, nullptr);
+ if (hwnd == nullptr)
return;
pThumb = thumbList.AddThumb(hwnd, ptszName, hContact);
@@ -526,9 +526,9 @@ static void CreateThumbWnd(wchar_t *ptszName, MCONTACT hContact, int nX, int nY) static void CreateThumbsFont()
{
for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++) {
- if (NULL != hFont[nFontId]) {
+ if (nullptr != hFont[nFontId]) {
DeleteObject(hFont[nFontId]);
- hFont[nFontId] = NULL;
+ hFont[nFontId] = nullptr;
}
LOGFONT lf;
@@ -541,25 +541,25 @@ static void CreateBackgroundBrush() {
bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR);
- if (NULL != hLTEdgesPen) {
+ if (nullptr != hLTEdgesPen) {
DeleteObject(hLTEdgesPen);
- hLTEdgesPen = NULL;
+ hLTEdgesPen = nullptr;
}
- if (NULL != hRBEdgesPen) {
+ if (nullptr != hRBEdgesPen) {
DeleteObject(hRBEdgesPen);
- hRBEdgesPen = NULL;
+ hRBEdgesPen = nullptr;
}
- if (NULL != hBmpBackground) {
+ if (nullptr != hBmpBackground) {
DeleteObject(hBmpBackground);
- hBmpBackground = NULL;
+ hBmpBackground = nullptr;
}
- if (NULL != hBkBrush) {
+ if (nullptr != hBkBrush) {
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
DeleteObject(hBkBrush);
- hBkBrush = NULL;
+ hBkBrush = nullptr;
}
if (db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
@@ -591,7 +591,7 @@ static int GetContactStatus(MCONTACT hContact) }
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -765,7 +765,7 @@ static void LoadContact(MCONTACT hContact) DWORD dwPos = db_get_dw(hContact, MODULE, "ThumbsPos", (DWORD)-1);
if (dwPos != -1) {
wchar_t *ptName = pcli->pfnGetContactDisplayName(hContact, 0);
- if (ptName != NULL) {
+ if (ptName != nullptr) {
int nX = DB_POS_GETX(dwPos);
int nY = DB_POS_GETY(dwPos);
@@ -778,7 +778,7 @@ static void LoadContact(MCONTACT hContact) BOOL HideOnFullScreen()
{
BOOL bFullscreen = FALSE;
- HWND hWnd = 0;
+ HWND hWnd = nullptr;
if (fcOpt.bHideWhenFullscreen) {
int w = GetSystemMetrics(SM_CXSCREEN);
@@ -893,7 +893,7 @@ static int OnModulesLoded(WPARAM, LPARAM) if (fcOpt.bToTop) {
fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime;
fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime;
- ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
+ ToTopTimerID = SetTimer(nullptr, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
return 0;
}
@@ -924,7 +924,7 @@ extern "C" int __declspec(dllexport) Load() char szId[20];
mir_snprintf(szId, "Font%d", i);
- FontService_RegisterFont(MODULE, szId, LPGENW("Floating contacts"), s_fonts[i], NULL, NULL, i + 1, false, &lf, defColor);
+ FontService_RegisterFont(MODULE, szId, LPGENW("Floating contacts"), s_fonts[i], nullptr, nullptr, i + 1, false, &lf, defColor);
}
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
@@ -945,11 +945,11 @@ extern "C" int __declspec(dllexport) Unload() if (hBkBrush) {
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
DeleteObject(hBkBrush);
- hBkBrush = NULL;
+ hBkBrush = nullptr;
}
for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++)
- if (NULL != hFont[nFontId])
+ if (nullptr != hFont[nFontId])
DeleteObject(hFont[nFontId]);
UnregisterWindowClass();
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index b9338223b4..c27c29b242 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -202,8 +202,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP mir_snprintf(szPercent, "%d%%", btOpacity);
SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != nullptr);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != nullptr);
}
return TRUE;
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index f1d3447e74..27f953a689 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -12,15 +12,15 @@ static BOOL bMouseMoved = FALSE; static int nLeft = 0;
static int nTop = 0;
static int nOffs = 5;
-static ThumbInfo *pThumbMouseIn = NULL;
+static ThumbInfo *pThumbMouseIn = nullptr;
static void SnapToScreen(RECT rcThumb, int nX, int nY, int *pX, int *pY)
{
int nWidth;
int nHeight;
- assert(NULL != pX);
- assert(NULL != pY);
+ assert(nullptr != pX);
+ assert(nullptr != pY);
nWidth = rcThumb.right - rcThumb.left;
nHeight = rcThumb.bottom - rcThumb.top;
@@ -41,7 +41,7 @@ ThumbInfo::ThumbInfo() ThumbInfo::~ThumbInfo()
{
if (pThumbMouseIn == this) {
- pThumbMouseIn = NULL;
+ pThumbMouseIn = nullptr;
KillTimer(hwnd, TIMERID_LEAVE_T);
}
dropTarget->Release();
@@ -64,13 +64,13 @@ void ThumbInfo::PositionThumb(int nX, int nY) ThumbInfo *pThumb = this;
while (pThumb) {
pThumb->PositionThumbWorker(pos.x, pos.y, &pos);
- if (NULL != pThumb->hwnd) /* Wine fix. */
+ if (nullptr != pThumb->hwnd) /* Wine fix. */
hdwp = DeferWindowPos(hdwp, pThumb->hwnd, HWND_TOPMOST, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
pThumb->ptPos = pos;
pos.x += pThumb->szSize.cx;
- pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : NULL;
+ pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : nullptr;
}
EndDeferWindowPos(hdwp);
@@ -102,7 +102,7 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos) // Docking and screen boundaries check
SnapToScreen(rcThumb, nX, nY, &nNewX, &nNewY);
- bLeading = dockOpt.hwndRight != NULL;
+ bLeading = dockOpt.hwndRight != nullptr;
if (fcOpt.bMoveTogether)
UndockThumbs(this, thumbList.FindThumb(dockOpt.hwndLeft));
@@ -238,7 +238,7 @@ void ThumbInfo::ResizeThumb() int index = FLT_FONTID_NOTONLIST;
himlMiranda = Clist_GetImageList();
- if (himlMiranda == NULL)
+ if (himlMiranda == nullptr)
return;
SIZEL sizeIcon;
@@ -247,7 +247,7 @@ void ThumbInfo::ResizeThumb() HDC hdc = GetWindowDC(hwnd);
if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
char *szProto = GetContactProto(hContact);
- if (NULL != szProto) {
+ if (nullptr != szProto) {
int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
@@ -352,7 +352,7 @@ void ThumbInfo::OnLButtonUp() if (bMouseDown) {
bMouseDown = FALSE;
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
// Check whether we shoud remove the window
GetWindowRect(hwndMiranda, &rcMiranda);
@@ -390,11 +390,11 @@ void ThumbInfo::OnMouseMove(int nX, int nY) ptOld = ptNew;
}
- else SetCursor(LoadCursor(NULL, IDC_ARROW));
+ else SetCursor(LoadCursor(nullptr, IDC_ARROW));
// Update selection status
if (!pThumbMouseIn) {
- SetTimer(hwnd, TIMERID_LEAVE_T, 10, NULL);
+ SetTimer(hwnd, TIMERID_LEAVE_T, 10, nullptr);
pThumbMouseIn = this;
ThumbSelect(TRUE);
@@ -423,7 +423,7 @@ void ThumbInfo::OnMouseMove(int nX, int nY) return;
tmpTimeIn = (fcOpt.TimeIn > 0) ? fcOpt.TimeIn : CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
- SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, 0);
+ SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, nullptr);
fTipTimerActive = TRUE;
}
}
@@ -483,10 +483,10 @@ void ThumbInfo::UpdateContent() HDC hdcDraw = bmpContent.getDC();
SetRect(&rc, 0, 0, szSize.cx, szSize.cy);
- if (NULL != hBmpBackground) {
+ if (nullptr != hBmpBackground) {
RECT rcBkgnd;
SetRect(&rcBkgnd, 0, 0, szSize.cx, szSize.cy);
- if (NULL != hLTEdgesPen)
+ if (nullptr != hLTEdgesPen)
InflateRect(&rcBkgnd, -1, -1);
int width = rcBkgnd.right - rcBkgnd.left;
int height = rcBkgnd.bottom - rcBkgnd.top;
@@ -549,19 +549,19 @@ void ThumbInfo::UpdateContent() }
else FillRect(hdcDraw, &rc, hBkBrush);
- if (NULL != hLTEdgesPen) {
+ if (nullptr != hLTEdgesPen) {
HPEN hOldPen = (HPEN)SelectObject(hdcDraw, hLTEdgesPen);
- MoveToEx(hdcDraw, 0, 0, NULL);
+ MoveToEx(hdcDraw, 0, 0, nullptr);
LineTo(hdcDraw, szSize.cx, 0);
- MoveToEx(hdcDraw, 0, 0, NULL);
+ MoveToEx(hdcDraw, 0, 0, nullptr);
LineTo(hdcDraw, 0, szSize.cy);
SelectObject(hdcDraw, hRBEdgesPen);
- MoveToEx(hdcDraw, 0, szSize.cy - 1, NULL);
+ MoveToEx(hdcDraw, 0, szSize.cy - 1, nullptr);
LineTo(hdcDraw, szSize.cx - 1, szSize.cy - 1);
- MoveToEx(hdcDraw, szSize.cx - 1, szSize.cy - 1, NULL);
+ MoveToEx(hdcDraw, szSize.cx - 1, szSize.cy - 1, nullptr);
LineTo(hdcDraw, szSize.cx - 1, 0);
SelectObject(hdcDraw, hOldPen);
@@ -575,7 +575,7 @@ void ThumbInfo::UpdateContent() if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
char *szProto = GetContactProto(hContact);
- if (NULL != szProto) {
+ if (nullptr != szProto) {
int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
@@ -656,7 +656,7 @@ void ThumbInfo::UpdateContent() blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
- UpdateLayeredWindow(hwnd, NULL, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
+ UpdateLayeredWindow(hwnd, nullptr, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
}
void ThumbInfo::PopupMessageDialog()
@@ -678,7 +678,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) GetThumbRect(&rc);
if (!PtInRect(&rc, pt)) {
KillTimer(hwnd, TIMERID_LEAVE_T);
- pThumbMouseIn = NULL;
+ pThumbMouseIn = nullptr;
ThumbDeselect(TRUE);
}
}
@@ -704,7 +704,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight)
{
- if (pThumbRight->dockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL) {
+ if (pThumbRight->dockOpt.hwndLeft == nullptr && pThumbLeft->dockOpt.hwndRight == nullptr) {
pThumbRight->dockOpt.hwndLeft = pThumbLeft->hwnd;
pThumbLeft->dockOpt.hwndRight = pThumbRight->hwnd;
}
@@ -713,20 +713,20 @@ void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight) void UndockThumbs(ThumbInfo *pThumb1, ThumbInfo *pThumb2)
{
- if (pThumb1 == NULL || pThumb2 == NULL)
+ if (pThumb1 == nullptr || pThumb2 == nullptr)
return;
if (pThumb1->dockOpt.hwndRight == pThumb2->hwnd)
- pThumb1->dockOpt.hwndRight = NULL;
+ pThumb1->dockOpt.hwndRight = nullptr;
if (pThumb1->dockOpt.hwndLeft == pThumb2->hwnd)
- pThumb1->dockOpt.hwndLeft = NULL;
+ pThumb1->dockOpt.hwndLeft = nullptr;
if (pThumb2->dockOpt.hwndRight == pThumb1->hwnd)
- pThumb2->dockOpt.hwndRight = NULL;
+ pThumb2->dockOpt.hwndRight = nullptr;
if (pThumb2->dockOpt.hwndLeft == pThumb1->hwnd)
- pThumb2->dockOpt.hwndLeft = NULL;
+ pThumb2->dockOpt.hwndLeft = nullptr;
}
/////////////////////////////////////////////////////////////////////////////
@@ -740,16 +740,16 @@ ThumbList::~ThumbList() ThumbInfo *ThumbList::AddThumb(HWND hwnd, wchar_t *ptszName, MCONTACT hContact)
{
- if (ptszName == NULL || hContact == NULL || hwnd == NULL)
- return NULL;
+ if (ptszName == nullptr || hContact == NULL || hwnd == nullptr)
+ return nullptr;
ThumbInfo *pThumb = new ThumbInfo;
wcsncpy_s(pThumb->ptszName, ptszName, _TRUNCATE);
pThumb->hContact = hContact;
pThumb->hwnd = hwnd;
- pThumb->dockOpt.hwndLeft = NULL;
- pThumb->dockOpt.hwndRight = NULL;
+ pThumb->dockOpt.hwndLeft = nullptr;
+ pThumb->dockOpt.hwndRight = nullptr;
pThumb->fTipActive = FALSE;
RegHotkey(hContact, hwnd);
@@ -774,22 +774,22 @@ void ThumbList::RemoveThumb(ThumbInfo *pThumb) ThumbInfo* ThumbList::FindThumb(HWND hwnd)
{
- if (!hwnd) return NULL;
+ if (!hwnd) return nullptr;
for (int i = 0; i < getCount(); ++i)
if (items[i]->hwnd == hwnd)
return items[i];
- return NULL;
+ return nullptr;
}
ThumbInfo *ThumbList::FindThumbByContact(MCONTACT hContact)
{
- if (!hContact) return NULL;
+ if (!hContact) return nullptr;
for (int i = 0; i < getCount(); ++i)
if (items[i]->hContact == hContact)
return items[i];
- return NULL;
+ return nullptr;
}
diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index 8f26cd0e7e..806b0972c7 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-PFolderItem lastItem = NULL;
+PFolderItem lastItem = nullptr;
static int bInitializing = 0;
@@ -8,7 +8,7 @@ static PFolderItem GetSelectedItem(HWND hWnd) {
int index = SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETCURSEL, 0, 0);
if (index == LB_ERR)
- return NULL;
+ return nullptr;
return (PFolderItem)SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETITEMDATA, index, 0);
}
@@ -173,7 +173,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) {
case WM_INITDIALOG:
- lastItem = NULL;
+ lastItem = nullptr;
TranslateDialogDefault(hWnd);
bInitializing = 1;
LoadRegisteredFolderSections(hWnd);
@@ -204,7 +204,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case LBN_SELCHANGE:
CheckForChanges(hWnd);
LoadRegisteredFolderItems(hWnd);
- lastItem = NULL;
+ lastItem = nullptr;
SetEditText(hWnd, L"");
RefreshPreview(hWnd);
}
@@ -214,7 +214,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (HIWORD(wParam)) {
case LBN_SELCHANGE:
item = GetSelectedItem(hWnd);
- if (item != NULL) {
+ if (item != nullptr) {
CheckForChanges(hWnd);
LoadItem(hWnd, item);
}
diff --git a/plugins/Folders/src/events.cpp b/plugins/Folders/src/events.cpp index db9bd46c1d..ae9616333c 100644 --- a/plugins/Folders/src/events.cpp +++ b/plugins/Folders/src/events.cpp @@ -31,7 +31,7 @@ int InitEvents() int DestroyEvents()
{
DestroyHookableEvent(hPathChanged);
- hPathChanged = 0;
+ hPathChanged = nullptr;
return 0;
}
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index f277a27ec3..0b86c2c357 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -28,8 +28,8 @@ CFolderItem::CFolderItem(const char *sectionName, const char *name, const wchar_ m_tszUserName = mir_wstrdup(userName);
else
m_tszUserName = mir_a2u(name);
- m_tszFormat = NULL;
- m_tszOldFormat = NULL;
+ m_tszFormat = nullptr;
+ m_tszOldFormat = nullptr;
GetDataFromDatabase(format);
FolderCreateDirectory();
}
@@ -84,13 +84,13 @@ void CFolderItem::Save() int CFolderItem::FolderCreateDirectory(int showFolder)
{
- if (m_tszFormat == NULL)
+ if (m_tszFormat == nullptr)
return FOLDER_SUCCESS;
CMStringW buffer(ExpandPath(m_tszFormat));
CreateDirectoryTreeW(buffer);
if (showFolder)
- ShellExecute(NULL, L"explore", buffer, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, L"explore", buffer, nullptr, nullptr, SW_SHOW);
return (DirectoryExists(buffer)) ? FOLDER_SUCCESS : FOLDER_FAILURE;
}
@@ -107,7 +107,7 @@ int CFolderItem::FolderDeleteOldDirectory(int showFolder) RemoveDirectories(buffer);
int res = (DirectoryExists(buffer)) ? FOLDER_FAILURE : FOLDER_SUCCESS;
if ((res == FOLDER_FAILURE) && (showFolder))
- ShellExecute(NULL, L"explore", buffer, NULL, NULL, SW_SHOW);
+ ShellExecute(nullptr, L"explore", buffer, nullptr, nullptr, SW_SHOW);
return res;
}
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 7dab3adde6..cba24efd33 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -30,7 +30,7 @@ wchar_t szUserDataPath[MAX_FOLDERS_PATH]; INT_PTR RegisterPathService(WPARAM, LPARAM lParam)
{
FOLDERSDATA *data = (FOLDERSDATA*)lParam;
- if (data == NULL)
+ if (data == nullptr)
return NULL;
if (data->cbSize != sizeof(FOLDERSDATA))
diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp index fbcdc83e57..e2d5af213a 100644 --- a/plugins/GmailNotifier/src/check.cpp +++ b/plugins/GmailNotifier/src/check.cpp @@ -7,7 +7,7 @@ void CheckMailInbox(Account *curAcc) {
// internet connection handle
// internet request handle
- HINTERNET hHTTPConnection = 0, hHTTPRequest = 0;
+ HINTERNET hHTTPConnection = nullptr, hHTTPRequest = nullptr;
DBVARIANT dbv;
static char *contentType = "Content-Type: application/x-www-form-urlencoded";
@@ -49,8 +49,8 @@ void CheckMailInbox(Account *curAcc) hHTTPConnection = InternetConnectA(hHTTPOpen,
"www.google.com",
INTERNET_DEFAULT_HTTPS_PORT,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
INTERNET_SERVICE_HTTP,
0,
0);
@@ -62,7 +62,7 @@ void CheckMailInbox(Account *curAcc) mir_strcpy(str, "/a/");
mir_strcat(str, curAcc->hosted);
mir_strcat(str, "/LoginAction");
- hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, NULL, NULL, INTERNET_FLAG_SECURE, 0);
+ hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, nullptr, nullptr, INTERNET_FLAG_SECURE, 0);
mir_strcat(requestBuffer, curAcc->hosted);
mir_strcat(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName=");
mir_strcat(requestBuffer, curAcc->name);
@@ -77,10 +77,10 @@ void CheckMailInbox(Account *curAcc) InternetCloseHandle(hHTTPConnection);
InternetCloseHandle(hHTTPRequest);
- hHTTPRequest = 0;
+ hHTTPRequest = nullptr;
}
- hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+ hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, nullptr, nullptr, INTERNET_SERVICE_HTTP, 0, 0);
if (!hHTTPConnection) {
mir_strcat(curAcc->results.content, Translate("Can't reach server!"));
goto error_handle;
@@ -92,10 +92,10 @@ void CheckMailInbox(Account *curAcc) }
else mir_strcpy(str, "/mail/feed/atom");
- hHTTPRequest = HttpOpenRequest(hHTTPConnection, L"GET", _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0);
+ hHTTPRequest = HttpOpenRequest(hHTTPConnection, L"GET", _A2T(str), nullptr, nullptr, nullptr, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0);
InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)mir_strlen(curAcc->name) + 1);
InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)mir_strlen(curAcc->pass) + 1);
- if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) {
+ if (!HttpSendRequest(hHTTPRequest, nullptr, 0, nullptr, 0)) {
mir_strcat(curAcc->results.content, Translate("Can't get RSS feed!"));
goto error_handle;
}
@@ -154,7 +154,7 @@ int ParsePage(char *page, resultLink *prst) int num = 0;
wchar_t str[64];
- prst->next = NULL;
+ prst->next = nullptr;
if (strstr(page, "Unauthorized"))
return -1;
if (!(str_head = strstr(page, "<entry>")))
@@ -180,9 +180,9 @@ int ParsePage(char *page, resultLink *prst) mir_strcpy(prst->content, name);
mir_strcat(prst->content, title);
MultiByteToWideChar(CP_UTF8, 0, prst->content, -1, str, 64);
- WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, nullptr, nullptr);
num++;
}
- prst->next = NULL;
+ prst->next = nullptr;
return num;
}
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index d2912d2082..451c125205 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -130,7 +130,7 @@ extern "C" int __declspec(dllexport) Load() for (int i = 0; i < acc_num; i++)
db_set_dw(acc[i].hContact, MODULE_NAME, "Status", ID_STATUS_NONEW);
- hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc);
+ hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc);
hMirandaStarted = HookEvent(ME_SYSTEM_MODULESLOADED, OnMirandaStart);
hOptionsInitial = HookEvent(ME_OPT_INITIALISE, OptInit);
@@ -154,7 +154,7 @@ extern "C" int __declspec(dllexport) Load() extern "C" int __declspec(dllexport) Unload(void)
{
if (hTimer)
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
for (int i = 0; i < acc_num; i++)
DeleteResults(acc[i].results.next);
free(acc);
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index 7e90749477..e49421dc5d 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -14,7 +14,7 @@ int OpenBrowser(WPARAM hContact, LPARAM) db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_NONEW);
curAcc->oldResults_num = 0;
DeleteResults(curAcc->results.next);
- curAcc->results.next = NULL;
+ curAcc->results.next = nullptr;
}
mir_forkthread(Login_ThreadFunc, curAcc);
}
@@ -44,7 +44,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case WM_CONTEXTMENU:
PUDeletePopup(hWnd);
- curAcc->popUpHwnd = NULL;
+ curAcc->popUpHwnd = nullptr;
pcli->pfnRemoveEvent(hContact, 1);
}
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -76,7 +76,7 @@ void NotifyUser(Account *curAcc) dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_READ;
dbei.szModule = MODULE_NAME;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
resultLink *prst = curAcc->results.next;
for (int i = 0; i < newMails; i++) {
@@ -114,7 +114,7 @@ void NotifyUser(Account *curAcc) ppd.colorBack = opt.popupBgColor;
ppd.colorText = opt.popupTxtColor;
ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = opt.popupDuration;
PUDeletePopup(curAcc->popUpHwnd);
PUAddPopup(&ppd);
@@ -124,13 +124,13 @@ void NotifyUser(Account *curAcc) }
curAcc->oldResults_num = curAcc->results_num;
DeleteResults(curAcc->results.next);
- curAcc->results.next = NULL;
+ curAcc->results.next = nullptr;
}
void DeleteResults(resultLink *prst)
{
- if (prst != NULL) {
- if (prst->next != NULL)
+ if (prst != nullptr) {
+ if (prst->next != nullptr)
DeleteResults(prst->next);
free(prst);
}
@@ -138,7 +138,7 @@ void DeleteResults(resultLink *prst) void __cdecl Login_ThreadFunc(void *lpParam)
{
- if (lpParam == NULL)
+ if (lpParam == nullptr)
return;
HANDLE hTempFile;
@@ -165,7 +165,7 @@ void __cdecl Login_ThreadFunc(void *lpParam) GetTempPathA(dwBufSize, buffer);
GetTempFileNameA(buffer, "gmail", 0, szTempName);
- hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
mir_strcpy(buffer, FORMDATA1);
mir_strcat(buffer, curAcc->hosted);
mir_strcat(buffer, FORMDATA2);
@@ -173,12 +173,12 @@ void __cdecl Login_ThreadFunc(void *lpParam) mir_strcat(buffer, FORMDATA3);
mir_strcat(buffer, "<input type=hidden name=userName value=");
mir_strcat(buffer, curAcc->name);
- if ((str_temp = strstr(buffer, "@")) != NULL)
+ if ((str_temp = strstr(buffer, "@")) != nullptr)
*str_temp = '\0';
mir_strcat(buffer, "><input type=hidden name=password value=");
mir_strcat(buffer, curAcc->pass);
mir_strcat(buffer, "></form></body>");
- WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, NULL);
+ WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, nullptr);
CloseHandle(hTempFile);
mir_strcat(lpPathBuffer, szTempName);
}
@@ -199,7 +199,7 @@ void __cdecl Login_ThreadFunc(void *lpParam) PROCESS_INFORMATION procInfo;
suInfo.cb = sizeof(suInfo);
suInfo.wShowWindow = SW_MAXIMIZE;
- if (CreateProcessA(NULL, lpPathBuffer, NULL, NULL, FALSE, 0, NULL, NULL, &suInfo, &procInfo))
+ if (CreateProcessA(nullptr, lpPathBuffer, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &suInfo, &procInfo))
CloseHandle(procInfo.hProcess);
if (curAcc->hosted[0]) {
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index aa5be0f448..4978d80214 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -163,7 +163,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA acc_num--;
SendMessage(hwndCombo, CB_DELETESTRING, curIndex, 0);
DeleteResults(acc[curIndex].results.next);
- acc[curIndex].results.next = NULL;
+ acc[curIndex].results.next = nullptr;
db_delete_contact(acc[curIndex].hContact);
for (int i = curIndex; i < acc_num; i++)
acc[i] = acc[i + 1];
@@ -198,10 +198,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
SaveButton(hwndDlg,hwndCombo, curIndex);
- opt.circleTime = GetDlgItemInt(hwndDlg, IDC_CIRCLE, NULL, FALSE);
+ opt.circleTime = GetDlgItemInt(hwndDlg, IDC_CIRCLE, nullptr, FALSE);
if (opt.circleTime > 0) {
- KillTimer(NULL, hTimer);
- hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc);
+ KillTimer(nullptr, hTimer);
+ hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc);
db_set_dw(NULL, MODULE_NAME, "circleTime", opt.circleTime);
}
opt.notifierOnTray = IsDlgButtonChecked(hwndDlg, IDC_OPTTRAY);
@@ -209,7 +209,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA db_set_dw(NULL, MODULE_NAME, "notifierOnTray", opt.notifierOnTray);
db_set_dw(NULL, MODULE_NAME, "notifierOnPop", opt.notifierOnPop);
- opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, NULL, TRUE);
+ opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, nullptr, TRUE);
db_set_dw(NULL, MODULE_NAME, "popupDuration", opt.popupDuration);
opt.popupBgColor = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor);
diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 9aa00d8e79..eb243b8f57 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -32,7 +32,7 @@ void BuildList(void) BOOL GetBrowser(char *str)
{
- HKEY hKey = NULL;
+ HKEY hKey = nullptr;
char *strKey;
char strIE[] = "Applications\\iexplore.exe\\shell\\open\\command";
char strDefault[] = "https\\shell\\open\\command";
@@ -56,11 +56,11 @@ BOOL GetBrowser(char *str) // Data size
DWORD cbData = 0;
// Get the default value
- if (RegQueryValueExA(hKey, NULL, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS && cbData > 0) {
- if (RegQueryValueExA(hKey, NULL, NULL, NULL, (LPBYTE)str, &cbData) == ERROR_SUCCESS) {
- if ((strKey = strstr(str, "%1")) != NULL)
+ if (RegQueryValueExA(hKey, nullptr, nullptr, nullptr, nullptr, &cbData) == ERROR_SUCCESS && cbData > 0) {
+ if (RegQueryValueExA(hKey, nullptr, nullptr, nullptr, (LPBYTE)str, &cbData) == ERROR_SUCCESS) {
+ if ((strKey = strstr(str, "%1")) != nullptr)
*(strKey--) = '\0';
- if ((strKey = strstr(str, "-")) != NULL)
+ if ((strKey = strstr(str, "-")) != nullptr)
*(strKey--) = '\0';
RegCloseKey(hKey);
return TRUE;
@@ -76,5 +76,5 @@ Account* GetAccountByContact(MCONTACT hContact) if (acc[i].hContact == hContact)
return &acc[i];
- return NULL;
+ return nullptr;
}
\ No newline at end of file diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index a23f0c6fe4..939c46f364 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -18,7 +18,7 @@ #include "Glob.h"
-CLFileShareNode * pclFirstNode = NULL;
+CLFileShareNode * pclFirstNode = nullptr;
mir_cs csFileShareListAccess;
@@ -40,7 +40,7 @@ CLShareUser::CLShareUser(HNETLIBCONN hCon, in_addr stAdd) {
hConnection = hCon;
stAddr = stAdd;
- pclNext = NULL;
+ pclNext = nullptr;
dwTotalSize = 0;
dwCurrentDL = 0;
dwSpeed = 0;
@@ -132,8 +132,8 @@ CLFileShareNode::CLFileShareNode(char * pszSrvPath, char * pszRealPath) {
memset(&st, 0, sizeof(STFileShareInfo));
st.lStructSize = sizeof(STFileShareInfo);
- pclNext = NULL;
- pclCurrentUsers = NULL;
+ pclNext = nullptr;
+ pclCurrentUsers = nullptr;
bSetPaths(pszSrvPath, pszRealPath);
}
@@ -155,8 +155,8 @@ CLFileShareNode::CLFileShareNode(STFileShareInfo * pstInfo) {
memset(&st, 0, sizeof(STFileShareInfo));
st.lStructSize = sizeof(STFileShareInfo);
- pclNext = NULL;
- pclCurrentUsers = NULL;
+ pclNext = nullptr;
+ pclCurrentUsers = nullptr;
bSetInfo(pstInfo);
}
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 3335b489a2..5e1134b2c9 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -22,15 +22,15 @@ #define WM_RELOAD_STATISTICS (WM_USER+10)
-static HANDLE hShareNewFileService = 0;
-static HANDLE hShowStatisticsViewService = 0;
+static HANDLE hShareNewFileService = nullptr;
+static HANDLE hShowStatisticsViewService = nullptr;
-static HANDLE hShareNewFileMenuItem = 0;
-static HANDLE hShowStatisticsViewMenuItem = 0;
+static HANDLE hShareNewFileMenuItem = nullptr;
+static HANDLE hShowStatisticsViewMenuItem = nullptr;
-static HANDLE hEventOptionsInitialize = 0;
+static HANDLE hEventOptionsInitialize = nullptr;
-HWND hwndStatsticView = 0;
+HWND hwndStatsticView = nullptr;
bool bLastAutoRefress = false;
HANDLE hMainThread;
@@ -99,7 +99,7 @@ string DBGetString(MCONTACT hContact, const char *szModule, const char *szSettin DBVARIANT dbv = { 0 };
if (!db_get(hContact, szModule, szSetting, &dbv)) {
if (dbv.type != DBVT_ASCIIZ) {
- MessageBox(NULL, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK);
ret = pszError;
}
else ret = dbv.pszVal;
@@ -146,7 +146,7 @@ void UpdateStatisticsView() unsigned long GetExternIP(const char *szURL, const char *szPattern)
{
- HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(0, IDC_WAIT));
+ HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(nullptr, IDC_WAIT));
NETLIBHTTPREQUEST nlhr;
memset(&nlhr, 0, sizeof(nlhr));
@@ -163,7 +163,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) if (nlreply->resultCode >= 200 && nlreply->resultCode < 300) {
nlreply->pData[nlreply->dataLength] = 0;// make sure its null terminated
char * pszIp = strstr(nlreply->pData, szPattern);
- if (pszIp == NULL)
+ if (pszIp == nullptr)
pszIp = nlreply->pData;
else
pszIp += mir_strlen(szPattern);
@@ -319,7 +319,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( }
pszTmp = strchr(szSelection, ':');
- if (pszTmp != NULL)
+ if (pszTmp != nullptr)
*pszTmp = '\0';
memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1);
@@ -472,7 +472,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) if (dwError) {
char szTemp[200];
mir_snprintf(szTemp, "Failed to create File Open dialog the error returned was %d", dwError);
- MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK);
}
return false;
}
@@ -505,7 +505,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0';
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) {
- MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
pszFileNamePos++;
@@ -516,7 +516,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) }
else {
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) {
- MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
}
@@ -636,7 +636,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) if (bLastAutoRefress != bAutoRefress) {
if (bAutoRefress)
- SetTimer(hwndDlg, 0, 1000, NULL);
+ SetTimer(hwndDlg, 0, 1000, nullptr);
else
KillTimer(hwndDlg, 0);
bLastAutoRefress = bAutoRefress;
@@ -664,14 +664,14 @@ void SetWindowsCtrls(HWND hwndDlg) const int nSpacing = 8;
int nCtrlHight = (rNewSize.bottom - (nSpacing * 3)) / 3 - 20;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_SHARES), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_SHARES), nullptr,
nSpacing,
35,
rNewSize.right - (nSpacing * 2),
nCtrlHight * 2,
SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_USERS), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_USERS), nullptr,
nSpacing,
(nSpacing * 2) + nCtrlHight * 2 + 25,
rNewSize.right - (nSpacing * 2),
@@ -778,7 +778,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
case WM_DESTROY:
- hwndStatsticView = NULL;
+ hwndStatsticView = nullptr;
return 0;
case WM_DROPFILES:
@@ -787,7 +787,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara char szDropedFile[MAX_PATH];
char szServPath[MAX_PATH] = { 0 };
- int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
+ int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
for (int i = 0; i < nLen; i++) {
DragQueryFile(hDrop, i, szDropedFile, sizeof(szDropedFile));
@@ -805,7 +805,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara strncpy(&szServPath[1], fileName + 1, MAX_PATH - 2);
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) {
- MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
}
@@ -852,7 +852,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara TranslateMenu(hMenu);
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON,
- pt.x, pt.y, 0, hwndDlg, NULL);
+ pt.x, pt.y, 0, hwndDlg, nullptr);
DestroyMenu(hMainMenu);
}
@@ -1077,7 +1077,7 @@ static INT_PTR nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/) BringWindowToTop(hwndStatsticView);
return 0;
}
- hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), NULL, DlgProcStatsticView, (LPARAM)NULL);
+ hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), nullptr, DlgProcStatsticView, (LPARAM)NULL);
ShowWindow(hwndStatsticView, SW_SHOWNORMAL);
return 0;
}
@@ -1492,7 +1492,7 @@ void InitGuiElements() hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
if (!hEventOptionsInitialize)
- MessageBox(NULL, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK);
bShowPopups = db_get_b(NULL, MODULE, "ShowPopups", bShowPopups) != 0;
}
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index 3ceb656f77..db86533b7f 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -442,7 +442,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) * pszTmp = '\\';
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
if (pszSrvPath[mir_strlen(pszSrvPath) - 1] != '/') {
@@ -454,14 +454,14 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) strmcat(szRealPath, "index.htm", MAX_PATH);
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
// a directory with index.html
strmcat(szRealPath, "l", MAX_PATH);
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
// generate directory index in temporary file
@@ -486,7 +486,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) (indexCreationMode == INDEX_CREATION_DETECT && BrowserSupportsXML)) &&
bCreateIndexXML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) {
hFile = CreateFile(szTempfile, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
mir_strcpy(szRealPath, "a.xml"); // restore .xml for mime type
}
@@ -494,7 +494,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) indexCreationMode == INDEX_CREATION_DETECT) &&
bCreateIndexHTML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) {
hFile = CreateFile(szTempfile, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
mir_strcpy(szRealPath, "a.html"); // restore .html for mime type
}
@@ -518,7 +518,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) }
else {
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
SendError(404, "Not Found", "HTTP server failed to open local file");
@@ -528,11 +528,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) mir_strcpy(this->szCurrentDLSrvPath, pszSrvPath);
- DWORD nDataSize = GetFileSize(hFile, NULL);
+ DWORD nDataSize = GetFileSize(hFile, nullptr);
dwTotalSize = nDataSize;
FILETIME stFileTime;
- GetFileTime(hFile, NULL, NULL, &stFileTime);
+ GetFileTime(hFile, nullptr, nullptr, &stFileTime);
char szCurTime[100];
time_t ltime;
@@ -557,7 +557,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) }
if (*(ULONG*)(&stAddr) != 0x0100007F && // do not show popup of 127.0.0.1
- strstr(pszRealPath, "\\@") == NULL) { // and of shares which start with an @
+ strstr(pszRealPath, "\\@") == nullptr) { // and of shares which start with an @
ShowPopupWindow(inet_ntoa(stAddr), pszSrvPath);
}
@@ -623,7 +623,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) char szBuf[1460 * 4];
if (dwFileStart > 0 || dwDataToSend != nDataSize) {
- if (SetFilePointer(hFile, dwFileStart, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (SetFilePointer(hFile, dwFileStart, nullptr, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
SendError(416, "Requested Range Not Satisfiable");
return true;
}
@@ -700,7 +700,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) if (bSpeedLimit)
dwCurOpr = min(nMaxBytesToSend, sizeof(szBuf));
- if (!ReadFile(hFile, szBuf, dwCurOpr, &dwBytesToWrite, NULL))
+ if (!ReadFile(hFile, szBuf, dwCurOpr, &dwBytesToWrite, nullptr))
break;
if (dwBytesToWrite <= 0)
diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index cd7687330c..c32f782f81 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -19,7 +19,7 @@ eIndexCreationMode indexCreationMode;
-static char* szIndexHTMLTemplate = NULL;
+static char* szIndexHTMLTemplate = nullptr;
static const int MAX_PARAM_LENGTH = 5;
// signs below 32 are not used anyway
@@ -55,7 +55,7 @@ enum Symbol bool LoadIndexHTMLTemplate()
{
- if (szIndexHTMLTemplate != NULL)
+ if (szIndexHTMLTemplate != nullptr)
return true;
char szBuf[10000];
@@ -67,14 +67,14 @@ bool LoadIndexHTMLTemplate() mir_snprintf(szBuf, "%s%s", szPluginPath, szIndexHTMLTemplateFile);
HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
- MessageBox(NULL, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK);
return false;
}
DWORD dwBytesRead = 0;
- if (ReadFile(hFile, pszBuf, sizeof(szBuf), &dwBytesRead, NULL) || dwBytesRead <= 0) {
+ if (ReadFile(hFile, pszBuf, sizeof(szBuf), &dwBytesRead, nullptr) || dwBytesRead <= 0) {
while (dwBytesRead > (DWORD)(pszBuf - szBuf)) {
if (*pszBuf == '[') {
char* pszKeywordBegin = pszBuf + 1;
@@ -259,9 +259,9 @@ bool LoadIndexHTMLTemplate() void FreeIndexHTMLTemplate()
{
- if (szIndexHTMLTemplate != NULL) {
+ if (szIndexHTMLTemplate != nullptr) {
delete[] szIndexHTMLTemplate;
- szIndexHTMLTemplate = NULL;
+ szIndexHTMLTemplate = nullptr;
}
}
@@ -283,7 +283,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, {
#define RelativeJump(begin) { pszPos += *((WORD*)(begin+1)) & 0x7FFF; }
- if (szIndexHTMLTemplate == NULL)
+ if (szIndexHTMLTemplate == nullptr)
return false;
// check if directory exists
@@ -297,10 +297,10 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, return FALSE;
FindClose(hFind);
- hFind = 0;
+ hFind = nullptr;
HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ,
- NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
+ nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
@@ -339,12 +339,12 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, switch (*pszPos) {
case SY_FOR_FILES:
case SY_FOR_DIRS:
- if (hFind == 0) {
+ if (hFind == nullptr) {
pszLevelBegin[iLevel++] = pszPos;
iCurrentAction = *pszPos;
hFind = FindFirstFile(szMask, &fdFindFileData);
- if (hFind == 0) {
+ if (hFind == nullptr) {
iCurrentAction = 0;
RelativeJump(pszLevelBegin[iLevel - 1]);
break;
@@ -353,7 +353,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, else {
if (!FindNextFile(hFind, &fdFindFileData)) {
FindClose(hFind);
- hFind = 0;
+ hFind = nullptr;
iCurrentAction = 0;
RelativeJump(pszLevelBegin[iLevel - 1]);
break;
@@ -366,7 +366,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, ((*pszPos == 19) == ((fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0))) {
if (!FindNextFile(hFind, &fdFindFileData)) {
FindClose(hFind);
- hFind = 0;
+ hFind = nullptr;
iCurrentAction = 0;
RelativeJump(pszLevelBegin[iLevel - 1]);
break;
@@ -503,14 +503,14 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, // flush the buffer from time to time
if (*pszPos == '\0' || pszBuffer - szBuffer > 8000) {
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
pszBuffer = szBuffer;
}
} while (*pszPos != '\0');
- if (hFind != 0)
+ if (hFind != nullptr)
FindClose(hFind);
SetEndOfFile(hFile);
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index c258832321..ea94a2cadc 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -73,8 +73,8 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const if (hFind == INVALID_HANDLE_VALUE)
return FALSE;
- HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, NULL,
- OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
+ HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr,
+ OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
FindClose(hFind);
@@ -99,14 +99,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const strncpy(szFileName, pszTemp + 1, MAX_PATH);
// Write Header
- WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, NULL);
+ WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, nullptr);
// check if a index.xsl exists in the same directory otherwise use the global
mir_snprintf(szMask, "%s%s", pszRealPath, "index.xsl");
HANDLE hFileExists = CreateFile(szMask, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFileExists == INVALID_HANDLE_VALUE) {
strncpy(szBuffer, "/index.xsl", BUFFER_SIZE);
@@ -116,15 +116,15 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const strncpy(szBuffer, "index.xsl", BUFFER_SIZE);
}
- WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL);
+ WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, nullptr);
- WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, NULL);
+ WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, nullptr);
// Write dirname
ReplaceSign(szFileName, MAX_PATH, '&', "&");
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <dirname>%s</dirname>\r\n", szFileName);
- WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL);
+ WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr);
// Find files and directories
do {
@@ -143,14 +143,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const else {
pszExt = strrchr(szFileName, '.');
- if (pszExt != NULL) {
+ if (pszExt != nullptr) {
*pszExt = '\0';
pszExt++;
}
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
- szFileName, (pszExt == NULL) ? "" : pszExt, fdFindFileData.nFileSizeLow);
+ szFileName, (pszExt == nullptr) ? "" : pszExt, fdFindFileData.nFileSizeLow);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&fdFindFileData.ftCreationTime, &systemTime);
@@ -169,13 +169,13 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const "/>\r\n");
}
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
}
} while (FindNextFile(hFind, &fdFindFileData));
- if (hFind != 0)
+ if (hFind != nullptr)
FindClose(hFind);
// Add other shared files & directories
@@ -195,7 +195,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" isdir=\"true\"/>\r\n", szFileName);
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
}
}
@@ -204,7 +204,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const strncmp(pszRealPath, pclCur->st.pszRealPath, mir_strlen(pszRealPath))) { // no duplicates
pszExt = strrchr(szFileName, '.');
- if (pszExt != NULL) {
+ if (pszExt != nullptr) {
*pszExt = '\0';
pszExt++;
}
@@ -214,16 +214,16 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const FILETIME ftFileAccessTime;
FILETIME ftFileModifyTime;
HANDLE hFileS = CreateFile(pclCur->st.pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFileS != INVALID_HANDLE_VALUE) {
- dwFileSize = GetFileSize(hFileS, NULL);
+ dwFileSize = GetFileSize(hFileS, nullptr);
GetFileTime(hFileS, &ftFileCreateTime, &ftFileAccessTime, &ftFileModifyTime);
CloseHandle(hFileS);
}
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
- szFileName, (pszExt == NULL) ? "" : pszExt, dwFileSize);
+ szFileName, (pszExt == nullptr) ? "" : pszExt, dwFileSize);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&ftFileCreateTime, &systemTime);
@@ -241,14 +241,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"/>\r\n");
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
}
}
}
}
- WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWritten, NULL);
+ WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWritten, nullptr);
SetEndOfFile(hFile);
CloseHandle(hFile);
diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp index 78f8c3c91c..56ec7a320f 100644 --- a/plugins/HTTPServer/src/MimeHandling.cpp +++ b/plugins/HTTPServer/src/MimeHandling.cpp @@ -1,7 +1,7 @@ #include "Glob.h"
/* MIME type/ext map */
-ContentTypeDB MIME = NULL;
+ContentTypeDB MIME = nullptr;
/* Default Mime type when recognition fails */
char DefaultMime[] = "application/octet-stream";
@@ -9,18 +9,18 @@ int bInitMimeHandling() {
FILE *mimeDB;
char line[LINE_MAX_SIZE];
- char *tok = NULL;
- ContentType *pDBCell = NULL;
- ContentTypeDB pDB = NULL;
- ExtensionList extListCur = NULL;
- ExtensionListCell *pExtCell = NULL;
+ char *tok = nullptr;
+ ContentType *pDBCell = nullptr;
+ ContentTypeDB pDB = nullptr;
+ ExtensionList extListCur = nullptr;
+ ExtensionListCell *pExtCell = nullptr;
char szBuf[10000];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szMimeTypeConfigFile);
mimeDB = fopen(szBuf, "r");
- if (mimeDB != NULL) {
+ if (mimeDB != nullptr) {
while (fgets(line, LINE_MAX_SIZE, mimeDB)) {
/*filter junk lines assuming Mime type start with letter
(convention ?) */
@@ -28,7 +28,7 @@ int bInitMimeHandling() || (line[0] <= 'Z' && line[0] >= 'A')) {
/*remove comments trailing comments*/
tok = strrchr(line, '#');
- if (tok != NULL) {
+ if (tok != nullptr) {
*tok = '\0';
}
/* remove trailing \n */
@@ -42,29 +42,29 @@ int bInitMimeHandling() pDBCell = (ContentType*)malloc(sizeof(ContentType));
pDBCell->mimeType = (char*)malloc(mir_strlen(tok) + 1);
mir_strcpy(pDBCell->mimeType, tok);
- pDBCell->extList = NULL;
- pDBCell->next = NULL;
+ pDBCell->extList = nullptr;
+ pDBCell->next = nullptr;
/* looking for extensions */
- tok = (char*)strtok(NULL, " \t");
- while (tok != NULL) {
+ tok = (char*)strtok(nullptr, " \t");
+ while (tok != nullptr) {
/*create and fill a cell*/
pExtCell = (ExtensionListCell*)malloc(sizeof(ExtensionListCell));
pExtCell->ext = (char*)malloc(mir_strlen(tok) + 1);
mir_strcpy(pExtCell->ext, tok);
- pExtCell->next = NULL;
+ pExtCell->next = nullptr;
/*link*/
- if (pDBCell->extList == NULL) {
+ if (pDBCell->extList == nullptr) {
pDBCell->extList = pExtCell;
}
else {
extListCur->next = pExtCell;
}
extListCur = pExtCell;
- tok = (char*)strtok(NULL, " \t");
+ tok = (char*)strtok(nullptr, " \t");
}
/* link */
- if (pDBCell->extList != NULL) { /*extension(s) found*/
- if (MIME == NULL) {
+ if (pDBCell->extList != nullptr) { /*extension(s) found*/
+ if (MIME == nullptr) {
MIME = pDBCell;
}
else {
@@ -81,7 +81,7 @@ int bInitMimeHandling() fclose(mimeDB);
}
- if (MIME == NULL) {
+ if (MIME == nullptr) {
return 0;
}
return 1;
@@ -95,7 +95,7 @@ const char* pszGetMimeType(const char * pszFileName) ext = strrchr(pszFileName, '.');
- if (ext != NULL) {
+ if (ext != nullptr) {
if (ext[1] == '\0') {
/*empty extension */
return DefaultMime;
@@ -106,9 +106,9 @@ const char* pszGetMimeType(const char * pszFileName) }
courMIME = MIME;
- while (courMIME != NULL) {
+ while (courMIME != nullptr) {
courEXT = courMIME->extList;
- while (courEXT != NULL) {
+ while (courEXT != nullptr) {
if (!_stricmp(courEXT->ext, ext)) {
return courMIME->mimeType;
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index a6126e8f51..fb821023f6 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -39,7 +39,7 @@ const char* pszDefaultShares[] = { "htdocs\\@settings\\index.xsl", "/index.xsl",
"htdocs\\@settings\\theme\\", "/theme/",
"htdocs\\", "/",
- 0, 0
+ nullptr, nullptr
};
void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP);
@@ -48,21 +48,21 @@ int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/); HNETLIBUSER hNetlibUser;
HANDLE hDirectBoundPort;
-HINSTANCE hInstance = NULL;
+HINSTANCE hInstance = nullptr;
CLIST_INTERFACE *pcli;
string sLogFilePath;
// static so they can not be used from other modules ( sourcefiles )
-static HANDLE hEventSystemInit = 0;
-static HANDLE hPreShutdown = 0;
+static HANDLE hEventSystemInit = nullptr;
+static HANDLE hPreShutdown = nullptr;
-static HANDLE hHttpAcceptConnectionsService = 0;
-static HANDLE hHttpAddChangeRemoveService = 0;
-static HANDLE hHttpGetShareService = 0;
-static HANDLE hHttpGetAllShares = 0;
+static HANDLE hHttpAcceptConnectionsService = nullptr;
+static HANDLE hHttpAddChangeRemoveService = nullptr;
+static HANDLE hHttpGetShareService = nullptr;
+static HANDLE hHttpGetAllShares = nullptr;
-static HGENMENU hAcceptConnectionsMenuItem = 0;
+static HGENMENU hAcceptConnectionsMenuItem = nullptr;
char szPluginPath[MAX_PATH] = { 0 };
int nPluginPathLen = 0;
@@ -77,7 +77,7 @@ int nMaxConnectionsPerUser = -1; int nDefaultDownloadLimit = -1;
bool bIsOnline = true;
-static HANDLE hEventProtoAck = 0;
+static HANDLE hEventProtoAck = nullptr;
bool bLimitOnlyWhenOnline = true;
@@ -121,7 +121,7 @@ bool bOpenLogFile() SHELLEXECUTEINFO st = { 0 };
st.cbSize = sizeof(st);
st.fMask = SEE_MASK_INVOKEIDLIST;
- st.hwnd = NULL;
+ st.hwnd = nullptr;
st.lpFile = sLogFilePath.c_str();
st.nShow = SW_SHOWDEFAULT;
ShellExecuteEx(&st);
@@ -134,7 +134,7 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) if (nLen < 0)
nLen = (int)mir_strlen(pszSrc);
DWORD dwBytesWritten;
- return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen);
+ return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, nullptr) && (dwBytesWritten == (DWORD)nLen);
}
@@ -154,13 +154,13 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) void LogEvent(const char * pszTitle, const char * pszLog)
{
- HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
- MessageBox(NULL, Translate("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK);
return;
}
- if (SetFilePointer(hFile, 0, 0, FILE_END) == INVALID_SET_FILE_POINTER) {
- MessageBox(NULL, Translate("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK);
+ if (SetFilePointer(hFile, 0, nullptr, FILE_END) == INVALID_SET_FILE_POINTER) {
+ MessageBox(nullptr, Translate("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK);
CloseHandle(hFile);
return;
}
@@ -179,7 +179,7 @@ void LogEvent(const char * pszTitle, const char * pszLog) !bWriteToFile(hFile, " : ") ||
!bWriteToFile(hFile, pszLog, nLogLen) ||
!bWriteToFile(hFile, "\r\n")) {
- MessageBox(NULL, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK);
}
CloseHandle(hFile);
}
@@ -232,13 +232,13 @@ bool bReadConfigurationFile() {
CLFileShareListAccess clCritSection;
- CLFileShareNode * pclLastNode = NULL;
+ CLFileShareNode * pclLastNode = nullptr;
char szBuf[1000];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szConfigFile);
HANDLE hFile = CreateFile(szBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return false;
@@ -257,14 +257,14 @@ bool bReadConfigurationFile() // append data to buffer
DWORD dwBytesRead = 0;
bEof = !ReadFile(hFile, &szBuf[dwBytesInBuffer], sizeof(szBuf) - dwBytesInBuffer,
- &dwBytesRead, NULL) || dwBytesRead <= 0;
+ &dwBytesRead, nullptr) || dwBytesRead <= 0;
pszCurPos = szBuf;
if (pszCurPos) {
- while (pszCurPos && (pszCurPos = strstr(pszCurPos, "<share>")) != NULL) {
+ while (pszCurPos && (pszCurPos = strstr(pszCurPos, "<share>")) != nullptr) {
pszCurPos += 7;
- char * pszColData[5] = { NULL };
+ char * pszColData[5] = {};
for (int n = 0; n < 5; n++) {
pszColData[n] = strstr(pszCurPos, ">");
if (!pszColData[n])
@@ -339,17 +339,17 @@ bool bWriteConfigurationFile() char szBuf[1000], temp[200];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szConfigFile);
- HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
mir_snprintf(temp, "%s%s", Translate("Failed to open or create file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
return false;
}
DWORD dwBytesWriten = 0;
- if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, NULL)) {
+ if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, nullptr)) {
mir_snprintf(temp, "%s%s", TranslateT("Failed to write xml header to file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
}
else {
CLFileShareNode *pclCur = pclFirstNode;
@@ -361,17 +361,17 @@ bool bWriteConfigurationFile() SplitIpAddress(pclCur->st.dwAllowedIP),
SplitIpAddress(pclCur->st.dwAllowedMask));
- if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, NULL)) {
+ if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, nullptr)) {
mir_snprintf(temp, "%s%s", Translate("Failed to write xml data to file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
break;
}
pclCur = pclCur->pclNext;
}
- if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, NULL)) {
+ if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, nullptr)) {
mir_snprintf(temp, "%s%s", Translate("Failed to write xml tail to file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
}
}
SetEndOfFile(hFile);
@@ -650,7 +650,7 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) char szTemp[200];
mir_snprintf(szTemp, Translate("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port"),
nlb.wPort == 80 ? "80" : nus.szIncomingPorts);
- MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK);
return 1001;
}
dwLocalPortUsed = nlb.wPort;
@@ -660,13 +660,13 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) }
else if (hDirectBoundPort && wparam == 0) {
Netlib_CloseHandle(hDirectBoundPort);
- hDirectBoundPort = 0;
+ hDirectBoundPort = nullptr;
Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
}
else return 0; // no changes;
if (!bShutdownInProgress)
- db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != 0);
+ db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != nullptr);
return 0;
}
@@ -744,7 +744,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) nlu.szDescriptiveName.a = Translate("HTTP Server");
hNetlibUser = Netlib_RegisterUser(& nlu);
if (!hNetlibUser) {
- MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
return 0;
}
@@ -810,7 +810,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) pclFirstNode = pclFirstNode->pclNext;
delete pclCur;
}
- pclFirstNode = NULL;
+ pclFirstNode = nullptr;
UnInitGuiElements();
@@ -858,49 +858,49 @@ extern "C" __declspec(dllexport) int Load() hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections);
if (!hHttpAcceptConnectionsService) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK);
return 1;
}
hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare);
if (!hHttpAddChangeRemoveService) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK);
return 1;
}
hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare);
if (!hHttpGetShareService) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK);
return 1;
}
hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares);
if (!hHttpGetAllShares) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK);
return 1;
}
hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
if (!hEventSystemInit) {
- MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK);
return 1;
}
hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
if (!hPreShutdown) {
- MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK);
return 1;
}
if (Profile_GetPathA(MAX_PATH, szPluginPath)) {
- MessageBox(NULL, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK);
return 1;
}
mir_strncat(szPluginPath, "\\HTTPServer\\", _countof(szPluginPath) - mir_strlen(szPluginPath));
int err = CreateDirectoryTree(szPluginPath);
if ((err != 0) && (err != ERROR_ALREADY_EXISTS)) {
- MessageBox(NULL, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK);
return 1;
}
@@ -910,7 +910,7 @@ extern "C" __declspec(dllexport) int Load() sLogFilePath += "HTTPServer.log";
if (!bInitMimeHandling())
- MessageBox(NULL, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK);
nMaxUploadSpeed = db_get_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed);
nMaxConnectionsTotal = db_get_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal);
diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index b64547ed7c..3c8a94d11a 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -67,12 +67,12 @@ extern "C" __declspec(dllexport) int Load(void) wndclass.lpfnWndProc = ProgressBarDlg;
wndclass.hInstance = hInst;
wndclass.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON));
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.lpszClassName = L"Progressbar";
RegisterClass(&wndclass);
- splitCursor = LoadCursor(NULL, IDC_SIZENS);
+ splitCursor = LoadCursor(nullptr, IDC_SIZENS);
HookEvent(ME_OPT_INITIALISE, InitOptionsDlg);
HookEvent(ME_DB_EVENT_ADDED, DBUpdate);
@@ -108,7 +108,7 @@ int InitOptionsDlg(WPARAM wParam, LPARAM) static INT_PTR LinkList_Main(WPARAM hContact, LPARAM)
{
HWND hWnd = WindowList_Find(hWindowList, hContact);
- if (hWnd != NULL) {
+ if (hWnd != nullptr) {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
int len = GetWindowTextLength(GetDlgItem(hWnd, IDC_MAIN));
@@ -118,7 +118,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) MEVENT hEvent = db_event_first(hContact);
if (hEvent == NULL) {
- MessageBox(NULL, TXT_EMPTYHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION));
+ MessageBox(nullptr, TXT_EMPTYHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION));
return 0;
}
@@ -132,10 +132,10 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) RECT DesktopRect;
GetWindowRect(GetDesktopWindow(), &DesktopRect);
- HWND hWndProgress = CreateWindow(L"Progressbar", TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, NULL, NULL, hInst, NULL);
- if (hWndProgress == NULL) {
+ HWND hWndProgress = CreateWindow(L"Progressbar", TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, hInst, nullptr);
+ if (hWndProgress == nullptr) {
mir_free(dbe.pBlob);
- MessageBox(NULL, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION );
+ MessageBox(nullptr, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION );
return -1;
}
SetWindowPos(hWndProgress, HWND_TOP, (int)((DesktopRect.right / 2) - 175), (int)((DesktopRect.bottom / 2) - 22), 0, 0, SWP_NOSIZE);
@@ -151,7 +151,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) if (ExtractURI(&dbe, hEvent, listStart) < 0) {
mir_free(dbe.pBlob);
RemoveList(listStart);
- MessageBox(NULL, TranslateT("Could not allocate memory!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION);
+ MessageBox(nullptr, TranslateT("Could not allocate memory!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION);
return -1;
}
}
@@ -172,7 +172,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) SendMessage(hWndProgress, WM_CLOSE, 0, 0);
if (ListCount(listStart) <= 0) {
RemoveList(listStart);
- MessageBox(NULL, TXT_NOLINKINHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION));
+ MessageBox(nullptr, TXT_NOLINKINHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION));
return 0;
}
@@ -183,11 +183,11 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) DlgParam->chrg.cpMax = -1;
DlgParam->chrg.cpMin = -1;
- HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), NULL, MainDlgProc, (LPARAM)DlgParam);
- if (hWndMain == NULL) {
+ HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), nullptr, MainDlgProc, (LPARAM)DlgParam);
+ if (hWndMain == nullptr) {
mir_free(DlgParam);
RemoveList(listStart);
- MessageBox(NULL, TranslateT("Could not create window!"), TranslateT("Error"), (MB_OK | MB_ICONEXCLAMATION));
+ MessageBox(nullptr, TranslateT("Could not create window!"), TranslateT("Error"), (MB_OK | MB_ICONEXCLAMATION));
return -1;
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index 563f2bc406..e039b792c8 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -88,7 +88,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) // This is used in srmm... and I think he knew what he did... :)
SendDlgItemMessage(hDlg, IDC_MAIN, EM_LIMITTEXT, (WPARAM)-1, 0);
- WriteLinkList(hDlg, WLL_ALL, (LISTELEMENT*)DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, WLL_ALL, (LISTELEMENT*)DlgParam->listStart, nullptr, 0);
return TRUE;
// open browser an load url if link is pressed
@@ -114,12 +114,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_LBUTTONUP:
link = (LPTSTR)mir_alloc((pENLink->chrg.cpMax - pENLink->chrg.cpMin + 2) * sizeof(wchar_t));
- if (link == NULL)
+ if (link == nullptr)
break;
SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM)&pENLink->chrg);
SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETSELTEXT, 0, (LPARAM)link);
- if (wcsstr(link, L"mailto:") != NULL)
- ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL);
+ if (wcsstr(link, L"mailto:") != nullptr)
+ ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL);
else {
bool openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF) != 0xFF;
Utils_OpenUrlW(link, openNewWindow);
@@ -138,7 +138,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) EnableMenuItem(hSubMenu, IDM_SHOWMESSAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
TranslateMenu(hSubMenu);
link = (LPTSTR)mir_alloc((pENLink->chrg.cpMax - pENLink->chrg.cpMin + 4) * sizeof(wchar_t));
- if (link == NULL)
+ if (link == nullptr)
break;
SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM)&pENLink->chrg);
SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETSELTEXT, 0, (LPARAM)link);
@@ -147,17 +147,17 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) pt.y = (short)HIWORD(pENLink->lParam);
ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, nullptr)) {
case IDM_LINK_OPEN:
- if (wcsstr(link, L"mailto:") != NULL)
- ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL);
+ if (wcsstr(link, L"mailto:") != nullptr)
+ ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL);
else
Utils_OpenUrlW(link, false);
break;
case IDM_LINK_OPENNEW:
- if (wcsstr(link, L"mailto:") != NULL)
- ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL);
+ if (wcsstr(link, L"mailto:") != nullptr)
+ ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL);
else
Utils_OpenUrlW(link);
break;
@@ -191,7 +191,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) listMenu = GetMenu(hDlg);
switch (wParam) {
case IDM_SEARCH: // open Search Box
- if (DlgParam != 0) {
+ if (DlgParam != nullptr) {
HWND hWndSearchDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCH_DLG), hDlg, SearchDlgProc, (LPARAM)DlgParam);
EnableMenuItem(listMenu, IDM_SEARCH, (MF_BYCOMMAND | MF_DISABLED | MF_GRAYED));
ShowWindow(hWndSearchDlg, SW_SHOW);
@@ -203,7 +203,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
SetDlgItemText(hDlg, IDC_MAIN, L"");
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
break;
case IDM_SAVE: // save button
@@ -224,12 +224,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L"");
if (GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED) {
CheckMenuItem(listMenu, IDM_DIR_IN, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
else {
CheckMenuItem(listMenu, IDM_DIR_IN, MF_CHECKED);
CheckMenuItem(listMenu, IDM_DIR_OUT, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
GetFilterText(GetMenu(hDlg), filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -243,12 +243,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L"");
if (GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED) {
CheckMenuItem(listMenu, IDM_DIR_OUT, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
else {
CheckMenuItem(listMenu, IDM_DIR_OUT, MF_CHECKED);
CheckMenuItem(listMenu, IDM_DIR_IN, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -263,12 +263,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L"");
if (GetMenuState(listMenu, IDM_TYPE_WEB, MF_BYCOMMAND) == MF_CHECKED) {
CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
else {
CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_CHECKED);
CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -280,12 +280,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L"");
if (GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_CHECKED) {
CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
else {
CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_CHECKED);
CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_UNCHECKED);
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
}
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -311,8 +311,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE:
Utils_ResizeDialog(hDlg, hInst, MAKEINTRESOURCEA(IDD_MAIN_DLG), LinklistResizer, (LPARAM)DlgParam);
// To get some scrollbars if needed...
- RedrawWindow(GetDlgItem(hDlg, IDC_MAIN), NULL, NULL, RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(hDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hDlg, IDC_MAIN), nullptr, nullptr, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hDlg, IDC_MESSAGE), nullptr, nullptr, RDW_INVALIDATE);
break;
case DM_LINKSPLITTER:
@@ -341,7 +341,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_DESTROY:
- if (DlgParam != NULL) {
+ if (DlgParam != nullptr) {
hContact = ((db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact);
Utils_SaveWindowPosition(hDlg, hContact, LINKLIST_MODULE, "Linklist");
db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_SPLITPOS, DlgParam->splitterPosNew);
@@ -386,7 +386,7 @@ INT_PTR CALLBACK SearchDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam wchar_t filter[FILTERTEXT];
HWND hListDlg = WindowList_Find(hWindowList, DlgParam->hContact);
- if (hListDlg == NULL)
+ if (hListDlg == nullptr)
break;
SetDlgItemText(hListDlg, IDC_MAIN, L"");
@@ -587,7 +587,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l else {
int mCol = GetMirandaColour(&colourSet);
if (mCol == 1) {
- MessageBox(NULL, TXT_NOSETTING, TXT_ERROR, MB_OK | MB_ICONEXCLAMATION);
+ MessageBox(nullptr, TXT_NOSETTING, TXT_ERROR, MB_OK | MB_ICONEXCLAMATION);
CheckDlgButton(hDlg, IDC_CHECK1, BST_UNCHECKED);
break;
}
@@ -733,7 +733,7 @@ LRESULT CALLBACK ProgressBarDlg(HWND hwnd, UINT message, WPARAM wParam, LPARAM l switch (message) {
case WM_CREATE:
- hwndPB = CreateWindowEx(0, PROGRESS_CLASS, L"", WS_CHILD | WS_VISIBLE, 0, 2, 343, 17, hwnd, NULL, hInst, NULL);
+ hwndPB = CreateWindowEx(0, PROGRESS_CLASS, L"", WS_CHILD | WS_VISIBLE, 0, 2, 343, 17, hwnd, nullptr, hInst, nullptr);
SendMessage(hwndPB, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
return 0;
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 977b934ccd..21ad54c0a2 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -51,7 +51,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wchar_t templink[LINK_MAX + 1];
wchar_t dbdate[DATE_SIZE + TIME_SIZE];
- if (listStart == NULL)
+ if (listStart == nullptr)
return -1;
link[0] = 0;
@@ -59,7 +59,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) time[0] = 0;
msg = DbEvent_GetTextW(dbei, CP_ACP);
- if (msg == NULL)
+ if (msg == nullptr)
return 0;
for (i = 0; msg[i]; ) {
@@ -104,7 +104,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wordlen = (i - wordStart + 1);
word = (LPTSTR)mir_alloc(wordlen * sizeof(wchar_t));
wordsearch = (LPTSTR)mir_alloc(wordlen * sizeof(wchar_t));
- if (word == NULL || wordsearch == NULL) {
+ if (word == nullptr || wordsearch == nullptr) {
mir_free(word);
mir_free(wordsearch);
linkFound = -1;
@@ -138,7 +138,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) }
if (isLink && wordlen <= LINK_MAX) {
- if (wcsstr(wordsearch, L"www.") != NULL && wcsstr(wordsearch, L"http://") == NULL && wcsstr(wordsearch, L"https://") == NULL) {
+ if (wcsstr(wordsearch, L"www.") != nullptr && wcsstr(wordsearch, L"http://") == nullptr && wcsstr(wordsearch, L"https://") == nullptr) {
wcsncpy_s(link, L"http://", LINK_MAX);
wcsncat_s(link, word, LINK_MAX);
} else {
@@ -147,7 +147,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) TimeZone_ToStringT(dbei->timestamp, L"d-t", dbdate, _countof(dbdate));
date_ptr = wcstok_s(dbdate, L"-", &tok_ctx);
- time_ptr = wcstok_s(NULL, L"-", &tok_ctx);
+ time_ptr = wcstok_s(nullptr, L"-", &tok_ctx);
wcsncpy_s(date, date_ptr, _TRUNCATE);
wcsncpy_s(time, time_ptr, _TRUNCATE);
@@ -156,7 +156,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) else
direction = DIRECTION_IN;
- if (type == LINK_MAIL && wcsstr(link, L"mailto:") == NULL) {
+ if (type == LINK_MAIL && wcsstr(link, L"mailto:") == nullptr) {
wcsncpy_s(templink, link, _TRUNCATE);
wcsncpy_s(link, L"mailto:", _TRUNCATE);
wcsncpy_s((link + _mstrlen(L"mailto:")), (_countof(link) - _mstrlen(L"mailto:")), templink, _TRUNCATE);
@@ -164,7 +164,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) // Add new Element to list:
newElement = (LISTELEMENT*)mir_alloc(sizeof(LISTELEMENT));
- if (newElement == NULL) {
+ if (newElement == nullptr) {
linkFound = -1;
break;
}
@@ -177,7 +177,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) newElement->hEvent = hEvent;
actualElement = listStart;
- while (actualElement->nextElement != NULL) {
+ while (actualElement->nextElement != nullptr) {
actualElement = actualElement->nextElement;
}
@@ -200,11 +200,11 @@ int RemoveList(LISTELEMENT *listStart) {
LISTELEMENT *actualElement, *tempElement;
- if ( listStart == NULL )
+ if ( listStart == nullptr )
return -1;
actualElement = listStart->nextElement;
- while ( actualElement != NULL )
+ while ( actualElement != nullptr )
{
tempElement = actualElement->nextElement;
mir_free(actualElement);
@@ -223,11 +223,11 @@ int ListCount(LISTELEMENT *listStart) LISTELEMENT *actualElement;
int count = 0;
- if ( listStart == NULL )
+ if ( listStart == nullptr )
return -1;
actualElement = listStart->nextElement;
- while ( actualElement != NULL )
+ while ( actualElement != nullptr )
{
count++;
actualElement = actualElement->nextElement;
@@ -245,7 +245,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc {
CHARFORMAT2 cf;
PARAFORMAT2 pf;
- HWND hwndProgress = NULL;
+ HWND hwndProgress = nullptr;
RECT DesktopRect;
MYCOLOURSET colourSet;
wchar_t textLine[LINK_MAX + DIR_SIZE + TIME_SIZE + TYPE_SIZE + 6];
@@ -295,7 +295,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc pf.wAlignment = PFA_LEFT;
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETPARAFORMAT, FALSE, (LPARAM) &pf);
- if ( searchString != NULL )
+ if ( searchString != nullptr )
{
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
@@ -342,17 +342,17 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc {
// Create Progressbar
GetWindowRect(GetDesktopWindow(), &DesktopRect);
- hwndProgress = CreateWindow(L"Progressbar", TranslateT("Processing list..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, NULL, NULL, hInst, NULL);
+ hwndProgress = CreateWindow(L"Progressbar", TranslateT("Processing list..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, hInst, nullptr);
SetWindowPos(hwndProgress,HWND_TOP,(int)(DesktopRect.right*0.5)-175,(int)(DesktopRect.bottom*0.5)-22,0,0,SWP_NOSIZE);
- if ( hwndProgress != NULL )
+ if ( hwndProgress != nullptr )
{
ShowWindow(hwndProgress, SW_SHOW);
SetForegroundWindow(hwndProgress);
}
}
- while ( actualElement != NULL )
+ while ( actualElement != nullptr )
{
filter1 = 0;
filter2 = 0;
@@ -371,7 +371,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc filter2 = 1;
- if ( searchString != NULL )
+ if ( searchString != nullptr )
{
if ( params & SLL_DEEP )
{
@@ -478,7 +478,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc if ((actCount < listCount) && (append == 0) && (options.showLine != 0))
DrawLine(hDlg, lineLen);
}
- else if ( searchString == NULL )
+ else if ( searchString == nullptr )
{
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
@@ -519,7 +519,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETEVENTMASK, 0, (LPARAM)ENM_LINK);
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_AUTOURLDETECT, TRUE, 0);
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETBKGNDCOLOR, FALSE, BGColourSel);
- SetDlgItemText(hDlg, IDC_OPTIONS_RE, NULL);
+ SetDlgItemText(hDlg, IDC_OPTIONS_RE, nullptr);
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
@@ -608,7 +608,7 @@ Write Message to window void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos)
{
LISTELEMENT *actualElement = listStart->nextElement;
- while (actualElement != NULL) {
+ while (actualElement != nullptr) {
if (actualElement->linePos == actLinePos) {
MEVENT hEvent = actualElement->hEvent;
if (hEvent != NULL ) {
@@ -618,7 +618,7 @@ void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos) db_event_get(hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
LPCTSTR msg = DbEvent_GetTextW(&dbe, CP_ACP);
- SetDlgItemText(hDlg, IDC_MESSAGE, NULL);
+ SetDlgItemText(hDlg, IDC_MESSAGE, nullptr);
SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
mir_free((void*)msg);
mir_free(dbe.pBlob);
@@ -744,7 +744,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz *realElementCount = 0;
actualElement = listStart->nextElement;
- while ( actualElement != NULL )
+ while ( actualElement != nullptr )
{
(*realElementCount)++;
@@ -762,7 +762,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz else if ( (params & WLL_URL) && (actualElement->type == LINK_URL))
filter2 = 1;
- if ( searchString != NULL )
+ if ( searchString != nullptr )
{
if ( params & SLL_DEEP )
{
@@ -906,11 +906,11 @@ void ClearLinePos(LISTELEMENT *listStart) {
LISTELEMENT *actualElement;
- if ( listStart == NULL )
+ if ( listStart == nullptr )
return;
actualElement = listStart->nextElement;
- while ( actualElement != NULL )
+ while ( actualElement != nullptr )
{
actualElement->linePos = -1;
actualElement = actualElement->nextElement;
@@ -922,11 +922,11 @@ int GetLastLinePos(LISTELEMENT *listStart) LISTELEMENT *actualElement;
int maxPos = -1;
- if ( listStart == NULL )
+ if ( listStart == nullptr )
return -1;
actualElement = listStart->nextElement;
- while ( actualElement != NULL )
+ while ( actualElement != nullptr )
{
if ( actualElement->linePos > maxPos )
maxPos = actualElement->linePos;
@@ -1187,7 +1187,7 @@ int DBUpdate(WPARAM wParam, LPARAM hEvent) // Call function to find URIs
linkNum = ExtractURI(&dbe, hEvent, DlgParam->listStart);
if ( linkNum > 0 )
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, linkNum);
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, linkNum);
}
mir_free(dbe.pBlob);
}
@@ -1256,8 +1256,8 @@ BOOL SaveEditAsStream( HWND hDlg ) if ( ! GetSaveFileName( &ofn ))
return FALSE;
// Create the specified file
- hFile = CreateFile( szFilename, GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
+ hFile = CreateFile( szFilename, GENERIC_WRITE, 0, nullptr,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr );
// Quit if file creation fails
if ( hFile == INVALID_HANDLE_VALUE )
return FALSE;
@@ -1281,7 +1281,7 @@ DWORD CALLBACK RTFSaveStreamCallback(DWORD_PTR dwCookie, LPBYTE lpBuffer, LONG l // Initialize "amount read" variable for WriteFile()
*plRead = 0;
// dwCookie is the file handle
- WriteFile( (HANDLE)dwCookie, lpBuffer, lSize, (LPDWORD)plRead, NULL );
+ WriteFile( (HANDLE)dwCookie, lpBuffer, lSize, (LPDWORD)plRead, nullptr );
// Continue, if needed
return 0;
}
diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp index 0bd72c9e5a..4ecbe3932d 100644 --- a/plugins/HistoryStats/src/bandctrlimpl.cpp +++ b/plugins/HistoryStats/src/bandctrlimpl.cpp @@ -37,12 +37,12 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_KILLFOCUS:
if (pCtrl->m_nCurFocused != -1) {
pCtrl->m_nCurFocused = -1;
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE);
}
return 0;
case WM_ENABLE:
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE);
return 0;
case WM_GETFONT:
@@ -54,7 +54,7 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_WINDOWPOSCHANGED:
pCtrl->recalcButtonRects();
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE);
return 0;
case WM_KEYDOWN:
@@ -139,7 +139,7 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, assert(static_cast<int>(wParam) >= 0);
pCtrl->m_nLayout = wParam;
pCtrl->recalcButtonRects();
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE);
return 0;
case BCM_GETBUTTONRECT:
@@ -167,12 +167,12 @@ bool BandCtrlImpl::registerClass() 0, // cbClsExtra
sizeof(BandCtrlImpl*), // cbWndExtra
g_hInst, // hInstance
- NULL, // hIcon
- NULL, // hCursor
- NULL, // hbrBackground
- NULL, // lpszMenuName
+ nullptr, // hIcon
+ nullptr, // hCursor
+ nullptr, // hbrBackground
+ nullptr, // lpszMenuName
m_ClassName, // lpszClassName
- NULL // hIconSm
+ nullptr // hIconSm
};
if (!RegisterClassEx(&wcx))
@@ -187,10 +187,10 @@ void BandCtrlImpl::unregisterClass() }
BandCtrlImpl::BandCtrlImpl(HWND hWnd, UINT_PTR nOwnId) :
- m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(NULL),
- m_hTheme(NULL), m_hImageList(NULL), m_hImageListD(NULL), m_hTooltip(NULL),
+ m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(nullptr),
+ m_hTheme(nullptr), m_hImageList(nullptr), m_hImageListD(nullptr), m_hTooltip(nullptr),
m_nCurHot(-1), m_nCurFocused(-1), m_nCurPressed(-1), m_bCurPressedDD(false),
- m_nLayout(0), m_nDDWidth(12), m_hDDIcon(NULL)
+ m_nLayout(0), m_nDDWidth(12), m_hDDIcon(nullptr)
{
m_IconSize.cx = m_IconSize.cy;
m_hDDIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DROPDOWN), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
@@ -202,22 +202,22 @@ BandCtrlImpl::~BandCtrlImpl() {
if (m_hTooltip) {
DestroyWindow(m_hTooltip);
- m_hTooltip = NULL;
+ m_hTooltip = nullptr;
}
if (m_hImageList) {
ImageList_Destroy(m_hImageList);
- m_hImageList = NULL;
+ m_hImageList = nullptr;
}
if (m_hImageListD) {
ImageList_Destroy(m_hImageListD);
- m_hImageListD = NULL;
+ m_hImageListD = nullptr;
}
if (m_hTheme) {
CloseThemeData(m_hTheme);
- m_hTheme = NULL;
+ m_hTheme = nullptr;
}
if (m_hDDIcon) {
@@ -231,7 +231,7 @@ void BandCtrlImpl::onWMPaint() // start painting
PAINTSTRUCT ps;
HDC hRealDC = BeginPaint(m_hWnd, &ps);
- if (hRealDC == NULL)
+ if (hRealDC == nullptr)
return;
// get rect for painting
@@ -242,23 +242,23 @@ void BandCtrlImpl::onWMPaint() HDC hDC = CreateCompatibleDC(hRealDC);
HBITMAP hMemBitmap = CreateCompatibleBitmap(hRealDC, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top);
HBITMAP hOldBitmap = reinterpret_cast<HBITMAP>(SelectObject(hDC, hMemBitmap));
- SetWindowOrgEx(hDC, ps.rcPaint.left, ps.rcPaint.top, NULL);
+ SetWindowOrgEx(hDC, ps.rcPaint.left, ps.rcPaint.top, nullptr);
// fill background
bool bBandEnabled = bool_(IsWindowEnabled(m_hWnd));
SetBkColor(hDC, GetSysColor(bBandEnabled ? COLOR_WINDOW : COLOR_BTNFACE));
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rOut, NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rOut, nullptr, 0, nullptr);
// draw top and bottom line
if (bBandEnabled) {
RECT rLine = { rOut.left, rOut.top, rOut.right, rOut.top + 1 };
SetBkColor(hDC, GetSysColor(COLOR_3DSHADOW));
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, nullptr, 0, nullptr);
rLine.top = (rLine.bottom = rOut.bottom) - 1;
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, nullptr, 0, nullptr);
}
// draw items
@@ -315,7 +315,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab if (bEnabled)
state = bPressed ? (m_bCurPressedDD ? TS_PRESSED : TS_HOT) : (item.bChecked ? (bHot ? TS_HOTCHECKED : TS_CHECKED) : (bHot ? TS_HOT : TS_NORMAL));
- DrawThemeBackground(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, state, &rDropDown, NULL);
+ DrawThemeBackground(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, state, &rDropDown, nullptr);
}
else {
--rDropDown.left;
@@ -331,7 +331,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab int x = rDropDown.left + (rDropDown.right - rDropDown.left - OS::smIconCX()) / 2;
int y = rDropDown.top + (rDropDown.bottom - rDropDown.top - OS::smIconCY()) / 2;
- DrawState(hDC, NULL, NULL, reinterpret_cast<LPARAM>(m_hDDIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | (bEnabled ? 0 : DSS_DISABLED));
+ DrawState(hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(m_hDDIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | (bEnabled ? 0 : DSS_DISABLED));
}
}
@@ -342,7 +342,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab if (bEnabled)
state = bPressed ? (!m_bCurPressedDD ? TS_PRESSED : TS_HOT) : (item.bChecked ? (bHot ? TS_HOTCHECKED : TS_CHECKED) : (bHot ? TS_HOT : TS_NORMAL));
- DrawThemeBackground(m_hTheme, hDC, part, state, &rItem, NULL);
+ DrawThemeBackground(m_hTheme, hDC, part, state, &rItem, nullptr);
}
else {
UINT state = 0;
@@ -379,7 +379,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab ImageList_Draw(m_hImageListD, item.nIconD, hDC, x, y, ILD_NORMAL);
else {
HICON hIcon = ImageList_GetIcon(m_hImageList, item.nIcon, 0);
- DrawState(hDC, NULL, NULL, reinterpret_cast<LPARAM>(hIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | DSS_DISABLED);
+ DrawState(hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(hIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | DSS_DISABLED);
DestroyIcon(hIcon);
}
}
@@ -396,12 +396,12 @@ void BandCtrlImpl::reloadTheme() {
if (m_hTheme) {
CloseThemeData(m_hTheme);
- m_hTheme = NULL;
+ m_hTheme = nullptr;
}
m_nDDWidth = 12;
- m_hTheme = OpenThemeData(0, L"TOOLBAR");
+ m_hTheme = OpenThemeData(nullptr, L"TOOLBAR");
recalcButtonRects();
}
@@ -411,11 +411,11 @@ HICON BandCtrlImpl::convertToGray(HICON hIcon) // preserves transparency
// works only for 32bit icons
- HICON hIconDisabled = NULL;
+ HICON hIconDisabled = nullptr;
ICONINFO ii;
if (!GetIconInfo(hIcon, &ii))
- return NULL;
+ return nullptr;
BITMAP bmp;
if (GetObject(ii.hbmColor, sizeof(bmp), &bmp) && bmp.bmBitsPixel == 32) {
@@ -536,7 +536,7 @@ void BandCtrlImpl::onBCMShowButton(int nItem, bool bShow) if (bShow != id.bVisible) {
id.bVisible = bShow;
recalcButtonRects();
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
}
}
@@ -556,7 +556,7 @@ void BandCtrlImpl::onBCMEnableButton(int nItem, bool bEnable) if (bEnable != id.bEnabled) {
id.bEnabled = bEnable;
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
}
}
@@ -603,7 +603,7 @@ void BandCtrlImpl::recalcButtonRects() m_hWnd, // hwnd
m_Items[i].uTTId, // uId
m_Items[i].rItem, // rect
- NULL, // hInstance
+ nullptr, // hInstance
const_cast<wchar_t*>(m_Items[i].tooltip.c_str()), // lpszText
};
@@ -622,9 +622,9 @@ void BandCtrlImpl::recalcButtonRects() else if (m_Items[i].uTTId == -1 && m_Items[i].bVisible && !m_Items[i].tooltip.empty()) {
// add a tooltip, if we don't have a tooltip but are now visible
if (!m_hTooltip)
- m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL);
+ m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr);
- TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i+1), m_Items[i].rItem, NULL,
+ TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i+1), m_Items[i].rItem, nullptr,
const_cast<wchar_t*>(m_Items[i].tooltip.c_str()), // lpszText
};
@@ -740,7 +740,7 @@ void BandCtrlImpl::onWMKeyDown(int nVirtKey) if (nNext != -1 && nNext != m_nCurFocused) {
m_nCurFocused = nNext;
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
}
}
else if (nVirtKey == VK_LEFT) {
@@ -748,7 +748,7 @@ void BandCtrlImpl::onWMKeyDown(int nVirtKey) if (nPrev != -1 && nPrev != m_nCurFocused) {
m_nCurFocused = nPrev;
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
}
}
else if (nVirtKey == VK_SPACE) {
@@ -821,7 +821,7 @@ void BandCtrlImpl::onWMMouseMove(POINTS pts) }
if (m_nCurHot != -1) {
- SetTimer(m_hWnd, m_PollId, m_PollDelay, NULL);
+ SetTimer(m_hWnd, m_PollId, m_PollDelay, nullptr);
}
}
diff --git a/plugins/HistoryStats/src/canvas.cpp b/plugins/HistoryStats/src/canvas.cpp index 945b22351b..215f631104 100644 --- a/plugins/HistoryStats/src/canvas.cpp +++ b/plugins/HistoryStats/src/canvas.cpp @@ -31,8 +31,8 @@ void Canvas::updateTrans(BYTE* pData) Canvas::Canvas(int nWidth, int nHeight) : m_nChannels(4), m_nWidth(nWidth),
m_nHeight(nHeight), m_nLineLength((m_nChannels * m_nWidth + 3) & ~0x3),
- m_bTransColor(false), m_TransColor(0), m_pBMIH(NULL), m_hDC(0),
- m_hBmp(0), m_hOldBmp(0)
+ m_bTransColor(false), m_TransColor(0), m_pBMIH(nullptr), m_hDC(nullptr),
+ m_hBmp(nullptr), m_hOldBmp(nullptr)
{}
Canvas::~Canvas()
@@ -65,7 +65,7 @@ void Canvas::fillBackground(COLORREF bkColor) RECT rAll = { 0, 0, m_nWidth, m_nHeight };
SetBkColor(hDC, bkColor);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rAll, NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rAll, nullptr, 0, nullptr);
endDraw();
}
@@ -87,10 +87,10 @@ HDC Canvas::beginDraw() m_pBMIH->biClrUsed = 0;
m_pBMIH->biClrImportant = 0;
- BYTE* pData = 0;
+ BYTE* pData = nullptr;
- m_hDC = CreateCompatibleDC(NULL);
- m_hBmp = CreateDIBSection(m_hDC, reinterpret_cast<BITMAPINFO*>(m_pBMIH), DIB_RGB_COLORS, reinterpret_cast<void**>(&pData), NULL, 0);
+ m_hDC = CreateCompatibleDC(nullptr);
+ m_hBmp = CreateDIBSection(m_hDC, reinterpret_cast<BITMAPINFO*>(m_pBMIH), DIB_RGB_COLORS, reinterpret_cast<void**>(&pData), nullptr, 0);
}
m_hOldBmp = SelectObject(m_hDC, m_hBmp);
@@ -101,7 +101,7 @@ HDC Canvas::beginDraw() void Canvas::endDraw()
{
SelectObject(m_hDC, m_hOldBmp);
- m_hOldBmp = NULL;
+ m_hOldBmp = nullptr;
}
bool Canvas::getDigest(Digest& digest)
diff --git a/plugins/HistoryStats/src/colbase_words.cpp b/plugins/HistoryStats/src/colbase_words.cpp index 9f80ba1f92..e45c77e019 100644 --- a/plugins/HistoryStats/src/colbase_words.cpp +++ b/plugins/HistoryStats/src/colbase_words.cpp @@ -164,7 +164,7 @@ void ColBaseWords::parseMsg(WordMap* pWords, const ext::string& msg, bool bOutgo }
ColBaseWords::ColBaseWords() : m_nSource(2), m_nMinLength(1), m_nMaxLength(0), m_bFilterLinks(true),
- m_hSource(NULL), m_hMinLength(NULL), m_hMaxLength(NULL), m_hFilterLinks(NULL),
+ m_hSource(nullptr), m_hMinLength(nullptr), m_hMaxLength(nullptr), m_hFilterLinks(nullptr),
m_bFilterMessages(false), m_bFilterWords(false)
{
}
@@ -221,7 +221,7 @@ void ColBaseWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp;
hTemp = Opt.insertGroup (hGroup, TranslateT("Extract words from"));
- m_hSource = Opt.insertRadio (hTemp, NULL, TranslateT("Incoming messages"));
+ m_hSource = Opt.insertRadio (hTemp, nullptr, TranslateT("Incoming messages"));
Opt.insertRadio (hTemp, m_hSource, TranslateT("Outgoing messages"));
Opt.insertRadio (hTemp, m_hSource, TranslateT("All messages"));
m_hMinLength = Opt.insertEdit(hGroup, TranslateT("Ignore words shorter than (chars)"), L"", OptionsCtrl::OCF_NUMBER);
@@ -308,7 +308,7 @@ void ColBaseWords::impl_contactDataFree(Contact& contact) const WordMap* pData = reinterpret_cast<WordMap*>(contact.getSlot(contactDataSlotGet()));
if (pData) {
delete pData;
- contact.setSlot(contactDataSlotGet(), NULL);
+ contact.setSlot(contactDataSlotGet(), nullptr);
}
}
diff --git a/plugins/HistoryStats/src/column.cpp b/plugins/HistoryStats/src/column.cpp index 1a0d85f2fb..51d9967873 100644 --- a/plugins/HistoryStats/src/column.cpp +++ b/plugins/HistoryStats/src/column.cpp @@ -85,7 +85,7 @@ Column* Column::fromUID(const ext::string& guid) return getColInfo(i).m_pFactory->makeInstance();
}
- return NULL;
+ return nullptr;
}
void Column::registerUID(FactoryBase* pFactory)
@@ -147,7 +147,7 @@ Column* Column::clone() const void Column::outputBegin()
{
- int restrictions = configGetRestrictions(NULL);
+ int restrictions = configGetRestrictions(nullptr);
m_bUsePNG =
m_pSettings->isPNGOutputActiveAndAvailable() && // do we want PNG output?
diff --git a/plugins/HistoryStats/src/column_chatduration.cpp b/plugins/HistoryStats/src/column_chatduration.cpp index 96af1bc4aa..fba75dbfc4 100644 --- a/plugins/HistoryStats/src/column_chatduration.cpp +++ b/plugins/HistoryStats/src/column_chatduration.cpp @@ -5,7 +5,7 @@ * ColChatDuration
*/
ColChatDuration::ColChatDuration() : m_nVisMode(3), m_bGraph(true), m_bDetail(true),
- m_hVisMode(NULL), m_hGraph(NULL), m_hDetail(NULL), m_nMaxForGraph(0)
+ m_hVisMode(nullptr), m_hGraph(nullptr), m_hDetail(nullptr), m_nMaxForGraph(0)
{
}
@@ -37,7 +37,7 @@ void ColChatDuration::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup OptionsCtrl::Item hTemp;
hTemp = Opt.insertGroup(hGroup, TranslateT("Chat duration type"));
- m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Minimum"));
+ m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Minimum"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Average"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Maximum"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Total (sum of all chats)"));
@@ -217,7 +217,7 @@ void ColChatDuration::impl_outputRenderRow(ext::ostream& tos, const Contact& con HDC hDC = canvas.beginDraw();
SetBkColor(hDC, con::ColorBar);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, barW, 15), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, barW, 15), nullptr, 0, nullptr);
canvas.endDraw();
diff --git a/plugins/HistoryStats/src/column_events.cpp b/plugins/HistoryStats/src/column_events.cpp index bdee38136a..016558f0ca 100644 --- a/plugins/HistoryStats/src/column_events.cpp +++ b/plugins/HistoryStats/src/column_events.cpp @@ -6,7 +6,7 @@ */
ColEvents::ColEvents()
- : m_nSource(5), m_hSource(NULL)
+ : m_nSource(5), m_hSource(nullptr)
{
}
diff --git a/plugins/HistoryStats/src/column_inout.cpp b/plugins/HistoryStats/src/column_inout.cpp index d305783e91..4a7ab6aec8 100644 --- a/plugins/HistoryStats/src/column_inout.cpp +++ b/plugins/HistoryStats/src/column_inout.cpp @@ -7,7 +7,7 @@ ColInOut::ColInOut()
: m_nSource(2), m_bAbsolute(false), m_nAbsTime(1),
- m_hSource(NULL), m_hAbsolute(NULL), m_hAbsTime(NULL)
+ m_hSource(nullptr), m_hAbsolute(nullptr), m_hAbsTime(nullptr)
{
}
@@ -40,9 +40,9 @@ void ColInOut::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
hTemp = Opt.insertGroup(hGroup, TranslateT("Display as"));
- m_hAbsolute = Opt.insertRadio(hTemp, NULL, TranslateT("Absolute"));
+ m_hAbsolute = Opt.insertRadio(hTemp, nullptr, TranslateT("Absolute"));
m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, TranslateT("Average"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, TranslateT("Units per day"));
+ m_hAbsTime = Opt.insertRadio(m_hAbsolute, nullptr, TranslateT("Units per day"));
Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per week"));
Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per month (30 days)"));
diff --git a/plugins/HistoryStats/src/column_inoutgraph.cpp b/plugins/HistoryStats/src/column_inoutgraph.cpp index e448e40b73..f5f10559fd 100644 --- a/plugins/HistoryStats/src/column_inoutgraph.cpp +++ b/plugins/HistoryStats/src/column_inoutgraph.cpp @@ -8,8 +8,8 @@ ColInOutGraph::ColInOutGraph()
: m_nSource(0), m_bAbsolute(false), m_nAbsTime(1), m_bShowSum(true),
m_bDetail(true), m_bDetailPercent(false), m_bDetailInvert(false), m_bGraphPercent(true),
- m_hSource(NULL), m_hAbsolute(NULL), m_hAbsTime(NULL), m_hShowSum(NULL),
- m_hDetail(NULL), m_hDetailPercent(NULL), m_hDetailInvert(NULL), m_hGraphPercent(NULL)
+ m_hSource(nullptr), m_hAbsolute(nullptr), m_hAbsTime(nullptr), m_hShowSum(nullptr),
+ m_hDetail(nullptr), m_hDetailPercent(nullptr), m_hDetailInvert(nullptr), m_hGraphPercent(nullptr)
{
}
@@ -56,13 +56,13 @@ void ColInOutGraph::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp;
hTemp = Opt.insertGroup(hGroup, TranslateT("Data source"));
- m_hSource = Opt.insertRadio(hTemp, NULL, TranslateT("Characters"));
+ m_hSource = Opt.insertRadio(hTemp, nullptr, TranslateT("Characters"));
Opt.insertRadio(hTemp, m_hSource, TranslateT("Messages"));
Opt.insertRadio(hTemp, m_hSource, TranslateT("Chats"));
hTemp = Opt.insertGroup(hGroup, TranslateT("Display as"));
- m_hAbsolute = Opt.insertRadio(hTemp, NULL, TranslateT("Absolute"));
+ m_hAbsolute = Opt.insertRadio(hTemp, nullptr, TranslateT("Absolute"));
m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, TranslateT("Average"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, TranslateT("Units per day"));
+ m_hAbsTime = Opt.insertRadio(m_hAbsolute, nullptr, TranslateT("Units per day"));
Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per week"));
Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per month (30 days)"));
m_hShowSum = Opt.insertCheck(hGroup, TranslateT("Show sum of incoming and outgoing"));
@@ -272,10 +272,10 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta HDC hDC = canvas.beginDraw();
SetBkColor(hDC, con::ColorOut);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, outW, 15), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, outW, 15), nullptr, 0, nullptr);
SetBkColor(hDC, con::ColorIn);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(100 - inW, 0, 100, 15), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(100 - inW, 0, 100, 15), nullptr, 0, nullptr);
if (m_bGraphPercent)
{
diff --git a/plugins/HistoryStats/src/column_nick.cpp b/plugins/HistoryStats/src/column_nick.cpp index 4ab72104ec..948656d5d1 100644 --- a/plugins/HistoryStats/src/column_nick.cpp +++ b/plugins/HistoryStats/src/column_nick.cpp @@ -8,8 +8,8 @@ ColNick::ColNick()
: m_bDetail(true)
, m_bContactCount(true)
- , m_hDetail(NULL)
- , m_hContactCount(NULL)
+ , m_hDetail(nullptr)
+ , m_hContactCount(nullptr)
{
}
diff --git a/plugins/HistoryStats/src/column_split.cpp b/plugins/HistoryStats/src/column_split.cpp index 512875a3c0..7b6c7b8b6b 100644 --- a/plugins/HistoryStats/src/column_split.cpp +++ b/plugins/HistoryStats/src/column_split.cpp @@ -9,9 +9,9 @@ ColSplit::ColSplit() : m_nSource(0), m_nSourceType(2), m_nVisMode(0),
m_nBlockUnit(0), m_nUnitsPerBlock(6), m_nBlocks(28), m_nGraphAlign(1),
m_bDetail(true),
- m_hSource(NULL), m_hVisMode(NULL),
- m_hBlockUnit(NULL), m_hUnitsPerBlock(NULL), m_hBlocks(NULL), m_hGraphAlign(NULL),
- m_hDetail(NULL),
+ m_hSource(nullptr), m_hVisMode(nullptr),
+ m_hBlockUnit(nullptr), m_hUnitsPerBlock(nullptr), m_hBlocks(nullptr), m_hGraphAlign(nullptr),
+ m_hDetail(nullptr),
m_nTimeDiv(3600), m_nTimeMod(24), m_nTimeOffset(0)
{
}
@@ -61,7 +61,7 @@ void ColSplit::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
hTemp = Opt.insertGroup(hGroup, TranslateT("\"Split\" type"));
- m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day"));
+ m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Hours of day"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week"));
hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Custom (for experts only)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
hTemp = Opt.insertGroup(hTempRadio, TranslateT("Column setup"));
@@ -69,7 +69,7 @@ void ColSplit::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per bar"), L"", OptionsCtrl::OCF_NUMBER);
m_hBlocks = Opt.insertEdit (hTemp, TranslateT("Bars per graph"), L"", OptionsCtrl::OCF_NUMBER);
hTemp = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment"));
- m_hGraphAlign = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary"));
+ m_hGraphAlign = Opt.insertRadio(hTemp, nullptr, TranslateT("Align on day boundary"));
Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary"));
m_hDetail = Opt.insertCheck(hGroup, TranslateT("Details for every bar (tooltip)"));
@@ -188,7 +188,7 @@ void ColSplit::impl_contactDataFree(Contact& contact) const if (pData)
{
delete[] pData;
- contact.setSlot(contactDataSlotGet(), NULL);
+ contact.setSlot(contactDataSlotGet(), nullptr);
}
}
@@ -389,7 +389,7 @@ void ColSplit::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D {
int bar_len = (50 * part_top + top - 1) / top;
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(j * 5, 50 - bar_len, j * 5 + 4, 50), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(j * 5, 50 - bar_len, j * 5 + 4, 50), nullptr, 0, nullptr);
}
}
diff --git a/plugins/HistoryStats/src/column_splittimeline.cpp b/plugins/HistoryStats/src/column_splittimeline.cpp index a5b75c0918..ad1a6b5915 100644 --- a/plugins/HistoryStats/src/column_splittimeline.cpp +++ b/plugins/HistoryStats/src/column_splittimeline.cpp @@ -9,9 +9,9 @@ ColSplitTimeline::ColSplitTimeline() : m_nSource(0), m_nSourceType(2), m_nIgnoreOld(0), m_nVisMode(0),
m_nHODGroup(1), m_nDOWGroup(1), m_nBlockUnit(0), m_nUnitsPerBlock(6),
m_nBlocks(28), m_nGraphAlign(1), m_nCustomGroup(1), m_bTopPerColumn(true),
- m_hSource(NULL), m_hIgnoreOld(NULL), m_hVisMode(NULL),
- m_hHODGroup(NULL), m_hDOWGroup(NULL), m_hBlockUnit(NULL), m_hUnitsPerBlock(NULL),
- m_hBlocks(NULL), m_hGraphAlign(NULL), m_hCustomGroup(NULL),m_hTopPerColumn(NULL),
+ m_hSource(nullptr), m_hIgnoreOld(nullptr), m_hVisMode(nullptr),
+ m_hHODGroup(nullptr), m_hDOWGroup(nullptr), m_hBlockUnit(nullptr), m_hUnitsPerBlock(nullptr),
+ m_hBlocks(nullptr), m_hGraphAlign(nullptr), m_hCustomGroup(nullptr),m_hTopPerColumn(nullptr),
m_nTimeDiv(3600), m_nTimeOffset(0),
m_nTimelineWidth(0), m_nBlockOffset(0), m_nNumBlocks(0)
{
@@ -75,7 +75,7 @@ void ColSplitTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGrou m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
m_hIgnoreOld = Opt.insertEdit(hGroup, TranslateT("Drop everything older than (days, 0=no limit)"), L"", OptionsCtrl::OCF_NUMBER);
hTemp = Opt.insertGroup(hGroup, TranslateT("\"Split\" type"));
- m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Hours of day"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hHODGroup = Opt.insertEdit (m_hVisMode, TranslateT("Number of days to group"), L"", OptionsCtrl::OCF_NUMBER);
hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hDOWGroup = Opt.insertEdit (hTempRadio, TranslateT("Number of weeks to group"), L"", OptionsCtrl::OCF_NUMBER);
@@ -85,7 +85,7 @@ void ColSplitTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGrou m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per block"), L"", OptionsCtrl::OCF_NUMBER);
m_hBlocks = Opt.insertEdit (hTemp, TranslateT("Blocks per column"), L"", OptionsCtrl::OCF_NUMBER);
hTemp = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment"));
- m_hGraphAlign = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary"));
+ m_hGraphAlign = Opt.insertRadio(hTemp, nullptr, TranslateT("Align on day boundary"));
Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary"));
m_hCustomGroup = Opt.insertEdit (hTempRadio, TranslateT("Number of columns to group"), L"", OptionsCtrl::OCF_NUMBER);
m_hTopPerColumn = Opt.insertCheck(hGroup, TranslateT("Calculate maximum per column (not per graph)"));
@@ -201,7 +201,7 @@ void ColSplitTimeline::impl_contactDataFree(Contact& contact) const if (pData)
{
delete pData;
- contact.setSlot(contactDataSlotGet(), NULL);
+ contact.setSlot(contactDataSlotGet(), nullptr);
}
}
@@ -536,7 +536,7 @@ void ColSplitTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& co int color = 255 * part_top / top;
SetBkColor(hDC, colorTab[color]);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, nullptr, 0, nullptr);
}
}
}
@@ -619,7 +619,7 @@ void ColSplitTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& co }
SetBkColor(hDC, color);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, nullptr, 0, nullptr);
}
}
}
diff --git a/plugins/HistoryStats/src/column_timeline.cpp b/plugins/HistoryStats/src/column_timeline.cpp index 9c82240562..1c4b5ce657 100644 --- a/plugins/HistoryStats/src/column_timeline.cpp +++ b/plugins/HistoryStats/src/column_timeline.cpp @@ -6,7 +6,7 @@ */
ColTimeline::ColTimeline() : m_nSource(0), m_nSourceType(2), m_nIgnoreOld(0), m_bDetail(true),
- m_nDays(7), m_hSource(NULL), m_hIgnoreOld(NULL), m_hDetail(NULL), m_hDays(NULL),
+ m_nDays(7), m_hSource(nullptr), m_hIgnoreOld(nullptr), m_hDetail(nullptr), m_hDays(nullptr),
m_nTimelineWidth(0), m_nFirstDay(0), m_nLastDay(0)
{
}
@@ -113,7 +113,7 @@ void ColTimeline::impl_contactDataFree(Contact& contact) const if (pData)
{
delete pData;
- contact.setSlot(contactDataSlotGet(), NULL);
+ contact.setSlot(contactDataSlotGet(), nullptr);
}
}
@@ -298,11 +298,11 @@ void ColTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& contact int from_left = 3 * ((curDay - m_nFirstDay) / m_nDays);
if (bar_len != 0)
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24 - bar_len, from_left + 3, 25 + bar_len), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24 - bar_len, from_left + 3, 25 + bar_len), nullptr, 0, nullptr);
}
SetBkColor(hDC, con::ColorBarLine);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), nullptr, 0, nullptr);
canvas.endDraw();
@@ -399,7 +399,7 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact HDC hDC = canvas.beginDraw();
SetBkColor(hDC, con::ColorIOLine);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), nullptr, 0, nullptr);
for (curDay = m_nFirstDay; curDay <= m_nLastDay; curDay += m_nDays)
{
@@ -430,12 +430,12 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact if (bar_len < 0)
{
SetBkColor(hDC, con::ColorIn);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24, from_left + 3, 24 - bar_len), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24, from_left + 3, 24 - bar_len), nullptr, 0, nullptr);
}
else if (bar_len > 0)
{
SetBkColor(hDC, con::ColorOut);
- ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 25 - bar_len, from_left + 3, 25), NULL, 0, NULL);
+ ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 25 - bar_len, from_left + 3, 25), nullptr, 0, nullptr);
}
}
diff --git a/plugins/HistoryStats/src/column_wordcount.cpp b/plugins/HistoryStats/src/column_wordcount.cpp index 65d59fe21d..e764e378de 100644 --- a/plugins/HistoryStats/src/column_wordcount.cpp +++ b/plugins/HistoryStats/src/column_wordcount.cpp @@ -9,7 +9,7 @@ ColWordCount::ColWordCount()
: m_nVisMode(0), m_bDetail(true),
- m_hVisMode(NULL), m_hDetail(NULL)
+ m_hVisMode(nullptr), m_hDetail(nullptr)
{
}
@@ -46,7 +46,7 @@ void ColWordCount::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp;
hTemp = Opt.insertGroup(hGroup, TranslateT("Word count type"));
- m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Total words"));
+ m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Total words"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Distinct words"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Ratio total/distinct words"));
m_hDetail = Opt.insertCheck(hGroup, TranslateT("Additional info in tooltip (depends on type)"));
@@ -72,7 +72,7 @@ void ColWordCount::impl_contactDataFree(Contact& contact) const if (pTrData)
{
delete pTrData;
- contact.setSlot(contactDataTransformSlotGet(), NULL);
+ contact.setSlot(contactDataTransformSlotGet(), nullptr);
}
}
@@ -104,7 +104,7 @@ void ColWordCount::impl_contactDataTransformCleanup(Contact& contact) const pData->clear();
delete[] pData;
- contact.setSlot(contactDataSlotGet(), NULL);
+ contact.setSlot(contactDataSlotGet(), nullptr);
}
}
diff --git a/plugins/HistoryStats/src/column_words.cpp b/plugins/HistoryStats/src/column_words.cpp index b19b363913..47028ffccf 100644 --- a/plugins/HistoryStats/src/column_words.cpp +++ b/plugins/HistoryStats/src/column_words.cpp @@ -79,12 +79,12 @@ ColWords::ColWords() , m_bDetail(true)
, m_bDetailInOut(false)
, m_bInOutColor(false)
- , m_hVisMode(NULL)
- , m_hNum(NULL)
- , m_hOffset(NULL)
- , m_hDetail(NULL)
- , m_hDetailInOut(NULL)
- , m_hInOutColor(NULL)
+ , m_hVisMode(nullptr)
+ , m_hNum(nullptr)
+ , m_hOffset(nullptr)
+ , m_hDetail(nullptr)
+ , m_hDetailInOut(nullptr)
+ , m_hInOutColor(nullptr)
{
}
@@ -133,7 +133,7 @@ void ColWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp;
hTemp = Opt.insertGroup(hGroup, TranslateT("Words type"));
- m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Most common words"));
+ m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Most common words"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Least common words"));
Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Longest words"));
m_hNum = Opt.insertEdit (hGroup, TranslateT("Number of words"), L"", OptionsCtrl::OCF_NUMBER);
@@ -174,7 +174,7 @@ void ColWords::impl_contactDataFree(Contact& contact) const if (pTrData)
{
delete pTrData;
- contact.setSlot(contactDataTransformSlotGet(), NULL);
+ contact.setSlot(contactDataTransformSlotGet(), nullptr);
}
}
@@ -197,7 +197,7 @@ void ColWords::impl_contactDataTransformCleanup(Contact& contact) const pData->clear();
delete pData;
- contact.setSlot(contactDataSlotGet(), NULL);
+ contact.setSlot(contactDataSlotGet(), nullptr);
}
}
diff --git a/plugins/HistoryStats/src/contact.cpp b/plugins/HistoryStats/src/contact.cpp index ed7e35c91d..8a03c1b746 100644 --- a/plugins/HistoryStats/src/contact.cpp +++ b/plugins/HistoryStats/src/contact.cpp @@ -86,7 +86,7 @@ void Contact::addChat(bool bOutgoing, DWORD, DWORD duration) void Contact::addEvent(WORD eventType, bool bOutgoing)
{
- InOut* pIO = NULL;
+ InOut* pIO = nullptr;
switch (eventType) {
case EVENTTYPE_URL:
diff --git a/plugins/HistoryStats/src/dlgconfigure.cpp b/plugins/HistoryStats/src/dlgconfigure.cpp index 63e21d6c3c..6aaa746b35 100644 --- a/plugins/HistoryStats/src/dlgconfigure.cpp +++ b/plugins/HistoryStats/src/dlgconfigure.cpp @@ -10,7 +10,7 @@ * DlgConfigure
*/
-HWND DlgConfigure::m_hCfgWnd = NULL;
+HWND DlgConfigure::m_hCfgWnd = nullptr;
bool DlgConfigure::m_bHookedEvent = false;
INT_PTR CALLBACK DlgConfigure::staticConfigureProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -88,7 +88,7 @@ int DlgConfigure::staticEventPreShutdown(WPARAM, LPARAM) void DlgConfigure::showModal()
{
if (g_bConfigureLock) {
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("You can't access the stand-alone configuration dialog of HistoryStats as long as the options dialog of Miranda NG is open. Please close the options dialog and try again.\r\n\r\nNote that the options offered by both dialogs are the same."),
TranslateT("HistoryStats - Warning"),
MB_ICONWARNING | MB_OK);
@@ -99,7 +99,7 @@ void DlgConfigure::showModal() if (IsWindow(m_hCfgWnd))
SetForegroundWindow(m_hCfgWnd);
else
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_CONFIGURE), NULL, staticConfigureProc);
+ CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_CONFIGURE), nullptr, staticConfigureProc);
}
void DlgConfigure::onWMInitDialog()
@@ -184,11 +184,11 @@ void DlgConfigure::rearrangeControls() utils::moveWindow(m_hOptWnd, rPage);
- InvalidateRect(m_hWnd, NULL, TRUE);
+ InvalidateRect(m_hWnd, nullptr, TRUE);
}
DlgConfigure::DlgConfigure(HWND hWnd) :
- m_hWnd(hWnd), m_bChanged(false), m_hOptWnd(NULL),
+ m_hWnd(hWnd), m_bChanged(false), m_hOptWnd(nullptr),
m_nPadY(-1), m_nOKPadX(0), m_nCancelPadX(0), m_nApplyPadX(0)
{
if (!m_hCfgWnd) {
@@ -206,5 +206,5 @@ DlgConfigure::~DlgConfigure() DestroyWindow(m_hOptWnd);
if (m_hWnd == m_hCfgWnd)
- m_hCfgWnd = NULL;
+ m_hCfgWnd = nullptr;
}
diff --git a/plugins/HistoryStats/src/dlgfilterwords.cpp b/plugins/HistoryStats/src/dlgfilterwords.cpp index 92b3143b84..aea8892a06 100644 --- a/plugins/HistoryStats/src/dlgfilterwords.cpp +++ b/plugins/HistoryStats/src/dlgfilterwords.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgFilterWords::staticDlgProc(HWND hDlg, UINT msg, WPARAM wPara case WM_DESTROY:
pDlg->onWMDestroy();
- pDlg->m_hWnd = NULL;
+ pDlg->m_hWnd = nullptr;
SetWindowLongPtr(hDlg, DWLP_USER, 0);
return TRUE;
@@ -102,7 +102,7 @@ void DlgFilterWords::onWMInitDialog() {
const Filter* pFilter = *i;
- HANDLE hCheck = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast<INT_PTR>(pFilter));
+ HANDLE hCheck = m_Sets.insertCheck(nullptr, pFilter->getName().c_str(), 0, reinterpret_cast<INT_PTR>(pFilter));
if (m_bColProvided && m_ColFilters.find(pFilter->getID()) != m_ColFilters.end())
m_Sets.checkItem(hCheck, true);
@@ -127,7 +127,7 @@ void DlgFilterWords::onWMInitDialog() SendDlgItemMessage(m_hWnd, IDC_MODE, CB_SETCURSEL, 0, 0);
- onSetSelChanged(NULL, 0);
+ onSetSelChanged(nullptr, 0);
}
void DlgFilterWords::onWMDestroy()
@@ -155,7 +155,7 @@ void DlgFilterWords::onSetAdd() m_Filters.push_back(pFilter);
- HANDLE hAdded = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast<UINT_PTR>(pFilter));
+ HANDLE hAdded = m_Sets.insertCheck(nullptr, pFilter->getName().c_str(), 0, reinterpret_cast<UINT_PTR>(pFilter));
m_Sets.selectItem(hAdded);
}
@@ -297,7 +297,7 @@ void DlgFilterWords::clearFilters() m_Filters.clear();
}
-DlgFilterWords::DlgFilterWords() : m_hWnd(NULL), m_bColProvided(false)
+DlgFilterWords::DlgFilterWords() : m_hWnd(nullptr), m_bColProvided(false)
{
}
diff --git a/plugins/HistoryStats/src/dlgoption.cpp b/plugins/HistoryStats/src/dlgoption.cpp index 61a67c04f2..07c9e3ac47 100644 --- a/plugins/HistoryStats/src/dlgoption.cpp +++ b/plugins/HistoryStats/src/dlgoption.cpp @@ -205,7 +205,7 @@ void DlgOption::onBandDropDown(HANDLE hButton, INT_PTR dwData) if (dwData == opCreateWarn) {
AppendMenu(hPopup, MF_STRING, 1, TranslateT("Show warnings..."));
- AppendMenu(hPopup, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hPopup, MF_SEPARATOR, 0, nullptr);
}
UINT iMenuFlags = g_pSettings->canShowStatistics() ? 0 : (MF_DISABLED | MF_GRAYED);
@@ -219,7 +219,7 @@ void DlgOption::onBandDropDown(HANDLE hButton, INT_PTR dwData) ptMenu.y,
0,
getHWnd(),
- NULL);
+ nullptr);
DestroyMenu(hPopup);
@@ -321,7 +321,7 @@ int DlgOption::saveSettings() void DlgOption::updateProblemInfo()
{
- bool bShowProblemInfo = reinterpret_cast<SubColumns*>(m_pPage[opColumns])->configHasConflicts(NULL);
+ bool bShowProblemInfo = reinterpret_cast<SubColumns*>(m_pPage[opColumns])->configHasConflicts(nullptr);
m_Band.showButton(m_hCreateButton, !bShowProblemInfo);
m_Band.showButton(m_hCreateWarnButton, bShowProblemInfo);
@@ -329,7 +329,7 @@ void DlgOption::updateProblemInfo() DlgOption::DlgOption(HWND hWnd) :
m_hWnd(hWnd), m_bSettingsModified(false), m_nCurPage(-1), m_LocalS(*g_pSettings),
- m_hCreateButton(NULL), m_hCreateWarnButton(NULL), m_bAcquiredLock(false)
+ m_hCreateButton(nullptr), m_hCreateWarnButton(nullptr), m_bAcquiredLock(false)
{}
DlgOption::~DlgOption()
@@ -350,7 +350,7 @@ DlgOption::~DlgOption() m_pPage[i]->destroyWindow();
// MEMO: don't delete them, they will delete themselves in their WM_DESTROY messages
- m_pPage[i] = NULL;
+ m_pPage[i] = nullptr;
}
}
}
\ No newline at end of file diff --git a/plugins/HistoryStats/src/dlgoption_subbase.cpp b/plugins/HistoryStats/src/dlgoption_subbase.cpp index 8c971434d4..fca95cf406 100644 --- a/plugins/HistoryStats/src/dlgoption_subbase.cpp +++ b/plugins/HistoryStats/src/dlgoption_subbase.cpp @@ -31,7 +31,7 @@ INT_PTR CALLBACK DlgOption::SubBase::staticDlgProc(HWND hDlg, UINT msg, WPARAM w }
DlgOption::SubBase::SubBase() :
- m_pParent(NULL), m_hWnd(NULL)
+ m_pParent(nullptr), m_hWnd(nullptr)
{
}
diff --git a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp index a2ff5e6ca8..54484d1877 100644 --- a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp +++ b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp @@ -67,7 +67,7 @@ INT_PTR CALLBACK DlgOption::SubColumns::staticAddProc(HWND hDlg, UINT msg, WPARA }
DlgOption::SubColumns::SubColumns() :
- m_hColTitle(NULL),
+ m_hColTitle(nullptr),
m_bShowInfo(true),
m_nInfoHeight(0)
{
@@ -213,11 +213,11 @@ void DlgOption::SubColumns::loadSettings() {
// remeber currently selected item
HANDLE hSelItem = m_Columns.getSelection();
- Column* pPrevCol = NULL;
+ Column* pPrevCol = nullptr;
if (hSelItem) {
pPrevCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSelItem));
- hSelItem = NULL;
+ hSelItem = nullptr;
}
// remember scroll bar position
@@ -233,7 +233,7 @@ void DlgOption::SubColumns::loadSettings() {
Column* pCol = localS.getCol(j);
ext::string colTitle = pCol->getTitleForOptions();
- OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, colTitle.c_str(), 0, reinterpret_cast<INT_PTR>(pCol));
+ OptionsCtrl::Check hColCheck = m_Columns.insertCheck(nullptr, colTitle.c_str(), 0, reinterpret_cast<INT_PTR>(pCol));
m_Columns.checkItem(hColCheck, pCol->isEnabled());
@@ -241,7 +241,7 @@ void DlgOption::SubColumns::loadSettings() hSelItem = hColCheck;
}
- m_Columns.ensureVisible(NULL);
+ m_Columns.ensureVisible(nullptr);
m_Columns.setRedraw(true);
// restore scroll bar position
@@ -257,7 +257,7 @@ void DlgOption::SubColumns::saveSettings() if (hSelItem) {
// deselect and select current item to save its options to localS
- m_Columns.selectItem(NULL);
+ m_Columns.selectItem(nullptr);
m_Columns.selectItem(hSelItem);
}
@@ -327,7 +327,7 @@ void DlgOption::SubColumns::addCol(int nCol) getParent()->getLocalSettings().addCol(pCol);
- OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, TranslateW(pCol->getTitle()), 0, reinterpret_cast<INT_PTR>(pCol));
+ OptionsCtrl::Check hColCheck = m_Columns.insertCheck(nullptr, TranslateW(pCol->getTitle()), 0, reinterpret_cast<INT_PTR>(pCol));
m_Columns.checkItem(hColCheck, pCol->isEnabled());
@@ -349,7 +349,7 @@ void DlgOption::SubColumns::onColSelChanging(HANDLE hItem, INT_PTR) m_Columns.setItemLabel(hItem, colTitle.c_str());
- m_hColTitle = NULL;
+ m_hColTitle = nullptr;
}
// column specific settings
@@ -378,25 +378,25 @@ void DlgOption::SubColumns::onColSelChanged(HANDLE hItem, INT_PTR) Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
// general column settings
- OptionsCtrl::Group hGeneral = m_Options.insertGroup(NULL, TranslateT("General column settings"), OptionsCtrl::OCF_ROOTGROUP);
+ OptionsCtrl::Group hGeneral = m_Options.insertGroup(nullptr, TranslateT("General column settings"), OptionsCtrl::OCF_ROOTGROUP);
m_hColTitle = m_Options.insertEdit(hGeneral, TranslateT("Title (default if empty)"), pCol->getCustomTitle().c_str());
// column specific settings
if (pCol->getFeatures() & Column::cfHasConfig) {
- OptionsCtrl::Group hSpecific = m_Options.insertGroup(NULL, TranslateT("Column specific settings"), OptionsCtrl::OCF_ROOTGROUP);
+ OptionsCtrl::Group hSpecific = m_Options.insertGroup(nullptr, TranslateT("Column specific settings"), OptionsCtrl::OCF_ROOTGROUP);
pCol->configToUI(m_Options, hSpecific);
}
- m_Options.ensureVisible(NULL);
+ m_Options.ensureVisible(nullptr);
// show output info for current column
HWND hInfo = GetDlgItem(getHWnd(), IDC_INFO);
TVINSERTSTRUCT tvi;
bool bPNGOutput = getParent()->isPNGOutput();
int nPNGMode = getParent()->getPNGMode();
- int restrictions = pCol->configGetRestrictions(NULL);
+ int restrictions = pCol->configGetRestrictions(nullptr);
SendMessage(hInfo, WM_SETREDRAW, FALSE, 0);
TreeView_DeleteAllItems(hInfo);
@@ -494,9 +494,9 @@ void DlgOption::SubColumns::onColItemDropped(HANDLE hItem, HANDLE hDropTarget, B // perform move
Column* pItem = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
- Column* pDropTaregt = hDropTarget ? reinterpret_cast<Column*>(m_Columns.getItemData(hDropTarget)) : NULL;
+ Column* pDropTaregt = hDropTarget ? reinterpret_cast<Column*>(m_Columns.getItemData(hDropTarget)) : nullptr;
- m_Columns.selectItem(NULL);
+ m_Columns.selectItem(nullptr);
getParent()->getLocalSettings().moveCol(pItem, pDropTaregt);
m_Columns.moveItem(hItem, hDropTarget);
@@ -551,7 +551,7 @@ void DlgOption::SubColumns::onBandDropDown(HANDLE hButton, INT_PTR dwData) ptMenu.y,
0,
getHWnd(),
- NULL);
+ nullptr);
DestroyMenu(hPopup);
@@ -595,9 +595,9 @@ void DlgOption::SubColumns::onMoveUp() hPrev2 = m_Columns.getPrevItem(hPrev2);
Column* pSelCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSel));
- Column* pPrev2Col = hPrev2 ? reinterpret_cast<Column*>(m_Columns.getItemData(hPrev2)) : NULL;
+ Column* pPrev2Col = hPrev2 ? reinterpret_cast<Column*>(m_Columns.getItemData(hPrev2)) : nullptr;
- m_Columns.selectItem(NULL);
+ m_Columns.selectItem(nullptr);
getParent()->getLocalSettings().moveCol(pSelCol, pPrev2Col);
m_Columns.moveItem(hSel, hPrev2);
@@ -620,7 +620,7 @@ void DlgOption::SubColumns::onMoveDown() Column* pSelCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSel));
Column* pNextCol = reinterpret_cast<Column*>(m_Columns.getItemData(hNext));
- m_Columns.selectItem(NULL);
+ m_Columns.selectItem(nullptr);
getParent()->getLocalSettings().moveCol(pSelCol, pNextCol);
m_Columns.moveItem(hSel, hNext);
@@ -658,12 +658,12 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp) Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
if (pCol) {
- int restrictions = pCol->configGetRestrictions(pHelp ? &curDetails : NULL);
+ int restrictions = pCol->configGetRestrictions(pHelp ? &curDetails : nullptr);
// sanity check: either HTML or PNG has to be fully supported
if ((restrictions & Column::crHTMLMask) != Column::crHTMLFull &&
(restrictions & Column::crPNGMask) != Column::crPNGFull) {
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("An internal column configuration error occurred. Please contact the author of this plugin."),
TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
}
diff --git a/plugins/HistoryStats/src/dlgoption_subexclude.cpp b/plugins/HistoryStats/src/dlgoption_subexclude.cpp index d0748d71f8..c0bf6e97f9 100644 --- a/plugins/HistoryStats/src/dlgoption_subexclude.cpp +++ b/plugins/HistoryStats/src/dlgoption_subexclude.cpp @@ -9,7 +9,7 @@ */
DlgOption::SubExclude::SubExclude() :
- m_hItemAll(NULL), m_bChanged(false)
+ m_hItemAll(nullptr), m_bChanged(false)
{
}
@@ -281,6 +281,6 @@ void DlgOption::SubExclude::setAll(HWND hCList, HANDLE hFirstItem, int iImage, b if (iOldIcon != 0xFF && iOldIcon != iImage)
SendMessage(hCList, CLM_SETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, iImage));
- hItem = bIterate ? reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast<LPARAM>(hItem))) : NULL;
+ hItem = bIterate ? reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast<LPARAM>(hItem))) : nullptr;
}
}
diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp index 4727738845..2ceed39e26 100644 --- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp +++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp @@ -74,7 +74,7 @@ INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARA RECT rDetails;
GetWindowRect(GetDlgItem(hDlg, IDC_DESCRIPTION), &rDetails);
- SetWindowPos(GetDlgItem(hDlg, IDC_DESCRIPTION), NULL, 0, 0, rDetails.right - rDetails.left, rDetails.bottom - rDetails.top + nHeightAdd, SWP_NOMOVE | SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hDlg, IDC_DESCRIPTION), nullptr, 0, 0, rDetails.right - rDetails.left, rDetails.bottom - rDetails.top + nHeightAdd, SWP_NOMOVE | SWP_NOZORDER);
}
}
return TRUE;
@@ -129,16 +129,16 @@ INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARA }
DlgOption::SubGlobal::SubGlobal() :
- m_hOnStartup(NULL),
- m_hShowMainMenu(NULL),
- m_hShowMainMenuSub(NULL),
- m_hShowContactMenu(NULL),
- m_hShowContactMenuPseudo(NULL),
- m_hGraphicsMode(NULL),
- m_hGraphicsModePNG(NULL),
- m_hPNGMode(NULL),
- m_hThreadLowPriority(NULL),
- m_hPathToBrowser(NULL),
+ m_hOnStartup(nullptr),
+ m_hShowMainMenu(nullptr),
+ m_hShowMainMenuSub(nullptr),
+ m_hShowContactMenu(nullptr),
+ m_hShowContactMenuPseudo(nullptr),
+ m_hGraphicsMode(nullptr),
+ m_hGraphicsModePNG(nullptr),
+ m_hPNGMode(nullptr),
+ m_hThreadLowPriority(nullptr),
+ m_hPathToBrowser(nullptr),
m_bShowInfo(false),
m_nInfoHeight(0)
{
@@ -219,20 +219,20 @@ void DlgOption::SubGlobal::onWMInitDialog() // settings
OptionsCtrl::Item hTemp;
- hTemp = m_Options.insertGroup(NULL, TranslateT("Integration"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Integration"), OptionsCtrl::OCF_ROOTGROUP);
m_hOnStartup = m_Options.insertCheck(hTemp, TranslateT("Create statistics on Miranda NG startup"));
m_hShowMainMenu = m_Options.insertCheck(hTemp, TranslateT("Add menu items to main menu"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hShowMainMenuSub = m_Options.insertCheck(m_hShowMainMenu, TranslateT("Put menu items into submenu"));
m_hShowContactMenu = m_Options.insertCheck(hTemp, TranslateT("Add menu items to contact menu"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hShowContactMenuPseudo = m_Options.insertCheck(m_hShowContactMenu, TranslateT("Don't hide menu items for pseudo protocols"));
m_hProtocols = m_Options.insertGroup(m_hShowContactMenu, TranslateT("Hide menu items for protocol..."));
- hTemp = m_Options.insertGroup(NULL, TranslateT("Graphics"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
- m_hGraphicsMode = m_Options.insertRadio(hTemp, NULL, TranslateT("Only use HTML to simulate graphics"));
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Graphics"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ m_hGraphicsMode = m_Options.insertRadio(hTemp, nullptr, TranslateT("Only use HTML to simulate graphics"));
m_hGraphicsModePNG = m_Options.insertRadio(hTemp, m_hGraphicsMode, TranslateT("Generate PNG files to represent graphics"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- m_hPNGMode = m_Options.insertRadio(m_hGraphicsModePNG, NULL, TranslateT("Fall back to HTML output if column options require HTML output"));
+ m_hPNGMode = m_Options.insertRadio(m_hGraphicsModePNG, nullptr, TranslateT("Fall back to HTML output if column options require HTML output"));
m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, TranslateT("Enforce PNG output, possibly ignoring some column options"));
m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, TranslateT("Prefer HTML output over PNG output if available"));
- hTemp = m_Options.insertGroup(NULL, TranslateT("Miscellaneous"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Miscellaneous"), OptionsCtrl::OCF_ROOTGROUP);
m_hThreadLowPriority = m_Options.insertCheck(hTemp, TranslateT("Generate statistics in background thread with low priority"));
m_hPathToBrowser = m_Options.insertEdit(hTemp, TranslateT("Path to browser (leave blank for system default)"));
@@ -251,7 +251,7 @@ void DlgOption::SubGlobal::onWMInitDialog() reinterpret_cast<INT_PTR>(protoList[i]->szModuleName)));
}
- m_Options.ensureVisible(NULL);
+ m_Options.ensureVisible(nullptr);
// init support info list
initSupportInfo();
diff --git a/plugins/HistoryStats/src/dlgoption_subinput.cpp b/plugins/HistoryStats/src/dlgoption_subinput.cpp index e04765daa4..f87cf76cde 100644 --- a/plugins/HistoryStats/src/dlgoption_subinput.cpp +++ b/plugins/HistoryStats/src/dlgoption_subinput.cpp @@ -6,20 +6,20 @@ */
DlgOption::SubInput::SubInput() :
- m_hChatSessionMinDur(NULL),
- m_hChatSessionTimeout(NULL),
- m_hAverageMinTime(NULL),
- m_hWordDelimiters(NULL),
- m_hMetaContactsMode(NULL),
- m_hMergeContacts(NULL),
- m_hMergeContactsGroups(NULL),
- m_hMergeMode(NULL),
- m_hProtocols(NULL),
- m_hIgnoreOlder(NULL),
- m_hIgnoreBefore(NULL),
- m_hIgnoreAfter(NULL),
- m_hFilterRawRTF(NULL),
- m_hFilterBBCodes(NULL)
+ m_hChatSessionMinDur(nullptr),
+ m_hChatSessionTimeout(nullptr),
+ m_hAverageMinTime(nullptr),
+ m_hWordDelimiters(nullptr),
+ m_hMetaContactsMode(nullptr),
+ m_hMergeContacts(nullptr),
+ m_hMergeContactsGroups(nullptr),
+ m_hMergeMode(nullptr),
+ m_hProtocols(nullptr),
+ m_hIgnoreOlder(nullptr),
+ m_hIgnoreBefore(nullptr),
+ m_hIgnoreAfter(nullptr),
+ m_hFilterRawRTF(nullptr),
+ m_hFilterBBCodes(nullptr)
{
}
@@ -68,16 +68,16 @@ void DlgOption::SubInput::onWMInitDialog() // settings
OptionsCtrl::Item hTemp, hTemp2;
- hTemp = m_Options.insertGroup(NULL, TranslateT("History interpretation"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("History interpretation"), OptionsCtrl::OCF_ROOTGROUP);
m_hChatSessionMinDur = m_Options.insertEdit(hTemp, TranslateT("Time a chat session must last to be counted (seconds)"), L"", OptionsCtrl::OCF_NUMBER);
m_hChatSessionTimeout = m_Options.insertEdit(hTemp, TranslateT("Time between two chat sessions (seconds)"), L"", OptionsCtrl::OCF_NUMBER);
m_hAverageMinTime = m_Options.insertEdit(hTemp, TranslateT("Minimum time to assume when calculating average (days)"), L"", OptionsCtrl::OCF_NUMBER);
m_hWordDelimiters = m_Options.insertEdit(hTemp, TranslateT("Word delimiting characters"));
- hTemp = m_Options.insertGroup(NULL, TranslateT("Contact filtering"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Contact filtering"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
m_hProtocols = m_Options.insertGroup(hTemp, TranslateT("Ignore all contacts with protocol..."));
hTemp2 = m_Options.insertGroup(hTemp, TranslateT("History read mode for metacontacts"), 0);
- m_hMetaContactsMode = m_Options.insertRadio(hTemp2, NULL, TranslateT("Use only metacontact's history"));
+ m_hMetaContactsMode = m_Options.insertRadio(hTemp2, nullptr, TranslateT("Use only metacontact's history"));
m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Use only subcontacts' histories (for one metacontact)"));
m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Use metacontact's history and its subcontacts' histories"));
m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Treat metacontacts and subcontacts as normal contacts"));
@@ -85,10 +85,10 @@ void DlgOption::SubInput::onWMInitDialog() m_hMergeContacts = m_Options.insertCheck(hTemp, TranslateT("Merge contacts with same name"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hMergeContactsGroups = m_Options.insertCheck(m_hMergeContacts, TranslateT("Only merge if contacts are in the same group"));
hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Duplicate detection when reading merged contacts"));
- m_hMergeMode = m_Options.insertRadio(hTemp2, NULL, TranslateT("Merge events (tolerant)"));
+ m_hMergeMode = m_Options.insertRadio(hTemp2, nullptr, TranslateT("Merge events (tolerant)"));
m_Options.insertRadio(hTemp2, m_hMergeMode, TranslateT("Merge events (strict)"));
m_Options.insertRadio(hTemp2, m_hMergeMode, TranslateT("Don't merge events"));
- hTemp = m_Options.insertGroup(NULL, TranslateT("Message filtering"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Message filtering"), OptionsCtrl::OCF_ROOTGROUP);
hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Ignore messages..."));
m_hIgnoreOlder = m_Options.insertEdit(hTemp2, TranslateT("...older than (days, 0=no limit)"), L"", OptionsCtrl::OCF_NUMBER);
m_hIgnoreBefore = m_Options.insertDateTime(hTemp2, TranslateT("...before date (none=no limit)"), 0, L"%Y-%m-%d", OptionsCtrl::OCF_ALLOWNONE);
@@ -115,7 +115,7 @@ void DlgOption::SubInput::onWMInitDialog() if (!RTFFilter::available())
m_Options.enableItem(m_hFilterRawRTF, false);
- m_Options.ensureVisible(NULL);
+ m_Options.ensureVisible(nullptr);
}
void DlgOption::SubInput::loadSettings()
diff --git a/plugins/HistoryStats/src/dlgoption_suboutput.cpp b/plugins/HistoryStats/src/dlgoption_suboutput.cpp index 97be76691a..bd20a1744e 100644 --- a/plugins/HistoryStats/src/dlgoption_suboutput.cpp +++ b/plugins/HistoryStats/src/dlgoption_suboutput.cpp @@ -6,46 +6,46 @@ */
DlgOption::SubOutput::SubOutput() :
- m_hRemoveEmptyContacts(NULL),
- m_hRemoveInChatsZero(NULL),
- m_hRemoveInBytesZero(NULL),
- m_hRemoveOutChatsZero(NULL),
- m_hRemoveOutBytesZero(NULL),
- m_hOmitContacts(NULL),
- m_hOmitByValue(NULL),
- m_hOmitByValueData(NULL),
- m_hOmitByValueLimit(NULL),
- m_hOmitByTime(NULL),
- m_hOmitByTimeDays(NULL),
- m_hOmitByRank(NULL),
- m_hOmitNumOnTop(NULL),
- m_hOmittedInTotals(NULL),
- m_hOmittedInExtraRow(NULL),
- m_hCalcTotals(NULL),
- m_hTableHeader(NULL),
- m_hTableHeaderRepeat(NULL),
- m_hTableHeaderVerbose(NULL),
- m_hHeaderTooltips(NULL),
- m_hHeaderTooltipsIfCustom(NULL),
- m_hSort(NULL),
- m_hNick(NULL),
- m_hOutputVariables(NULL),
- m_hOutputFile(NULL),
- m_hOutputExtraToFolder(NULL),
- m_hOutputExtraFolder(NULL),
- m_hOverwriteAlways(NULL),
- m_hAutoOpenOptions(NULL),
- m_hAutoOpenStartup(NULL),
- m_hAutoOpenMenu(NULL)
+ m_hRemoveEmptyContacts(nullptr),
+ m_hRemoveInChatsZero(nullptr),
+ m_hRemoveInBytesZero(nullptr),
+ m_hRemoveOutChatsZero(nullptr),
+ m_hRemoveOutBytesZero(nullptr),
+ m_hOmitContacts(nullptr),
+ m_hOmitByValue(nullptr),
+ m_hOmitByValueData(nullptr),
+ m_hOmitByValueLimit(nullptr),
+ m_hOmitByTime(nullptr),
+ m_hOmitByTimeDays(nullptr),
+ m_hOmitByRank(nullptr),
+ m_hOmitNumOnTop(nullptr),
+ m_hOmittedInTotals(nullptr),
+ m_hOmittedInExtraRow(nullptr),
+ m_hCalcTotals(nullptr),
+ m_hTableHeader(nullptr),
+ m_hTableHeaderRepeat(nullptr),
+ m_hTableHeaderVerbose(nullptr),
+ m_hHeaderTooltips(nullptr),
+ m_hHeaderTooltipsIfCustom(nullptr),
+ m_hSort(nullptr),
+ m_hNick(nullptr),
+ m_hOutputVariables(nullptr),
+ m_hOutputFile(nullptr),
+ m_hOutputExtraToFolder(nullptr),
+ m_hOutputExtraFolder(nullptr),
+ m_hOverwriteAlways(nullptr),
+ m_hAutoOpenOptions(nullptr),
+ m_hAutoOpenStartup(nullptr),
+ m_hAutoOpenMenu(nullptr)
{
array_each_(i, m_hSortBy)
{
- m_hSortBy[i] = NULL;
+ m_hSortBy[i] = nullptr;
}
array_each_(i, m_hSortDir)
{
- m_hSortDir[i] = NULL;
+ m_hSortDir[i] = nullptr;
}
}
@@ -98,7 +98,7 @@ void DlgOption::SubOutput::onWMInitDialog() OptionsCtrl::Item hTemp;
OptionsCtrl::Item hTemp2;
- hTemp = m_Options.insertGroup(NULL, TranslateT("Contact filtering and totals"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Contact filtering and totals"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
m_hRemoveEmptyContacts = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with empty history"));
m_hRemoveOutChatsZero = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with only incoming chats"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hRemoveOutBytesZero = m_Options.insertCheck(m_hRemoveOutChatsZero, TranslateT("Remove only if you never answered"));
@@ -116,14 +116,14 @@ void DlgOption::SubOutput::onWMInitDialog() m_hOmittedInTotals = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include omitted contacts in totals"));
m_hOmittedInExtraRow = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include totals of omitted contacts in additional row"));
m_hCalcTotals = m_Options.insertCheck(hTemp, TranslateT("Include totals in statistics"));
- hTemp = m_Options.insertGroup(NULL, TranslateT("Table header"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("Table header"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
m_hTableHeader = m_Options.insertCheck(hTemp, TranslateT("Output header"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK | OptionsCtrl::OCF_DISABLED | OptionsCtrl::OCF_NODISABLECHILDS);
m_hTableHeaderRepeat = m_Options.insertEdit(m_hTableHeader, TranslateT("Repeat header every n contacts (0=don't repeat)"), L"0", OptionsCtrl::OCF_NUMBER);
m_hTableHeaderVerbose = m_Options.insertCheck(m_hTableHeader, TranslateT("Make column titles more verbose"));
m_hHeaderTooltips = m_Options.insertCheck(m_hTableHeader, TranslateT("Show tooltips with detailed information in column titles"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
m_hHeaderTooltipsIfCustom = m_Options.insertCheck(m_hHeaderTooltips, TranslateT("Only show if a custom title was entered or if titles are not verbose"));
- m_hSort = m_Options.insertGroup(NULL, TranslateT("Sorting"), OptionsCtrl::OCF_ROOTGROUP);
- hTemp = m_Options.insertGroup(NULL, TranslateT("HTML file generation"), OptionsCtrl::OCF_ROOTGROUP);
+ m_hSort = m_Options.insertGroup(nullptr, TranslateT("Sorting"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp = m_Options.insertGroup(nullptr, TranslateT("HTML file generation"), OptionsCtrl::OCF_ROOTGROUP);
m_hNick = m_Options.insertEdit(hTemp, TranslateT("Own nick for statistics"));
hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Output files and folders"));
m_hOutputVariables = m_Options.insertCheck(hTemp2, TranslateT("Substitute variables in output file name and subfolder for additional files"));
@@ -200,7 +200,7 @@ void DlgOption::SubOutput::onWMInitDialog() m_Options.addComboItem(m_hSortBy[i], TranslateW(sortKeys[j].desc));
}
- m_hSortDir[i] = m_Options.insertRadio(m_hSortBy[i], NULL, TranslateT("Ascending"));
+ m_hSortDir[i] = m_Options.insertRadio(m_hSortBy[i], nullptr, TranslateT("Ascending"));
m_Options.insertRadio(m_hSortBy[i], m_hSortDir[i], TranslateT("Descending"));
}
@@ -232,7 +232,7 @@ void DlgOption::SubOutput::onWMInitDialog() m_Options.addComboItem(m_hOmitByValueData, TranslateW(omitData[i]));
}
- m_Options.ensureVisible(NULL);
+ m_Options.ensureVisible(nullptr);
}
void DlgOption::SubOutput::loadSettings()
diff --git a/plugins/HistoryStats/src/iconlib.cpp b/plugins/HistoryStats/src/iconlib.cpp index d8a6dc5417..0fa5d6a40e 100644 --- a/plugins/HistoryStats/src/iconlib.cpp +++ b/plugins/HistoryStats/src/iconlib.cpp @@ -5,15 +5,15 @@ #include "resource.h"
bool IconLib::m_bIcoLibAvailable = false;
-HANDLE IconLib::m_hHookSkin2IconsChanged = NULL;
+HANDLE IconLib::m_hHookSkin2IconsChanged = nullptr;
IconLib::IconInfo IconLib::m_IconInfo[] = {
- { IDI_HISTORYSTATS , "main_menu" , NULL, LPGENW("Create statistics (main menu)") },
- { IDI_HISTORYSTATS , "menu_show" , NULL, LPGENW("Show statistics (main menu)") },
- { IDI_HISTORYSTATS , "menu_config" , NULL, LPGENW("Configure... (main menu)") },
- { IDI_HISTORYSTATS , "contact_menu" , NULL, LPGENW("Contact menu") },
- { IDI_EXCLUDE_NO , "exclude_no" , NULL, LPGENW("Unexcluded contacts") },
- { IDI_EXCLUDE_YES , "exclude_yes" , NULL, LPGENW("Excluded contacts") },
+ { IDI_HISTORYSTATS , "main_menu" , nullptr, LPGENW("Create statistics (main menu)") },
+ { IDI_HISTORYSTATS , "menu_show" , nullptr, LPGENW("Show statistics (main menu)") },
+ { IDI_HISTORYSTATS , "menu_config" , nullptr, LPGENW("Configure... (main menu)") },
+ { IDI_HISTORYSTATS , "contact_menu" , nullptr, LPGENW("Contact menu") },
+ { IDI_EXCLUDE_NO , "exclude_no" , nullptr, LPGENW("Unexcluded contacts") },
+ { IDI_EXCLUDE_YES , "exclude_yes" , nullptr, LPGENW("Excluded contacts") },
{ IDI_TREE_CHECK1 , "tree_check1" , LPGENW("Options tree"), LPGENW("Checkbox") },
{ IDI_TREE_CHECK2 , "tree_check2" , LPGENW("Options tree"), LPGENW("Checkbox (checked)") },
{ IDI_TREE_CHECK3 , "tree_check3" , LPGENW("Options tree"), LPGENW("Checkbox (disabled)") },
@@ -52,7 +52,7 @@ void IconLib::init() {
array_each_(i, m_IconInfo)
{
- m_IconInfo[i].hIcon = NULL;
+ m_IconInfo[i].hIcon = nullptr;
}
if (m_bIcoLibAvailable = mu::icolib::_available()) {
@@ -124,7 +124,7 @@ void IconLib::uninit() {
if (m_IconInfo[i].hIcon) {
DestroyIcon(m_IconInfo[i].hIcon);
- m_IconInfo[i].hIcon = NULL;
+ m_IconInfo[i].hIcon = nullptr;
}
}
}
diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index 19f1a84612..202a6fcea0 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -31,17 +31,17 @@ PLUGININFOEX g_pluginInfoEx = { {0xf184f5a0, 0xc198, 0x4454, {0xa9, 0xb4, 0xf6, 0xe2, 0xfd, 0x53, 0x41, 0x33}},
};
-SettingsSerializer* g_pSettings = NULL;
+SettingsSerializer* g_pSettings = nullptr;
bool g_bMainMenuExists = false;
bool g_bContactMenuExists = false;
bool g_bExcludeLock = false;
bool g_bConfigureLock = false;
-static HGENMENU g_hMenuCreateStatistics = NULL;
-static HGENMENU g_hMenuShowStatistics = NULL;
-static HGENMENU g_hMenuConfigure = NULL;
-static HGENMENU g_hMenuToggleExclude = NULL;
+static HGENMENU g_hMenuCreateStatistics = nullptr;
+static HGENMENU g_hMenuShowStatistics = nullptr;
+static HGENMENU g_hMenuConfigure = nullptr;
+static HGENMENU g_hMenuToggleExclude = nullptr;
#if defined(HISTORYSTATS_HISTORYCOPY)
static HGENMENU g_hMenuHistoryCopy = NULL;
@@ -93,16 +93,16 @@ static INT_PTR SvcSetExclude(WPARAM hContact, LPARAM lParam) static void MenuIconsChanged(LPARAM)
{
if (g_hMenuCreateStatistics)
- Menu_ModifyItem(g_hMenuCreateStatistics, NULL, IconLib::getIcon(IconLib::iiMenuCreateStatistics));
+ Menu_ModifyItem(g_hMenuCreateStatistics, nullptr, IconLib::getIcon(IconLib::iiMenuCreateStatistics));
if (g_hMenuShowStatistics)
- Menu_ModifyItem(g_hMenuShowStatistics, NULL, IconLib::getIcon(IconLib::iiMenuShowStatistics));
+ Menu_ModifyItem(g_hMenuShowStatistics, nullptr, IconLib::getIcon(IconLib::iiMenuShowStatistics));
if (g_hMenuConfigure)
- Menu_ModifyItem(g_hMenuConfigure, NULL, IconLib::getIcon(IconLib::iiMenuConfigure));
+ Menu_ModifyItem(g_hMenuConfigure, nullptr, IconLib::getIcon(IconLib::iiMenuConfigure));
if (g_hMenuToggleExclude)
- Menu_ModifyItem(g_hMenuToggleExclude, NULL, IconLib::getIcon(IconLib::iiContactMenu));
+ Menu_ModifyItem(g_hMenuToggleExclude, nullptr, IconLib::getIcon(IconLib::iiContactMenu));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -119,7 +119,7 @@ static INT_PTR MenuShowStatistics(WPARAM, LPARAM) if (g_pSettings->canShowStatistics())
g_pSettings->showStatistics();
else
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("The statistics can't be found. Either you never created them or the last created statistics were moved to a different location and can't be found anymore."),
TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_OK);
@@ -145,7 +145,7 @@ void AddMainMenu() CreateServiceFunction(con::SvcShowStatistics, MenuShowStatistics);
CreateServiceFunction(con::SvcConfigure, MenuConfigure);
- HGENMENU hRoot = bInPopup ? Menu_CreateRoot(MO_MAIN, LPGENW("Statistics"), 1910000000) : NULL;
+ HGENMENU hRoot = bInPopup ? Menu_CreateRoot(MO_MAIN, LPGENW("Statistics"), 1910000000) : nullptr;
Menu_ConfigureItem(hRoot, MCI_OPT_UID, "7F116B24-9D84-4D04-B6AA-EED95051A184");
g_hMenuCreateStatistics = mu::clist::addMainMenuItem(
@@ -339,7 +339,7 @@ static int EventOptInitialise(WPARAM wParam, LPARAM) wParam,
TranslateT("History"),
TranslateT("Statistics"),
- NULL,
+ nullptr,
DlgOption::staticDlgProc,
MAKEINTRESOURCEA(IDD_OPTIONS),
g_hInst);
@@ -406,13 +406,13 @@ extern "C" __declspec(dllexport) int Load() pcli = Clist_GetInterface();
// init COM, needed for GUID generation
- CoInitialize(NULL);
+ CoInitialize(nullptr);
// register our own window classes
if (!BandCtrlImpl::registerClass() || !OptionsCtrlImpl::registerClass())
{
MessageBox(
- 0,
+ nullptr,
L"Failed to register a required window class. Can't continue loading plugin.",
L"HistoryStats - Error",
MB_OK | MB_ICONERROR);
@@ -424,7 +424,7 @@ extern "C" __declspec(dllexport) int Load() if (!mu::load())
{
MessageBox(
- 0,
+ nullptr,
L"This version of HistoryStats isn't compatible with your Miranda NG "
L"version. Possibly, your Miranda NG is outdated or you are trying to "
L"use the Unicode version with a non-Unicode Miranda NG.\r\n\r\n"
diff --git a/plugins/HistoryStats/src/mirandacontact.cpp b/plugins/HistoryStats/src/mirandacontact.cpp index f217bb5bb7..66de169919 100644 --- a/plugins/HistoryStats/src/mirandacontact.cpp +++ b/plugins/HistoryStats/src/mirandacontact.cpp @@ -46,7 +46,7 @@ void MirandaContact::stripMetaID(DBEVENTINFO& dbe) if (dbe.cbBlob >= 6 && !pTextBegin[dbe.cbBlob - 1]) {
char* pIDEnd = pTextBegin + dbe.cbBlob - 1;
char* pIDBegin = pIDEnd;
- char* pIDSep = NULL;
+ char* pIDSep = nullptr;
while (pIDBegin >= pTextBegin + 2 && *--pIDBegin)
if (*pIDBegin == '*')
@@ -104,7 +104,7 @@ void MirandaContact::beginRead() ci.hContact = m_Sources[j];
ci.hEvent = db_event_first(ci.hContact);
- ci.ei.dbe.pBlob = NULL;
+ ci.ei.dbe.pBlob = nullptr;
ci.ei.nAllocated = 0;
fetchSlot(j);
@@ -209,7 +209,7 @@ void MirandaContactTolerantMerge::fillQueue() m_SpareEIs.pop_front();
}
else {
- ci.ei.dbe.pBlob = NULL;
+ ci.ei.dbe.pBlob = nullptr;
ci.ei.nAllocated = 0;
}
}
@@ -273,7 +273,7 @@ void MirandaContactStrictMerge::fillQueue() m_SpareEIs.pop_front();
}
else {
- ci.ei.dbe.pBlob = NULL;
+ ci.ei.dbe.pBlob = nullptr;
ci.ei.nAllocated = 0;
}
}
@@ -310,7 +310,7 @@ void MirandaContactNoMerge::fillQueue() m_SpareEIs.pop_front();
}
else {
- ci.ei.dbe.pBlob = NULL;
+ ci.ei.dbe.pBlob = nullptr;
ci.ei.nAllocated = 0;
}
@@ -335,6 +335,6 @@ MirandaContact* MirandaContactFactory::makeMirandaContact(int MergeMode, const e return new MirandaContactNoMerge(strNick, strProtocol, strGroup, sources);
default:
- return 0;
+ return nullptr;
}
}
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 62c9e21bb0..212485233a 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -56,7 +56,7 @@ namespace mu void addIcon(const wchar_t* szSection, const wchar_t* szDescription, const char* szIconName, const char* szDefaultFile, int iDefaultIndex)
{
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.w = const_cast<wchar_t*>(szSection);
sid.description.w = const_cast<wchar_t*>(szDescription);
sid.pszName = const_cast<char*>(szIconName);
@@ -148,14 +148,14 @@ namespace mu char* wideToAnsiDup(const WCHAR* pszWide, UINT uCP /* = CP_ACP */)
{
if (!pszWide)
- return NULL;
+ return nullptr;
- int len = WideCharToMultiByte(uCP, 0, pszWide, -1, NULL, 0, NULL, NULL);
+ int len = WideCharToMultiByte(uCP, 0, pszWide, -1, nullptr, 0, nullptr, nullptr);
char* result = reinterpret_cast<char*>(malloc(sizeof(char)* len));
if (!result)
- return NULL;
+ return nullptr;
- WideCharToMultiByte(uCP, 0, pszWide, -1, result, len, NULL, NULL);
+ WideCharToMultiByte(uCP, 0, pszWide, -1, result, len, nullptr, nullptr);
result[len - 1] = 0;
return result;
}
@@ -163,12 +163,12 @@ namespace mu WCHAR* ansiToWideDup(const char* pszAnsi, UINT uCP /* = CP_ACP */)
{
if (!pszAnsi)
- return NULL;
+ return nullptr;
- int len = MultiByteToWideChar(uCP, 0, pszAnsi, -1, NULL, 0);
+ int len = MultiByteToWideChar(uCP, 0, pszAnsi, -1, nullptr, 0);
WCHAR* result = reinterpret_cast<WCHAR*>(malloc(sizeof(WCHAR)* len));
if (!result)
- return NULL;
+ return nullptr;
MultiByteToWideChar(uCP, 0, pszAnsi, -1, result, len);
result[len - 1] = 0;
@@ -178,16 +178,16 @@ namespace mu char* wideToAnsi(const WCHAR* pszWide, char* pszRes, int maxLen, UINT uCP /* = CP_ACP */)
{
if (!pszWide)
- return NULL;
+ return nullptr;
- WideCharToMultiByte(uCP, 0, pszWide, -1, pszRes, maxLen, NULL, NULL);
+ WideCharToMultiByte(uCP, 0, pszWide, -1, pszRes, maxLen, nullptr, nullptr);
return pszRes;
}
WCHAR* ansiToWide(const char* pszAnsi, WCHAR* pszRes, int maxLen, UINT uCP /* = CP_ACP */)
{
if (!pszAnsi)
- return NULL;
+ return nullptr;
MultiByteToWideChar(uCP, 0, pszAnsi, -1, pszRes, maxLen);
return pszRes;
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.cpp b/plugins/HistoryStats/src/optionsctrlimpl.cpp index 95c17cd380..9b4a1333e8 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl.cpp @@ -9,7 +9,7 @@ */
const wchar_t* OptionsCtrlImpl::m_ClassName = L"HistoryStatsOptions";
-HIMAGELIST OptionsCtrlImpl::m_hStateIcons = NULL;
+HIMAGELIST OptionsCtrlImpl::m_hStateIcons = nullptr;
int OptionsCtrlImpl::m_nStateIconsRef = 0;
LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -56,7 +56,7 @@ LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wPar case WM_WINDOWPOSCHANGED:
{
WINDOWPOS* pWP = reinterpret_cast<WINDOWPOS*>(lParam);
- SetWindowPos(pCtrl->m_hTree, NULL, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(pCtrl->m_hTree, nullptr, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
return 0;
@@ -346,7 +346,7 @@ void OptionsCtrlImpl::staticFreeStateImages() IconLib::unregisterCallback(staticUpdateStateImages, 0);
ImageList_Destroy(m_hStateIcons);
- m_hStateIcons = NULL;
+ m_hStateIcons = nullptr;
}
}
@@ -390,12 +390,12 @@ bool OptionsCtrlImpl::registerClass() 0, // cbClsExtra
sizeof(OptionsCtrlImpl*), // cbWndExtra
g_hInst, // hInstance
- NULL, // hIcon
- NULL, // hCursor
- NULL, // hbrBackground
- NULL, // lpszMenuName
+ nullptr, // hIcon
+ nullptr, // hCursor
+ nullptr, // hbrBackground
+ nullptr, // lpszMenuName
m_ClassName, // lpszClassName
- NULL // hIconSm
+ nullptr // hIconSm
};
if (!RegisterClassEx(&wcx))
@@ -416,7 +416,7 @@ void OptionsCtrlImpl::unregisterClass() }
OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, UINT_PTR nOwnId) :
- m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(NULL), m_pfnOldTreeProc(NULL), m_bModified(true), m_hDragItem(NULL)
+ m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(nullptr), m_pfnOldTreeProc(nullptr), m_bModified(true), m_hDragItem(nullptr)
{
}
@@ -443,7 +443,7 @@ LRESULT OptionsCtrlImpl::onWMCreate(CREATESTRUCT* pCS) m_hWnd,
reinterpret_cast<HMENU>(ccTree),
g_hInst,
- NULL);
+ nullptr);
if (!m_hTree)
return -1;
@@ -468,11 +468,11 @@ void OptionsCtrlImpl::onWMDestroy() // undo subclassing of tree view
SetWindowLongPtr(m_hTree, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_pfnOldTreeProc));
- m_pfnOldTreeProc = NULL;
+ m_pfnOldTreeProc = nullptr;
// destroy tree view before invalidating 'this'
DestroyWindow(m_hTree);
- m_hTree = NULL;
+ m_hTree = nullptr;
}
void OptionsCtrlImpl::onNMClick()
@@ -547,7 +547,7 @@ void OptionsCtrlImpl::onTVNDeleteItem(NMTREEVIEW* pNMTreeView) nmoc.hdr.code = OCN_SELCHANGING;
nmoc.hdr.hwndFrom = m_hWnd;
nmoc.hdr.idFrom = m_nOwnId;
- nmoc.hItem = 0;
+ nmoc.hItem = nullptr;
nmoc.dwData = 0;
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmoc.hdr.idFrom, reinterpret_cast<LPARAM>(&nmoc));
@@ -559,7 +559,7 @@ void OptionsCtrlImpl::onTVNDeleteItem(NMTREEVIEW* pNMTreeView) // do actual delete
Item* pItem = getItem(pNMTreeView->itemOld.hItem);
- setItem(pNMTreeView->itemOld.hItem, NULL);
+ setItem(pNMTreeView->itemOld.hItem, nullptr);
pItem->onDeselect();
@@ -638,7 +638,7 @@ void OptionsCtrlImpl::onWMLButtonUp(const POINT& pt) HTREEITEM hDragItem = m_hDragItem;
TreeView_SetInsertMark(m_hTree, NULL, FALSE);
- m_hDragItem = NULL;
+ m_hDragItem = nullptr;
ReleaseCapture();
// check for drop target and handle
@@ -773,7 +773,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertGroup(HTREEITEM hParent, OCGROUP* pGroup) assert(pGroup);
assert(pGroup->szLabel);
- return (new Group(this, hParent ? getItem(hParent) : NULL, pGroup->szLabel, pGroup->dwFlags, pGroup->dwData))->m_hItem;
+ return (new Group(this, hParent ? getItem(hParent) : nullptr, pGroup->szLabel, pGroup->dwFlags, pGroup->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertCheck(HTREEITEM hParent, OCCHECK* pCheck)
@@ -781,7 +781,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertCheck(HTREEITEM hParent, OCCHECK* pCheck) assert(pCheck);
assert(pCheck->szLabel);
- return (new Check(this, hParent ? getItem(hParent) : NULL, pCheck->szLabel, pCheck->dwFlags, pCheck->dwData))->m_hItem;
+ return (new Check(this, hParent ? getItem(hParent) : nullptr, pCheck->szLabel, pCheck->dwFlags, pCheck->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertRadio(HTREEITEM hParent, OCRADIO* pRadio)
@@ -789,11 +789,11 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertRadio(HTREEITEM hParent, OCRADIO* pRadio) assert(pRadio);
assert(pRadio->szLabel);
- Item* pSibling = pRadio->hSibling ? getItem(reinterpret_cast<HTREEITEM>(pRadio->hSibling)) : NULL;
+ Item* pSibling = pRadio->hSibling ? getItem(reinterpret_cast<HTREEITEM>(pRadio->hSibling)) : nullptr;
assert(!pSibling || pSibling->m_ItemType == itRadio);
- return (new Radio(this, hParent ? getItem(hParent) : NULL, reinterpret_cast<Radio*>(pSibling), pRadio->szLabel, pRadio->dwFlags, pRadio->dwData))->m_hItem;
+ return (new Radio(this, hParent ? getItem(hParent) : nullptr, reinterpret_cast<Radio*>(pSibling), pRadio->szLabel, pRadio->dwFlags, pRadio->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertEdit(HTREEITEM hParent, OCEDIT* pEdit)
@@ -802,7 +802,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertEdit(HTREEITEM hParent, OCEDIT* pEdit) assert(pEdit->szLabel);
assert(pEdit->szEdit);
- return (new Edit(this, hParent ? getItem(hParent) : NULL, pEdit->szLabel, pEdit->szEdit, pEdit->dwFlags, pEdit->dwData))->m_hItem;
+ return (new Edit(this, hParent ? getItem(hParent) : nullptr, pEdit->szLabel, pEdit->szEdit, pEdit->dwFlags, pEdit->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertCombo(HTREEITEM hParent, OCCOMBO* pCombo)
@@ -810,7 +810,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertCombo(HTREEITEM hParent, OCCOMBO* pCombo) assert(pCombo);
assert(pCombo->szLabel);
- return (new Combo(this, hParent ? getItem(hParent) : NULL, pCombo->szLabel, pCombo->dwFlags, pCombo->dwData))->m_hItem;
+ return (new Combo(this, hParent ? getItem(hParent) : nullptr, pCombo->szLabel, pCombo->dwFlags, pCombo->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertButton(HTREEITEM hParent, OCBUTTON* pButton)
@@ -819,7 +819,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertButton(HTREEITEM hParent, OCBUTTON* pButto assert(pButton->szLabel);
assert(pButton->szButton);
- return (new Button(this, hParent ? getItem(hParent) : NULL, pButton->szLabel, pButton->szButton, pButton->dwFlags, pButton->dwData))->m_hItem;
+ return (new Button(this, hParent ? getItem(hParent) : nullptr, pButton->szLabel, pButton->szButton, pButton->dwFlags, pButton->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertDateTime(HTREEITEM hParent, OCDATETIME* pDateTime)
@@ -828,7 +828,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertDateTime(HTREEITEM hParent, OCDATETIME* pD assert(pDateTime->szLabel);
assert(pDateTime->szFormat);
- return (new DateTime(this, hParent ? getItem(hParent) : NULL, pDateTime->szLabel, pDateTime->szFormat, pDateTime->dwDateTime, pDateTime->dwFlags, pDateTime->dwData))->m_hItem;
+ return (new DateTime(this, hParent ? getItem(hParent) : nullptr, pDateTime->szLabel, pDateTime->szFormat, pDateTime->dwDateTime, pDateTime->dwFlags, pDateTime->dwData))->m_hItem;
}
HTREEITEM OptionsCtrlImpl::onOCMInsertColor(HTREEITEM hParent, OCCOLOR* pColor)
@@ -836,7 +836,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertColor(HTREEITEM hParent, OCCOLOR* pColor) assert(pColor);
assert(pColor->szLabel);
- return (new Color(this, hParent ? getItem(hParent) : NULL, pColor->szLabel, pColor->crColor, pColor->dwFlags, pColor->dwData))->m_hItem;
+ return (new Color(this, hParent ? getItem(hParent) : nullptr, pColor->szLabel, pColor->crColor, pColor->dwFlags, pColor->dwData))->m_hItem;
}
const wchar_t* OptionsCtrlImpl::onOCMGetItemLabel(HTREEITEM hItem)
@@ -1015,7 +1015,7 @@ HTREEITEM OptionsCtrlImpl::onOCMGetItem(HTREEITEM hItem, DWORD dwFlag) return TreeView_GetPrevSibling(m_hTree, hItem);
default:
- return NULL;
+ return nullptr;
}
}
@@ -1152,7 +1152,7 @@ bool OptionsCtrlImpl::isItemValid(HTREEITEM hItem) TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast<Item*>(tvi.lParam) : NULL;
+ Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast<Item*>(tvi.lParam) : nullptr;
return bool_(pItem);
}
@@ -1164,7 +1164,7 @@ OptionsCtrlImpl::Item* OptionsCtrlImpl::getItem(HTREEITEM hItem) TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast<Item*>(tvi.lParam) : NULL;
+ Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast<Item*>(tvi.lParam) : nullptr;
assert(pItem);
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp index 868fa46436..ebf47ae9ba 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp @@ -9,7 +9,7 @@ OptionsCtrlImpl::Button::Button(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szButton, DWORD dwFlags, INT_PTR dwData)
: Item(pCtrl, itButton, szLabel, dwFlags, dwData)
- , m_hButtonWnd(NULL)
+ , m_hButtonWnd(nullptr)
, m_strButton(szButton)
{
m_pCtrl->insertItem(pParent, this, m_strLabel.c_str(), dwFlags, m_bEnabled ? siButton : siButtonG);
@@ -47,7 +47,7 @@ void OptionsCtrlImpl::Button::onSelect() if (hTempWnd = CreateWindowEx(
0, WC_BUTTON, m_strButton.c_str(), dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccButton), g_hInst, NULL))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccButton), g_hInst, nullptr))
{
SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hTreeFront), MAKELPARAM(TRUE, 0));
@@ -74,9 +74,9 @@ void OptionsCtrlImpl::Button::onDeselect() m_pCtrl->setNodeText(m_hItem, m_strLabel.c_str());
DestroyWindow(m_hButtonWnd);
- m_hButtonWnd = NULL;
+ m_hButtonWnd = nullptr;
- InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE);
+ InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE);
}
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp index 3439d87832..b7ff993eed 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp @@ -14,7 +14,7 @@ COLORREF OptionsCtrlImpl::Color::getColorValue() OptionsCtrlImpl::Color::Color(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, COLORREF crColor, DWORD dwFlags, INT_PTR dwData)
: Item(pCtrl, itColor, szLabel, dwFlags, dwData)
- , m_hColorWnd(NULL)
+ , m_hColorWnd(nullptr)
, m_crColor(crColor)
{
m_pCtrl->insertItem(pParent, this, m_strLabel.c_str(), dwFlags, m_bEnabled ? siColor : siColorG);
@@ -54,9 +54,9 @@ void OptionsCtrlImpl::Color::onSelect() DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
if (hTempWnd = CreateWindowEx(
- 0, _A2W(WNDCLASS_COLOURPICKER), NULL, dwStyle,
+ 0, _A2W(WNDCLASS_COLOURPICKER), nullptr, dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccColor), g_hInst, NULL))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccColor), g_hInst, nullptr))
{
SendMessage(hTempWnd, CPM_SETCOLOUR, 0, m_crColor);
@@ -83,9 +83,9 @@ void OptionsCtrlImpl::Color::onDeselect() m_pCtrl->setNodeText(m_hItem, m_strLabel.c_str());
DestroyWindow(m_hColorWnd);
- m_hColorWnd = NULL;
+ m_hColorWnd = nullptr;
- InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE);
+ InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE);
}
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp index db0837a97e..5e8aa5bad6 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp @@ -47,7 +47,7 @@ ext::string OptionsCtrlImpl::Combo::getCombinedText() }
OptionsCtrlImpl::Combo::Combo(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, DWORD dwFlags, INT_PTR dwData)
- : Item(pCtrl, itCombo, szLabel, dwFlags, dwData), m_hComboWnd(NULL), m_nSelected(-1)
+ : Item(pCtrl, itCombo, szLabel, dwFlags, dwData), m_hComboWnd(nullptr), m_nSelected(-1)
{
m_bDisableChildsOnIndex0 = bool_(dwFlags & OCF_DISABLECHILDSONINDEX0);
@@ -88,7 +88,7 @@ void OptionsCtrlImpl::Combo::onSelect() if (hTempWnd = CreateWindowEx(
WS_EX_CLIENTEDGE, WC_COMBOBOX, L"", dwStyle,
r.left, r.top, r.right - r.left, (r.bottom - r.top) * 20,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccCombo), g_hInst, NULL))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccCombo), g_hInst, nullptr))
{
vector_each_(i, m_Items)
{
@@ -127,9 +127,9 @@ void OptionsCtrlImpl::Combo::onDeselect() m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str());
DestroyWindow(m_hComboWnd);
- m_hComboWnd = NULL;
+ m_hComboWnd = nullptr;
- InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE);
+ InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE);
// enable childs?
enableChildsCombo();
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp index 0a32c7a29c..9a089fc886 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp @@ -181,7 +181,7 @@ ext::string OptionsCtrlImpl::DateTime::getCombinedText() }
OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szFormat, time_t timestamp, DWORD dwFlags, INT_PTR dwData)
-: Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(NULL), m_strFormat(szFormat), m_timestamp(timestamp)
+: Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(nullptr), m_strFormat(szFormat), m_timestamp(timestamp)
{
m_bDisableChildsOnNone = bool_(dwFlags & OCF_DISABLECHILDSONNONE);
m_bAllowNone = bool_(dwFlags & OCF_ALLOWNONE);
@@ -221,7 +221,7 @@ void OptionsCtrlImpl::DateTime::onSelect() if (hTempWnd = CreateWindowEx(
WS_EX_CLIENTEDGE, DATETIMEPICK_CLASS, L"", dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccDateTime), g_hInst, NULL)) {
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccDateTime), g_hInst, nullptr)) {
// restrict to dates a timestamp can hold (with 1 day less to avoid timezone issues)
SYSTEMTIME stMinMax[2] = { toSystemTime(0x00000000 + 24 * 60 * 60), toSystemTime(0x7FFFFFFF - 24 * 60 * 60) };
@@ -266,9 +266,9 @@ void OptionsCtrlImpl::DateTime::onDeselect() m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str());
DestroyWindow(m_hDateTimeWnd);
- m_hDateTimeWnd = NULL;
+ m_hDateTimeWnd = nullptr;
- InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE);
+ InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE);
// enable childs?
enableChildsDateTime();
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp index c297fedd16..df4991990b 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp @@ -39,7 +39,7 @@ ext::string OptionsCtrlImpl::Edit::getCombinedText() }
OptionsCtrlImpl::Edit::Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szEdit, DWORD dwFlags, INT_PTR dwData)
- : Item(pCtrl, itEdit, szLabel, dwFlags, dwData), m_hEditWnd(NULL)
+ : Item(pCtrl, itEdit, szLabel, dwFlags, dwData), m_hEditWnd(nullptr)
{
m_strEdit = szEdit;
m_bNumber = bool_(dwFlags & OCF_NUMBER);
@@ -85,7 +85,7 @@ void OptionsCtrlImpl::Edit::onSelect() if (hTempWnd = CreateWindowEx(
WS_EX_CLIENTEDGE, WC_EDIT, m_strEdit.c_str(), dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccEdit), g_hInst, NULL))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccEdit), g_hInst, nullptr))
{
SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hTreeFront), MAKELPARAM(TRUE, 0));
@@ -114,9 +114,9 @@ void OptionsCtrlImpl::Edit::onDeselect() m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str());
DestroyWindow(m_hEditWnd);
- m_hEditWnd = NULL;
+ m_hEditWnd = nullptr;
- InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE);
+ InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE);
}
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_item.cpp b/plugins/HistoryStats/src/optionsctrlimpl_item.cpp index 2900ce6a44..faf8ec18e0 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_item.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_item.cpp @@ -6,7 +6,7 @@ */
OptionsCtrlImpl::Item::Item(OptionsCtrlImpl* pCtrl, ItemType ItemType, const wchar_t* szLabel, DWORD dwFlags, INT_PTR dwData) :
- m_pCtrl(pCtrl), m_hItem(NULL), m_nRef(1), m_ItemType(ItemType), m_strLabel(szLabel), m_dwData(dwData)
+ m_pCtrl(pCtrl), m_hItem(nullptr), m_nRef(1), m_ItemType(ItemType), m_strLabel(szLabel), m_dwData(dwData)
{
m_bEnabled = !(dwFlags & OCF_DISABLED);
m_bDisableChilds = !(dwFlags & OCF_NODISABLECHILDS);
diff --git a/plugins/HistoryStats/src/settings.cpp b/plugins/HistoryStats/src/settings.cpp index 9ed6692ff7..722e6e0c96 100644 --- a/plugins/HistoryStats/src/settings.cpp +++ b/plugins/HistoryStats/src/settings.cpp @@ -41,7 +41,7 @@ Settings::CharMapper::CharMapper(const Settings& settings) Settings::Filter::Filter(const ext::string& strID)
: m_strID(strID), m_nMode(fwmWordsMatching), m_nRef(0)
{
- time_t curTime = time(NULL);
+ time_t curTime = time(nullptr);
struct tm* curTM = localtime(&curTime);
m_strName += utils::intToPadded(1900 + curTM->tm_year, 4);
@@ -393,7 +393,7 @@ const Settings::Filter* Settings::getFilter(const ext::string& strID) const return &(*i);
}
- return NULL;
+ return nullptr;
}
Settings& Settings::operator =(const Settings& other)
@@ -569,7 +569,7 @@ void Settings::ensureConstraints() void Settings::openURL(const wchar_t *szURL)
{
if (m_PathToBrowser.empty())
- ShellExecute(NULL, L"open", szURL, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, L"open", szURL, nullptr, nullptr, SW_SHOWNORMAL);
else
- ShellExecute(NULL, L"open", m_PathToBrowser.c_str(), szURL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, L"open", m_PathToBrowser.c_str(), szURL, nullptr, SW_SHOWNORMAL);
}
diff --git a/plugins/HistoryStats/src/settingstree.cpp b/plugins/HistoryStats/src/settingstree.cpp index 21d6501cf8..ff3893777c 100644 --- a/plugins/HistoryStats/src/settingstree.cpp +++ b/plugins/HistoryStats/src/settingstree.cpp @@ -10,12 +10,12 @@ void SettingsTree::makeKeyValid() }
SettingsTree::SettingsTree() :
- m_pCurValues(NULL)
+ m_pCurValues(nullptr)
{
}
SettingsTree::SettingsTree(const ext::string& config) :
- m_pCurValues(NULL)
+ m_pCurValues(nullptr)
{
fromString(config);
}
@@ -122,7 +122,7 @@ void SettingsTree::setKey(const wchar_t* key) if (i != m_Keys.end())
m_pCurValues = &i->second;
else
- m_pCurValues = NULL;
+ m_pCurValues = nullptr;
}
bool SettingsTree::readBool(const wchar_t* setting, bool errorValue) const
@@ -213,7 +213,7 @@ bool SettingsTree::delSetting(const wchar_t* setting) if (m_pCurValues->size() == 0) {
m_Keys.erase(m_CurKey);
- m_pCurValues = NULL;
+ m_pCurValues = nullptr;
}
return true;
diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index 50cd82c8ad..842e24106e 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -31,7 +31,7 @@ void Statistic::prepareColumns() {
Column *pCol = m_Settings.getCol(i);
if (pCol->isEnabled()) {
- int restrictions = pCol->configGetRestrictions(NULL);
+ int restrictions = pCol->configGetRestrictions(nullptr);
// MEMO: checks for columns having no HTML-only support
if (!bOutputPNG && !(restrictions & Column::crHTMLMask))
@@ -541,7 +541,7 @@ bool Statistic::stepSortContacts() ContactCompareBase** ppCmps = new ContactCompareBase*[cmpDepth];
- ContactCompareBase* pCmp = NULL;
+ ContactCompareBase* pCmp = nullptr;
ContactCompareBase* pPrev = &cmpName;
for (int i = cmpDepth - 1; i >= 0; --i) {
@@ -658,7 +658,7 @@ bool Statistic::stepSortContacts() pCmp->setDir(m_Settings.m_Sort[i].asc);
ppCmps[i] = pPrev = pCmp;
- pCmp = NULL;
+ pCmp = nullptr;
}
std::sort(m_Contacts.begin(), m_Contacts.end(), ContactCompareOp(ppCmps[0]));
@@ -707,25 +707,25 @@ bool Statistic::stepOmitContacts() double (Contact::*double_fn)() const;
DWORD(Contact::*DWORD_fn)() const;
} valueMap[] = {
- { 0, 1.0, &Contact::getInBytes, 0, 0 },
- { 0, 1.0, &Contact::getOutBytes, 0, 0 },
- { 0, 1.0, &Contact::getTotalBytes, 0, 0 },
- { 1, 604800.0, 0, &Contact::getInBytesAvg, 0 },
- { 1, 604800.0, 0, &Contact::getOutBytesAvg, 0 },
- { 1, 604800.0, 0, &Contact::getTotalBytesAvg, 0 },
- { 0, 1.0, &Contact::getInMessages, 0, 0 },
- { 0, 1.0, &Contact::getOutMessages, 0, 0 },
- { 0, 1.0, &Contact::getTotalMessages, 0, 0 },
- { 1, 604800.0, 0, &Contact::getInMessagesAvg, 0 },
- { 1, 604800.0, 0, &Contact::getOutMessagesAvg, 0 },
- { 1, 604800.0, 0, &Contact::getTotalMessagesAvg, 0 },
- { 0, 1.0, &Contact::getInChats, 0, 0 },
- { 0, 1.0, &Contact::getOutChats, 0, 0 },
- { 0, 1.0, &Contact::getTotalChats, 0, 0 },
- { 1, 604800.0, 0, &Contact::getInChatsAvg, 0 },
- { 1, 604800.0, 0, &Contact::getOutChatsAvg, 0 },
- { 1, 604800.0, 0, &Contact::getTotalChatsAvg, 0 },
- { 2, 1 / 3600.0, 0, 0, &Contact::getChatDurSum },
+ { 0, 1.0, &Contact::getInBytes, nullptr, nullptr },
+ { 0, 1.0, &Contact::getOutBytes, nullptr, nullptr },
+ { 0, 1.0, &Contact::getTotalBytes, nullptr, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getInBytesAvg, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getOutBytesAvg, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getTotalBytesAvg, nullptr },
+ { 0, 1.0, &Contact::getInMessages, nullptr, nullptr },
+ { 0, 1.0, &Contact::getOutMessages, nullptr, nullptr },
+ { 0, 1.0, &Contact::getTotalMessages, nullptr, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getInMessagesAvg, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getOutMessagesAvg, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getTotalMessagesAvg, nullptr },
+ { 0, 1.0, &Contact::getInChats, nullptr, nullptr },
+ { 0, 1.0, &Contact::getOutChats, nullptr, nullptr },
+ { 0, 1.0, &Contact::getTotalChats, nullptr, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getInChatsAvg, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getOutChatsAvg, nullptr },
+ { 1, 604800.0, nullptr, &Contact::getTotalChatsAvg, nullptr },
+ { 2, 1 / 3600.0, nullptr, nullptr, &Contact::getChatDurSum },
};
int valueKey = m_Settings.m_OmitByValueData;
@@ -1173,12 +1173,12 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN m_Settings(settings),
m_CharMapper(m_Settings),
m_hInst(hInst),
- m_hWndProgress(NULL),
- m_hThreadPushEvent(NULL),
- m_hCancelEvent(NULL),
+ m_hWndProgress(nullptr),
+ m_hThreadPushEvent(nullptr),
+ m_hCancelEvent(nullptr),
m_InvokedFrom(invokedFrom),
- m_pTotals(NULL),
- m_pOmitted(NULL),
+ m_pTotals(nullptr),
+ m_pOmitted(nullptr),
m_bActuallyOmitted(false),
m_nNextSlot(0),
m_nLastFileNr(0),
@@ -1188,7 +1188,7 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN m_nFirstTime(0),
m_nLastTime(0)
{
- m_TimeStarted = TimeZone_ToLocal(time(NULL));
+ m_TimeStarted = TimeZone_ToLocal(time(nullptr));
m_MSecStarted = GetTickCount();
m_AverageMinTime = settings.m_AverageMinTime * 24 * 60 * 60; // calculate seconds from days
}
@@ -1196,15 +1196,15 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN bool Statistic::createStatistics()
{
// Prepare event for cancel.
- m_hCancelEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (m_hCancelEvent == NULL)
+ m_hCancelEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (m_hCancelEvent == nullptr)
return false;
- m_hWndProgress = CreateDialog(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), 0, staticProgressProc);
+ m_hWndProgress = CreateDialog(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), nullptr, staticProgressProc);
- if (m_hWndProgress == NULL) {
+ if (m_hWndProgress == nullptr) {
CloseHandle(m_hCancelEvent);
- m_hCancelEvent = NULL;
+ m_hCancelEvent = nullptr;
return false;
}
@@ -1220,13 +1220,13 @@ bool Statistic::createStatistics() MSG msg;
while (!bDone) {
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
+ while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
bDone = true;
break;
}
- if (msg.hwnd == NULL || !IsDialogMessage(msg.hwnd, &msg)) { /* Wine fix. */
+ if (msg.hwnd == nullptr || !IsDialogMessage(msg.hwnd, &msg)) { /* Wine fix. */
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -1246,8 +1246,8 @@ bool Statistic::createStatistics() // Cleanup.
CloseHandle(m_hCancelEvent);
- m_hCancelEvent = NULL;
- m_hWndProgress = NULL;
+ m_hCancelEvent = nullptr;
+ m_hWndProgress = nullptr;
if (m_bResult) {
// Save last successfully created statistics
@@ -1316,7 +1316,7 @@ void __cdecl Statistic::threadProc(void *lpParameter) // check for errors
if (!pStats->m_ErrorText.empty() && !Miranda_IsTerminated())
- MessageBox(0, pStats->m_ErrorText.c_str(), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, pStats->m_ErrorText.c_str(), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
// free statistics
delete pStats;
@@ -1402,7 +1402,7 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS {
// check if running and make running
if (m_bRunning) {
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("HistoryStats is already generating statistics. Please wait for the already running process to be finished or cancel it and try again."),
TranslateT("HistoryStats"), MB_ICONINFORMATION | MB_OK);
return;
@@ -1410,9 +1410,9 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS m_bRunning = true;
- HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
// create event for thread stack unwinding
- if (hEvent == NULL) {
+ if (hEvent == nullptr) {
m_bRunning = false;
return;
}
@@ -1424,11 +1424,11 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS HANDLE hThread = mir_forkthread(threadProc, (void*)pStats);
// wait for thread to place itself on thread unwind stack
- if (hThread != NULL)
+ if (hThread != nullptr)
WaitForSingleObject(pStats->m_hThreadPushEvent, INFINITE);
else
m_bRunning = false;
CloseHandle(pStats->m_hThreadPushEvent);
- pStats->m_hThreadPushEvent = NULL;
+ pStats->m_hThreadPushEvent = nullptr;
}
diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp index 9c58288dfe..4e0a78400b 100644 --- a/plugins/HistoryStats/src/utils.cpp +++ b/plugins/HistoryStats/src/utils.cpp @@ -411,7 +411,7 @@ ext::a::string utils::convertWToA(const WCHAR* str, size_t len) {
char* buf = new char[len + 1];
- len = WideCharToMultiByte(CP_ACP, 0, str, len, buf, len, NULL, NULL);
+ len = WideCharToMultiByte(CP_ACP, 0, str, len, buf, len, nullptr, nullptr);
buf[len] = '\0';
@@ -759,7 +759,7 @@ bool utils::createPath(const ext::string& path) curPath += curDir;
- if (!CreateDirectory(curPath.c_str(), NULL)) {
+ if (!CreateDirectory(curPath.c_str(), nullptr)) {
return false;
}
@@ -848,7 +848,7 @@ void utils::centerDialog(HWND hDlg, HWND hParent /* = NULL */) if (GetWindowRect(hParent, &rParent) && GetWindowRect(hDlg, &rDlg)) {
SetWindowPos(
hDlg,
- 0,
+ nullptr,
(rParent.right + rParent.left - rDlg.right + rDlg.left) / 2,
(rParent.bottom + rParent.top - rDlg.bottom + rDlg.top) / 2,
0,
@@ -858,7 +858,7 @@ void utils::centerDialog(HWND hDlg, HWND hParent /* = NULL */) else if (GetWindowRect(hDlg, &rDlg)) {
SetWindowPos(
hDlg,
- 0,
+ nullptr,
(GetSystemMetrics(SM_CXSCREEN) - rDlg.right + rDlg.left) / 2,
(GetSystemMetrics(SM_CYSCREEN) - rDlg.bottom + rDlg.top) / 2,
0,
@@ -971,7 +971,7 @@ Locale Locale::m_Data; /*
* RTFFilter
*/
-RTFFilter::RTFFilter() : m_hRTFConv(NULL), m_RTFConvString(0)
+RTFFilter::RTFFilter() : m_hRTFConv(nullptr), m_RTFConvString(nullptr)
{
}
@@ -983,7 +983,7 @@ void RTFFilter::init() if (!(m_Data.m_RTFConvString = reinterpret_cast<RTFCONVSTRING>(GetProcAddress(m_Data.m_hRTFConv, "RtfconvString")))) {
FreeLibrary(m_Data.m_hRTFConv);
- m_Data.m_hRTFConv = NULL;
+ m_Data.m_hRTFConv = nullptr;
}
}
@@ -993,8 +993,8 @@ void RTFFilter::uninit() if (m_Data.m_hRTFConv) {
FreeLibrary(m_Data.m_hRTFConv);
- m_Data.m_hRTFConv = NULL;
- m_Data.m_RTFConvString = NULL;
+ m_Data.m_hRTFConv = nullptr;
+ m_Data.m_RTFConvString = nullptr;
}
}
@@ -1011,7 +1011,7 @@ ext::t::string RTFFilter::filter(const ext::t::string& str) intptr_t len = m_Data.m_RTFConvString(
strA.c_str(),
- NULL,
+ nullptr,
0,
CP_UNICODE,
CONVMODE_USE_SYSTEM_TABLE | CONVMODE_NO_OUTPUT_BOM,
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 87e42974f6..ad73c5d46c 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -30,7 +30,7 @@ typedef struct // build criteria
time_t BuildCriteria(int dwti)
{
- time_t tim = time(NULL);
+ time_t tim = time(nullptr);
switch (dwti) {
case 0:
@@ -93,7 +93,7 @@ static int CompareBookmarks(const void* p1, const void* p2) static void GetBookmarks(MCONTACT hContact, BEventData** books, size_t* bookcnt)
{
- *books = NULL;
+ *books = nullptr;
*bookcnt = 0;
DBVARIANT dbv;
@@ -143,7 +143,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke BEventData *books, *item, ev = { 0 };
size_t bookcnt, btshift;
- SetCursor(LoadCursor(0, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
// switch off SAFETYMODE if necessary
if (unsafe)
@@ -167,7 +167,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (bookcnt != 0) { // keep bookmarks
ev.hDBEvent = hDBEvent;
item = (BEventData*)bsearch(&ev, books, bookcnt, sizeof(BEventData), CompareBookmarks);
- if (item != NULL && item->Timestamp == dbei.timestamp) {
+ if (item != nullptr && item->Timestamp == dbei.timestamp) {
doDelete = FALSE;
btshift = (--bookcnt - (item - books))*sizeof(BEventData);
if (btshift)
@@ -189,7 +189,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (unsafe)
db_set_safety_mode(TRUE);
- SetCursor(LoadCursor(0, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
// shutdown action
@@ -237,7 +237,7 @@ void SetSrmmIcon(MCONTACT hContact) {
int sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0);
- StatusIconData sid = { 0 };
+ StatusIconData sid = {};
sid.szModule = ModuleName;
for (int i = 0; i < 4; i++) {
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index d2b68c7a12..b503a09580 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -72,7 +72,7 @@ HANDLE GetIconHandle(const char* name) if (mir_strcmp(iconList[i].szName, name) == 0)
return hIconLibItem[i];
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(const char* name)
@@ -168,7 +168,7 @@ void SaveSettings(HWND hwndDlg) // set tooltips
int st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
- StatusIconData sid = { 0 };
+ StatusIconData sid = {};
sid.szModule = ModuleName;
sid.dwId = 0;
sid.hIcon = LoadIconEx("actG");
@@ -249,7 +249,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) // Find clicked item
hItem = (HANDLE)SendMessage(nmc->hdr.hwndFrom, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y));
// Nothing was clicked
- if (hItem == NULL || !(IsHContactContact(hItem) || IsHContactInfo(hItem)))
+ if (hItem == nullptr || !(IsHContactContact(hItem) || IsHContactInfo(hItem)))
break;
// It was not our extended icon
diff --git a/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp b/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp index 3f59ff7712..a732504763 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp @@ -99,7 +99,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; //case WM_NOTIFY
case WM_DESTROY:
- hDialogWnd = 0; // èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû (ïîêà îòêðûòû íàñòðîéêè), 0 (ïðè çàêðûòèè äèàëîãà) áëîêèðóåò ýòî
+ hDialogWnd = nullptr; // èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû (ïîêà îòêðûòû íàñòðîéêè), 0 (ïðè çàêðûòèè äèàëîãà) áëîêèðóåò ýòî
break;
}
diff --git a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp index a138e21388..01ed11e26f 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 - 1307, USA. HINSTANCE hInstance;
int hLangpack;
-HWND hDialogWnd = 0; // õýíäë îêíà íàñòðîåê, îí ãëîáàëüíî èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû èç õóêà
+HWND hDialogWnd = nullptr; // õýíäë îêíà íàñòðîåê, îí ãëîáàëüíî èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû èç õóêà
HHOOK hHook;
CLIST_INTERFACE *pcli;
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; diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 12c0308a3e..d3f5cf2847 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -41,7 +41,7 @@ static const char *classNames[] = { ChatHTMLBuilder::ChatHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
+ setLastEventTime(time(nullptr));
}
void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
@@ -98,7 +98,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color;
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getChatMode() == Options::MODE_TEMPLATE)
@@ -110,9 +110,9 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
COLORREF bkgColor = db_get_dw(NULL, CHATMOD, "BackgroundLog", 0xFFFFFF);
@@ -161,7 +161,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
DWORD iconFlags = db_get_dw(NULL, CHATMOD, CHAT_ICON_FLAGS, 0);
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
const char *iconFile = "";
DWORD dwData = eventData->dwData;
bool isSent = eventData->bIsMe != 0;
@@ -256,7 +256,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) void ChatHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings != NULL)
+ if (protoSettings != nullptr)
appendEventNonTemplate(view, event);
}
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 232cc4c203..b9d8106bb0 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -28,23 +28,23 @@ HTMLBuilder::HTMLBuilder() lastIEViewEvent.cbSize = sizeof(IEVIEWEVENT);
lastIEViewEvent.iType = IEE_LOG_MEM_EVENTS;
lastIEViewEvent.codepage = CP_ACP;
- lastIEViewEvent.pszProto = NULL;
+ lastIEViewEvent.pszProto = nullptr;
lastIEViewEvent.count = 0;
lastIEViewEvent.dwFlags = 0;
lastIEViewEvent.hContact = NULL;
- lastIEViewEvent.hwnd = NULL;
- lastIEViewEvent.eventData = NULL;
+ lastIEViewEvent.hwnd = nullptr;
+ lastIEViewEvent.eventData = nullptr;
}
HTMLBuilder::~HTMLBuilder()
{
- if (lastIEViewEvent.pszProto != NULL)
+ if (lastIEViewEvent.pszProto != nullptr)
mir_free((void*)lastIEViewEvent.pszProto);
}
bool HTMLBuilder::encode(MCONTACT hContact, const char *proto, const wchar_t *text, CMStringW &str, int level, int flags, bool isSent)
{
- TextToken *token = NULL, *token2;
+ TextToken *token = nullptr, *token2;
switch (level) {
case 0:
if (flags & ENF_CHAT_FORMATTING) {
@@ -66,8 +66,8 @@ bool HTMLBuilder::encode(MCONTACT hContact, const char *proto, const wchar_t *te token = TextToken::tokenizeSmileys(hContact, proto, text, isSent);
break;
}
- if (token != NULL) {
- for (token2 = token; token != NULL; token = token2) {
+ if (token != nullptr) {
+ for (token2 = token; token != nullptr; token = token2) {
bool skip = false;
token2 = token->getNext();
if (token->getType() == TextToken::TEXT)
@@ -83,8 +83,8 @@ bool HTMLBuilder::encode(MCONTACT hContact, const char *proto, const wchar_t *te char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const wchar_t *wtext, int flags, bool isSent)
{
- if (wtext == NULL)
- return NULL;
+ if (wtext == nullptr)
+ return nullptr;
CMStringW str;
encode(hContact, proto, wtext, str, 0, flags, isSent);
@@ -93,16 +93,16 @@ char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const wchar_ char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const char *text, int flags, bool isSent)
{
- if (text == NULL)
- return NULL;
+ if (text == nullptr)
+ return nullptr;
return encodeUTF8(hContact, proto, _A2T(text), flags, isSent);
}
char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const char *text, int cp, int flags, bool isSent)
{
- if (text == NULL)
- return NULL;
+ if (text == nullptr)
+ return nullptr;
ptrW wtext(mir_a2u_cp(text, cp));
return encodeUTF8(hContact, proto, wtext, flags, isSent);
@@ -115,7 +115,7 @@ char* HTMLBuilder::getProto(MCONTACT hContact) char* HTMLBuilder::getProto(const char *proto, MCONTACT hContact)
{
- if (proto != NULL)
+ if (proto != nullptr)
return mir_strdup(proto);
return mir_strdup(GetContactProto(hContact));
@@ -124,10 +124,10 @@ char* HTMLBuilder::getProto(const char *proto, MCONTACT hContact) char* HTMLBuilder::getRealProto(MCONTACT hContact)
{
if (hContact == NULL)
- return NULL;
+ return nullptr;
char *szProto = mir_strdup(GetContactProto(hContact));
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO)) {
hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL)
replaceStr(szProto, GetContactProto(hContact));
@@ -137,7 +137,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact) char* HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto)
{
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO)) {
hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL)
return mir_strdup(GetContactProto(hContact));
@@ -148,7 +148,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto) MCONTACT HTMLBuilder::getRealContact(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO))
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO))
hContact = db_mc_getMostOnline(hContact);
return hContact;
}
@@ -194,15 +194,15 @@ void HTMLBuilder::getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut) wchar_t* HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto)
{
wchar_t *str = Contact_GetInfo(CNF_DISPLAY, hContact, szProto);
- if (str != NULL)
+ if (str != nullptr)
return str;
str = Contact_GetInfo(CNF_UNIQUEID, hContact, szProto);
- if (str != NULL)
+ if (str != nullptr)
return str;
str = pcli->pfnGetContactDisplayName(hContact, 0);
- if (str != NULL)
+ if (str != nullptr)
return mir_wstrdup(str);
return mir_wstrdup(TranslateT("(Unknown Contact)"));
@@ -223,12 +223,12 @@ void HTMLBuilder::appendEventNew(IEView *view, IEVIEWEVENT *event) void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
{
- IEVIEWEVENTDATA *prevEventData = NULL;
+ IEVIEWEVENTDATA *prevEventData = nullptr;
MEVENT hDbEvent = event->hDbEventFirst;
event->hDbEventFirst = NULL;
ptrA szProto;
- if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != NULL)
+ if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != nullptr)
szProto = mir_strdup(event->pszProto);
else
szProto = getProto(event->hContact);
@@ -243,7 +243,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) newEvent.dwFlags = event->dwFlags;
newEvent.hContact = event->hContact;
newEvent.hwnd = event->hwnd;
- newEvent.eventData = NULL;
+ newEvent.eventData = nullptr;
for (int eventIdx = 0; hDbEvent != NULL && (eventIdx < event->count || event->count == -1); eventIdx++) {
DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
@@ -271,9 +271,9 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) eventData->dwFlags |= IEEDF_RTL;
eventData->time = dbei.timestamp;
- eventData->pszNickW = NULL;
- eventData->pszTextW = NULL;
- eventData->pszText2W = NULL;
+ eventData->pszNickW = nullptr;
+ eventData->pszTextW = nullptr;
+ eventData->pszText2W = nullptr;
if (dbei.flags & DBEF_SENT) {
eventData->pszNickW = getContactName(NULL, szProto);
eventData->bIsMe = TRUE;
@@ -317,8 +317,8 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) eventData->iType = IEED_EVENT_MESSAGE;
}
free(dbei.pBlob);
- eventData->next = NULL;
- if (prevEventData != NULL)
+ eventData->next = nullptr;
+ if (prevEventData != nullptr)
prevEventData->next = eventData;
else
newEvent.eventData = eventData;
@@ -329,7 +329,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) hDbEvent = db_event_next(event->hContact, hDbEvent);
}
appendEventNew(view, &newEvent);
- for (IEVIEWEVENTDATA* eventData2 = newEvent.eventData; eventData2 != NULL;) {
+ for (IEVIEWEVENTDATA* eventData2 = newEvent.eventData; eventData2 != nullptr;) {
IEVIEWEVENTDATA *eventData = eventData2->next;
mir_free((void*)eventData2->pszTextW);
mir_free((void*)eventData2->pszText2W);
@@ -342,7 +342,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(const char *protocolName)
{
ProtocolSettings *protoSettings = Options::getProtocolSettings(protocolName);
- if (protoSettings == NULL || !protoSettings->isSRMMEnable())
+ if (protoSettings == nullptr || !protoSettings->isSRMMEnable())
protoSettings = Options::getProtocolSettings();
return protoSettings;
@@ -356,7 +356,7 @@ ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(MCONTACT hContact) ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(const char *protocolName)
{
ProtocolSettings *protoSettings = Options::getProtocolSettings(protocolName);
- if (protoSettings == NULL || !protoSettings->isHistoryEnable())
+ if (protoSettings == nullptr || !protoSettings->isHistoryEnable())
protoSettings = Options::getProtocolSettings();
return protoSettings;
@@ -373,7 +373,7 @@ ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(MCONTACT hContact) ProtocolSettings* HTMLBuilder::getChatProtocolSettings(const char *protocolName)
{
ProtocolSettings *protoSettings = Options::getProtocolSettings(protocolName);
- if (protoSettings == NULL || !protoSettings->isChatEnable())
+ if (protoSettings == nullptr || !protoSettings->isChatEnable())
protoSettings = Options::getProtocolSettings();
return protoSettings;
@@ -396,11 +396,11 @@ void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event) lastIEViewEvent.dwFlags = event->dwFlags;
lastIEViewEvent.hContact = event->hContact;
lastIEViewEvent.hwnd = event->hwnd;
- lastIEViewEvent.eventData = NULL;
- if (lastIEViewEvent.pszProto != NULL)
+ lastIEViewEvent.eventData = nullptr;
+ if (lastIEViewEvent.pszProto != nullptr)
mir_free((void*)lastIEViewEvent.pszProto);
- if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != NULL)
+ if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != nullptr)
lastIEViewEvent.pszProto = mir_strdup(event->pszProto);
else
lastIEViewEvent.pszProto = getProto(event->hContact);
@@ -408,10 +408,10 @@ void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event) void HTMLBuilder::clear(IEView *view, IEVIEWEVENT *event)
{
- if (event != NULL) {
+ if (event != nullptr) {
setLastIEViewEvent(event);
- if (lastIEViewEvent.pszProto != NULL || event->hContact == NULL)
+ if (lastIEViewEvent.pszProto != nullptr || event->hContact == NULL)
buildHead(view, &lastIEViewEvent);
}
}
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 5885305f4d..abbc3f3065 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -65,8 +65,8 @@ static const char *dbSpanSettingNames[] = { HistoryHTMLBuilder::HistoryHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
- startedTime = time(NULL);
+ setLastEventTime(time(nullptr));
+ startedTime = time(nullptr);
}
bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
@@ -149,7 +149,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color, bkgColor;
ProtocolSettings *protoSettings = getHistoryProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getHistoryMode() == Options::MODE_TEMPLATE) {
@@ -199,7 +199,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) lf.lfItalic ? "font-style: italic;" : "");
}
for (i = 0; i < SPAN_FONT_NUM; i++) {
- loadMsgDlgFont(dbSpanSettingNames[i], &lf, &color, NULL);
+ loadMsgDlgFont(dbSpanSettingNames[i], &lf, &color, nullptr);
str.AppendFormat("%s {float: %s; font-family: %s; font-size: %dpt; font-weight: %s; color: #%06X; %s }\n",
spanClassNames[i],
i < 2 ? "left" : "right; clear: right;",
@@ -223,7 +223,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event DWORD dwFlags = db_get_b(NULL, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
ptrA szRealProto(getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
CMStringA str;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE ||
@@ -241,7 +241,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event szText = encodeUTF8(event->hContact, szRealProto, eventData->pszText, event->codepage, eventData->iType == IEED_EVENT_MESSAGE ? ENF_ALL : 0, isSent);
/* History++-specific formatting */
- const char *iconFile = NULL;
+ const char *iconFile = nullptr;
switch (eventData->iType) {
case IEED_EVENT_SYSTEM:
str.AppendFormat("<div class=\"%s\">", "divSystem");
@@ -258,7 +258,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event iconFile = "message.gif";
str.AppendFormat("<div class=\"%s\">", isSent ? "divMessageOut" : "divMessageIn");
}
- if (dwFlags & SMF_LOG_SHOWICONS && iconFile != NULL)
+ if (dwFlags & SMF_LOG_SHOWICONS && iconFile != nullptr)
Utils::appendIcon(str, iconFile);
else
str.Append(" ");
@@ -286,7 +286,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event void HistoryHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getHistoryProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getHistoryMode() & Options::MODE_TEMPLATE)
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index febf370288..4fa21b9e8a 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DISPID_NAVIGATECOMPLETE2 252 // UIActivate new document
#define DISPID_DOCUMENTCOMPLETE 259 // new document goes ReadyState_Complete
-IEView* IEView::list = NULL;
+IEView* IEView::list = nullptr;
mir_cs IEView::mutex;
static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
IEView *view = IEView::get(GetParent(GetParent(hwnd)));
- if (view != NULL) {
+ if (view != nullptr) {
switch (message) {
case WM_KEYUP:
if (LOWORD(wParam) == VK_ESCAPE && !(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000))
@@ -73,7 +73,7 @@ static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPA static LRESULT CALLBACK IEViewDocWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
IEView *view = IEView::get(GetParent(hwnd));
- if (view != NULL) {
+ if (view != nullptr) {
WNDPROC oldWndProc = view->getDocWndProc();
if (message == WM_PARENTNOTIFY && wParam == WM_CREATE) {
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
@@ -87,7 +87,7 @@ static LRESULT CALLBACK IEViewDocWindowProcedure(HWND hwnd, UINT message, WPARAM static LRESULT CALLBACK IEViewWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
IEView *view = IEView::get(hwnd);
- if (view != NULL) {
+ if (view != nullptr) {
WNDPROC oldWndProc = view->getMainWndProc();
if (message == WM_PARENTNOTIFY && wParam == WM_CREATE) {
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
@@ -107,7 +107,7 @@ IEViewSink::~IEViewSink() {} STDMETHODIMP IEViewSink::QueryInterface(REFIID riid, PVOID *ppv)
{
- *ppv = NULL;
+ *ppv = nullptr;
if (IID_IUnknown == riid)
*ppv = (IUnknown *)this;
@@ -117,7 +117,7 @@ STDMETHODIMP IEViewSink::QueryInterface(REFIID riid, PVOID *ppv) if (DIID_DWebBrowserEvents2 == riid)
*ppv = (DWebBrowserEvents2*)this;
- if (NULL != *ppv) {
+ if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
@@ -231,7 +231,7 @@ void IEView::setBorder() if (oldStyle != style) {
SetWindowLongPtr(hwnd, GWL_EXSTYLE, style);
- SetWindowPos(getHWND(), NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+ SetWindowPos(getHWND(), nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
}
}
@@ -244,19 +244,19 @@ IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy rcClient.top = y;
rcClient.right = x + cx;
rcClient.bottom = y + cy;
- if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC))) {
+ if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, nullptr, CLSCTX_INPROC))) {
CComPtr<IOleObject> pOleObject;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject))) {
pOleObject->SetClientSite(this);
pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, this->parent, &rcClient);
}
- else MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
+ else MessageBox(nullptr, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
CComPtr<IOleInPlaceObject> pOleInPlace;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleInPlace)))
pOleInPlace->GetWindow(&hwnd);
else
- MessageBox(NULL, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
+ MessageBox(nullptr, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
setBorder();
CComPtr<IConnectionPointContainer> pCPContainer;
@@ -269,7 +269,7 @@ IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy // want to sink its events.
sink = new IEViewSink(this);
if (FAILED(m_pConnectionPoint->Advise(sink, &m_dwCookie)))
- MessageBox(NULL, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
+ MessageBox(nullptr, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
}
}
setMainWndProc((WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)IEViewWindowProcedure));
@@ -277,7 +277,7 @@ IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy {
mir_cslock lck(mutex);
next = list;
- if (next != NULL)
+ if (next != nullptr)
next->prev = this;
list = this;
}
@@ -291,33 +291,33 @@ IEView::~IEView() mir_cslock lck(mutex);
if (list == this)
list = next;
- else if (prev != NULL)
+ else if (prev != nullptr)
prev->next = next;
- if (next != NULL)
+ if (next != nullptr)
next->prev = prev;
- prev = NULL;
- next = NULL;
+ prev = nullptr;
+ next = nullptr;
}
CComPtr<IOleObject> pOleObject;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject)))
- pOleObject->SetClientSite(NULL);
+ pOleObject->SetClientSite(nullptr);
else
- MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
+ MessageBox(nullptr, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
- if (builder != NULL) {
+ if (builder != nullptr) {
delete builder;
- builder = NULL;
+ builder = nullptr;
}
- if (m_pConnectionPoint != NULL)
+ if (m_pConnectionPoint != nullptr)
m_pConnectionPoint->Unadvise(m_dwCookie);
mir_free(selectedText);
- if (sink != NULL)
+ if (sink != nullptr)
delete sink;
DestroyWindow(hwnd);
}
@@ -325,21 +325,21 @@ IEView::~IEView() void IEView::release()
{
mir_cslock lck(mutex);
- while (list != NULL)
+ while (list != nullptr)
delete list;
- list = NULL;
+ list = nullptr;
}
IEView* IEView::get(HWND hwnd)
{
- if (list == NULL) return NULL;
+ if (list == nullptr) return nullptr;
mir_cslock lock(mutex);
- for (IEView *ptr = list; ptr != NULL; ptr = ptr->next)
+ for (IEView *ptr = list; ptr != nullptr; ptr = ptr->next)
if (ptr->hwnd == hwnd)
return ptr;
- return NULL;
+ return nullptr;
}
void IEView::setMainWndProc(WNDPROC wndProc)
@@ -375,7 +375,7 @@ WNDPROC IEView::getServerWndProc() // IUnknown
STDMETHODIMP IEView::QueryInterface(REFIID riid, PVOID *ppv)
{
- *ppv = NULL;
+ *ppv = nullptr;
if (IID_IUnknown == riid)
*ppv = this;
if (IID_IOleClientSite == riid)
@@ -391,7 +391,7 @@ STDMETHODIMP IEView::QueryInterface(REFIID riid, PVOID *ppv) if (IID_IDispatch == riid)
*ppv = (IDispatch*)this;
- if (NULL != *ppv) {
+ if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
@@ -413,7 +413,7 @@ STDMETHODIMP_(ULONG) IEView::Release(void) // IDispatch
STDMETHODIMP IEView::GetTypeInfoCount(UINT *pctinfo)
{
- if (pctinfo == NULL) return E_INVALIDARG;
+ if (pctinfo == nullptr) return E_INVALIDARG;
*pctinfo = 4;
return S_OK;
}
@@ -643,10 +643,10 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge ppt->y,
0,
hwnd,
- (RECT*)NULL);
+ (RECT*)nullptr);
DestroyMenu(hMenu);
if (iSelection == ID_MENU_CLEARLOG)
- clear(NULL);
+ clear(nullptr);
else
SendMessage(hSPWnd, WM_COMMAND, iSelection, (LPARAM)NULL);
}
@@ -657,7 +657,7 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge STDMETHODIMP IEView::GetHostInfo(DOCHOSTUIINFO *pInfo)
{
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER;// | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE;
- if (builder == NULL) {
+ if (builder == nullptr) {
pInfo->dwFlags |= DOCHOSTUIFLAG_DIALOG;
}
return S_OK;
@@ -678,7 +678,7 @@ STDMETHODIMP IEView::TranslateAccelerator(LPMSG, const GUID *, DWORD) { return S STDMETHODIMP IEView::GetOptionKeyPath(LPOLESTR *, DWORD) { return E_NOTIMPL; }
STDMETHODIMP IEView::GetDropTarget(IDropTarget *, IDropTarget **ppDropTarget)
{
- *ppDropTarget = NULL;
+ *ppDropTarget = nullptr;
return S_OK;
// return E_NOTIMPL;
}
@@ -699,7 +699,7 @@ STDMETHODIMP IEView::QueryService(REFGUID guidService, REFIID riid, void** ppvOb return (HRESULT)this->QueryInterface(riid, ppvObject);
}
else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
}
return E_NOINTERFACE;
}
@@ -718,7 +718,7 @@ STDMETHODIMP IEView::GetSecuritySite(IInternetSecurityMgrSite **) STDMETHODIMP IEView::MapUrlToZone(LPCWSTR pwszUrl, DWORD *pdwZone, DWORD)
{
- if (pdwZone != NULL && pwszUrl != NULL && !mir_wstrcmp(pwszUrl, L"about:blank")) {
+ if (pdwZone != nullptr && pwszUrl != nullptr && !mir_wstrcmp(pwszUrl, L"about:blank")) {
*pdwZone = URLZONE_LOCAL_MACHINE;
return S_OK;
}
@@ -733,7 +733,7 @@ STDMETHODIMP IEView::GetSecurityId(LPCWSTR, BYTE *, DWORD *, DWORD_PTR) STDMETHODIMP IEView::ProcessUrlAction(LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *, DWORD, DWORD, DWORD)
{
DWORD dwPolicy = URLPOLICY_ALLOW;
- if (pwszUrl != NULL && !mir_wstrcmp(pwszUrl, L"about:blank")) {
+ if (pwszUrl != nullptr && !mir_wstrcmp(pwszUrl, L"about:blank")) {
if (dwAction <= URLACTION_ACTIVEX_MAX && dwAction >= URLACTION_ACTIVEX_MIN) {
//dwPolicy = URLPOLICY_DISALLOW;
//dwPolicy = URLPOLICY_ALLOW;
@@ -780,13 +780,13 @@ STDMETHODIMP IEView::GetZoneMappings(DWORD, IEnumString **, DWORD) IHTMLDocument2* IEView::getDocument()
{
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != NULL) {
+ if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != nullptr) {
CComPtr<IHTMLDocument2> document;
dispatch.QueryInterface(&document);
return document.Detach();
}
- return NULL;
+ return nullptr;
}
void IEView::setWindowPos(int x, int y, int cx, int cy)
@@ -809,7 +809,7 @@ void IEView::scrollToTop() CComPtr<IHTMLDocument2> document = getDocument();
if (document) {
CComPtr<IHTMLWindow2> pWindow;
- if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != NULL)
+ if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x01FFFFFF, -0x01FFFFFF);
}
}
@@ -819,7 +819,7 @@ void IEView::scrollToBottomSoft() CComPtr<IHTMLDocument2> document = getDocument();
if (document) {
CComPtr<IHTMLWindow2> pWindow;
- if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != NULL)
+ if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x01FFFFFF, 0x01FFFFFF);
}
}
@@ -827,11 +827,11 @@ void IEView::scrollToBottomSoft() void IEView::scrollToBottom()
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return;
CComPtr<IHTMLElementCollection> collection;
- if (SUCCEEDED(document->get_all(&collection)) && collection != NULL) {
+ if (SUCCEEDED(document->get_all(&collection)) && collection != nullptr) {
long len;
if (SUCCEEDED(collection->get_length(&len))) {
VARIANT variant;
@@ -839,9 +839,9 @@ void IEView::scrollToBottom() variant.lVal = len - 1;
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(collection->item(variant, variant, &dispatch)) && dispatch != NULL) {
+ if (SUCCEEDED(collection->item(variant, variant, &dispatch)) && dispatch != nullptr) {
CComPtr<IHTMLElement> element;
- if (SUCCEEDED(dispatch.QueryInterface(&element)) && element != NULL) {
+ if (SUCCEEDED(dispatch.QueryInterface(&element)) && element != nullptr) {
variant.vt = VT_BOOL;
variant.boolVal = VARIANT_FALSE;
element->scrollIntoView(variant);
@@ -851,18 +851,18 @@ void IEView::scrollToBottom() }
CComPtr<IHTMLWindow2> pWindow;
- if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != NULL)
+ if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x0000FFFF, 0x0000FFFF);
}
void IEView::write(const wchar_t *text)
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return;
SAFEARRAY *safe_array = ::SafeArrayCreateVector(VT_VARIANT, 0, 1);
- if (safe_array != NULL) {
+ if (safe_array != nullptr) {
VARIANT *variant;
::SafeArrayAccessData(safe_array, (LPVOID *)&variant);
variant->vt = VT_BSTR;
@@ -894,12 +894,12 @@ void IEView::writef(const char *fmt, ...) void IEView::navigate(const char *url)
{
- pWebBrowser->Navigate(BSTR_PTR(_A2T(url)), NULL, NULL, NULL, NULL);
+ pWebBrowser->Navigate(BSTR_PTR(_A2T(url)), nullptr, nullptr, nullptr, nullptr);
}
void IEView::navigate(const wchar_t *url)
{
- pWebBrowser->Navigate(BSTR_PTR(url), NULL, NULL, NULL, NULL);
+ pWebBrowser->Navigate(BSTR_PTR(url), nullptr, nullptr, nullptr, nullptr);
}
void IEView::documentClose()
@@ -922,7 +922,7 @@ void IEView::appendEventOld(IEVIEWEVENT *event) if (clearRequired)
clear(event);
- if (builder != NULL)
+ if (builder != nullptr)
builder->appendEventOld(this, event);
getFocus = false;
@@ -933,10 +933,10 @@ void IEView::appendEvent(IEVIEWEVENT *event) if (clearRequired)
clear(event);
- if (event->eventData == NULL)
+ if (event->eventData == nullptr)
return;
- if (builder != NULL)
+ if (builder != nullptr)
builder->appendEventNew(this, event);
getFocus = false;
@@ -945,14 +945,14 @@ void IEView::appendEvent(IEVIEWEVENT *event) void IEView::clear(IEVIEWEVENT *event)
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL) {
- pWebBrowser->Navigate(BSTR_PTR(L"about:blank"), NULL, NULL, NULL, NULL);
+ if (document == nullptr) {
+ pWebBrowser->Navigate(BSTR_PTR(L"about:blank"), nullptr, nullptr, nullptr, nullptr);
HRESULT hr = S_OK;
CComPtr<IHTMLDocument2> doc2;
- while ((doc2 == NULL) && (hr == S_OK)) {
+ while ((doc2 == nullptr) && (hr == S_OK)) {
Sleep(0);
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != NULL)
+ if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != nullptr)
dispatch.QueryInterface(&doc2);
}
}
@@ -969,7 +969,7 @@ void IEView::clear(IEVIEWEVENT *event) CComPtr<IDispatch> open_window;
document->open(BSTR_PTR(L"text/html"), open_name, open_features, open_replace, &open_window);
}
- if (builder != NULL)
+ if (builder != nullptr)
builder->clear(this, event);
clearRequired = false;
@@ -982,7 +982,7 @@ void* IEView::getSelection(IEVIEWEVENT *event) mir_free(selectedText);
selectedText = getSelection();
if (mir_wstrlen(selectedText) == 0)
- return NULL;
+ return nullptr;
if (event->dwFlags & IEEF_NO_UNICODE) {
int cp = CP_ACP;
@@ -1025,24 +1025,24 @@ void IEView::translateAccelerator(UINT uMsg, WPARAM wParam, LPARAM lParam) WCHAR* IEView::getSelection()
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
- return NULL;
+ if (document == nullptr)
+ return nullptr;
CComPtr<IHTMLSelectionObject> pSelection;
- if (FAILED(document->get_selection(&pSelection)) || pSelection == NULL)
- return NULL;
+ if (FAILED(document->get_selection(&pSelection)) || pSelection == nullptr)
+ return nullptr;
CComPtr<IDispatch> pDisp;
- if (FAILED(pSelection->createRange(&pDisp)) || pDisp == NULL)
- return NULL;
+ if (FAILED(pSelection->createRange(&pDisp)) || pDisp == nullptr)
+ return nullptr;
CComPtr<IHTMLTxtRange> pRange;
if (FAILED(pDisp.QueryInterface(&pRange)))
- return NULL;
+ return nullptr;
- BSTR text = NULL;
+ BSTR text = nullptr;
if (FAILED(pRange->get_text(&text)))
- return NULL;
+ return nullptr;
WCHAR *res = mir_wstrdup(text);
::SysFreeString(text);
@@ -1055,13 +1055,13 @@ WCHAR* IEView::getSelection() **/
WCHAR* IEView::getHrefFromAnchor(CComPtr<IHTMLElement> element)
{
- if (element == NULL)
- return NULL;
+ if (element == nullptr)
+ return nullptr;
CComPtr<IHTMLAnchorElement> pAnchor;
if (FAILED(element.QueryInterface(&pAnchor))) {
VARIANT variant;
- WCHAR *url = NULL;
+ WCHAR *url = nullptr;
if (SUCCEEDED(element->getAttribute(BSTR_PTR(L"href"), 2, &variant)) && variant.vt == VT_BSTR) {
url = mir_wstrdup(variant.bstrVal);
::SysFreeString(variant.bstrVal);
@@ -1071,10 +1071,10 @@ WCHAR* IEView::getHrefFromAnchor(CComPtr<IHTMLElement> element) }
CComPtr<IHTMLElement> pParent;
- if (SUCCEEDED(element->get_parentElement(&pParent)) && pParent != NULL)
+ if (SUCCEEDED(element->get_parentElement(&pParent)) && pParent != nullptr)
return getHrefFromAnchor(pParent);
- return NULL;
+ return nullptr;
}
bool IEView::mouseActivate()
@@ -1091,11 +1091,11 @@ bool IEView::mouseClick(POINT pt) getFocus = true;
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return false;
CComPtr<IHTMLElement> element;
- if (SUCCEEDED(document->elementFromPoint(pt.x, pt.y, &element)) && element != NULL) {
+ if (SUCCEEDED(document->elementFromPoint(pt.x, pt.y, &element)) && element != nullptr) {
ptrW url(getHrefFromAnchor(element));
if (url != NULL) {
if ((GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000))
@@ -1123,7 +1123,7 @@ bool IEView::setFocus(HWND) void IEView::saveDocument()
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return;
VARIANT vValue;
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index 9fd96db78d..38a3d64089 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -37,7 +37,7 @@ static const char *classNames[] = { MUCCHTMLBuilder::MUCCHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
+ setLastEventTime(time(nullptr));
}
void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
@@ -86,7 +86,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check) szResult[0] = '\0';
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
@@ -116,7 +116,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) LOGFONTA lf;
COLORREF color;
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getChatMode() == Options::MODE_TEMPLATE)
@@ -128,9 +128,9 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
COLORREF bkgColor = db_get_dw(NULL, MUCCMOD, "BackgroundLog", 0xFFFFFF);
@@ -181,7 +181,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
DWORD dwData = eventData->dwData;
bool isSent = eventData->bIsMe != 0;
CMStringA str, style;
@@ -270,7 +270,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) void MUCCHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings != NULL)
+ if (protoSettings != nullptr)
appendEventNonTemplate(view, event);
}
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 59723e6c5f..36b9726dd4 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -28,11 +28,11 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
#define OPTIONS_PAGES 4
-static ProtocolSettings *srmmCurrentProtoItem = NULL;
-static ProtocolSettings *chatCurrentProtoItem = NULL;
-static ProtocolSettings *historyCurrentProtoItem = NULL;
-static HIMAGELIST hProtocolImageList = NULL;
-static HIMAGELIST hImageList = NULL;
+static ProtocolSettings *srmmCurrentProtoItem = nullptr;
+static ProtocolSettings *chatCurrentProtoItem = nullptr;
+static ProtocolSettings *historyCurrentProtoItem = nullptr;
+static HIMAGELIST hProtocolImageList = nullptr;
+static HIMAGELIST hImageList = nullptr;
struct
{
@@ -52,14 +52,14 @@ static LPARAM GetItemParam(HWND hwndTreeView, HTREEITEM hItem) {
TVITEM tvi = { 0 };
tvi.mask = TVIF_PARAM;
- tvi.hItem = hItem == NULL ? TreeView_GetSelection(hwndTreeView) : hItem;
+ tvi.hItem = hItem == nullptr ? TreeView_GetSelection(hwndTreeView) : hItem;
TreeView_GetItem(hwndTreeView, &tvi);
return tvi.lParam;
}
static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
char path[MAX_PATH];
int i = Options::MODE_COMPATIBLE;
if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
@@ -89,7 +89,7 @@ static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto) static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
char path[MAX_PATH];
int i = Options::MODE_COMPATIBLE;
if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
@@ -119,7 +119,7 @@ static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto) static void SaveHistoryProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
char path[MAX_PATH];
int i = Options::MODE_COMPATIBLE;
if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
@@ -181,14 +181,14 @@ static void SetIcon(HWND hwnd, DWORD id, int index, bool condition) hIcon = ImageList_GetIcon(hImageList, index + 0, ILD_NORMAL);
hIcon = (HICON)SendDlgItemMessage(hwnd, id, STM_SETICON, (WPARAM)hIcon, 0);
- if (hIcon != NULL)
+ if (hIcon != nullptr)
DestroyIcon(hIcon);
}
static void UpdateTemplateIcons(HWND hwnd, const char *path)
{
TemplateMap *tmap = TemplateMap::loadTemplates(path, path, true);
- if (tmap != NULL) {
+ if (tmap != nullptr) {
SetIcon(hwnd, IDC_GROUPSUPPORT, 0, tmap->isGrouping());
SetIcon(hwnd, IDC_RTLSUPPORT, 2, tmap->isRTL());
delete tmap;
@@ -201,7 +201,7 @@ static void UpdateTemplateIcons(HWND hwnd, const char *path) static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isSRMMEnableTemp());
CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getSRMMModeTemp() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
@@ -216,19 +216,19 @@ static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto) CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getSRMMFlagsTemp() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getSRMMFlagsTemp() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getSRMMFlagsTemp() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
- if (proto->getSRMMBackgroundFilenameTemp() != NULL) {
+ if (proto->getSRMMBackgroundFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getSRMMBackgroundFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, "");
}
- if (proto->getSRMMCssFilename() != NULL) {
+ if (proto->getSRMMCssFilename() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getSRMMCssFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, "");
}
- if (proto->getSRMMTemplateFilenameTemp() != NULL) {
+ if (proto->getSRMMTemplateFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getSRMMTemplateFilenameTemp());
}
else {
@@ -242,7 +242,7 @@ static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto) static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isChatEnableTemp());
CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getChatModeTemp() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
@@ -257,19 +257,19 @@ static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto) CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getChatFlagsTemp() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getChatFlagsTemp() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getChatFlagsTemp() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
- if (proto->getChatBackgroundFilenameTemp() != NULL) {
+ if (proto->getChatBackgroundFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getChatBackgroundFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, "");
}
- if (proto->getChatCssFilename() != NULL) {
+ if (proto->getChatCssFilename() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getChatCssFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, "");
}
- if (proto->getChatTemplateFilenameTemp() != NULL) {
+ if (proto->getChatTemplateFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getChatTemplateFilenameTemp());
}
else {
@@ -283,7 +283,7 @@ static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto) static void UpdateHistoryProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isHistoryEnableTemp());
CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getHistoryModeTemp() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
@@ -298,19 +298,19 @@ static void UpdateHistoryProtoInfo(HWND hwndDlg, ProtocolSettings *proto) CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getHistoryFlagsTemp() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getHistoryFlagsTemp() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getHistoryFlagsTemp() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
- if (proto->getHistoryBackgroundFilenameTemp() != NULL) {
+ if (proto->getHistoryBackgroundFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getHistoryBackgroundFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, "");
}
- if (proto->getHistoryCssFilename() != NULL) {
+ if (proto->getHistoryCssFilename() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getHistoryCssFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, "");
}
- if (proto->getHistoryTemplateFilenameTemp() != NULL) {
+ if (proto->getHistoryTemplateFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getHistoryTemplateFilenameTemp());
}
else {
@@ -326,25 +326,25 @@ static void RefreshProtoIcons() {
int i;
ProtocolSettings *proto;
- if (hProtocolImageList != NULL) {
+ if (hProtocolImageList != nullptr) {
ImageList_RemoveAll(hProtocolImageList);
}
else {
- for (i = 0, proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext(), i++);
+ for (i = 0, proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext(), i++);
hProtocolImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
ILC_MASK | ILC_COLOR32, i, 0);
}
- for (i = 0, proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext(), i++) {
- HICON hIcon = NULL;
+ for (i = 0, proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext(), i++) {
+ HICON hIcon = nullptr;
if (i > 0) {
hIcon = (HICON)CallProtoService(proto->getProtocolName(), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- if (hIcon == NULL) {
+ if (hIcon == nullptr) {
hIcon = (HICON)CallProtoService(proto->getProtocolName(), PS_LOADICON, PLI_PROTOCOL, 0);
}
ImageList_AddIcon(hProtocolImageList, hIcon);
DestroyIcon(hIcon);
}
- if (hIcon == NULL) {
+ if (hIcon == nullptr) {
hIcon = (HICON)Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
ImageList_AddIcon(hProtocolImageList, hIcon);
IcoLib_ReleaseIcon(hIcon);
@@ -354,7 +354,7 @@ static void RefreshProtoIcons() static void RefreshIcons()
{
- if (hImageList != NULL) {
+ if (hImageList != nullptr) {
ImageList_RemoveAll(hImageList);
}
else {
@@ -369,14 +369,14 @@ static void RefreshIcons() static void RefreshProtoList(HWND hwndDlg, int mode, bool protoTemplates)
{
int i;
- HTREEITEM hItem = NULL;
+ HTREEITEM hItem = nullptr;
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_DeleteAllItems(hProtoList);
TreeView_SetImageList(hProtoList, hProtocolImageList, TVSIL_NORMAL);
ProtocolSettings *proto;
- for (i = 0, proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext(), i++) {
+ for (i = 0, proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext(), i++) {
char protoName[128];
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE;
@@ -419,7 +419,7 @@ static bool BrowseFile(HWND hwndDlg, char *filter, char *defExt, char *path, int GetWindowTextA(hwndDlg, path, maxLen);
ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = filter;//"Templates (*.ivt)\0*.ivt\0All Files\0*.*\0\0";
ofn.lpstrFile = path;
ofn.Flags = OFN_FILEMUSTEXIST;
@@ -573,7 +573,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar {
MarkInitialized(2);
TranslateDialogDefault(hwndDlg);
- srmmCurrentProtoItem = NULL;
+ srmmCurrentProtoItem = nullptr;
RefreshProtoList(hwndDlg, 0, true);
return TRUE;
}
@@ -645,7 +645,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case UM_CHECKSTATECHANGE:
{
ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != NULL)
+ if (proto != nullptr)
if (strcmpi(proto->getProtocolName(), "_default_"))
proto->setSRMMEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
@@ -680,7 +680,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)NULL);
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveSRMMProtoSettings(hwndDlg, srmmCurrentProtoItem);
UpdateSRMMProtoInfo(hwndDlg, proto);
break;
@@ -706,7 +706,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w case WM_INITDIALOG:
MarkInitialized(4);
TranslateDialogDefault(hwndDlg);
- historyCurrentProtoItem = NULL;
+ historyCurrentProtoItem = nullptr;
RefreshProtoList(hwndDlg, 2, true);
return TRUE;
@@ -777,7 +777,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w case UM_CHECKSTATECHANGE:
{
ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != NULL)
+ if (proto != nullptr)
if (strcmpi(proto->getProtocolName(), "_default_"))
proto->setHistoryEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
@@ -813,7 +813,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)NULL);
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveHistoryProtoSettings(hwndDlg, historyCurrentProtoItem);
UpdateHistoryProtoInfo(hwndDlg, proto);
break;
@@ -839,7 +839,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA case WM_INITDIALOG:
MarkInitialized(8);
TranslateDialogDefault(hwndDlg);
- chatCurrentProtoItem = NULL;
+ chatCurrentProtoItem = nullptr;
RefreshProtoList(hwndDlg, 1, true);
return TRUE;
@@ -910,7 +910,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA case UM_CHECKSTATECHANGE:
{
ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != NULL)
+ if (proto != nullptr)
if (strcmpi(proto->getProtocolName(), "_default_"))
proto->setChatEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
@@ -947,7 +947,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)NULL);
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveChatProtoSettings(hwndDlg, chatCurrentProtoItem);
UpdateChatProtoInfo(hwndDlg, proto);
break;
@@ -970,12 +970,12 @@ bool Options::bSmileyAdd = false; int Options::avatarServiceFlags = 0;
int Options::generalFlags;
-ProtocolSettings *Options::protocolList = NULL;
+ProtocolSettings *Options::protocolList = nullptr;
ProtocolSettings::ProtocolSettings(const char *protocolName)
{
this->protocolName = mir_strdup(protocolName);
- next = NULL;
+ next = nullptr;
srmmEnable = false;
srmmMode = Options::MODE_COMPATIBLE;
srmmFlags = 0;
@@ -1476,7 +1476,7 @@ void Options::init() /* TODO: move to buildProtocolList method */
int protoCount;
PROTOACCOUNT **pProtos;
- ProtocolSettings *lastProto = NULL;
+ ProtocolSettings *lastProto = nullptr;
Proto_EnumAccounts(&protoCount, &pProtos);
for (int i = 0; i < protoCount + 1; i++) {
ProtocolSettings *proto;
@@ -1593,7 +1593,7 @@ void Options::init() db_free(&dbv);
}
proto->copyToTemp();
- if (lastProto != NULL) {
+ if (lastProto != nullptr) {
lastProto->setNext(proto);
}
else {
@@ -1611,14 +1611,14 @@ void Options::init() void Options::uninit()
{
ProtocolSettings *p, *p1;
- for (p = protocolList; p != NULL; p = p1) {
+ for (p = protocolList; p != nullptr; p = p1) {
p1 = p->getNext();
delete p;
}
TemplateMap::dropTemplates();
- if (hImageList != NULL)
+ if (hImageList != nullptr)
ImageList_Destroy(hImageList);
- if (hProtocolImageList != NULL)
+ if (hProtocolImageList != nullptr)
ImageList_Destroy(hProtocolImageList);
}
@@ -1660,23 +1660,23 @@ ProtocolSettings * Options::getProtocolSettings() ProtocolSettings * Options::getProtocolSettings(const char *protocolName)
{
- for (ProtocolSettings *proto = protocolList; proto != NULL; proto = proto->getNext())
+ for (ProtocolSettings *proto = protocolList; proto != nullptr; proto = proto->getNext())
if (!strcmpi(proto->getProtocolName(), protocolName))
return proto;
- return NULL;
+ return nullptr;
}
void Options::resetProtocolSettings()
{
- for (ProtocolSettings *proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext())
+ for (ProtocolSettings *proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext())
proto->copyToTemp();
}
void Options::saveProtocolSettings()
{
ProtocolSettings *proto = Options::getProtocolSettings();
- for (int i = 0; proto != NULL; proto = proto->getNext(), i++) {
+ for (int i = 0; proto != nullptr; proto = proto->getNext(), i++) {
char dbsName[256];
char tmpPath[MAX_PATH];
proto->copyFromTemp();
@@ -1751,7 +1751,7 @@ void Options::saveProtocolSettings() void Options::Reload()
{
ProtocolSettings *p, *p1;
- for (p = Options::protocolList; p != NULL; p = p1) {
+ for (p = Options::protocolList; p != nullptr; p = p1) {
p1 = p->getNext();
delete p;
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index afaab42afb..b7538c2cc4 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -64,8 +64,8 @@ static const char *classNames[] = { ScriverHTMLBuilder::ScriverHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
- startedTime = time(NULL);
+ setLastEventTime(time(nullptr));
+ startedTime = time(nullptr);
}
bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
@@ -128,7 +128,7 @@ char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod if ((mode == 0 || mode == 1) && (dwFlags & SMF_LOG_SHOWDATE)) {
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
@@ -174,7 +174,7 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color;
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE) {
@@ -191,9 +191,9 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
COLORREF bkgColor = db_get_dw(NULL, SRMMMOD, "BkgColour", 0xFFFFFF);
@@ -277,7 +277,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event ptrA szRealProto(getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
const char *className = "";
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
bool isRTL = (eventData->dwFlags & IEEDF_RTL) != 0;
@@ -334,7 +334,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event if (dwFlags & SMF_LOG_SHOWTIME &&
(eventData->iType != IEED_EVENT_MESSAGE ||
(dwFlags & SMF_LOG_MARKFOLLOWUPS || isGroupBreak || !(dwFlags & SMF_LOG_GROUPMESSAGES)))) {
- char* timestampString = NULL;
+ char* timestampString = nullptr;
if (dwFlags & SMF_LOG_GROUPMESSAGES) {
if (isGroupBreak) {
if (!(dwFlags & SMF_LOG_MARKFOLLOWUPS))
@@ -347,7 +347,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event }
else timestampString = timestampToString(dwFlags, eventData->time, 0);
- if (timestampString != NULL)
+ if (timestampString != nullptr)
str.AppendFormat("<span class=\"%s\">%s</span>", isSent ? "timeOut" : "timeIn", timestampString);
if (eventData->iType != IEED_EVENT_MESSAGE)
@@ -409,7 +409,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event void ScriverHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE)
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index e904b93f38..657e22560a 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -77,9 +77,9 @@ static const char *classNames[] = { TabSRMMHTMLBuilder::TabSRMMHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
- lastEventTime = time(NULL);
- startedTime = time(NULL);
+ setLastEventTime(time(nullptr));
+ lastEventTime = time(nullptr);
+ startedTime = time(nullptr);
}
bool TabSRMMHTMLBuilder::isDbEventShown(DWORD dwFlags, DBEVENTINFO *dbei)
@@ -121,10 +121,10 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) *colour = db_get_dw(NULL, TABSRMM_FONTMODULE, str, 0x000000);
}
if (lf) {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
mir_snprintf(str, "Font%dSize", i);
lf->lfHeight = (char)db_get_b(NULL, TABSRMM_FONTMODULE, str, 10);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
lf->lfWidth = 0;
lf->lfEscapement = 0;
@@ -158,7 +158,7 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG const char *szFormat;
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
if (!isGroupBreak || !(dwFlags & MWF_LOG_SHOWDATES)) {
@@ -201,7 +201,7 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color;
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE) {
@@ -218,9 +218,9 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
str.Append("<html><head><style type=\"text/css\">\n");
COLORREF inColor, outColor;
@@ -291,7 +291,7 @@ time_t TabSRMMHTMLBuilder::getStartedTime() void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
- DWORD today = (DWORD)time(NULL);
+ DWORD today = (DWORD)time(nullptr);
today = today - today % 86400;
DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
@@ -303,7 +303,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event char *szRealProto = getRealProto(event->hContact);
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_FILE || eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_STATUSCHANGE) {
bool isGroupBreak = true;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
@@ -420,7 +420,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event void TabSRMMHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE)
diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp index 705ba6ddc3..708abda305 100644 --- a/plugins/IEView/src/Template.cpp +++ b/plugins/IEView/src/Template.cpp @@ -39,7 +39,7 @@ TokenDef::TokenDef(const char *tokenString, int token, int escape) Token::Token(int type, const char *text, int escape)
{
- next = NULL;
+ next = nullptr;
this->type = type;
this->escape = escape;
this->text = mir_strdup(text);
@@ -77,8 +77,8 @@ const char* Token::getText() Template::Template(const char *name, const char *text)
{
- m_next = NULL;
- m_tokens = NULL;
+ m_next = nullptr;
+ m_tokens = nullptr;
m_text = mir_strdup(text);
m_name = mir_strdup(name);
tokenize();
@@ -89,8 +89,8 @@ Template::~Template() mir_free(m_text);
mir_free(m_name);
Token *ptr = m_tokens, *ptr2;
- m_tokens = NULL;
- for (; ptr != NULL; ptr = ptr2) {
+ m_tokens = nullptr;
+ for (; ptr != nullptr; ptr = ptr2) {
ptr2 = ptr->getNext();
delete ptr;
}
@@ -148,11 +148,11 @@ static TokenDef tokenNames[] = { void Template::tokenize()
{
- if (m_text == NULL)
+ if (m_text == nullptr)
return;
char *str = mir_strdup(m_text);
- Token *lastToken = NULL;
+ Token *lastToken = nullptr;
int lastTokenType = Token::PLAIN;
int lastTokenEscape = 0;
int l = (int)mir_strlen(str);
@@ -191,9 +191,9 @@ void Template::tokenize() if (lastTokenType == Token::PLAIN)
newToken = new Token(lastTokenType, str + lastTokenStart, lastTokenEscape);
else
- newToken = new Token(lastTokenType, NULL, lastTokenEscape);
+ newToken = new Token(lastTokenType, nullptr, lastTokenEscape);
- if (lastToken != NULL)
+ if (lastToken != nullptr)
lastToken->setNext(newToken);
else
m_tokens = newToken;
@@ -208,13 +208,13 @@ void Template::tokenize() mir_free(str);
}
-TemplateMap* TemplateMap::m_mapList = NULL;
+TemplateMap* TemplateMap::m_mapList = nullptr;
TemplateMap::TemplateMap(const char *name)
{
- m_entries = NULL;
- m_next = NULL;
- m_filename = NULL;
+ m_entries = nullptr;
+ m_next = nullptr;
+ m_filename = nullptr;
m_name = mir_strdup(name);
m_grouping = false;
m_rtl = false;
@@ -231,7 +231,7 @@ TemplateMap::~TemplateMap() TemplateMap* TemplateMap::add(const char *id, const char *filename)
{
TemplateMap *map;
- for (map = m_mapList; map != NULL; map = map->m_next) {
+ for (map = m_mapList; map != nullptr; map = map->m_next) {
if (!mir_strcmp(map->m_name, id)) {
map->clear();
map->setFilename(filename);
@@ -256,8 +256,8 @@ void TemplateMap::clear() {
Template *ptr, *ptr2;
ptr = m_entries;
- m_entries = NULL;
- for (; ptr != NULL; ptr = ptr2) {
+ m_entries = nullptr;
+ for (; ptr != nullptr; ptr = ptr2) {
ptr2 = ptr->getNext();
delete ptr;
}
@@ -318,12 +318,12 @@ static TokenDef templateNames[] = { TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, bool onlyInfo)
{
char lastTemplate[1024], tmp2[1024];
- if (filename == NULL || mir_strlen(filename) == 0)
- return NULL;
+ if (filename == nullptr || mir_strlen(filename) == 0)
+ return nullptr;
FILE *fh = fopen(filename, "rt");
- if (fh == NULL)
- return NULL;
+ if (fh == nullptr)
+ return nullptr;
TemplateMap *tmap;
if (!onlyInfo)
@@ -334,7 +334,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, char store[4096];
bool wasTemplate = false;
CMStringA templateText;
- while (fgets(store, sizeof(store), fh) != NULL) {
+ while (fgets(store, sizeof(store), fh) != nullptr) {
if (sscanf(store, "%s", tmp2) == EOF) continue;
//template start
bool bFound = false;
@@ -366,7 +366,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, "hMessageOutGroupStart", "hMessageOutGroupInner" };
tmap->m_grouping = true;
for (int i = 0; i < _countof(groupTemplates); i++) {
- if (tmap->getTemplate(groupTemplates[i]) == NULL) {
+ if (tmap->getTemplate(groupTemplates[i]) == nullptr) {
tmap->m_grouping = false;
break;
}
@@ -374,7 +374,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, static const char *rtlTemplates[] = { "MessageInRTL", "MessageOutRTL" }; //"HTMLStartRTL",
tmap->m_rtl = true;
for (int i = 0; i < _countof(rtlTemplates); i++) {
- if (tmap->getTemplate(rtlTemplates[i]) == NULL) {
+ if (tmap->getTemplate(rtlTemplates[i]) == nullptr) {
tmap->m_rtl = false;
break;
}
@@ -384,29 +384,29 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, Template* TemplateMap::getTemplate(const char *text)
{
- for (Template *ptr = m_entries; ptr != NULL; ptr = ptr->getNext())
+ for (Template *ptr = m_entries; ptr != nullptr; ptr = ptr->getNext())
if (ptr->equals(text))
return ptr;
- return 0;
+ return nullptr;
}
Template* TemplateMap::getTemplate(const char *proto, const char *text)
{
- for (TemplateMap *ptr = m_mapList; ptr != NULL; ptr = ptr->m_next)
+ for (TemplateMap *ptr = m_mapList; ptr != nullptr; ptr = ptr->m_next)
if (!mir_strcmp(ptr->m_name, proto))
return ptr->getTemplate(text);
- return NULL;
+ return nullptr;
}
TemplateMap* TemplateMap::getTemplateMap(const char *proto)
{
- for (TemplateMap *ptr = m_mapList; ptr != NULL; ptr = ptr->m_next)
+ for (TemplateMap *ptr = m_mapList; ptr != nullptr; ptr = ptr->m_next)
if (!mir_strcmp(ptr->m_name, proto))
return ptr;
- return NULL;
+ return nullptr;
}
void TemplateMap::setFilename(const char *filename)
@@ -422,7 +422,7 @@ TemplateMap* TemplateMap::loadTemplates(const char *id, const char *filename, bo void TemplateMap::dropTemplates()
{
- for (TemplateMap *p = m_mapList, *p1; p != NULL; p = p1) {
+ for (TemplateMap *p = m_mapList, *p1; p != nullptr; p = p1) {
p1 = p->m_next;
delete p;
}
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 2910730b1c..95b083c771 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TemplateHTMLBuilder::TemplateHTMLBuilder()
{
iLastEventType = -1;
- startedTime = lastEventTime = time(NULL);
- groupTemplate = NULL;
+ startedTime = lastEventTime = time(nullptr);
+ groupTemplate = nullptr;
}
TemplateHTMLBuilder::~TemplateHTMLBuilder()
@@ -36,7 +36,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) {
DBVARIANT dbv;
wchar_t tmpPath[MAX_PATH];
- wchar_t *result = NULL;
+ wchar_t *result = nullptr;
if (Options::getAvatarServiceFlags() == Options::AVATARSERVICE_PRESENT) {
AVATARCACHEENTRY *ace;
@@ -45,7 +45,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) else
ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
- if (ace != NULL) {
+ if (ace != nullptr) {
if (ace->cbSize == sizeof(AVATARCACHEENTRY))
result = ace->szFilename;
else // compatibility: in M0.9 it will always be char*
@@ -55,7 +55,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) {
if (mir_wstrlen(dbv.ptszVal) > 0) {
//wchar_t *ext = wcsrchr(dbv.ptszVal, '.');
- if (result == NULL) {
+ if (result == nullptr) {
/* relative -> absolute */
mir_wstrcpy(tmpPath, dbv.ptszVal);
if (wcsncmp(tmpPath, L"http://", 7))
@@ -89,7 +89,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? L"s" : L"t", str, _countof(str));
else { // date
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
@@ -109,26 +109,26 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, ProtocolSettings *protoSettings)
{
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
DBVARIANT dbv;
char tempStr[1024];
- char *szNameIn = NULL;
- char *szNameOut = NULL;
- char *szUINIn = NULL;
- char *szUINOut = NULL;
- char *szNickIn = NULL;
- char *szNickOut = NULL;
- char *szStatusMsg = NULL;
+ char *szNameIn = nullptr;
+ char *szNameOut = nullptr;
+ char *szUINIn = nullptr;
+ char *szUINOut = nullptr;
+ char *szNickIn = nullptr;
+ char *szNickOut = nullptr;
+ char *szStatusMsg = nullptr;
MCONTACT hRealContact = getRealContact(event->hContact);
char *szRealProto = getProto(hRealContact);
char *szProto = getProto(event->pszProto, event->hContact);
TemplateMap *tmpm = getTemplateMap(protoSettings);
- if (tmpm == NULL)
+ if (tmpm == nullptr)
return;
char tempBase[1024] = { 0 };
@@ -155,7 +155,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr wchar_t szNoAvatarPath[MAX_PATH];
wcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
- if (szNoAvatarPathTmp != NULL)
+ if (szNoAvatarPathTmp != nullptr)
*szNoAvatarPathTmp = 0;
mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
if (_waccess(szNoAvatarPath, 0) == -1)
@@ -165,11 +165,11 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr char *szNoAvatar = mir_utf8encode(tempStr);
char *szAvatarIn = getAvatar(event->hContact, szRealProto);
- if (szAvatarIn == NULL)
+ if (szAvatarIn == nullptr)
szAvatarIn = mir_strdup(szNoAvatar);
char *szAvatarOut = getAvatar(NULL, szRealProto);
- if (szAvatarOut == NULL)
+ if (szAvatarOut == nullptr)
szAvatarOut = mir_strdup(szNoAvatar);
if (!db_get(event->hContact, "CList", "StatusMsg", &dbv)) {
@@ -186,19 +186,19 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr if (tszNick != NULL)
szNickOut = encodeUTF8(event->hContact, szRealProto, tszNick, ENF_NAMESMILEYS, true);
- Template *tmplt = NULL;
+ Template *tmplt = nullptr;
if (tmpm) {
tmplt = tmpm->getTemplate(((event->dwFlags & IEEF_RTL) && tmpm->isRTL()) ? "HTMLStartRTL" : "HTMLStart");
- if (tmplt == NULL)
+ if (tmplt == nullptr)
tmplt = tmpm->getTemplate("HTMLStart");
}
CMStringA str;
- if (tmplt != NULL) {
- for (Token *token = tmplt->getTokens(); token != NULL; token = token->getNext()) {
+ if (tmplt != nullptr) {
+ for (Token *token = tmplt->getTokens(); token != nullptr; token = token->getNext()) {
const char *tokenVal;
- tokenVal = NULL;
+ tokenVal = nullptr;
switch (token->getType()) {
case Token::PLAIN:
tokenVal = token->getText();
@@ -237,7 +237,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr tokenVal = szNickOut;
break;
}
- if (tokenVal != NULL) {
+ if (tokenVal != nullptr) {
if (token->getEscape())
str.Append(ptrA(Utils::escapeString(tokenVal)));
else
@@ -263,13 +263,13 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr mir_free(szNickOut);
mir_free(szStatusMsg);
- groupTemplate = NULL;
+ groupTemplate = nullptr;
iLastEventType = -1;
}
void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, ProtocolSettings* protoSettings)
{
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
DBVARIANT dbv;
@@ -277,15 +277,15 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, char tempStr[1024];
char szCID[32];
- char *szNameIn = NULL;
- char *szNameOut = NULL;
- char *szUIN = NULL;
- char *szUINIn = NULL;
- char *szUINOut = NULL;
- char *szNickIn = NULL;
- char *szNickOut = NULL;
- char *szStatusMsg = NULL;
- char *szAvatar = NULL;
+ char *szNameIn = nullptr;
+ char *szNameOut = nullptr;
+ char *szUIN = nullptr;
+ char *szUINIn = nullptr;
+ char *szUINOut = nullptr;
+ char *szNickIn = nullptr;
+ char *szNickOut = nullptr;
+ char *szStatusMsg = nullptr;
+ char *szAvatar = nullptr;
const char *tmpltName[2];
bool isGrouping = false;
@@ -295,7 +295,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, tempBase[0] = '\0';
TemplateMap *tmpm = getTemplateMap(protoSettings);
- if (tmpm != NULL) {
+ if (tmpm != nullptr) {
mir_strcpy(tempBase, "file://");
mir_strcat(tempBase, tmpm->getFilename());
@@ -324,7 +324,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, wchar_t szNoAvatarPath[MAX_PATH];
wcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
- if (szNoAvatarPathTmp != NULL)
+ if (szNoAvatarPathTmp != nullptr)
*szNoAvatarPathTmp = 0;
mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
if (_waccess(szNoAvatarPath, 0) == -1)
@@ -333,15 +333,15 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, mir_snprintf(tempStr, "%snoavatar.png", tempBase);
char *szNoAvatar = mir_utf8encode(tempStr);
- char *szAvatarIn = NULL;
+ char *szAvatarIn = nullptr;
if (event->hContact != NULL)
szAvatarIn = getAvatar(event->hContact, szRealProto);
- if (szAvatarIn == NULL)
+ if (szAvatarIn == nullptr)
szAvatarIn = mir_strdup(szNoAvatar);
char *szAvatarOut = getAvatar(NULL, szRealProto);
- if (szAvatarOut == NULL)
+ if (szAvatarOut == nullptr)
szAvatarOut = mir_strdup(szNoAvatar);
if (event->hContact != NULL) {
@@ -361,7 +361,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, szNickOut = encodeUTF8(event->hContact, szRealProto, tszNick, ENF_NAMESMILEYS, true);
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE || eventData->iType == IEED_EVENT_FILE || eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_SYSTEM) {
CMStringA str;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
@@ -385,10 +385,10 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, mir_snprintf(szCID, "%d", (int)event->hContact);
}
tmpltName[0] = groupTemplate;
- tmpltName[1] = NULL;
- groupTemplate = NULL;
+ tmpltName[1] = nullptr;
+ groupTemplate = nullptr;
- char *szName = NULL, *szText = NULL, *szFileDesc = NULL;
+ char *szName = nullptr, *szText = nullptr, *szFileDesc = nullptr;
if (event->eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
else
@@ -430,14 +430,14 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, }
else if (eventData->iType == IEED_EVENT_FILE) {
tmpltName[1] = isHistory ? isSent ? "hFileOut" : "hFileIn" : isSent ? "FileOut" : "FileIn";
- Template *tmplt = (tmpm == NULL) ? NULL : tmpm->getTemplate(tmpltName[1]);
- if (tmplt == NULL)
+ Template *tmplt = (tmpm == nullptr) ? nullptr : tmpm->getTemplate(tmpltName[1]);
+ if (tmplt == nullptr)
tmpltName[1] = isHistory ? "hFile" : "File";
}
else if (eventData->iType == IEED_EVENT_URL) {
tmpltName[1] = isHistory ? isSent ? "hURLOut" : "hURLIn" : isSent ? "URLOut" : "URLIn";
- Template *tmplt = (tmpm == NULL) ? NULL : tmpm->getTemplate(tmpltName[1]);
- if (tmplt == NULL)
+ Template *tmplt = (tmpm == nullptr) ? nullptr : tmpm->getTemplate(tmpltName[1]);
+ if (tmplt == nullptr)
tmpltName[1] = isHistory ? "hURL" : "URL";
}
else if (eventData->iType == IEED_EVENT_STATUSCHANGE || (eventData->iType == IEED_EVENT_SYSTEM))
@@ -445,14 +445,14 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, /* template-specific formatting */
for (int i = 0; i < 2; i++) {
- if (tmpltName[i] == NULL || tmpm == NULL) continue;
+ if (tmpltName[i] == nullptr || tmpm == nullptr) continue;
Template *tmplt = tmpm->getTemplate(tmpltName[i]);
- if (tmplt == NULL)
+ if (tmplt == nullptr)
continue;
- for (Token *token = tmplt->getTokens(); token != NULL; token = token->getNext()) {
+ for (Token *token = tmplt->getTokens(); token != nullptr; token = token->getNext()) {
const char *tokenVal;
- tokenVal = NULL;
+ tokenVal = nullptr;
switch (token->getType()) {
case Token::PLAIN:
tokenVal = token->getText();
@@ -536,7 +536,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, tokenVal = szFileDesc;
break;
}
- if (tokenVal != NULL) {
+ if (tokenVal != nullptr) {
if (token->getEscape())
str.Append(ptrA(Utils::escapeString(tokenVal)));
else
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index 1b77f1efb4..68d47269aa 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -23,26 +23,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TextToken::TextToken(int _type, const char *_text, int _len)
{
- next = NULL;
+ next = nullptr;
tag = 0;
end = false;
type = _type;
text = mir_strndup(_text, _len);
wtext = mir_a2u(text);
- link = NULL;
- wlink = NULL;
+ link = nullptr;
+ wlink = nullptr;
}
TextToken::TextToken(int _type, const wchar_t *_wtext, int _len)
{
- next = NULL;
+ next = nullptr;
tag = 0;
end = false;
type = _type;
wtext = mir_wstrndup(_wtext, _len);
text = mir_u2a(wtext);
- link = NULL;
- wlink = NULL;
+ link = nullptr;
+ wlink = nullptr;
}
TextToken::~TextToken()
@@ -92,7 +92,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) static int bbTagEnd[BB_TAG_NUM];
static int bbTagCount[BB_TAG_NUM];
int i, j;
- TextToken *firstToken = NULL, *lastToken = NULL, *bbToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr, *bbToken = nullptr;
int textLen = 0;
for (j = 0; j < BB_TAG_NUM; j++) {
bbTagCount[j] = 0;
@@ -213,14 +213,14 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) if (textLen > 0) {
TextToken *newToken = new TextToken(TEXT, text + i - textLen, textLen);
textLen = 0;
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
lastToken = newToken;
}
if (newTokenType == BBCODE) {
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = bbToken;
else
lastToken->setNext(bbToken);
@@ -237,7 +237,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) TextToken* TextToken::tokenizeLinks(const wchar_t *text)
{
- TextToken *firstToken = NULL, *lastToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr;
int textLen = 0;
int l = (int)mir_wstrlen(text);
for (int i = 0; i <= l;) {
@@ -267,7 +267,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) if (textLen > 0) {
TextToken *newToken = new TextToken(TEXT, text + i - textLen, textLen);
textLen = 0;
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -277,7 +277,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) if (newTokenType == WWWLINK || newTokenType == LINK) {
TextToken *newToken = new TextToken(newTokenType, text + i, newTokenSize);
newToken->setLink(newToken->getText());
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -294,7 +294,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, const wchar_t *text, bool isSent)
{
- TextToken *firstToken = NULL, *lastToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr;
int l = (int)mir_wstrlen(text);
if (!Options::isSmileyAdd())
return new TextToken(TEXT, text, l);
@@ -307,12 +307,12 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons sp.hContact = hContact;
SMADD_BATCHPARSERES *spRes = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
int last_pos = 0;
- if (spRes != NULL) {
+ if (spRes != nullptr) {
for (int i = 0; i < (int)sp.numSmileys; i++) {
- if (spRes[i].filepath != NULL && mir_strlen((char *)spRes[i].filepath) > 0) {
+ if (spRes[i].filepath != nullptr && mir_strlen((char *)spRes[i].filepath) > 0) {
if ((int)spRes[i].startChar - last_pos > 0) {
TextToken *newToken = new TextToken(TEXT, text + last_pos, spRes[i].startChar - last_pos);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -325,7 +325,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons else
newToken->setLink((char *)spRes[i].filepath);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -338,7 +338,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons }
if (last_pos < l) {
TextToken *newToken = new TextToken(TEXT, text + last_pos, l - last_pos);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -350,7 +350,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text)
{
- TextToken *firstToken = NULL, *lastToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr;
int textLen = 0;
int l = (int)mir_wstrlen(text);
wchar_t* tokenBuffer = new wchar_t[l + 1];
@@ -359,7 +359,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) int newTokenSize = 1;
int newTokenTag = 0;
int newTokenTextLen = 0;
- const wchar_t * newTokenText = NULL;
+ const wchar_t * newTokenText = nullptr;
bool endToken = false;
@@ -420,7 +420,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) if (textLen > 0) {
TextToken *newToken = new TextToken(TEXT, tokenBuffer, textLen);
textLen = 0;
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -431,7 +431,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) TextToken *newToken = new TextToken(newTokenType, newTokenText, newTokenTextLen);
newToken->setEnd(endToken);
newToken->setTag(newTokenTag);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -453,8 +453,8 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) {
wchar_t *out;
const wchar_t *ptr;
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
int c = 0;
bool wasSpace = false;
for (ptr = str; *ptr != '\0'; ptr++) {
@@ -502,7 +502,7 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) void TextToken::toString(CMStringW &str)
{
- wchar_t *eText = NULL, *eLink = NULL;
+ wchar_t *eText = nullptr, *eLink = nullptr;
switch (type) {
case TEXT:
eText = htmlEncode(wtext);
@@ -516,12 +516,12 @@ void TextToken::toString(CMStringW &str) const wchar_t *linkPrefix = type == WWWLINK ? L"http://" : L"";
if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_EMBED)) {
wchar_t *match = wcsstr(wlink, L"youtube.com");
- if (match != NULL) {
+ if (match != nullptr) {
match = wcsstr(match + 11, L"v=");
- if (match != NULL) {
+ if (match != nullptr) {
match += 2;
wchar_t *match2 = wcsstr(match, L"&");
- int len = match2 != NULL ? match2 - match : (int)mir_wstrlen(match);
+ int len = match2 != nullptr ? match2 - match : (int)mir_wstrlen(match);
match = mir_wstrdup(match);
match[len] = 0;
int width = 0;
@@ -563,7 +563,7 @@ void TextToken::toString(CMStringW &str) break;
case SMILEY:
eText = htmlEncode(wtext);
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(wlink, L".swf") != NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(wlink, L".swf") != nullptr)) {
str.AppendFormat(L"<span title=\"%s\" class=\"img\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></span>",
@@ -595,14 +595,14 @@ void TextToken::toString(CMStringW &str) break;
case BB_IMG:
eText = htmlEncode(wtext);
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && eText != NULL && (wcsstr(eText, L".swf") != NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && eText != nullptr && (wcsstr(eText, L".swf") != nullptr)) {
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"100%%\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></div>",
eText);
}
else {
- if (eText != NULL && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8))
+ if (eText != nullptr && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8))
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><img class=\"img\" style=\"width: expression((maxw = this.parentNode.offsetWidth ) > this.width ? 'auto' : maxw);\" src=\"file://%s\" /></div>", eText);
else
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><img class=\"img\" style=\"width: expression((maxw = this.parentNode.offsetWidth ) > this.width ? 'auto' : maxw);\" src=\"%s\" /></div>", eText);
@@ -611,7 +611,7 @@ void TextToken::toString(CMStringW &str) case BB_BIMG:
eText = htmlEncode(mir_ptr<wchar_t>(Utils::toAbsolute(wtext)));
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(eText, L".swf") != NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(eText, L".swf") != nullptr)) {
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"100%%\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></div>",
@@ -668,6 +668,6 @@ void TextToken::toString(CMStringW &str) }
break;
}
- if (eText != NULL) delete[] eText;
- if (eLink != NULL) delete[] eLink;
+ if (eText != nullptr) delete[] eText;
+ if (eLink != nullptr) delete[] eLink;
}
diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index 2a7e48a0e3..f195c9638e 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -51,7 +51,7 @@ static int countNoWhitespace(const wchar_t *str) void Utils::convertPath(char *path)
{
- if (path != NULL) {
+ if (path != nullptr) {
for (; *path != '\0'; path++) {
if (*path == '\\') *path = '/';
}
@@ -60,7 +60,7 @@ void Utils::convertPath(char *path) void Utils::convertPath(wchar_t *path)
{
- if (path != NULL) {
+ if (path != nullptr) {
for (; *path != '\0'; path++) {
if (*path == '\\') *path = '/';
}
@@ -89,8 +89,8 @@ int Utils::detectURL(const wchar_t *text) char *Utils::escapeString(const char *a)
{
- if (a == NULL)
- return NULL;
+ if (a == nullptr)
+ return nullptr;
int i, l, len = (int)mir_strlen(a);
for (i = l = 0; i < len; i++, l++) {
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp index 3ca5d06151..db0fae3210 100644 --- a/plugins/IEView/src/external_funcs.cpp +++ b/plugins/IEView/src/external_funcs.cpp @@ -190,7 +190,7 @@ namespace External if (pDispParams == nullptr || pDispParams->cArgs < 5)
return E_INVALIDARG;
- HINSTANCE res = ShellExecuteW(NULL, pDispParams->rgvarg[4].bstrVal, pDispParams->rgvarg[3].bstrVal, pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].intVal);
+ HINSTANCE res = ShellExecuteW(nullptr, pDispParams->rgvarg[4].bstrVal, pDispParams->rgvarg[3].bstrVal, pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].intVal);
if (pVarResult != nullptr)
{
@@ -207,7 +207,7 @@ namespace External return E_INVALIDARG;
BSTR data = pDispParams->rgvarg[0].bstrVal;
- if (OpenClipboard(NULL))
+ if (OpenClipboard(nullptr))
{
EmptyClipboard();
size_t size = sizeof(wchar_t)* (mir_wstrlen(data) + 1);
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp index 5ac7146d98..4b86be1748 100644 --- a/plugins/IEView/src/ieview_main.cpp +++ b/plugins/IEView/src/ieview_main.cpp @@ -67,7 +67,7 @@ IconItem iconList[] = extern "C" int __declspec(dllexport) Load(void)
{
- int wdsize = GetCurrentDirectory(0, NULL);
+ int wdsize = GetCurrentDirectory(0, nullptr);
wchar_t *workingDir = new wchar_t[wdsize];
GetCurrentDirectory(wdsize, workingDir);
Utils::convertPath(workingDir);
diff --git a/plugins/IEView/src/ieview_services.cpp b/plugins/IEView/src/ieview_services.cpp index b1d6d66f27..0681854e12 100644 --- a/plugins/IEView/src/ieview_services.cpp +++ b/plugins/IEView/src/ieview_services.cpp @@ -26,7 +26,7 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam) IEVIEWWINDOW *window = (IEVIEWWINDOW *)lParam;
Options::init();
if (window->iType == IEW_CREATE) {
- HTMLBuilder *builder = NULL;
+ HTMLBuilder *builder = nullptr;
switch (window->dwMode) {
case IEWM_MUCC:
builder = new MUCCHTMLBuilder();
@@ -44,7 +44,7 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam) builder = new HistoryHTMLBuilder();
break;
case IEWM_BROWSER:
- builder = NULL;
+ builder = nullptr;
break;
default:
builder = new ScriverHTMLBuilder();
@@ -55,17 +55,17 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam) }
else if (window->iType == IEW_SETPOS) {
IEView *view = IEView::get(window->hwnd);
- if (view != NULL)
+ if (view != nullptr)
view->setWindowPos(window->x, window->y, window->cx, window->cy);
}
else if (window->iType == IEW_SCROLLBOTTOM) {
IEView *view = IEView::get(window->hwnd);
- if (view != NULL)
+ if (view != nullptr)
view->scrollToBottom();
}
else if (window->iType == IEW_DESTROY) {
IEView *view = IEView::get(window->hwnd);
- if (view != NULL)
+ if (view != nullptr)
delete view;
}
return 0;
@@ -76,7 +76,7 @@ INT_PTR HandleIEEvent(WPARAM, LPARAM lParam) IEVIEWEVENT *event = (IEVIEWEVENT *)lParam;
Options::init();
IEView *view = IEView::get(event->hwnd);
- if (view != NULL) {
+ if (view != nullptr) {
if (event->iType == IEE_LOG_DB_EVENTS)
view->appendEventOld(event);
else if (event->iType == IEE_CLEAR_LOG)
@@ -98,7 +98,7 @@ INT_PTR HandleIENavigate(WPARAM, LPARAM lParam) IEVIEWNAVIGATE *navigate = (IEVIEWNAVIGATE *)lParam;
Options::init();
IEView *view = IEView::get(navigate->hwnd);
- if (view != NULL) {
+ if (view != nullptr) {
if (navigate->iType == IEN_NAVIGATE) {
view->navigate(navigate);
}
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index e83b181864..df6aa14bbd 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -22,10 +22,10 @@ HINSTANCE g_hInst;
-HANDLE hIcoLibIconsChanged = NULL;
-HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hContactSettingChanged = NULL;
-HANDLE hPrebuildContactMenu = NULL;
-HANDLE hExtraIcon = NULL;
+HANDLE hIcoLibIconsChanged = nullptr;
+HANDLE hHookExtraIconsRebuild = nullptr, hHookExtraIconsApply = nullptr, hContactSettingChanged = nullptr;
+HANDLE hPrebuildContactMenu = nullptr;
+HANDLE hExtraIcon = nullptr;
int hLangpack;
INT currentFilter = 0;
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index 1882a02de2..db24cf3045 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -41,9 +41,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TreeView_DeleteAllItems(hTree);
for (int i = 2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
int index = ImageList_AddIcon(himlButtonIcons, Skin_LoadIcon(ii[i].icon));
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
tvis.item.lParam = ii[i].type;
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 4b6890b7ab..80ca2367d1 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -30,7 +30,7 @@ struct AccountMap szSrcAcc(mir_strdup(_src)),
iSrcIndex(_origIdx),
tszSrcName(mir_wstrdup(_srcName)),
- pa(NULL)
+ pa(nullptr)
{}
~AccountMap() {}
@@ -114,7 +114,7 @@ static int myGetD(MCONTACT hContact, const char *szModule, const char *szSetting static wchar_t* myGetWs(MCONTACT hContact, const char *szModule, const char *szSetting)
{
DBVARIANT dbv = { DBVT_WCHAR };
- return srcDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? NULL : dbv.ptszVal;
+ return srcDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? nullptr : dbv.ptszVal;
}
static BOOL myGetS(MCONTACT hContact, const char *szModule, const char *szSetting, char *dest)
@@ -131,7 +131,7 @@ static MCONTACT HContactFromNumericID(char *pszProtoName, char *pszSetting, DWOR for (MCONTACT hContact = dstDb->FindFirstContact(); hContact; hContact = dstDb->FindNextContact(hContact)) {
if (db_get_dw(hContact, pszProtoName, pszSetting, 0) == dwID) {
char* szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, pszProtoName))
+ if (szProto != nullptr && !mir_strcmp(szProto, pszProtoName))
return hContact;
}
}
@@ -181,7 +181,7 @@ static int iPrevIndex = -1; static void SetAccountName(int idx, PROTOACCOUNT *pa)
{
- ListView_SetItemText(hwndList, idx, 1, (pa == NULL) ? TranslateT("<New account>") : pa->tszAccountName);
+ ListView_SetItemText(hwndList, idx, 1, (pa == nullptr) ? TranslateT("<New account>") : pa->tszAccountName);
}
static LRESULT CALLBACK ComboWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -192,7 +192,7 @@ static LRESULT CALLBACK ComboWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM int idx = SendMessage(hwnd, CB_GETCURSEL, 0, 0);
if (idx == 0)
- pMap->pa = NULL;
+ pMap->pa = nullptr;
else
pMap->pa = (PROTOACCOUNT*)SendMessage(hwnd, CB_GETITEMDATA, idx, 0);
@@ -201,7 +201,7 @@ static LRESULT CALLBACK ComboWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM }
DestroyWindow(hwnd);
- hwndCombo = 0;
+ hwndCombo = nullptr;
}
return mir_callNextSubclass(hwnd, ComboWndProc, uMsg, wParam, lParam);
}
@@ -234,11 +234,11 @@ static LRESULT CALLBACK ListWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lvitem.mask = LVIF_PARAM;
ListView_GetItem(hwnd, &lvitem);
- if (hwndCombo != NULL)
+ if (hwndCombo != nullptr)
SendMessage(hwndCombo, WM_KILLFOCUS, 0, (LPARAM)hwndCombo);
hwndCombo = CreateWindowEx(WS_EX_CLIENTEDGE, WC_COMBOBOX, L"", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
- r.left + 3, r.top, r.right - r.left - 3, r.bottom - r.top, hwnd, 0, hInst, NULL);
+ r.left + 3, r.top, r.right - r.left - 3, r.bottom - r.top, hwnd, nullptr, hInst, nullptr);
// copy a font from listview
HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
@@ -310,7 +310,7 @@ static INT_PTR CALLBACK AccountsMatcherProc(HWND hwndDlg, UINT uMsg, WPARAM wPar switch (LOWORD(wParam)) {
case IDOK:
- if (hwndCombo != NULL)
+ if (hwndCombo != nullptr)
SendMessage(hwndCombo, WM_KILLFOCUS, 0, (LPARAM)hwndCombo);
EndDialog(hwndDlg, IDOK);
break;
@@ -325,7 +325,7 @@ static INT_PTR CALLBACK AccountsMatcherProc(HWND hwndDlg, UINT uMsg, WPARAM wPar break;
case WM_DESTROY:
- hwndAccMerge = NULL;
+ hwndAccMerge = nullptr;
break;
case WM_NOTIFY:
@@ -347,14 +347,14 @@ static INT_PTR CALLBACK AccountsMatcherProc(HWND hwndDlg, UINT uMsg, WPARAM wPar static char* newStr(const char *s)
{
- return (s == NULL) ? NULL : mir_strcpy(new char[mir_strlen(s) + 1], s);
+ return (s == nullptr) ? nullptr : mir_strcpy(new char[mir_strlen(s) + 1], s);
}
static bool FindDestAccount(const char *szProto)
{
for (int i = 0; i < arAccountMap.getCount(); i++) {
AccountMap &pam = arAccountMap[i];
- if (pam.pa == NULL)
+ if (pam.pa == nullptr)
continue;
if (!mir_strcmp(pam.pa->szModuleName, szProto))
@@ -370,7 +370,7 @@ static PROTOACCOUNT* FindMyAccount(const char *szProto, const char *szBaseProto, PROTOACCOUNT **destAccs;
Proto_EnumAccounts(&destProtoCount, &destAccs);
- PROTOACCOUNT *pProto = NULL;
+ PROTOACCOUNT *pProto = nullptr;
for (int i = 0; i < destProtoCount; i++) {
PROTOACCOUNT *pa = destAccs[i];
// already used? skip
@@ -410,7 +410,7 @@ static PROTOACCOUNT* FindMyAccount(const char *szProto, const char *szBaseProto, if (bEqual)
return pa;
}
- return (bStrict) ? NULL : pProto;
+ return (bStrict) ? nullptr : pProto;
}
bool ImportAccounts(OBJLIST<char> &arSkippedModules)
@@ -453,14 +453,14 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules) // all accounts to be converted automatically, no need to raise a dialog
if (bNeedManualMerge)
- if (DialogBox(hInst, MAKEINTRESOURCE(IDD_ACCMERGE), NULL, AccountsMatcherProc) != IDOK)
+ if (DialogBox(hInst, MAKEINTRESOURCE(IDD_ACCMERGE), nullptr, AccountsMatcherProc) != IDOK)
return false;
bool bImportSysAll = (nImportOptions & IOPT_SYS_SETTINGS) != 0;
for (int i = 0; i < arAccountMap.getCount(); i++) {
AccountMap &p = arAccountMap[i];
- if (p.pa != NULL || p.szBaseProto == NULL || !mir_strcmp(p.szSrcAcc, META_PROTO))
+ if (p.pa != nullptr || p.szBaseProto == NULL || !mir_strcmp(p.szSrcAcc, META_PROTO))
continue;
if (!Proto_IsProtocolLoaded(p.szBaseProto)) {
@@ -470,11 +470,11 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules) ACC_CREATE newacc;
newacc.pszBaseProto = p.szBaseProto;
- newacc.pszInternal = NULL;
+ newacc.pszInternal = nullptr;
newacc.ptszAccountName = p.tszSrcName;
p.pa = ProtoCreateAccount(&newacc);
- if (p.pa == NULL) {
+ if (p.pa == nullptr) {
AddMessage(LPGENW("Unable to create an account %s of protocol %S"), p.tszSrcName, p.szBaseProto);
return false;
}
@@ -517,7 +517,7 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules) static MCONTACT MapContact(MCONTACT hSrc)
{
ContactMap *pDestContact = arContactMap.find((ContactMap*)&hSrc);
- return (pDestContact == NULL) ? INVALID_CONTACT_ID : pDestContact->dstID;
+ return (pDestContact == nullptr) ? INVALID_CONTACT_ID : pDestContact->dstID;
}
static MCONTACT AddContact(char *szProto, char *pszUniqueSetting, DBVARIANT *id, const wchar_t *pszUserID, wchar_t *nick, wchar_t *group)
@@ -563,7 +563,7 @@ int ModulesEnumProc(const char *szModuleName, DWORD, LPARAM lParam) void ImportContactSettings(AccountMap *pda, MCONTACT hSrc, MCONTACT hDst)
{
- if (pda->pa == NULL)
+ if (pda->pa == nullptr)
return;
ImportContactData icd = { hSrc, hDst, pda->szSrcAcc, pda->pa->szModuleName };
@@ -577,7 +577,7 @@ static int ImportGroup(const char* szSettingName, LPARAM lParam) int *pnGroups = (int*)lParam;
wchar_t *tszGroup = myGetWs(NULL, "CListGroups", szSettingName);
- if (tszGroup != NULL) {
+ if (tszGroup != nullptr) {
if (CreateGroup(tszGroup + 1, NULL))
pnGroups[0]++;
mir_free(tszGroup);
@@ -612,7 +612,7 @@ DBCachedContact* FindDestMeta(DBCachedContact *ccSrc) return cc;
}
- return NULL;
+ return nullptr;
}
MCONTACT FindExistingMeta(DBCachedContact *ccSrc)
@@ -626,7 +626,7 @@ MCONTACT FindExistingMeta(DBCachedContact *ccSrc) continue;
DBCachedContact *cc = dstDb->m_cache->GetCachedContact(hDestSub);
- if (cc == NULL || !cc->IsSub()) // check if it's a sub
+ if (cc == nullptr || !cc->IsSub()) // check if it's a sub
continue;
if (hResult == INVALID_CONTACT_ID)
@@ -645,7 +645,7 @@ void ImportMeta(DBCachedContact *ccSrc) // check first that the precise copy of metacontact exists
DBCachedContact *ccDst = FindDestMeta(ccSrc);
- if (ccDst == NULL) {
+ if (ccDst == nullptr) {
MCONTACT hDest = FindExistingMeta(ccSrc);
if (hDest == 0) {
AddMessage(LPGENW("Metacontact cannot be imported due to its ambiguity."));
@@ -663,7 +663,7 @@ void ImportMeta(DBCachedContact *ccSrc) CopySettings(ccSrc->contactID, META_PROTO, hDest, META_PROTO);
ccDst = dstDb->m_cache->GetCachedContact(hDest);
- if (ccDst == NULL) // normally it shouldn't happen
+ if (ccDst == nullptr) // normally it shouldn't happen
return;
// simply copy the whole metacontact structure
@@ -688,7 +688,7 @@ void ImportMeta(DBCachedContact *ccSrc) }
else { // add missing subs
ccDst = dstDb->m_cache->GetCachedContact(hDest);
- if (ccDst == NULL) // normally it shouldn't happen
+ if (ccDst == nullptr) // normally it shouldn't happen
return;
for (int i = 0; i < ccSrc->nSubs; i++) {
@@ -723,7 +723,7 @@ static MCONTACT ImportContact(MCONTACT hSrc) {
// Check what protocol this contact belongs to
DBCachedContact *cc = srcDb->m_cache->GetCachedContact(hSrc);
- if (cc == NULL || cc->szProto == NULL) {
+ if (cc == nullptr || cc->szProto == nullptr) {
AddMessage(LPGENW("Skipping contact with no protocol"));
return NULL;
}
@@ -734,7 +734,7 @@ static MCONTACT ImportContact(MCONTACT hSrc) }
AccountMap *pda = arAccountMap.find((AccountMap*)&cc->szProto);
- if (pda == NULL || pda->pa == NULL) {
+ if (pda == nullptr || pda->pa == nullptr) {
AddMessage(LPGENW("Skipping contact, account %S cannot be mapped."), cc->szProto);
return NULL;
}
@@ -774,7 +774,7 @@ static MCONTACT ImportContact(MCONTACT hSrc) default:
hDst = INVALID_CONTACT_ID;
- pszUniqueID = NULL;
+ pszUniqueID = nullptr;
}
if (hDst != INVALID_CONTACT_ID) {
@@ -824,7 +824,7 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC // we ignore history import for metacontacts
// the metahistory will be generated automatically by gathering subs' histories
DBCachedContact *cc = srcDb->m_cache->GetCachedContact(hContact);
- if (cc == NULL)
+ if (cc == nullptr)
return;
// for k/v databases we read history for subs only
@@ -937,7 +937,7 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC if (!(i % 10)) {
MSG msg;
- if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -961,18 +961,18 @@ void MirandaImport(HWND hdlg) {
hdlgProgress = hdlg;
- if ((dstDb = db_get_current()) == NULL) {
+ if ((dstDb = db_get_current()) == nullptr) {
AddMessage(LPGENW("Error retrieving current profile, exiting."));
return;
}
DATABASELINK *dblink = FindDatabasePlugin(importFile);
- if (dblink == NULL) {
+ if (dblink == nullptr) {
AddMessage(LPGENW("There's no database driver to open the input file, exiting."));
return;
}
- if ((srcDb = dblink->Load(importFile, TRUE)) == NULL) {
+ if ((srcDb = dblink->Load(importFile, TRUE)) == nullptr) {
AddMessage(LPGENW("Error loading source file, exiting."));
return;
}
@@ -995,7 +995,7 @@ void MirandaImport(HWND hdlg) dstDb->SetCacheSafetyMode(FALSE);
// Start benchmark timer
- DWORD dwTimer = time(NULL);
+ DWORD dwTimer = time(nullptr);
OBJLIST<char> arSkippedAccs(1, CompareModules);
if (!ImportAccounts(arSkippedAccs)) {
@@ -1034,7 +1034,7 @@ void MirandaImport(HWND hdlg) // Process queued messages
MSG msg;
- if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -1068,7 +1068,7 @@ void MirandaImport(HWND hdlg) AddMessage(LPGENW("Importing history."));
MCONTACT hContact = srcDb->FindFirstContact();
for (int i = 1; hContact != NULL; i++) {
- ImportHistory(hContact, NULL, NULL);
+ ImportHistory(hContact, nullptr, NULL);
SetProgress(100 * i / nNumberOfContacts);
hContact = srcDb->FindNextContact(hContact);
@@ -1084,7 +1084,7 @@ void MirandaImport(HWND hdlg) dblink->Unload(srcDb);
// Stop timer
- dwTimer = time(NULL) - dwTimer;
+ dwTimer = time(nullptr) - dwTimer;
// Print statistics
AddMessage(LPGENW("Import completed in %d seconds."), dwTimer);
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 8f6b875f1a..33ae9d1494 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -58,7 +58,7 @@ static INT_PTR ImportCommand(WPARAM, LPARAM) SetForegroundWindow(hwndWizard);
SetFocus(hwndWizard);
}
- else hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
+ else hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
return 0;
}
@@ -86,7 +86,7 @@ static int ModulesLoaded(WPARAM, LPARAM) // Only autorun import wizard if at least one protocol is installed
int nProtocols = 0;
- PROTOACCOUNT **ppProtos = NULL;
+ PROTOACCOUNT **ppProtos = nullptr;
Proto_EnumAccounts(&nProtocols, &ppProtos);
if (nProtocols > 0) {
CallService(IMPORT_SERVICE, 0, 0);
@@ -107,7 +107,7 @@ static int OnExit(WPARAM, LPARAM) static INT_PTR ServiceMode(WPARAM, LPARAM)
{
g_bServiceMode = true;
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
return SERVICE_ONLYDB;
}
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp index 427b82222b..38aecfa1f5 100644 --- a/plugins/Import/src/miranda.cpp +++ b/plugins/Import/src/miranda.cpp @@ -46,7 +46,7 @@ static void SearchForLists(HWND hwndDlg, const wchar_t *mirandaPath, const wchar continue;
// skip the current profile too
- if (mirandaProf != NULL && !mir_wstrcmpi(mirandaProf, fd.cFileName))
+ if (mirandaProf != nullptr && !mir_wstrcmpi(mirandaProf, fd.cFileName))
continue;
wchar_t buf[MAX_PATH], profile[MAX_PATH];
@@ -77,9 +77,9 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg, UINT message, WPARAM wParam, LPAR VARSW pfn(L"%miranda_profilename%");
SearchForLists(hwndDlg, pfd2, pfn);
- SearchForLists(hwndDlg, pfd1, NULL);
+ SearchForLists(hwndDlg, pfd1, nullptr);
if (mir_wstrcmpi(pfd, pfd2))
- SearchForLists(hwndDlg, pfd, NULL);
+ SearchForLists(hwndDlg, pfd, nullptr);
}
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, 0, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_LIST, LBN_SELCHANGE), 0);
@@ -222,7 +222,7 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hwndDlg, UINT message, WPARAM wP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(NULL));
+ dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(nullptr));
struct tm *TM = localtime(&dwSinceDate);
struct _SYSTEMTIME ST = { 0 };
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 8425e52cab..ba9e6a45aa 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int CreateGroup(const wchar_t *group, MCONTACT hContact)
{
- if (group == NULL)
+ if (group == nullptr)
return 0;
if (Clist_GroupExists(group)) {
@@ -201,7 +201,7 @@ HICON GetIcon(int iIconId, bool size) if (iconList[i].defIconID == iIconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);
- return NULL;
+ return nullptr;
}
HANDLE GetIconHandle(int iIconId)
@@ -210,7 +210,7 @@ HANDLE GetIconHandle(int iIconId) if (iconList[i].defIconID == iIconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void RegisterIcons()
diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 15efa50cff..a5fd8e26ee 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -66,7 +66,7 @@ INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM char sModuleFileName[MAX_PATH];
GetModuleFileNameA(hInst, sModuleFileName, sizeof(sModuleFileName));
char *pszFileName = strrchr(sModuleFileName, '\\');
- if (pszFileName == NULL)
+ if (pszFileName == nullptr)
pszFileName = sModuleFileName;
else
pszFileName++;
@@ -96,7 +96,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARDINTRO), hdlg, WizardIntroPageProc);
- SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hwndPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hwndPage, SW_SHOW);
ShowWindow(hdlg, SW_SHOW);
Window_SetIcon_IcoLib(hdlg, GetIconHandle(IDI_IMPORT));
@@ -109,7 +109,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hdlg, IDCANCEL), TRUE);
SetDlgItemText(hdlg, IDCANCEL, TranslateT("Cancel"));
hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam);
- SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hwndPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hwndPage, SW_SHOW);
break;
diff --git a/plugins/KeyboardNotify/src/EnumProc.cpp b/plugins/KeyboardNotify/src/EnumProc.cpp index e1056113e4..d14af76609 100644 --- a/plugins/KeyboardNotify/src/EnumProc.cpp +++ b/plugins/KeyboardNotify/src/EnumProc.cpp @@ -26,7 +26,7 @@ extern PROCESS_LIST ProcessList; BOOL areThereProcessesRunning(void)
{
- HANDLE hSnapShot = NULL;
+ HANDLE hSnapShot = nullptr;
PROCESSENTRY32 procentry;
BOOL bFlag;
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp index 6f56a9552d..2a47c528b7 100644 --- a/plugins/KeyboardNotify/src/flash.cpp +++ b/plugins/KeyboardNotify/src/flash.cpp @@ -339,7 +339,7 @@ void previewFlashing(BOOL buttonState) return;
bPreviewSemaphore = TRUE;
- mir_forkthread(PreviewThread, 0);
+ mir_forkthread(PreviewThread, nullptr);
}
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 1890ee3e6c..23a0e0d907 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -175,7 +175,7 @@ static void SetAllContactIcons(HWND hwndList) HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if(hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == EMPTY_EXTRA_ICON) {
char *szProto = GetContactProto(hContact);
- if(szProto == NULL)
+ if(szProto == nullptr)
protoCaps = 0;
else
protoCaps = CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0);
@@ -231,7 +231,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPa }
SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
return TRUE;
case WM_SETFOCUS:
SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPa SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
//fall through
case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
break;
case CLN_OPTIONSCHANGED:
ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
@@ -263,7 +263,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPa if(nm->iColumn == -1)
break;
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if(hItem == NULL)
+ if(hItem == nullptr)
break;
if (!(hitFlags & CLCHT_ONITEMEXTRA))
break;
@@ -283,7 +283,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPa iImage = 0;
SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, nm->iColumn, iImage);
}
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
break;
}
diff --git a/plugins/KeyboardNotify/src/keyboard.cpp b/plugins/KeyboardNotify/src/keyboard.cpp index eaa613c661..d8ea3dbfff 100644 --- a/plugins/KeyboardNotify/src/keyboard.cpp +++ b/plugins/KeyboardNotify/src/keyboard.cpp @@ -45,7 +45,7 @@ BOOL OpenKeyboardDevice() DefineDosDevice(DDD_RAW_TARGET_PATH, aux1, aux2);
mir_snwprintf(aux1, L"\\\\.\\Kbd%d", i);
- hKbdDev[i] = CreateFile(aux1, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ hKbdDev[i] = CreateFile(aux1, GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
@@ -66,7 +66,7 @@ BOOL ToggleKeyboardLights(BYTE byte) InputBuffer.LedFlags = byte;
for (i=0; i < MAX_KBDHANDLES && hKbdDev[i] != INVALID_HANDLE_VALUE; i++)
- result |= DeviceIoControl(hKbdDev[i], IOCTL_KEYBOARD_SET_INDICATORS, &InputBuffer, DataLength, NULL, 0, &ReturnedLength, NULL);
+ result |= DeviceIoControl(hKbdDev[i], IOCTL_KEYBOARD_SET_INDICATORS, &InputBuffer, DataLength, nullptr, 0, &ReturnedLength, nullptr);
return result;
}
@@ -81,7 +81,7 @@ void CloseKeyboardDevice() CloseHandle(hKbdDev[i]);
mir_snwprintf(aux, L"Kbd%d", i);
- DefineDosDevice(DDD_REMOVE_DEFINITION, aux, NULL);
+ DefineDosDevice(DDD_REMOVE_DEFINITION, aux, nullptr);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
}
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index e68a3cac24..59a3b82e83 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -32,17 +32,17 @@ CLIST_INTERFACE *pcli; int hLangpack;
DWORD IDThread = 0;
-HANDLE hThread = NULL;
+HANDLE hThread = nullptr;
HANDLE hFlashEvent;
HANDLE hExitEvent;
-HHOOK hMirandaMouseHook = NULL;
-HHOOK hMirandaKeyBoardHook = NULL;
-HHOOK hMirandaWndProcHook = NULL;
+HHOOK hMirandaMouseHook = nullptr;
+HHOOK hMirandaKeyBoardHook = nullptr;
+HHOOK hMirandaWndProcHook = nullptr;
UINT hReminderTimer = 0;
-HHOOK hMouseHook = NULL;
-HHOOK hKeyBoardHook = NULL;
+HHOOK hMouseHook = nullptr;
+HHOOK hKeyBoardHook = nullptr;
BYTE bEmulateKeypresses = 0;
DWORD dwLastInput = 0;
POINT lastGlobalMousePos = { 0, 0 };
@@ -77,8 +77,8 @@ BYTE bTrillianLedsURL; BYTE bTrillianLedsFile;
BYTE bTrillianLedsOther;
-PROTOCOL_LIST ProtoList = { 0, NULL };
-PROCESS_LIST ProcessList = { 0, NULL };
+PROTOCOL_LIST ProtoList = { 0, nullptr };
+PROCESS_LIST ProcessList = { 0, nullptr };
int nWaitDelay;
unsigned int nExternCount = 0;
@@ -529,7 +529,7 @@ void createProcessList(void) void destroyProcessList(void)
{
- if (ProcessList.szFileName == NULL)
+ if (ProcessList.szFileName == nullptr)
return;
for (int i = 0; i < ProcessList.count; i++)
@@ -538,7 +538,7 @@ void destroyProcessList(void) mir_free(ProcessList.szFileName);
ProcessList.count = 0;
- ProcessList.szFileName = NULL;
+ ProcessList.szFileName = nullptr;
}
//========================== Windows hooks ==========================
@@ -623,26 +623,26 @@ static LRESULT CALLBACK MirandaWndProcHookFunction(int code, WPARAM wParam, LPAR int HookWindowsHooks()
{
if (wReminderCheck)
- hReminderTimer = SetTimer(NULL, 0, wReminderCheck * 60000, ReminderTimer);
+ hReminderTimer = SetTimer(nullptr, 0, wReminderCheck * 60000, ReminderTimer);
if (bFlashUntil & UNTIL_REATTENDED) {
switch (bMirandaOrWindows) {
case ACTIVE_WINDOWS:
if (bEmulateKeypresses) {
- if (hMouseHook == NULL)
- hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, 0, GetCurrentThreadId());
- if (hKeyBoardHook == NULL)
- hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, 0, GetCurrentThreadId());
+ if (hMouseHook == nullptr)
+ hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, nullptr, GetCurrentThreadId());
+ if (hKeyBoardHook == nullptr)
+ hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, nullptr, GetCurrentThreadId());
}
break;
case ACTIVE_MIRANDA:
- if (hMirandaMouseHook == NULL)
- hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE, MirandaMouseHookFunction, NULL, GetCurrentThreadId());
- if (hMirandaKeyBoardHook == NULL)
- hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, MirandaKeyBoardHookFunction, NULL, GetCurrentThreadId());
- if (hMirandaWndProcHook == NULL)
- hMirandaWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, MirandaWndProcHookFunction, NULL, GetCurrentThreadId());
+ if (hMirandaMouseHook == nullptr)
+ hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE, MirandaMouseHookFunction, nullptr, GetCurrentThreadId());
+ if (hMirandaKeyBoardHook == nullptr)
+ hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, MirandaKeyBoardHookFunction, nullptr, GetCurrentThreadId());
+ if (hMirandaWndProcHook == nullptr)
+ hMirandaWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, MirandaWndProcHookFunction, nullptr, GetCurrentThreadId());
}
}
@@ -652,7 +652,7 @@ int HookWindowsHooks() int UnhookWindowsHooks()
{
if (hReminderTimer)
- KillTimer(NULL, hReminderTimer);
+ KillTimer(nullptr, hReminderTimer);
if (hMouseHook)
UnhookWindowsHookEx(hMouseHook);
if (hKeyBoardHook)
@@ -665,7 +665,7 @@ int UnhookWindowsHooks() UnhookWindowsHookEx(hMirandaWndProcHook);
hReminderTimer = 0;
- hMouseHook = hKeyBoardHook = hMirandaMouseHook = hMirandaKeyBoardHook = hMirandaWndProcHook = NULL;
+ hMouseHook = hKeyBoardHook = hMirandaMouseHook = hMirandaKeyBoardHook = hMirandaWndProcHook = nullptr;
return 0;
}
@@ -781,7 +781,7 @@ void createProtocolList(void) for (int i = 0; i < ProtoList.protoCount; i++) {
ProtoList.protoInfo[i].xstatus.count = 0;
- ProtoList.protoInfo[i].xstatus.enabled = NULL;
+ ProtoList.protoInfo[i].xstatus.enabled = nullptr;
ProtoList.protoInfo[i].szProto = mir_strdup(proto[i]->szModuleName);
if (!ProtoList.protoInfo[i].szProto) {
ProtoList.protoInfo[i].enabled = FALSE;
@@ -801,7 +801,7 @@ void createProtocolList(void) static void destroyProtocolList(void)
{
- if (ProtoList.protoInfo == NULL)
+ if (ProtoList.protoInfo == nullptr)
return;
for (int i = 0; i < ProtoList.protoCount; i++) {
@@ -813,7 +813,7 @@ static void destroyProtocolList(void) mir_free(ProtoList.protoInfo);
ProtoList.protoCount = 0;
- ProtoList.protoInfo = NULL;
+ ProtoList.protoInfo = nullptr;
}
@@ -911,11 +911,11 @@ static int ModulesLoaded(WPARAM, LPARAM) // Create some synchronisation objects
createEventPrefix(eventPrefix, MAX_PATH - 11);
mir_snwprintf(eventName, L"%s/FlashEvent", eventPrefix);
- hFlashEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
+ hFlashEvent = CreateEvent(nullptr, FALSE, FALSE, eventName);
mir_snwprintf(eventName, L"%s/ExitEvent", eventPrefix);
- hExitEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
+ hExitEvent = CreateEvent(nullptr, FALSE, FALSE, eventName);
- hThread = mir_forkthread(FlashThreadFunction, 0);
+ hThread = mir_forkthread(FlashThreadFunction, nullptr);
HookEvent(ME_MC_ENABLED, OnMetaChanged);
HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index c53a626859..7425a67cc3 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -93,7 +93,7 @@ void importThemes(const wchar_t *filename, BOOL overrideExisting) size_t i; wchar_t buffer[MAX_PATH + 1], theme[MAX_PATH + 1], *str; - while (fgetws(buffer, MAX_PATH, fImport) != NULL) { + while (fgetws(buffer, MAX_PATH, fImport) != nullptr) { for (str = buffer; *str && isspace(*str); str++); //ltrim if (!*str || *str == ';') //empty line or comment continue; @@ -125,7 +125,7 @@ static void createProcessListAux(void) else for (int i = 0; i < ProcessListAux.count; i++) if (!ProcessList.szFileName[i]) - ProcessListAux.szFileName[i] = NULL; + ProcessListAux.szFileName[i] = nullptr; else { ProcessListAux.szFileName[i] = mir_wstrdup(ProcessList.szFileName[i]); } @@ -134,7 +134,7 @@ static void createProcessListAux(void) static void destroyProcessListAux(void) { - if (ProcessListAux.szFileName == NULL) + if (ProcessListAux.szFileName == nullptr) return; for (int i = 0; i < ProcessListAux.count; i++) { if (ProcessListAux.szFileName[i]) { @@ -143,7 +143,7 @@ static void destroyProcessListAux(void) } mir_free(ProcessListAux.szFileName); ProcessListAux.count = 0; - ProcessListAux.szFileName = NULL; + ProcessListAux.szFileName = nullptr; } static void createXstatusListAux(void) @@ -153,7 +153,7 @@ static void createXstatusListAux(void) for (int i = 0; i < ProtoList.protoCount; i++) { XstatusListAux[i].count = ProtoList.protoInfo[i].xstatus.count; if (!XstatusListAux[i].count) - XstatusListAux[i].enabled = NULL; + XstatusListAux[i].enabled = nullptr; else { XstatusListAux[i].enabled = (BOOL *)mir_alloc(XstatusListAux[i].count * sizeof(BOOL)); if (!XstatusListAux[i].enabled) @@ -173,7 +173,7 @@ static void destroyXstatusListAux(void) if (XstatusListAux[i].enabled) mir_free(XstatusListAux[i].enabled); mir_free(XstatusListAux); - XstatusListAux = NULL; + XstatusListAux = nullptr; } } @@ -286,7 +286,7 @@ static INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam TranslateDialogDefault(hwndDlg); { WPARAM j; - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; TVITEM tvi = { 0 }; HTREEITEM hSectionItem, hItem; HWND hwndTree = GetDlgItem(hwndDlg, IDC_TREE_XSTATUS); @@ -304,7 +304,7 @@ static INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, imageCount, imageCount); TreeView_SetImageList(hwndTree, hImageList, TVSIL_NORMAL); - HICON hIconAux = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0); + HICON hIconAux = (HICON)LoadImage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0); if (hIconAux) { ImageList_AddIcon(hImageList, hIconAux); DestroyIcon(hIconAux); @@ -320,7 +320,7 @@ static INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam PROTOACCOUNT **protos; Proto_EnumAccounts(&count, &protos); - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.pszText = protos[i]->tszAccountName; @@ -1161,7 +1161,7 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara path[0] = '\0'; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); mir_wstrcat(filter, L" (*.knt)"); pfilter = filter + mir_wstrlen(filter) + 1; @@ -1189,7 +1189,7 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara path[0] = '\0'; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); mir_wstrcat(filter, L" (*.knt)"); pfilter = filter + mir_wstrlen(filter) + 1; diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 8ec11cec68..ad77475d8a 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -20,11 +20,11 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
HANDLE hExtraIcon;
-static HGENMENU hMainMenuGroup = NULL;
+static HGENMENU hMainMenuGroup = nullptr;
static HANDLE hListeningInfoChangedEvent;
static HANDLE hEnableStateChangedEvent;
-static HANDLE hTTB = NULL;
+static HANDLE hTTB = nullptr;
BOOL loaded = FALSE;
static UINT hTimer = 0;
static DWORD lastInfoSetTime = 0;
@@ -45,7 +45,7 @@ INT_PTR MainMenuClicked(WPARAM wParam, LPARAM lParam); bool ListeningToEnabled(char *proto, bool ignoreGlobal = false);
INT_PTR ListeningToEnabled(WPARAM wParam, LPARAM lParam);
INT_PTR EnableListeningTo(WPARAM wParam, LPARAM lParam);
-INT_PTR EnableListeningTo(char *proto = NULL, bool enabled = false);
+INT_PTR EnableListeningTo(char *proto = nullptr, bool enabled = false);
INT_PTR GetTextFormat(WPARAM wParam, LPARAM lParam);
wchar_t* GetParsedFormat(LISTENINGTOINFO *lti);
INT_PTR GetParsedFormat(WPARAM wParam, LPARAM lParam);
@@ -53,7 +53,7 @@ INT_PTR GetOverrideContactOption(WPARAM wParam, LPARAM lParam); INT_PTR GetUnknownText(WPARAM wParam, LPARAM lParam);
INT_PTR SetNewSong(WPARAM wParam, LPARAM lParam);
void SetExtraIcon(MCONTACT hContact, BOOL set);
-void SetListeningInfos(LISTENINGTOINFO *lti = NULL);
+void SetListeningInfos(LISTENINGTOINFO *lti = nullptr);
INT_PTR HotkeysEnable(WPARAM wParam, LPARAM lParam);
INT_PTR HotkeysDisable(WPARAM wParam, LPARAM lParam);
INT_PTR HotkeysToggle(WPARAM wParam, LPARAM lParam);
@@ -62,12 +62,12 @@ INT_PTR HotkeysToggle(WPARAM wParam, LPARAM lParam); void UpdateGlobalStatusMenus()
{
- bool enabled = ListeningToEnabled(NULL, true);
+ bool enabled = ListeningToEnabled(nullptr, true);
Menu_SetChecked(proto_items[0].hMenu, enabled);
Menu_EnableItem(proto_items[0].hMenu, opts.enable_sending);
- if (hTTB != NULL)
+ if (hTTB != nullptr)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTB, (LPARAM)(enabled ? TTBST_PUSHED : 0));
}
@@ -88,7 +88,7 @@ void RebuildMenu() for (unsigned int i = 1; i < proto_items.size(); i++) {
ProtocolInfo *info = &proto_items[i];
- if (info->hMenu != NULL)
+ if (info->hMenu != nullptr)
Menu_RemoveItem(info->hMenu);
wchar_t text[512];
@@ -124,7 +124,7 @@ void RegisterProtocol(char *proto, wchar_t *account) mir_wstrncpy(proto_items[id].account, account, _countof(proto_items[id].account));
- proto_items[id].hMenu = NULL;
+ proto_items[id].hMenu = nullptr;
proto_items[id].old_xstatus = 0;
proto_items[id].old_xstatus_name[0] = '\0';
proto_items[id].old_xstatus_message[0] = '\0';
@@ -134,11 +134,11 @@ void RegisterProtocol(char *proto, wchar_t *account) int AccListChanged(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *proto = (PROTOACCOUNT *)lParam;
- if (proto == NULL)
+ if (proto == nullptr)
return 0;
ProtocolInfo *info = GetProtoInfo(proto->szModuleName);
- if (info != NULL) {
+ if (info != nullptr) {
if (wParam == PRAC_UPGRADED || wParam == PRAC_CHANGED) {
mir_wstrncpy(info->account, proto->tszAccountName, _countof(info->account));
@@ -180,10 +180,10 @@ int ModulesLoaded(WPARAM, LPARAM) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *proto = GetContactProto(hContact);
- if (proto != NULL) {
+ if (proto != nullptr) {
DBVARIANT dbv;
if (!db_get_ws(hContact, proto, "ListeningTo", &dbv)) {
- if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0)
+ if (dbv.ptszVal != nullptr && dbv.ptszVal[0] != 0)
SetExtraIcon(hContact, TRUE);
db_free(&dbv);
@@ -203,13 +203,13 @@ int ModulesLoaded(WPARAM, LPARAM) mi.root = hMainMenuGroup;
mi.position = 0;
mi.pszService = MS_LISTENINGTO_MAINMENU;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
// Add all protos
SET_UID(mi, 0xc396a9dd, 0x9a00, 0x46af, 0x96, 0x2e, 0x5, 0x5a, 0xbc, 0x52, 0xfc, 0x9b);
mi.name.w = LPGENW("Send to all protocols");
mi.flags = CMIF_UNICODE
- | (ListeningToEnabled(NULL, true) ? CMIF_CHECKED : 0)
+ | (ListeningToEnabled(nullptr, true) ? CMIF_CHECKED : 0)
| (opts.enable_sending ? 0 : CMIF_GRAYED);
proto_items.resize(1);
proto_items[0].hMenu = Menu_AddMainMenuItem(&mi);
@@ -325,7 +325,7 @@ int PreShutdown(WPARAM, LPARAM) loaded = FALSE;
if (hTimer != NULL) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
@@ -338,18 +338,18 @@ int PreShutdown(WPARAM, LPARAM) static INT_PTR TopToolBarClick(WPARAM, LPARAM)
{
- EnableListeningTo(NULL, !ListeningToEnabled(NULL, true));
+ EnableListeningTo(nullptr, !ListeningToEnabled(nullptr, true));
return 0;
}
// Toptoolbar hook to put an icon in the toolbar
int TopToolBarLoaded(WPARAM, LPARAM)
{
- BOOL enabled = ListeningToEnabled(NULL, true);
+ BOOL enabled = ListeningToEnabled(nullptr, true);
CreateServiceFunction(MS_LISTENINGTO_TTB, TopToolBarClick);
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconHandleDn = iconList[0].hIcolib;
ttb.hIconHandleUp = iconList[1].hIcolib;
ttb.pszService = MS_LISTENINGTO_TTB;
@@ -378,7 +378,7 @@ bool ListeningToEnabled(char *proto, bool ignoreGlobal) if (!ignoreGlobal && !opts.enable_sending)
return FALSE;
- if (proto == NULL || proto[0] == 0) {
+ if (proto == nullptr || proto[0] == 0) {
// Check all protocols
for (unsigned int i = 1; i < proto_items.size(); ++i)
if (!ListeningToEnabled(proto_items[i].proto, TRUE))
@@ -406,7 +406,7 @@ ProtocolInfo* GetProtoInfo(char *proto) if (mir_strcmp(proto, proto_items[i].proto) == 0)
return &proto_items[i];
- return NULL;
+ return nullptr;
}
static void ReplaceVars(Buffer<wchar_t> *buffer, MCONTACT hContact, wchar_t **variables, int numVariables)
@@ -433,7 +433,7 @@ static void ReplaceVars(Buffer<wchar_t> *buffer, MCONTACT hContact, wchar_t **va }
else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) {
wchar_t tmp[128];
- TimeZone_ToStringT(time(NULL), L"d s", tmp, _countof(tmp));
+ TimeZone_ToStringT(time(nullptr), L"d s", tmp, _countof(tmp));
buffer->replace(j, i + 1, tmp);
}
else {
@@ -462,8 +462,8 @@ void ReplaceTemplate(Buffer<wchar_t> *out, MCONTACT hContact, wchar_t *templ, wc {
if (ServiceExists(MS_VARS_FORMATSTRING)) {
- wchar_t *tmp = variables_parse_ex(templ, NULL, hContact, vars, numVars);
- if (tmp != NULL) {
+ wchar_t *tmp = variables_parse_ex(templ, nullptr, hContact, vars, numVars);
+ if (tmp != nullptr) {
out->append(tmp);
mir_free(tmp);
out->pack();
@@ -476,9 +476,9 @@ void ReplaceTemplate(Buffer<wchar_t> *out, MCONTACT hContact, wchar_t *templ, wc out->pack();
}
-void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL)
+void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = nullptr)
{
- if (proto == NULL || !ListeningToEnabled(proto))
+ if (proto == nullptr || !ListeningToEnabled(proto))
return;
if (ProtoServiceExists(proto, PS_SET_LISTENINGTO))
@@ -494,13 +494,13 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) ics.status = &status;
// Set or reset?
- if (lti == NULL) {
+ if (lti == nullptr) {
// Reset -> only if is still in music xstatus
ics.flags = CSSF_MASK_STATUS;
if (CallProtoService(proto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&ics) || status != XSTATUS_MUSIC) {
if (opts.xstatus_set == SET_XSTATUS) {
ProtocolInfo *pi = GetProtoInfo(proto);
- if (pi != NULL) {
+ if (pi != nullptr) {
pi->old_xstatus = 0;
pi->old_xstatus_name[0] = '\0';
pi->old_xstatus_message[0] = '\0';
@@ -535,7 +535,7 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) else {
// Set to old text
ProtocolInfo *pi = GetProtoInfo(proto);
- if (pi != NULL) {
+ if (pi != nullptr) {
ics.flags = CSSF_UNICODE | CSSF_MASK_STATUS | CSSF_MASK_NAME | CSSF_MASK_MESSAGE;
ics.status = &pi->old_xstatus;
ics.ptszName = pi->old_xstatus_name;
@@ -548,7 +548,7 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) CallProtoService(proto, PS_SETCUSTOMSTATUSEX, 0, (LPARAM)&ics);
- if (pi != NULL) {
+ if (pi != nullptr) {
pi->old_xstatus = 0;
pi->old_xstatus_name[0] = '\0';
pi->old_xstatus_message[0] = '\0';
@@ -572,7 +572,7 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) ics.flags = CSSF_MASK_STATUS;
if (!CallProtoService(proto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&ics) && status != XSTATUS_MUSIC) {
ProtocolInfo *pi = GetProtoInfo(proto);
- if (pi != NULL) {
+ if (pi != nullptr) {
ics.flags = CSSF_UNICODE | CSSF_MASK_STATUS | CSSF_MASK_NAME | CSSF_MASK_MESSAGE;
ics.status = &pi->old_xstatus;
ics.ptszName = pi->old_xstatus_name;
@@ -614,7 +614,7 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) }
else if (db_get_b(0, MODULE_NAME, "UseStatusMessage", 1) && ProtoServiceExists(proto, PS_SETAWAYMSG)) {
int status = CallProtoService(proto, PS_GETSTATUS, 0, 0);
- if (lti == NULL)
+ if (lti == nullptr)
CallProtoService(proto, PS_SETAWAYMSG, status, 0);
else {
ptrW fr(GetParsedFormat(lti));
@@ -628,7 +628,7 @@ INT_PTR EnableListeningTo(char *proto, bool enabled) if (!loaded)
return -1;
- if (proto == NULL || proto[0] == 0) {
+ if (proto == nullptr || proto[0] == 0) {
// For all protocols
for (unsigned int i = 1; i < proto_items.size(); ++i)
EnableListeningTo(proto_items[i].proto, enabled);
@@ -643,11 +643,11 @@ INT_PTR EnableListeningTo(char *proto, bool enabled) // Modify menu info
ProtocolInfo *info = GetProtoInfo(proto);
- if (info != NULL) {
+ if (info != nullptr) {
Menu_EnableItem(info->hMenu, opts.enable_sending);
Menu_SetChecked(info->hMenu, enabled);
- SetListeningInfo(proto, (opts.enable_sending && enabled) ? GetListeningInfo() : NULL);
+ SetListeningInfo(proto, (opts.enable_sending && enabled) ? GetListeningInfo() : nullptr);
}
// Set all protos info
@@ -691,8 +691,8 @@ INT_PTR GetTextFormat(WPARAM, LPARAM) wchar_t *GetParsedFormat(LISTENINGTOINFO *lti)
{
- if (lti == NULL)
- return NULL;
+ if (lti == nullptr)
+ return nullptr;
wchar_t *fr[] = {
L"artist", UNKNOWN(lti->ptszArtist),
@@ -732,8 +732,8 @@ void SetListeningInfos(LISTENINGTOINFO *lti) for (unsigned int i = 1; i < proto_items.size(); ++i)
SetListeningInfo(proto_items[i].proto, lti);
- wchar_t *fr = NULL;
- char *info = NULL;
+ wchar_t *fr = nullptr;
+ char *info = nullptr;
if (lti) {
fr = GetParsedFormat(lti);
@@ -751,14 +751,14 @@ void SetListeningInfos(LISTENINGTOINFO *lti) static void CALLBACK GetInfoTimer(HWND, UINT, UINT_PTR, DWORD)
{
if (hTimer != NULL) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
// Check if we can set it now...
DWORD now = GetTickCount();
if (now < lastInfoSetTime + MIN_TIME_BEETWEEN_SETS) {
- hTimer = SetTimer(NULL, NULL, lastInfoSetTime + MIN_TIME_BEETWEEN_SETS - now, GetInfoTimer);
+ hTimer = SetTimer(nullptr, NULL, lastInfoSetTime + MIN_TIME_BEETWEEN_SETS - now, GetInfoTimer);
return;
}
lastInfoSetTime = GetTickCount(); // TODO Move this to inside the if that really sets
@@ -808,11 +808,11 @@ void StartTimer() if (want) {
if (hTimer == NULL)
- hTimer = SetTimer(NULL, NULL, opts.time_to_pool * 1000, GetInfoTimer);
+ hTimer = SetTimer(nullptr, NULL, opts.time_to_pool * 1000, GetInfoTimer);
}
else {
if (hTimer != NULL) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
// To be sure that no one was left behind
@@ -824,17 +824,17 @@ void StartTimer() void HasNewListeningInfo()
{
if (hTimer != NULL) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
- hTimer = SetTimer(NULL, NULL, 100, GetInfoTimer);
+ hTimer = SetTimer(nullptr, NULL, 100, GetInfoTimer);
}
void SetExtraIcon(MCONTACT hContact, BOOL set)
{
- ExtraIcon_SetIconByName(hExtraIcon, hContact, set ? "listening_to_icon" : NULL);
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, set ? "listening_to_icon" : nullptr);
}
int SettingChanged(WPARAM hContact, LPARAM lParam)
@@ -847,10 +847,10 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0;
char *proto = GetContactProto(hContact);
- if (proto == NULL || strcmp(cws->szModule, proto) != 0)
+ if (proto == nullptr || strcmp(cws->szModule, proto) != 0)
return 0;
- if (cws->value.type == DBVT_DELETED || cws->value.ptszVal == NULL || cws->value.ptszVal[0] == 0)
+ if (cws->value.type == DBVT_DELETED || cws->value.ptszVal == nullptr || cws->value.ptszVal[0] == 0)
SetExtraIcon(hContact, FALSE);
else
SetExtraIcon(hContact, TRUE);
diff --git a/plugins/ListeningTo/src/main.cpp b/plugins/ListeningTo/src/main.cpp index 132e2b7385..d3eb164123 100644 --- a/plugins/ListeningTo/src/main.cpp +++ b/plugins/ListeningTo/src/main.cpp @@ -59,7 +59,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- CoInitialize(NULL);
+ CoInitialize(nullptr);
InitServices();
InitMusic();
diff --git a/plugins/ListeningTo/src/music.cpp b/plugins/ListeningTo/src/music.cpp index 3ded9a24d2..7fdec99f11 100644 --- a/plugins/ListeningTo/src/music.cpp +++ b/plugins/ListeningTo/src/music.cpp @@ -37,7 +37,7 @@ void FreeMusic() {
for (int i = 0; i < NUM_PLAYERS; i++) {
delete players[i];
- players[i] = NULL;
+ players[i] = nullptr;
}
}
@@ -146,7 +146,7 @@ int ChangedListeningInfo() LISTENINGTOINFO * GetListeningInfo()
{
if (current.cbSize == 0)
- return NULL;
+ return nullptr;
return ¤t;
}
diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp index 9bc51bd3ab..a4d934f8c8 100644 --- a/plugins/ListeningTo/src/options.cpp +++ b/plugins/ListeningTo/src/options.cpp @@ -55,13 +55,13 @@ static OptPageControl formatControls[] = { };
static OptPageControl playersControls[] = {
- { NULL, CONTROL_CHECKBOX, IDC_WATRACK, "GetInfoFromWATrack", FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_WATRACK, "GetInfoFromWATrack", FALSE },
{ &opts.time_to_pool, CONTROL_SPIN, IDC_POLL_TIMER, "TimeToPool", (WORD)5, IDC_POLL_TIMER_SPIN, (WORD)1, (WORD)255 },
- { NULL, CONTROL_CHECKBOX, IDC_WINAMP, "EnableWinamp", TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_ITUNES, "EnableITunes", TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_WMP, "EnableWMP", TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_FOOBAR, "EnableFoobar", TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_MRADIO, "EnableMRadio", TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_WINAMP, "EnableWinamp", TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_ITUNES, "EnableITunes", TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_WMP, "EnableWMP", TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_FOOBAR, "EnableFoobar", TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_MRADIO, "EnableMRadio", TRUE },
{ &opts.enable_other_players, CONTROL_CHECKBOX, IDC_OTHER, "EnableOtherPlayers", TRUE },
{ &opts.enable_code_injection, CONTROL_CHECKBOX, IDC_CODE_INJECTION, "EnableCodeInjection", TRUE }
};
@@ -118,7 +118,7 @@ void LoadOptions() BOOL IsTypeEnabled(LISTENINGTOINFO *lti)
{
- if (lti == NULL)
+ if (lti == nullptr)
return TRUE;
if (lti->dwFlags & LTI_UNICODE) {
@@ -171,7 +171,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_INITDIALOG:
- if (hExtraIcon != NULL) {
+ if (hExtraIcon != nullptr) {
ShowWindow(GetDlgItem(hwndDlg, IDC_SHOW_ADV_ICON), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_ADV_ICON), SW_HIDE);
}
diff --git a/plugins/ListeningTo/src/players/generic.cpp b/plugins/ListeningTo/src/players/generic.cpp index db11f757d7..c4996d763b 100644 --- a/plugins/ListeningTo/src/players/generic.cpp +++ b/plugins/ListeningTo/src/players/generic.cpp @@ -20,15 +20,15 @@ Boston, MA 02111-1307, USA. #include "../stdafx.h"
static UINT hTimer = NULL;
-static HANDLE hLog = NULL;
+static HANDLE hLog = nullptr;
-GenericPlayer *singleton = NULL;
+GenericPlayer *singleton = nullptr;
void m_log(const wchar_t *function, const wchar_t *fmt, ...)
{
- if (hLog == NULL) {
+ if (hLog == nullptr) {
hLog = mir_createLog(MODULE_NAME, L"ListeningTo log", L"c:\\temp\\listeningto.txt", 0);
- if (hLog == NULL)
+ if (hLog == nullptr)
return;
}
@@ -45,10 +45,10 @@ static LRESULT CALLBACK ReceiverWndProc(HWND hWnd, UINT message, WPARAM wParam, case WM_COPYDATA:
if (loaded) {
COPYDATASTRUCT *pData = (PCOPYDATASTRUCT)lParam;
- if (pData == NULL || pData->dwData != MIRANDA_DW_PROTECTION || pData->cbData == 0 || pData->lpData == NULL)
+ if (pData == nullptr || pData->dwData != MIRANDA_DW_PROTECTION || pData->cbData == 0 || pData->lpData == nullptr)
return FALSE;
- if (singleton != NULL)
+ if (singleton != nullptr)
singleton->NewData((WCHAR *)pData->lpData, pData->cbData / 2);
return TRUE;
@@ -75,21 +75,21 @@ GenericPlayer::GenericPlayer() wc.lpszClassName = MIRANDA_WINDOWCLASS;
RegisterClass(&wc);
- hWnd = CreateWindow(MIRANDA_WINDOWCLASS, LPGENW("Miranda ListeningTo receiver"), 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
+ hWnd = CreateWindow(MIRANDA_WINDOWCLASS, LPGENW("Miranda ListeningTo receiver"), 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr);
}
GenericPlayer::~GenericPlayer()
{
if (hTimer != NULL) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
DestroyWindow(hWnd);
- hWnd = NULL;
+ hWnd = nullptr;
UnregisterClass(MIRANDA_WINDOWCLASS, hInst);
- singleton = NULL;
+ singleton = nullptr;
}
void GenericPlayer::ProcessReceived()
@@ -100,11 +100,11 @@ void GenericPlayer::ProcessReceived() // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0"
WCHAR *p1 = wcsstr(received, L"\\0");
- if (IsEmpty(received) || p1 == NULL)
+ if (IsEmpty(received) || p1 == nullptr)
return;
// Process string
- WCHAR *parts[11] = { 0 };
+ WCHAR *parts[11] = {};
int pCount = 0;
WCHAR *p = received;
do {
@@ -113,8 +113,8 @@ void GenericPlayer::ProcessReceived() pCount++;
p = p1 + 2;
p1 = wcsstr(p, L"\\0");
- } while (p1 != NULL && pCount < 10);
- if (p1 != NULL)
+ } while (p1 != nullptr && pCount < 10);
+ if (p1 != nullptr)
*p1 = '\0';
parts[pCount] = p;
@@ -157,7 +157,7 @@ void GenericPlayer::ProcessReceived() else
li->ptszPlayer = mir_wstrdup(player->name);
- if (parts[9] != NULL) {
+ if (parts[9] != nullptr) {
long length = _wtoi(parts[9]);
if (length > 0) {
li->ptszLength = (wchar_t*)mir_alloc(10 * sizeof(wchar_t));
@@ -177,7 +177,7 @@ void GenericPlayer::ProcessReceived() // Put back the '\\'s
for (int i = 1; i <= pCount; i++)
*(parts[i] - 2) = L'\\';
- if (p1 != NULL)
+ if (p1 != nullptr)
*p1 = L'\\';
wcscpy(last_received, received);
@@ -189,13 +189,13 @@ void GenericPlayer::ProcessReceived() static VOID CALLBACK SendTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
if (!loaded)
return;
- if (singleton != NULL)
+ if (singleton != nullptr)
singleton->ProcessReceived();
}
@@ -213,7 +213,7 @@ void GenericPlayer::NewData(const WCHAR *data, size_t len) received[len] = L'\0';
if (hTimer)
- KillTimer(NULL, hTimer);
- hTimer = SetTimer(NULL, NULL, 300, SendTimerProc); // Do the processing after we return true
+ KillTimer(nullptr, hTimer);
+ hTimer = SetTimer(nullptr, NULL, 300, SendTimerProc); // Do the processing after we return true
}
}
diff --git a/plugins/ListeningTo/src/players/itunes.cpp b/plugins/ListeningTo/src/players/itunes.cpp index 167779db76..49def11904 100644 --- a/plugins/ListeningTo/src/players/itunes.cpp +++ b/plugins/ListeningTo/src/players/itunes.cpp @@ -31,11 +31,11 @@ ITunes::ITunes() filename[0] = L'\0';
- hwnd = NULL;
- iTunesApp = NULL;
- track = NULL;
- file = NULL;
- ret = NULL;
+ hwnd = nullptr;
+ iTunesApp = nullptr;
+ track = nullptr;
+ file = nullptr;
+ ret = nullptr;
}
void ITunes::FindWindow()
@@ -51,9 +51,9 @@ void ITunes::FreeTempData() RELEASE(track);
RELEASE(iTunesApp);
- if (ret != NULL) {
+ if (ret != nullptr) {
SysFreeString(ret);
- ret = NULL;
+ ret = nullptr;
}
}
@@ -66,10 +66,10 @@ BOOL ITunes::InitAndGetFilename() // Find window
FindWindow();
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return FALSE;
- CALL(CoCreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER, __uuidof(iTunesApp), (void **)&iTunesApp));
+ CALL(CoCreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER, __uuidof(iTunesApp), (void **)&iTunesApp));
ITPlayerState state;
CALL(iTunesApp->get_PlayerState(&state));
@@ -77,7 +77,7 @@ BOOL ITunes::InitAndGetFilename() return FALSE;
CALL(iTunesApp->get_CurrentTrack(&track));
- if (track == NULL)
+ if (track == nullptr)
return FALSE;
CALL(track->QueryInterface(__uuidof(file), (void **)&file));
@@ -132,10 +132,10 @@ BOOL ITunes::FillCache() listening_info.ptszType = mir_wstrdup(L"Music");
- if (listening_info.ptszTitle == NULL) {
+ if (listening_info.ptszTitle == nullptr) {
// Get from filename
WCHAR *p = wcsrchr(filename, '\\');
- if (p != NULL)
+ if (p != nullptr)
p++;
else
p = filename;
@@ -143,7 +143,7 @@ BOOL ITunes::FillCache() listening_info.ptszTitle = mir_wstrdup(p);
wchar_t *pt = wcsrchr(listening_info.ptszTitle, '.');
- if (pt != NULL)
+ if (pt != nullptr)
*p = '\0';
}
diff --git a/plugins/ListeningTo/src/players/player.cpp b/plugins/ListeningTo/src/players/player.cpp index a2bfcd1751..666f640cf8 100644 --- a/plugins/ListeningTo/src/players/player.cpp +++ b/plugins/ListeningTo/src/players/player.cpp @@ -44,7 +44,7 @@ BOOL Player::GetListeningInfo(LISTENINGTOINFO *lti) if (listening_info.cbSize == 0)
return false;
- if (lti != NULL)
+ if (lti != nullptr)
CopyListeningInfo(lti, &listening_info);
return true;
}
@@ -62,7 +62,7 @@ ExternalPlayer::ExternalPlayer() name = L"ExternalPlayer";
needPoll = TRUE;
- window_classes = NULL;
+ window_classes = nullptr;
num_window_classes = 0;
found_window = FALSE;
}
@@ -73,10 +73,10 @@ ExternalPlayer::~ExternalPlayer() HWND ExternalPlayer::FindWindow()
{
- HWND hwnd = NULL;
+ HWND hwnd = nullptr;
for (int i = 0; i < num_window_classes; i++) {
- hwnd = ::FindWindow(window_classes[i], NULL);
- if (hwnd != NULL)
+ hwnd = ::FindWindow(window_classes[i], nullptr);
+ if (hwnd != nullptr)
break;
}
return hwnd;
@@ -84,7 +84,7 @@ HWND ExternalPlayer::FindWindow() BOOL ExternalPlayer::GetListeningInfo(LISTENINGTOINFO *lti)
{
- if (FindWindow() == NULL)
+ if (FindWindow() == nullptr)
return FALSE;
return Player::GetListeningInfo(lti);
@@ -95,8 +95,8 @@ BOOL ExternalPlayer::GetListeningInfo(LISTENINGTOINFO *lti) CodeInjectionPlayer::CodeInjectionPlayer()
{
name = L"CodeInjectionPlayer";
- dll_name = NULL;
- message_window_class = NULL;
+ dll_name = nullptr;
+ message_window_class = nullptr;
next_request_time = 0;
}
@@ -113,12 +113,12 @@ void CodeInjectionPlayer::InjectCode() // Window is opened?
HWND hwnd = FindWindow();
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return;
// Msg Window is registered? (aka plugin is running?)
- HWND msgHwnd = ::FindWindow(message_window_class, NULL);
- if (msgHwnd != NULL)
+ HWND msgHwnd = ::FindWindow(message_window_class, nullptr);
+ if (msgHwnd != nullptr)
return;
@@ -131,7 +131,7 @@ void CodeInjectionPlayer::InjectCode() return;
char *p = strrchr(dll_path, '\\');
- if (p == NULL)
+ if (p == nullptr)
return;
p++;
@@ -153,21 +153,21 @@ void CodeInjectionPlayer::InjectCode() GetWindowThreadProcessId(hwnd, &pid);
HANDLE hProcess = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION
| PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, pid);
- if (hProcess == NULL)
+ if (hProcess == nullptr)
return;
- char *_dll = (char *)VirtualAllocEx(hProcess, NULL, len + 1, MEM_COMMIT, PAGE_READWRITE);
- if (_dll == NULL) {
+ char *_dll = (char *)VirtualAllocEx(hProcess, nullptr, len + 1, MEM_COMMIT, PAGE_READWRITE);
+ if (_dll == nullptr) {
CloseHandle(hProcess);
return;
}
- WriteProcessMemory(hProcess, _dll, dll_path, len + 1, NULL);
+ WriteProcessMemory(hProcess, _dll, dll_path, len + 1, nullptr);
HMODULE hKernel32 = GetModuleHandleA("kernel32");
HANDLE hLoadLibraryA = GetProcAddress(hKernel32, "LoadLibraryA");
DWORD threadId;
- HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)hLoadLibraryA, _dll, 0, &threadId);
- if (hThread == NULL) {
+ HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)hLoadLibraryA, _dll, 0, &threadId);
+ if (hThread == nullptr) {
VirtualFreeEx(hProcess, _dll, len + 1, MEM_RELEASE);
CloseHandle(hProcess);
return;
diff --git a/plugins/ListeningTo/src/players/watrack.cpp b/plugins/ListeningTo/src/players/watrack.cpp index 895c555b91..bbbd1ee81f 100644 --- a/plugins/ListeningTo/src/players/watrack.cpp +++ b/plugins/ListeningTo/src/players/watrack.cpp @@ -19,13 +19,13 @@ Boston, MA 02111-1307, USA. #include "../stdafx.h"
-static WATrack *instance = NULL;
+static WATrack *instance = nullptr;
int NewStatusCallback(WPARAM wParam, LPARAM lParam)
{
if (!loaded)
return 0;
- if (instance != NULL)
+ if (instance != nullptr)
instance->NewStatus(wParam, lParam);
return 0;
}
@@ -34,16 +34,16 @@ WATrack::WATrack() {
name = L"WATrack";
instance = this;
- hNewStatusHook = NULL;
+ hNewStatusHook = nullptr;
}
WATrack::~WATrack()
{
- if (hNewStatusHook != NULL) {
+ if (hNewStatusHook != nullptr) {
UnhookEvent(hNewStatusHook);
- hNewStatusHook = NULL;
+ hNewStatusHook = nullptr;
}
- instance = NULL;
+ instance = nullptr;
}
void WATrack::EnableDisable()
@@ -53,7 +53,7 @@ void WATrack::EnableDisable() return;
}
- if (hNewStatusHook == NULL)
+ if (hNewStatusHook == nullptr)
hNewStatusHook = HookEvent(ME_WAT_NEWSTATUS, NewStatusCallback);
}
@@ -72,13 +72,13 @@ void WATrack::NewStatus(int event, int value) void WATrack::GetData()
{
- SONGINFO *si = NULL;
+ SONGINFO *si = nullptr;
int playing = CallService(MS_WAT_GETMUSICINFO, WAT_INF_UNICODE, (LPARAM)&si);
FreeData();
// See if something is playing
- if (playing == WAT_RES_NOTFOUND || si == NULL || si->status != 1 || (IsEmpty(si->artist) && IsEmpty(si->title)))
+ if (playing == WAT_RES_NOTFOUND || si == nullptr || si->status != 1 || (IsEmpty(si->artist) && IsEmpty(si->title)))
return;
// Copy new data
diff --git a/plugins/ListeningTo/src/players/wmp.cpp b/plugins/ListeningTo/src/players/wmp.cpp index a78f6f3a57..c69f288765 100644 --- a/plugins/ListeningTo/src/players/wmp.cpp +++ b/plugins/ListeningTo/src/players/wmp.cpp @@ -25,7 +25,7 @@ static LRESULT CALLBACK ReceiverWndProc(HWND hWnd, UINT message, WPARAM wParam, static UINT hTimer = NULL;
-WindowsMediaPlayer *singleton = NULL;
+WindowsMediaPlayer *singleton = nullptr;
WindowsMediaPlayer::WindowsMediaPlayer()
{
@@ -39,21 +39,21 @@ WindowsMediaPlayer::WindowsMediaPlayer() wc.lpszClassName = WMP_WINDOWCLASS;
RegisterClass(&wc);
- hWnd = CreateWindow(WMP_WINDOWCLASS, LPGENW("Miranda ListeningTo WMP receiver"), 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
+ hWnd = CreateWindow(WMP_WINDOWCLASS, LPGENW("Miranda ListeningTo WMP receiver"), 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr);
}
WindowsMediaPlayer::~WindowsMediaPlayer()
{
if (hTimer != NULL) {
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
}
DestroyWindow(hWnd);
- hWnd = NULL;
+ hWnd = nullptr;
UnregisterClass(WMP_WINDOWCLASS, hInst);
- singleton = NULL;
+ singleton = nullptr;
}
void WindowsMediaPlayer::ProcessReceived()
@@ -68,13 +68,13 @@ void WindowsMediaPlayer::ProcessReceived() WCHAR *p1 = wcsstr(received, L"\\0");
- if (received[0] == L'\0' || p1 == NULL) {
+ if (received[0] == L'\0' || p1 == nullptr) {
NotifyInfoChanged();
return;
}
// Process string
- WCHAR *parts[8] = { 0 };
+ WCHAR *parts[8] = {};
int pCount = 0;
WCHAR *p = received;
do {
@@ -83,8 +83,8 @@ void WindowsMediaPlayer::ProcessReceived() pCount++;
p = p1 + 2;
p1 = wcsstr(p, L"\\0");
- } while (p1 != NULL && pCount < 7);
- if (p1 != NULL)
+ } while (p1 != nullptr && pCount < 7);
+ if (p1 != nullptr)
*p1 = L'\0';
parts[pCount] = p;
@@ -104,7 +104,7 @@ void WindowsMediaPlayer::ProcessReceived() // Put back the '\\'s
for (int i = 1; i <= pCount; i++)
*(parts[i] - 2) = L'\\';
- if (p1 != NULL)
+ if (p1 != nullptr)
*p1 = L'\\';
}
@@ -113,13 +113,13 @@ void WindowsMediaPlayer::ProcessReceived() static VOID CALLBACK SendTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, hTimer);
+ KillTimer(nullptr, hTimer);
hTimer = NULL;
if (!loaded)
return;
- if (singleton != NULL)
+ if (singleton != nullptr)
singleton->ProcessReceived();
}
@@ -133,8 +133,8 @@ void WindowsMediaPlayer::NewData(const WCHAR *data, size_t len) received[len] = '\0';
if (hTimer)
- KillTimer(NULL, hTimer);
- hTimer = SetTimer(NULL, NULL, 300, SendTimerProc); // Do the processing after we return true
+ KillTimer(nullptr, hTimer);
+ hTimer = SetTimer(nullptr, NULL, 300, SendTimerProc); // Do the processing after we return true
}
}
@@ -144,14 +144,14 @@ static LRESULT CALLBACK ReceiverWndProc(HWND hWnd, UINT message, WPARAM wParam, if (!loaded)
return FALSE;
- if (singleton == NULL || !singleton->enabled)
+ if (singleton == nullptr || !singleton->enabled)
return FALSE;
COPYDATASTRUCT* pData = (PCOPYDATASTRUCT)lParam;
- if (pData->dwData != 0x547 || pData->cbData == 0 || pData->lpData == NULL)
+ if (pData->dwData != 0x547 || pData->cbData == 0 || pData->lpData == nullptr)
return FALSE;
- if (singleton != NULL)
+ if (singleton != nullptr)
singleton->NewData((WCHAR *)pData->lpData, pData->cbData / 2);
return TRUE;
diff --git a/plugins/ListeningTo/src/variables.cpp b/plugins/ListeningTo/src/variables.cpp index 011404689f..73cb62f6d4 100644 --- a/plugins/ListeningTo/src/variables.cpp +++ b/plugins/ListeningTo/src/variables.cpp @@ -22,10 +22,10 @@ Boston, MA 02111-1307, USA. wchar_t* VariablesParseInfo(ARGUMENTSINFO *ai)
{
if (ai->cbSize < sizeof(ARGUMENTSINFO))
- return NULL;
+ return nullptr;
LISTENINGTOINFO *lti = GetListeningInfo();
- if (lti == NULL) {
+ if (lti == nullptr) {
ai->flags = AIF_FALSE;
return mir_wstrdup(L"");
}
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 2924c50a2f..e76912891c 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -32,10 +32,10 @@ HEMREGISTRATION hLotusRegister = 0; boolean volatile Plugin_Terminated = false;
mir_cs checkthreadCS;
-HGENMENU hMenuHandle = NULL;
-HANDLE hCheckEvent = NULL;
+HGENMENU hMenuHandle = nullptr;
+HANDLE hCheckEvent = nullptr;
-static HWND hTimerWnd = (HWND)NULL;
+static HWND hTimerWnd = (HWND)nullptr;
static UINT TID = (UINT)2006;
char settingServer[MAX_SETTING_STR] = "", settingServerSec[MAX_SETTING_STR] = "", settingDatabase[MAX_SETTING_STR] = "",
@@ -50,7 +50,7 @@ BYTE settingSetColours = 0, settingShowError = 1, settingIniAnswer = -1, setting BOOL settingStatus[STATUS_COUNT];
BOOL bMirandaCall=FALSE;
-struct HISTORIA *first = NULL;
+struct HISTORIA *first = nullptr;
BOOL running = FALSE;
BOOL second = FALSE;
BOOL isPopupWaiting = FALSE;
@@ -138,12 +138,12 @@ void ExtClear() //check if msg was clicked and exists on msgs list
struct HISTORIA* getEl(DWORD id)
{
- for(struct HISTORIA *cur = first; cur != NULL; cur = cur->next)
+ for(struct HISTORIA *cur = first; cur != nullptr; cur = cur->next)
{
if(cur->noteID == id)
return cur;
}
- return NULL;
+ return nullptr;
}
@@ -154,7 +154,7 @@ void addNewId(DWORD id) assert(nowy);
nowy->noteID = id;
nowy->next = first;
- nowy->pq = NULL;
+ nowy->pq = nullptr;
nowy->again = FALSE;
first = nowy;
}
@@ -176,14 +176,14 @@ void addPopup(DWORD id,HWND hWnd) void deletePopupsHandles(struct POPUPSQUEUE **firstpq, BOOL closePopup)
{
struct POPUPSQUEUE *curpq = *firstpq, *delpq;
- while(curpq != NULL) {
+ while(curpq != nullptr) {
delpq = curpq;
curpq = curpq->next;
if(closePopup)
PUDeletePopup(delpq->hWnd);
mir_free(delpq);
}
- *firstpq = NULL;
+ *firstpq = nullptr;
}
@@ -191,7 +191,7 @@ void deletePopupsHandles(struct POPUPSQUEUE **firstpq, BOOL closePopup) void deleteElements()
{
struct HISTORIA *cur = first, *del;
- while(cur != NULL)
+ while(cur != nullptr)
{
del = cur;
cur = cur->next;
@@ -199,7 +199,7 @@ void deleteElements() mir_free(del);
first = cur;
}
- first = NULL;
+ first = nullptr;
}
@@ -265,7 +265,7 @@ BOOL strrep(char *src, char *needle, char *newstring) BOOL checkFilters(wchar_t* str, int field)
{
wchar_t buff[512] = L"";
- wchar_t *strptr = NULL;
+ wchar_t *strptr = nullptr;
switch(field) {
case 0:
wcsncpy_s(buff, settingFilterSender, _TRUNCATE);
@@ -316,7 +316,7 @@ void Click(HWND hWnd,BOOL execute) strrep(tmpcommand, "%OID%", pid->strNote);
strrep(tmpparameters, "%OID%", pid->strNote);
log_p(L"executing: %S %S", tmpcommand, tmpparameters);
- ShellExecuteA(NULL, "Open", tmpcommand, tmpparameters, NULL, SW_NORMAL);
+ ShellExecuteA(nullptr, "Open", tmpcommand, tmpparameters, nullptr, SW_NORMAL);
}
}
@@ -383,13 +383,13 @@ BOOL checkNotesIniFile(BOOL bInfo) char* PLUGINNAME_lower = _strlwr(mir_strdup(PLUGINNAME));
//is there our plugin as safe?
- if(strstr(tmp1,PLUGINNAME_lower) == NULL)
+ if(strstr(tmp1,PLUGINNAME_lower) == nullptr)
{
if(!settingIniCheck && !bInfo)
return FALSE;
if(!settingIniAnswer || bInfo){
- switch(MessageBox(NULL, TranslateT("This utility check your notes.ini file if it's set to authenticate this plugin as safe. Plugin is not added as Lotus Extension, so plugin built-in authentication will not work properly. Do you want to add plugin as Lotus Extension (modify notes.ini by adding \"EXTMGR_ADDINS=PLUGINNAME\")?"), TranslateT("LotusNotify plugin configuration"), MB_YESNO))
+ switch(MessageBox(nullptr, TranslateT("This utility check your notes.ini file if it's set to authenticate this plugin as safe. Plugin is not added as Lotus Extension, so plugin built-in authentication will not work properly. Do you want to add plugin as Lotus Extension (modify notes.ini by adding \"EXTMGR_ADDINS=PLUGINNAME\")?"), TranslateT("LotusNotify plugin configuration"), MB_YESNO))
{
case IDYES:
{
@@ -415,7 +415,7 @@ BOOL checkNotesIniFile(BOOL bInfo) (OSSetEnvironmentVariable1) ("EXTMGR_ADDINS", tmp); //set notes.ini entry
if(bInfo) {
- MessageBox(NULL, TranslateT("notes.ini modified correctly. Miranda restart required."), TranslateT("LotusNotify plugin configuration"), MB_OK);
+ MessageBox(nullptr, TranslateT("notes.ini modified correctly. Miranda restart required."), TranslateT("LotusNotify plugin configuration"), MB_OK);
} else{
ErMsgT(TranslateT("notes.ini modified correctly. Miranda restart required."));
}
@@ -426,7 +426,7 @@ BOOL checkNotesIniFile(BOOL bInfo) } else {
//setting set already
if(bInfo)
- MessageBox(NULL, TranslateT("notes.ini seem to be set correctly."), TranslateT("LotusNotify plugin configuration"), MB_OK);
+ MessageBox(nullptr, TranslateT("notes.ini seem to be set correctly."), TranslateT("LotusNotify plugin configuration"), MB_OK);
return TRUE;
}
@@ -538,7 +538,7 @@ int check() { Menu_EnableItem(hMenuHandle, !running);
log(L"check: starting checkthread");
- mir_forkthread(checkthread, NULL);
+ mir_forkthread(checkthread, nullptr);
return 0;
}
@@ -575,7 +575,7 @@ void checkthread(void*) log(L"checkthread: Started NotesInitThread");
#endif
- if (error = OSPathNetConstruct1(NULL, settingServer, settingDatabase, fullpath)) {
+ if (error = OSPathNetConstruct1(nullptr, settingServer, settingDatabase, fullpath)) {
goto errorblock;
}
#ifdef _DEBUG
@@ -584,7 +584,7 @@ void checkthread(void*) if (error = NSFDbOpen1(fullpath, &db_handle)) {
if (mir_strcmp(settingServerSec, "") != 0) {
- if (error = OSPathNetConstruct1(NULL, settingServerSec, settingDatabase, fullpath)) {
+ if (error = OSPathNetConstruct1(nullptr, settingServerSec, settingDatabase, fullpath)) {
goto errorblock;
}
else {
@@ -720,7 +720,7 @@ void checkthread(void*) field_from_UNICODE[field_len] = '\0';
NSFItemGetTime1(note_handle, MAIL_POSTEDDATE_ITEM, &sendDate);
- error = ConvertTIMEDATEToText1(NULL, NULL, &sendDate, field_date, MAXALPHATIMEDATE, &field_len);
+ error = ConvertTIMEDATEToText1(nullptr, nullptr, &sendDate, field_date, MAXALPHATIMEDATE, &field_len);
field_date[field_len] = '\0';
field_len = NSFItemGetText1(note_handle, MAIL_SUBJECT_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
@@ -748,7 +748,7 @@ void checkthread(void*) else
wcsncpy_s(msgFrom, field_from_UNICODE, _TRUNCATE);
- for (Att = 0; MailGetMessageAttachmentInfo1(note_handle, Att, &bhAttachment, NULL, &cSize, NULL, NULL, NULL, NULL); Att++)
+ for (Att = 0; MailGetMessageAttachmentInfo1(note_handle, Att, &bhAttachment, nullptr, &cSize, nullptr, nullptr, nullptr, nullptr); Att++)
attSize += cSize;
#ifdef _DEBUG
@@ -909,7 +909,7 @@ void fillServersList(HWND hwndDlg) return;
}
- error = NSGetServerList1(NULL, &hServerList);
+ error = NSGetServerList1(nullptr, &hServerList);
if (error == NOERROR) {
pServerList = (BYTE far *) OSLockObject1(hServerList);
@@ -1148,7 +1148,7 @@ static INT_PTR CALLBACK DlgProcLotusNotifyConnectionOpts(HWND hwndDlg, UINT msg, GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, _countof(settingPassword));
break;
case IDC_INTERVAL:
- settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE);
+ settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, nullptr, FALSE);
break;
case IDC_KEEP_CONNEXION_ON_ERROR:
settingKeepConnection = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR);
@@ -1230,7 +1230,7 @@ static INT_PTR CALLBACK DlgProcLotusNotifyPopupOpts(HWND hwndDlg, UINT msg, WPAR settingFgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_GETCOLOUR, 0, 0);
break;
case IDC_INTERVAL1:
- settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE);
+ settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, nullptr, TRUE);
break;
case IDC_ONCEONLY:
settingOnceOnly = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONCEONLY);
@@ -1576,7 +1576,7 @@ void checkEnvPath(wchar_t *path) wcslwr(cur);
wchar_t *found = wcsstr(cur, path);
size_t len = mir_wstrlen(path);
- if (found != NULL && (found[len] == ';' || found[len] == 0 || (found[len] == '\\' && (found[len + 1] == ';' || found[len + 1] == 0))))
+ if (found != nullptr && (found[len] == ';' || found[len] == 0 || (found[len] == '\\' && (found[len + 1] == ';' || found[len + 1] == 0))))
return;
_wputenv(CMStringW(FORMAT, L"PATH=%s;%s;", cur, path));
@@ -1607,7 +1607,7 @@ static int modulesloaded(WPARAM, LPARAM) hLotusDll = LoadLibrary(path);
assert(hLotusDll);
- if (hLotusDll != NULL) {
+ if (hLotusDll != nullptr) {
log(L"Loading LN Functions");
@@ -1619,7 +1619,7 @@ static int modulesloaded(WPARAM, LPARAM) log(L"Initializing Lotus");
- if (NotesInitExtended1(0, NULL)) {
+ if (NotesInitExtended1(0, nullptr)) {
//initialize lotus //TODO: Lotus can terminate miranda process here with msgbox "Shared Memory from a previous Notes/Domino run has been detected, this process will exit now"
startuperror += 4;
diff --git a/plugins/LotusNotify/src/debug.cpp b/plugins/LotusNotify/src/debug.cpp index 6c59964094..c29996f0b5 100644 --- a/plugins/LotusNotify/src/debug.cpp +++ b/plugins/LotusNotify/src/debug.cpp @@ -14,7 +14,7 @@ void logRegister(){ void logUnregister(){
Netlib_CloseHandle(netlibHandle);
- netlibHandle = NULL;
+ netlibHandle = nullptr;
}
void log(const wchar_t* szText){
diff --git a/plugins/LotusNotify/src/lotusnotes.cpp b/plugins/LotusNotify/src/lotusnotes.cpp index 8c5d1d9ff9..6408558977 100644 --- a/plugins/LotusNotify/src/lotusnotes.cpp +++ b/plugins/LotusNotify/src/lotusnotes.cpp @@ -77,7 +77,7 @@ void GetLotusPath(wchar_t *sTemp, DWORD size) return;
}
- RegQueryValueEx( dmKey, TEXT("Path"), NULL, NULL, (BYTE*)sTemp, &size );
+ RegQueryValueEx( dmKey, TEXT("Path"), nullptr, nullptr, (BYTE*)sTemp, &size );
RegCloseKey(dmKey);
return;
}
diff --git a/plugins/MenuItemEx/src/images.cpp b/plugins/MenuItemEx/src/images.cpp index d197226eb8..f59b4c2c4e 100644 --- a/plugins/MenuItemEx/src/images.cpp +++ b/plugins/MenuItemEx/src/images.cpp @@ -17,7 +17,7 @@ void HalfBitmap32Alpha(HBITMAP hBitmap) dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -79,7 +79,7 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -124,8 +124,8 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) dwLen = bmp.bmWidth * bmp.bmHeight * 4;
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
// Create bitmap
BITMAPINFO RGB32BitsBITMAPINFO;
@@ -136,11 +136,11 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- HBITMAP hDirectBitmap = CreateDIBSection(NULL,
+ HBITMAP hDirectBitmap = CreateDIBSection(nullptr,
(BITMAPINFO *)&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
(void **)&ptPixels,
- NULL, 0);
+ nullptr, 0);
// Copy data
if (bmp.bmBitsPixel != 32)
@@ -148,10 +148,10 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) HDC hdcOrig, hdcDest;
HBITMAP oldOrig, oldDest;
- hdcOrig = CreateCompatibleDC(NULL);
+ hdcOrig = CreateCompatibleDC(nullptr);
oldOrig = (HBITMAP)SelectObject(hdcOrig, hBitmap);
- hdcDest = CreateCompatibleDC(NULL);
+ hdcDest = CreateCompatibleDC(nullptr);
oldDest = (HBITMAP)SelectObject(hdcDest, hDirectBitmap);
BitBlt(hdcDest, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOrig, 0, 0, SRCCOPY);
@@ -270,10 +270,10 @@ HICON MakeHalfAlphaIcon(HICON SourceIcon) TempIcon = CopyIcon(SourceIcon);
if (!GetIconInfo(TempIcon, &TargetIconInfo))
- return NULL;
+ return nullptr;
if (!GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo))
- return NULL;
+ return nullptr;
MakeBitmap32(&TargetIconInfo.hbmColor);
HalfBitmap32Alpha(TargetIconInfo.hbmColor);
@@ -315,7 +315,7 @@ HICON BindOverlayIcon(HICON SourceIcon, LPCSTR OverlayIconName) TempIcon = CopyIcon(SourceIcon);
if (!GetIconInfo(TempIcon, &TargetIconInfo))
- return NULL;
+ return nullptr;
MakeBitmap32(&TargetIconInfo.hbmColor);
CorrectBitmap32Alpha(TargetIconInfo.hbmColor, FALSE);
@@ -323,12 +323,12 @@ HICON BindOverlayIcon(HICON SourceIcon, LPCSTR OverlayIconName) OverlayIcon = IcoLib_GetIcon(OverlayIconName);
if (!GetIconInfo(OverlayIcon, &OverlayIconInfo) || !GetObject(OverlayIconInfo.hbmColor, sizeof(BITMAP), &OverlayBitmapInfo))
- return NULL;
+ return nullptr;
- TargetDC = CreateCompatibleDC(NULL);
+ TargetDC = CreateCompatibleDC(nullptr);
OldTargetBitmap = (HBITMAP)SelectObject(TargetDC, TargetIconInfo.hbmColor);
- OverlayDC = CreateCompatibleDC(NULL);
+ OverlayDC = CreateCompatibleDC(nullptr);
OldOverlayBitmap = (HBITMAP)SelectObject(OverlayDC, OverlayIconInfo.hbmColor);
AlphaBlend(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight,
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 0f6b58fe2e..4666c47cc6 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -35,8 +35,8 @@ struct { }
static const statusMsg[] = {
{ "CList", "StatusMsg", LPGENW("Status message"), 1 },
- { 0, "XStatusName", LPGENW("xStatus title"), 4 },
- { 0, "XStatusMsg", LPGENW("xStatus message"), 2 },
+ { nullptr, "XStatusName", LPGENW("xStatus title"), 4 },
+ { nullptr, "XStatusMsg", LPGENW("xStatus message"), 2 },
{ "AdvStatus", "tune/text", LPGENW("Listening to"), 8 },
{ "AdvStatus", "activity/title", LPGENW("Activity title"), 8 },
{ "AdvStatus", "activity/text", LPGENW("Activity text"), 8 }
@@ -113,7 +113,7 @@ static int enumModulesSettingsProc(const char *szName, LPARAM lParam) msll->first = (struct ModSetLinkLinkItem *)malloc(sizeof(struct ModSetLinkLinkItem));
if (!msll->first) return 1;
msll->first->name = _strdup(szName);
- msll->first->next = 0;
+ msll->first->next = nullptr;
msll->last = msll->first;
}
else
@@ -123,7 +123,7 @@ static int enumModulesSettingsProc(const char *szName, LPARAM lParam) msll->last->next = (BYTE*)item;
msll->last = (struct ModSetLinkLinkItem *)item;
item->name = _strdup(szName);
- item->next = 0;
+ item->next = nullptr;
}
return 0;
}
@@ -140,26 +140,26 @@ static void FreeModuleSettingLL(ModuleSettingLL* msll) if (item->name)
{
free(item->name);
- item->name = 0;
+ item->name = nullptr;
}
temp = item;
item = (struct ModSetLinkLinkItem *)item->next;
if (temp)
{
free(temp);
- temp = 0;
+ temp = nullptr;
}
}
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
}
}
static void RenameDbProto(MCONTACT hContact, MCONTACT hContactNew, char* oldName, char* newName, int delOld)
{
// enum all setting the contact has for the module
- ModuleSettingLL settinglist = { NULL, NULL };
+ ModuleSettingLL settinglist = { nullptr, nullptr };
db_enum_settings(hContact, enumModulesSettingsProc, oldName, &settinglist);
for (ModSetLinkLinkItem *setting = settinglist.first; setting; setting = (ModSetLinkLinkItem *)setting->next) {
@@ -196,7 +196,7 @@ static void RenameDbProto(MCONTACT hContact, MCONTACT hContactNew, char* oldName static void ShowPopup(char* szText, wchar_t* tszText, MCONTACT hContact)
{
POPUPDATAT ppd = { 0 };
- wchar_t* text = 0;
+ wchar_t* text = nullptr;
if (tszText)
text = mir_wstrdup(tszText);
@@ -224,13 +224,13 @@ BOOL DirectoryExists(MCONTACT hContact) void CopyToClipboard(HWND, LPSTR pszMsg, LPTSTR ptszMsg)
{
- LPTSTR buf = 0;
+ LPTSTR buf = nullptr;
if (ptszMsg)
buf = mir_wstrdup(ptszMsg);
else if (pszMsg)
buf = mir_a2u(pszMsg);
- if (buf == 0)
+ if (buf == nullptr)
return;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(buf) + 1)*sizeof(wchar_t));
@@ -239,7 +239,7 @@ void CopyToClipboard(HWND, LPSTR pszMsg, LPTSTR ptszMsg) mir_free(buf);
GlobalUnlock(hglbCopy);
- if (OpenClipboard(NULL) == NULL)
+ if (OpenClipboard(nullptr) == NULL)
return;
EmptyClipboard();
@@ -263,7 +263,7 @@ void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID, size_t dwIDSize) DBVARIANT dbv_uniqueid;
LPSTR uID = (LPSTR)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if (uID == (LPSTR)CALLSERVICE_NOTFOUND)
- uID = NULL;
+ uID = nullptr;
szID[0] = 0;
if (uID && db_get(hContact, szProto, uID, &dbv_uniqueid) == 0) {
@@ -344,7 +344,7 @@ void getIP(MCONTACT hContact, LPSTR szProto, LPSTR szIP) LPTSTR getMirVer(MCONTACT hContact)
{
LPSTR szProto = GetContactProto(hContact);
- if (!szProto) return NULL;
+ if (!szProto) return nullptr;
LPTSTR msg = db_get_wsa(hContact, szProto, "MirVer");
if (msg) {
@@ -353,7 +353,7 @@ LPTSTR getMirVer(MCONTACT hContact) mir_free(msg);
}
- return NULL;
+ return nullptr;
}
static LRESULT CALLBACK AuthReqEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -460,12 +460,12 @@ static INT_PTR onHide(WPARAM wparam, LPARAM) // following 4 functions should be self-explanatory
static void ModifyVisibleSet(int mode, BOOL alpha)
{
- Menu_ModifyItem(hmenuVis, NULL, (mode) ? hIcons[1] : (alpha ? hIcons[3] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)));
+ Menu_ModifyItem(hmenuVis, nullptr, (mode) ? hIcons[1] : (alpha ? hIcons[3] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)));
}
static void ModifyInvisSet(int mode, BOOL alpha)
{
- Menu_ModifyItem(hmenuOff, NULL, (mode) ? hIcons[2] : (alpha ? hIcons[4] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)));
+ Menu_ModifyItem(hmenuOff, nullptr, (mode) ? hIcons[2] : (alpha ? hIcons[4] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)));
}
static void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID)
@@ -524,7 +524,7 @@ static void ModifyStatusMsg(MCONTACT hContact) hIconSMsg = hIcon;
}
- Menu_ModifyItem(hmenuStatusMsg, NULL, hIconSMsg);
+ Menu_ModifyItem(hmenuStatusMsg, nullptr, hIconSMsg);
DestroyIcon(hIconSMsg);
}
@@ -543,13 +543,13 @@ static void ModifyCopyIP(MCONTACT hContact) hIconCIP = hIcon;
}
- Menu_ModifyItem(hmenuCopyIP, NULL, hIconCIP);
+ Menu_ModifyItem(hmenuCopyIP, nullptr, hIconCIP);
DestroyIcon(hIconCIP);
}
static void ModifyCopyMirVer(MCONTACT hContact)
{
- HICON hMenuIcon = NULL;
+ HICON hMenuIcon = nullptr;
if (ServiceExists(MS_FP_GETCLIENTICONT)) {
LPTSTR msg = getMirVer(hContact);
if (msg) {
@@ -557,9 +557,9 @@ static void ModifyCopyMirVer(MCONTACT hContact) mir_free(msg);
}
}
- if (hMenuIcon == NULL)
+ if (hMenuIcon == nullptr)
hMenuIcon = hIcons[0];
- Menu_ModifyItem(hmenuCopyMirVer, NULL, hMenuIcon);
+ Menu_ModifyItem(hmenuCopyMirVer, nullptr, hMenuIcon);
}
static INT_PTR onCopyID(WPARAM wparam, LPARAM lparam)
@@ -575,7 +575,7 @@ static INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) }
LPSTR szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return 0;
GetID(hContact, szProto, (LPSTR)&szID, _countof(szID));
@@ -591,9 +591,9 @@ static INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) else
strncpy(buffer, szID, _countof(buffer)-1);
- CopyToClipboard((HWND)lparam, buffer, 0);
+ CopyToClipboard((HWND)lparam, buffer, nullptr);
if (CTRL_IS_PRESSED && bPopupService)
- ShowPopup(buffer, 0, hContact);
+ ShowPopup(buffer, nullptr, hContact);
return 0;
}
@@ -630,9 +630,9 @@ static INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam) }
}
- CopyToClipboard((HWND)lparam, 0, buffer);
+ CopyToClipboard((HWND)lparam, nullptr, buffer);
if (CTRL_IS_PRESSED && bPopupService)
- ShowPopup(0, buffer, hContact);
+ ShowPopup(nullptr, buffer, hContact);
return 0;
}
@@ -644,9 +644,9 @@ static INT_PTR onCopyIP(WPARAM wparam, LPARAM lparam) char szIP[128];
getIP((MCONTACT)wparam, szProto, (LPSTR)&szIP);
- CopyToClipboard((HWND)lparam, szIP, 0);
+ CopyToClipboard((HWND)lparam, szIP, nullptr);
if (CTRL_IS_PRESSED && bPopupService)
- ShowPopup(szIP, 0, (MCONTACT)wparam);
+ ShowPopup(szIP, nullptr, (MCONTACT)wparam);
return 0;
}
@@ -655,9 +655,9 @@ static INT_PTR onCopyMirVer(WPARAM wparam, LPARAM lparam) {
LPTSTR msg = getMirVer((MCONTACT)wparam);
if (msg) {
- CopyToClipboard((HWND)lparam, _T2A(msg), 0);
+ CopyToClipboard((HWND)lparam, _T2A(msg), nullptr);
if (CTRL_IS_PRESSED && bPopupService)
- ShowPopup(_T2A(msg), 0, (MCONTACT)wparam);
+ ShowPopup(_T2A(msg), nullptr, (MCONTACT)wparam);
mir_free(msg);
}
@@ -674,7 +674,7 @@ static INT_PTR onRecvFiles(WPARAM wparam, LPARAM) {
char path[MAX_PATH];
CallService(MS_FILE_GETRECEIVEDFILESFOLDER, wparam, (LPARAM)&path);
- ShellExecuteA(0, "open", path, 0, 0, SW_SHOW);
+ ShellExecuteA(nullptr, "open", path, nullptr, nullptr, SW_SHOW);
return 0;
}
@@ -702,7 +702,7 @@ static INT_PTR onChangeProto(WPARAM wparam, LPARAM lparam) else
return 0;
}
- if (MessageBox(NULL, TranslateT("Do you want to send authorization request\nto new contact?"),
+ if (MessageBox(nullptr, TranslateT("Do you want to send authorization request\nto new contact?"),
L"Miranda NG", MB_OKCANCEL | MB_SETFOREGROUND | MB_TOPMOST) == IDOK)
onSendAuthRequest((WPARAM)hContactNew, 0);
@@ -754,7 +754,7 @@ static void ModifySubmenuItem(HGENMENU hItem, int checked, int hidden) flags |= CMIF_CHECKED;
if (hidden)
flags |= CMIF_HIDDEN;
- Menu_ModifyItem(hItem, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(hItem, nullptr, INVALID_HANDLE_VALUE, flags);
}
// called when the contact-menu is built
@@ -867,7 +867,7 @@ static int EnumProtoSubmenu(WPARAM, LPARAM) if (hProtoItem[i])
{
Menu_RemoveItem(hProtoItem[i]);
- hProtoItem[i] = 0;
+ hProtoItem[i] = nullptr;
}
}
}
@@ -896,7 +896,7 @@ static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) static int TabsrmmButtonsInit(WPARAM, LPARAM)
{
- BBButton bbd = { 0 };
+ BBButton bbd = {};
bbd.pszModuleName = MODULENAME;
bbd.dwDefPos = 1000;
bbd.pwszTooltip = LPGENW("Browse Received Files");
@@ -964,7 +964,7 @@ static int PluginInit(WPARAM, LPARAM) SET_UID(mi, 0xe09c04d4, 0xc6b1, 0x4048, 0x98, 0xd6, 0xbe, 0x11, 0xf6, 0x91, 0x15, 0xba);
mi.position++;
mi.name.w = LPGENW("Ignore");
- mi.pszService = 0;
+ mi.pszService = nullptr;
mi.hIcolibItem = IcoLib_GetIcon("miex_ignore");
hmenuIgnore = Menu_AddContactMenuItem(&mi);
@@ -1019,7 +1019,7 @@ static int PluginInit(WPARAM, LPARAM) mi.position++;
mi.name.w = LPGENW("Copy Status Message");
mi.pszService = MS_STATUSMSG;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
hmenuStatusMsg = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x3847bfcd, 0xfcd5, 0x4435, 0xa6, 0x54, 0x2e, 0x9, 0xc5, 0xba, 0xcf, 0x71);
diff --git a/plugins/MessageState/src/clist_extra.cpp b/plugins/MessageState/src/clist_extra.cpp index b76a01401f..a4cf2e23f6 100644 --- a/plugins/MessageState/src/clist_extra.cpp +++ b/plugins/MessageState/src/clist_extra.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-HANDLE hExtraIcon = NULL;
+HANDLE hExtraIcon = nullptr;
int ExtraIconsApply(WPARAM hContact, LPARAM force)
{
diff --git a/plugins/MimCmd/src/MimCmd.cpp b/plugins/MimCmd/src/MimCmd.cpp index f4cfed40e2..88d2dcd2db 100644 --- a/plugins/MimCmd/src/MimCmd.cpp +++ b/plugins/MimCmd/src/MimCmd.cpp @@ -37,7 +37,7 @@ int lpprintf(const char *format, ...) char* GetProgramName(char *programName, int size)
{
char name[512];
- GetModuleFileNameA(GetModuleHandle(NULL), name, sizeof(name));
+ GetModuleFileNameA(GetModuleHandle(nullptr), name, sizeof(name));
char *p = strrchr(name, '\\');
if (p)
strncpy_s(programName, size, p + 1, _TRUNCATE);
diff --git a/plugins/MimCmd/src/commands.cpp b/plugins/MimCmd/src/commands.cpp index d066dab4af..db79ddbe7c 100644 --- a/plugins/MimCmd/src/commands.cpp +++ b/plugins/MimCmd/src/commands.cpp @@ -20,12 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-LISTCOMMANDS ListCommands = NULL;
+LISTCOMMANDS ListCommands = nullptr;
-PCommand knownCommands = NULL;
+PCommand knownCommands = nullptr;
int cKnownCommands = 0;
-HMODULE hCmdLineDLL = NULL;
+HMODULE hCmdLineDLL = nullptr;
char *GetMirandaFolder(char *mimFolder, int size)
{
@@ -36,14 +36,14 @@ char *GetMirandaFolder(char *mimFolder, int size) int ConnectToMiranda()
{
wchar_t tszPath[MAX_PATH];
- GetModuleFileName(NULL, tszPath, _countof(tszPath));
+ GetModuleFileName(nullptr, tszPath, _countof(tszPath));
wchar_t *p = wcsrchr(tszPath, '\\');
if (p) p[1] = 0;
wcsncat_s(tszPath, L"libs", _TRUNCATE);
DWORD cbPath = (DWORD)wcslen(tszPath);
- DWORD cbSize = GetEnvironmentVariable(L"PATH", NULL, 0);
+ DWORD cbSize = GetEnvironmentVariable(L"PATH", nullptr, 0);
wchar_t *ptszVal = new wchar_t[cbSize + MAX_PATH + 2];
wcscpy(ptszVal, tszPath);
wcscat(ptszVal, L";");
@@ -55,7 +55,7 @@ int ConnectToMiranda() GetMirandaFolder(pluginPath, sizeof(pluginPath));
mir_strcat(pluginPath, "\\plugins\\cmdline.dll");
- ListCommands = NULL;
+ ListCommands = nullptr;
hCmdLineDLL = LoadLibraryA(pluginPath);
@@ -77,7 +77,7 @@ int DisconnectFromMiranda() int GetKnownCommands()
{
ListCommands(&knownCommands, &cKnownCommands);
- return (knownCommands == NULL);
+ return (knownCommands == nullptr);
}
int DestroyKnownCommands()
@@ -102,7 +102,7 @@ PCommand GetCommand(char *command) if (knownCommands[i].ID == MIMCMD_HELP)
return &knownCommands[i];
- return NULL;
+ return nullptr;
}
void HandleHelpCommand(PCommand, char *argv[], int argc, PReply reply)
@@ -139,7 +139,7 @@ PReply ParseCommand(char *argv[], int argc) {
PCommand command = GetCommand(argv[1]);
if (!command)
- return NULL;
+ return nullptr;
PReply reply = &sdCmdLine->reply;
if (command->ID == MIMCMD_HELP)
diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp index eec0c8b196..cb388d0681 100644 --- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp +++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp @@ -5,7 +5,7 @@ MFLogger::MFLogger()
{
- logFunction = NULL;
+ logFunction = nullptr;
memcpy(m_prefix, L" ", PREFIX_SIZE * sizeof(m_prefix[0]));
}
@@ -21,7 +21,7 @@ void MFLogger::set6CharsPrefix(const wchar_t* prefix){ }
void MFLogger::releaseLogger(){
- logFunction = NULL;
+ logFunction = nullptr;
DeleteCriticalSection(&logCs);
}
diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp index 96ac041006..10fe3c3763 100644 --- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp +++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp @@ -38,7 +38,7 @@ MessageQueueUtils::MessageQueueUtils() {
unloadedMQProcessId = -1;
//one mutex per all messagequeues schould be enough
- smMutex = CreateMutex(NULL, FALSE, L"Local\\mirfoxMqMirSm");
+ smMutex = CreateMutex(nullptr, FALSE, L"Local\\mirfoxMqMirSm");
}
@@ -114,7 +114,7 @@ MessageQueueUtils::unloadMessageQueue(uint16_t unloadedMQProcessId) this->unloadedMQProcessId = unloadedMQProcessId;
if (mqMirSm){
delete mqMirSm;
- mqMirSm = NULL;
+ mqMirSm = nullptr;
} else {
logger->log(L"MessageQueueUtils::unloadMessageQueue - mqMirSm was NULL");
}
@@ -231,7 +231,7 @@ MessageQueueUtils::sendMessage(int clientRecordId, char menuItemType, char userA getMqName(clientRecordId).c_str(),
boost::interprocess::read_write);
- if (sm == NULL){
+ if (sm == nullptr){
logger->log(L"MessageQueueUtils::sendMessage (sm mode) sm == NULL");
return; //error
}
diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp index 18fafa241e..5696e7695a 100644 --- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp +++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp @@ -1230,7 +1230,7 @@ time_t SharedMemoryUtils::mfGetCurrentTimestamp()
{
- time_t currentTimestamp = time(NULL);
+ time_t currentTimestamp = time(nullptr);
//logger->log_dp(L"mfGetCurrentTimestamp() [" SCNuPTR L"]", currentTimestamp);
return currentTimestamp;
@@ -1369,7 +1369,7 @@ SharedMemoryUtils::isTokenOnList(std::wstring& token, std::wstring& tokensList) void
SharedMemoryUtils::unloadFromCSM(uint16_t processCsmId)
{
- if (csm == NULL){
+ if (csm == nullptr){
logger->log(L"SharedMemoryUtils::unloadFromCSM: csm == NULL , return");
return;
}
diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index 325ef6cd9b..ed6857ff96 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -364,7 +364,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM //set contacts and groups icons
setListContactIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST));
- setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
mirfoxMiranda.getMirfoxData().tab2OptionsState = MFENUM_OPTIONS_WORK;
@@ -392,7 +392,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM setListContactIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST));
//fall through
case CLN_CONTACTMOVED:
- setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
break;
case CLN_OPTIONSCHANGED:
resetListOptions(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST));
@@ -412,7 +412,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
// Nothing was clicked
- if (hItem == NULL){
+ if (hItem == nullptr){
break;
}
// It was not a visbility icon
@@ -446,7 +446,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
// Update the all/none icons
- setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
// Activate Apply button
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -517,9 +517,9 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // use DestroyIcon only witchout icolib
DestroyIcon(icoHandle_ICON_OFF);
- icoHandle_ICON_OFF = NULL;
+ icoHandle_ICON_OFF = nullptr;
DestroyIcon(icoHandle_ICON_FF);
- icoHandle_ICON_FF = NULL;
+ icoHandle_ICON_FF = nullptr;
break;
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index caf5456467..0e0592b242 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -9,7 +9,7 @@ MirandaUtils::MirandaUtils() : logger(MFLogger::getInstance())
{
- netlibHandle = NULL;
+ netlibHandle = nullptr;
InitializeCriticalSection(&ackMapCs);
}
@@ -39,7 +39,7 @@ void MirandaUtils::netlibRegister(){ void MirandaUtils::netlibUnregister(){
Netlib_CloseHandle(netlibHandle);
- netlibHandle = NULL;
+ netlibHandle = nullptr;
}
@@ -79,10 +79,10 @@ std::wstring& MirandaUtils::getDisplayName() void MirandaUtils::userActionThread(void* threadArg)
{
- Thread_Push(0);
+ Thread_Push(nullptr);
ActionThreadArgStruct* actionThreadArgPtr = (ActionThreadArgStruct*)threadArg;
- if (actionThreadArgPtr->mirfoxDataPtr == NULL){
+ if (actionThreadArgPtr->mirfoxDataPtr == nullptr){
MFLogger::getInstance()->log(L"MirandaUtils::userActionThread: ERROR mirfoxDataPtr == NULL");
return;
}
@@ -114,7 +114,7 @@ void MirandaUtils::sendMessageToContact(ActionThreadArgStruct* args) {
logger->log(L"MirandaUtils::sendMessageToContact: start");
- if (args->targetHandle == NULL){
+ if (args->targetHandle == nullptr){
logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandle == NULL");
return;
}
@@ -143,7 +143,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ // }
char *targetHandleSzProto = GetContactProto((UINT_PTR)args->targetHandle); //targetHandleSzProto doesnt need mir_free or delete
- if (targetHandleSzProto == NULL){
+ if (targetHandleSzProto == nullptr){
logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandleSzProto == NULL");
return;
}
@@ -155,9 +155,9 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ HANDLE hProcess = sendMessageMiranda((UINT_PTR)args->targetHandle, msgBuffer);
logger->log_p(L"SMTC: hProcess = [" SCNuPTR L"]", hProcess);
- MIRFOXACKDATA* myMfAck = NULL;
+ MIRFOXACKDATA* myMfAck = nullptr;
- if (hProcess != NULL){
+ if (hProcess != nullptr){
//if hProcess of sending process is null there will not be any ack
EnterCriticalSection(&ackMapCs);
@@ -178,26 +178,26 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ logger->log_p(L"SMTC: ACK break by Plugin_Terminated (=%d) or Miranda_IsTerminated()", args->mirfoxDataPtr->Plugin_Terminated);
break;
}
- } while (myMfAck == NULL && counter <= MAX_ACK_WAIT_COUNTER); //TODO or Plugin_Terminated or Miranda_IsTerminated()
+ } while (myMfAck == nullptr && counter <= MAX_ACK_WAIT_COUNTER); //TODO or Plugin_Terminated or Miranda_IsTerminated()
logger->log_p(L"SMTC: ACK found counter = [%d] myMfAck = [" SCNuPTR L"]", counter, myMfAck);
}
MirandaContact* mirandaContact = args->mirfoxDataPtr->getMirandaContactPtrByHandle((UINT_PTR)args->targetHandle);
- const wchar_t* contactNameW = NULL;
- wchar_t* tszAccountName = NULL;
+ const wchar_t* contactNameW = nullptr;
+ wchar_t* tszAccountName = nullptr;
if (mirandaContact){
contactNameW = mirandaContact->contactNameW.c_str();
MirandaAccount* mirandaAccount = mirandaContact->mirandaAccountPtr;
if (mirandaAccount)
tszAccountName = mirandaAccount->tszAccountName;
}
- if(myMfAck != NULL && myMfAck->result == ACKRESULT_SUCCESS){
+ if(myMfAck != nullptr && myMfAck->result == ACKRESULT_SUCCESS){
addMessageToDB((UINT_PTR)args->targetHandle, msgBuffer, bufSize, targetHandleSzProto);
if (mode == MFENUM_SMM_ONLY_SEND){
//show notyfication popup (only in SMM_ONLY_SEND mode)
wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)];
- if (contactNameW != NULL && tszAccountName != NULL)
+ if (contactNameW != nullptr && tszAccountName != nullptr)
if (args->mirfoxDataPtr->getAddAccountToContactNameCheckbox()){
mir_snwprintf(buffer, 1024, TranslateT("Message sent to %s"), contactNameW);
} else {
@@ -215,7 +215,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ }
else if (mode == MFENUM_SMM_SEND_AND_SHOW_MW){
//notify hook to open window
- if (args->mirfoxDataPtr != NULL && args->mirfoxDataPtr->hhook_EventOpenMW != NULL){
+ if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){
notifyHookToOpenMsgWindow(args, false);
}
else logger->log(L"SMTC: ERROR1 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL");
@@ -224,16 +224,16 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ else {
//error - show error popup
wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)];
- if (myMfAck != NULL){
+ if (myMfAck != nullptr){
logger->log_p(L"SMTC: ERROR - Cannot send message - result = [%d] ", myMfAck->result);
- if (myMfAck->errorDesc != NULL){
- if (contactNameW != NULL && tszAccountName != NULL){
+ if (myMfAck->errorDesc != nullptr){
+ if (contactNameW != nullptr && tszAccountName != nullptr){
mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s) - %S"), contactNameW, tszAccountName, myMfAck->errorDesc);
} else {
mir_snwprintf(buffer, 1024, TranslateT("Cannot send message - %S"), myMfAck->errorDesc);
}
} else {
- if (contactNameW != NULL && tszAccountName != NULL){
+ if (contactNameW != nullptr && tszAccountName != nullptr){
mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName);
} else {
mir_snwprintf(buffer, 1024, TranslateT("Cannot send message"));
@@ -241,7 +241,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ }
} else {
logger->log(L"SMTC: ERROR - Cannot send message 2");
- if (contactNameW != NULL && tszAccountName != NULL){
+ if (contactNameW != nullptr && tszAccountName != nullptr){
mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName);
} else {
mir_snwprintf(buffer, 1024, TranslateT("Cannot send message"));
@@ -256,7 +256,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ //if MFENUM_SMM_SEND_AND_SHOW_MW, even if error sending message - notify hook to open window
if (mode == MFENUM_SMM_SEND_AND_SHOW_MW){
- if (args->mirfoxDataPtr != NULL && args->mirfoxDataPtr->hhook_EventOpenMW != NULL){
+ if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){
notifyHookToOpenMsgWindow(args, true);
}
else logger->log(L"SMTC: ERROR2 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL");
@@ -265,8 +265,8 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ delete[] buffer;
}
- if (myMfAck != NULL){ //when we found ack, not when we exceed MAX_ACK_WAIT_COUNTER
- if (myMfAck->errorDesc != NULL) delete myMfAck->errorDesc;
+ if (myMfAck != nullptr){ //when we found ack, not when we exceed MAX_ACK_WAIT_COUNTER
+ if (myMfAck->errorDesc != nullptr) delete myMfAck->errorDesc;
delete myMfAck->szModule;
delete myMfAck;
}
@@ -276,7 +276,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ }
else if (mode == MFENUM_SMM_ONLY_SHOW_MW) {
//notify hook to open msg window
- if (args->mirfoxDataPtr != NULL && args->mirfoxDataPtr->hhook_EventOpenMW != NULL){
+ if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){
notifyHookToOpenMsgWindow(args, true);
}
else logger->log(L"SMTC: ERROR3 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL");
@@ -294,7 +294,7 @@ void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_ dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = targetHandleSzProto;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.cbBlob = (DWORD)bufSize;
dbei.pBlob = (PBYTE)msgBuffer;
db_event_add(hContact, &dbei);
@@ -311,7 +311,7 @@ void MirandaUtils::notifyHookToOpenMsgWindow(ActionThreadArgStruct* args, bool s msgBuffer->append(L"\r\n");
onHookOpenMv->msgBuffer = msgBuffer;
} else {
- onHookOpenMv->msgBuffer = NULL;
+ onHookOpenMv->msgBuffer = nullptr;
}
NotifyEventHooks(args->mirfoxDataPtr->hhook_EventOpenMW, (WPARAM)onHookOpenMv, 0);
@@ -321,7 +321,7 @@ void MirandaUtils::notifyHookToOpenMsgWindow(ActionThreadArgStruct* args, bool s //http://www.shloemi.com/2012/09/solved-setforegroundwindow-win32-api-not-always-works/
void MirandaUtils::ForceForegroundWindow(HWND hWnd)
{
- DWORD foreThread = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
+ DWORD foreThread = GetWindowThreadProcessId(GetForegroundWindow(), nullptr);
DWORD appThread = GetCurrentThreadId();
if (foreThread != appThread) {
@@ -339,7 +339,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) {
OnHookOpenMvStruct* param = (OnHookOpenMvStruct*)wParam;
- if (param->msgBuffer != NULL){
+ if (param->msgBuffer != nullptr){
wchar_t *msgBuffer = mir_wstrdup(param->msgBuffer->c_str());
CallServiceSync(MS_MSG_SENDMESSAGEW, (WPARAM)param->targetHandle, (LPARAM)msgBuffer);
mir_free(msgBuffer);
@@ -360,7 +360,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) if (!Srmm_GetWindowData((WPARAM)param->targetHandle, mwd) && mwd.hwndWindow){
HWND parent;
HWND hWnd = mwd.hwndWindow;
- while((parent = GetParent(hWnd)) != 0)
+ while((parent = GetParent(hWnd)) != nullptr)
hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm)
ForceForegroundWindow(hWnd);
}
@@ -381,13 +381,13 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) result = CallProtoService(args->accountSzModuleName, PS_SETAWAYMSG, status, (LPARAM)args->userActionSelection);
MirandaAccount* mirandaAccount = args->mirfoxDataPtr->getMirandaAccountPtrBySzModuleName(args->accountSzModuleName);
- wchar_t* tszAccountName = NULL;
+ wchar_t* tszAccountName = nullptr;
if (mirandaAccount)
tszAccountName = mirandaAccount->tszAccountName;
wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)];
if(result == 0){
- if (tszAccountName != NULL){
+ if (tszAccountName != nullptr){
logger->log_p(L"SSOA: Status message set on [%s]", tszAccountName);
mir_snwprintf(buffer, 1024, TranslateT("Status message set on %s"), tszAccountName);
} else {
@@ -401,7 +401,7 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) PUShowMessageT(buffer, SM_NOTIFY);
}
} else {
- if (tszAccountName != NULL){
+ if (tszAccountName != nullptr){
logger->log_p(L"SSOA: ERROR - Cannot set status message 2 on [%s] - result = [%d] ", tszAccountName, result);
mir_snwprintf(buffer, 1024, TranslateT("Cannot set status message on %s"), tszAccountName);
} else {
@@ -427,7 +427,7 @@ int MirandaUtils::onProtoAck(WPARAM, LPARAM lParam) void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack)
{
- if (ack == NULL || ack->type != ACKTYPE_MESSAGE){
+ if (ack == nullptr || ack->type != ACKTYPE_MESSAGE){
//we are waiting for ACKTYPE_MESSAGE ack's
return;
}
@@ -450,7 +450,7 @@ void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack) strcpy_s(myMfSzLparamPtr, len2, (char*)ack->lParam);
myMfAck->errorDesc = myMfSzLparamPtr;
} else {
- myMfAck->errorDesc = NULL;
+ myMfAck->errorDesc = nullptr;
}
ackMap[ack->hProcess] = myMfAck;
diff --git a/plugins/MirFox/src/MirfoxData.cpp b/plugins/MirFox/src/MirfoxData.cpp index e6bcfb7c31..5e7bd0809e 100644 --- a/plugins/MirFox/src/MirfoxData.cpp +++ b/plugins/MirFox/src/MirfoxData.cpp @@ -28,8 +28,8 @@ MirfoxData::MirfoxData(void) middleClickSendMode = MFENUM_SMM_ONLY_SEND;
processCsmId = 0;
- hhook_EventOpenMW = NULL;
- hhook_OpenMW = NULL;
+ hhook_EventOpenMW = nullptr;
+ hhook_OpenMW = nullptr;
mirfoxAccountIdPool = 1;
maxAccountIOrder = 0;
@@ -105,7 +105,7 @@ MirfoxData::getMirandaContactPtrByHandle(MCONTACT contactHandle){ if (contactHandle == NULL){
logger->log(L"getMirandaContactPtrByHandle: return NULL for HANDLE: [NULL]");
- return NULL;
+ return nullptr;
}
boost::ptr_list<MirandaContact>* mirandaContactsPtr = getMirandaContacts();
@@ -118,7 +118,7 @@ MirfoxData::getMirandaContactPtrByHandle(MCONTACT contactHandle){ }
logger->log_p(L"getMirandaContactPtrByHandle: return NULL for HANDLE: [" SCNuPTR L"]", contactHandle);
- return NULL; //mirandaContact not found
+ return nullptr; //mirandaContact not found
}
@@ -126,7 +126,7 @@ MirfoxData::getMirandaContactPtrByHandle(MCONTACT contactHandle){ void
MirfoxData::setContactDisplayName(MirandaContact* mirandaContact){
- if (mirandaContact->mirandaAccountPtr != NULL && strcmp(mirandaContact->mirandaAccountPtr->szProtoName, "Twitter") == 0){
+ if (mirandaContact->mirandaAccountPtr != nullptr && strcmp(mirandaContact->mirandaAccountPtr->szProtoName, "Twitter") == 0){
// hack for Twitter protocol
DBVARIANT dbv;
if (!db_get_s(mirandaContact->contactHandle, mirandaContact->mirandaAccountPtr->szModuleName, "Username", &dbv, DBVT_WCHAR)) {
@@ -144,7 +144,7 @@ MirfoxData::setContactDisplayName(MirandaContact* mirandaContact){ }
MFLogger::getInstance()->log_p(L"initializeMirandaContacts: got name for hContact = [" SCNuPTR L"] is: [%s]", mirandaContact->contactHandle,
- &(mirandaContact->contactNameW)==NULL ? L"<null>" : mirandaContact->contactNameW.c_str());
+ &(mirandaContact->contactNameW)==nullptr ? L"<null>" : mirandaContact->contactNameW.c_str());
}
@@ -210,7 +210,7 @@ MirfoxData::getAccountSzModuleNameById(uint64_t id) }
logger->log_p(L"getAccountSzModuleNameById: return NULL for id = [%I64u]", id);
- return NULL; //mirandaAccount not found
+ return nullptr; //mirandaAccount not found
}
@@ -221,9 +221,9 @@ MirfoxData::getMirandaAccountPtrBySzModuleName(char* szModuleName) MFLogger* logger = MFLogger::getInstance();
- if (szModuleName == NULL){
+ if (szModuleName == nullptr){
logger->log(L"getMirandaAccountPtrBySzModuleName: return NULL for szModuleName: [NULL]");
- return NULL;
+ return nullptr;
}
boost::ptr_list<MirandaAccount>* mirandaAccountsPtr = getMirandaAccounts();
@@ -236,7 +236,7 @@ MirfoxData::getMirandaAccountPtrBySzModuleName(char* szModuleName) }
logger->log_p(L"getMirandaAccountPtrBySzModuleName: return NULL for szModuleName: [%S]", szModuleName);
- return NULL; //mirandaAccount not found
+ return nullptr; //mirandaAccount not found
}
@@ -356,7 +356,7 @@ void MirfoxData::refreshContact_Add(SharedMemoryUtils& sharedMemoryUtils, MCONTA );
char *szModuleName = Proto_GetBaseAccountName(mirandaContactItemPtr->contactHandle);
- if (szModuleName != NULL)
+ if (szModuleName != nullptr)
mirandaContactItemPtr->mirandaAccountPtr = getMirandaAccountPtrBySzModuleName(szModuleName);
// Always getting '(Unknown Contact)' here if called from HookEvent ME_DB_CONTACT_ADDED, (updated to proper via ME_DB_CONTACT_SETTINGCHANGED)
@@ -492,7 +492,7 @@ MirfoxData::shouldProtoBeActiveByName(std::string protoName) int
MirfoxData::getAccountDefaultState(MirandaAccount* account)
{
- if (account == NULL){
+ if (account == nullptr){
return 2;
}
@@ -509,13 +509,13 @@ MirfoxData::getContactDefaultState(MirandaContact* contact) {
MFLogger* logger = MFLogger::getInstance();
- if (contact == NULL)
+ if (contact == nullptr)
return 2;
- if (contact->mirandaAccountPtr == NULL)
+ if (contact->mirandaAccountPtr == nullptr)
return 2;
- if (contact->mirandaAccountPtr->szProtoName == NULL)
+ if (contact->mirandaAccountPtr->szProtoName == nullptr)
return 2;
if (!shouldProtoBeActiveByName(contact->mirandaAccountPtr->szProtoName))
@@ -811,7 +811,7 @@ MirandaContact::MirandaContact(MCONTACT contactHandleL) {
contactState = MFENUM_MIRANDACONTACT_STATE_UNKNOWN;
contactHandle = contactHandleL;
- mirandaAccountPtr = NULL;
+ mirandaAccountPtr = nullptr;
}
MirandaContact::~MirandaContact(void)
diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp index 0a59139994..176929461c 100644 --- a/plugins/MirFox/src/MirfoxMiranda.cpp +++ b/plugins/MirFox/src/MirfoxMiranda.cpp @@ -64,7 +64,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) switch (wParam) {
case PRAC_ADDED:
- if (acc != NULL) {
+ if (acc != nullptr) {
//checking account
if(acc->bIsEnabled == 0 || acc->bDynDisabled != 0){
return;
@@ -75,7 +75,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) case PRAC_UPGRADED:
case PRAC_CHANGED:
- if (acc != NULL) {
+ if (acc != nullptr) {
//checking account
if(acc->bIsEnabled == 0 || acc->bDynDisabled != 0){
return;
@@ -89,7 +89,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) break;
case PRAC_CHECKED:
- if (acc != NULL) {
+ if (acc != nullptr) {
if (acc->bIsEnabled) {
//checking account
if(acc->bDynDisabled != 0){
@@ -109,7 +109,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) void CMirfoxMiranda::onContactAdded_async(void* threadArg)
{
- Thread_Push(0);
+ Thread_Push(nullptr);
OnContactAsyncThreadArgStruct* onContactAsyncThreadArgStruct = (OnContactAsyncThreadArgStruct*)threadArg;
CMirfoxMiranda* mirfoxMiranda = onContactAsyncThreadArgStruct->mirfoxMiranda;
MFLogger* logger = MFLogger::getInstance();
@@ -169,7 +169,7 @@ void CMirfoxMiranda::onContactSettingChanged(MCONTACT hContact, LPARAM lParam) void CMirfoxMiranda::onContactSettingChanged_async(void* threadArg){
- Thread_Push(0);
+ Thread_Push(nullptr);
OnContactAsyncThreadArgStruct* onContactAsyncThreadArgStruct = (OnContactAsyncThreadArgStruct*)threadArg;
CMirfoxMiranda* mirfoxMiranda = onContactAsyncThreadArgStruct->mirfoxMiranda;
MFLogger* logger = MFLogger::getInstance();
@@ -260,10 +260,10 @@ void CMirfoxMiranda::initializeSharedMemoryData(MirfoxData& mirfoxData, SharedMe if(result.errorCode != 0){
//error
if (result.errorCode == -3){ //existing csm version is too high -> i'm too old
- MessageBox(NULL, TranslateT("This MirFox (Miranda) plugin is too old. Please update it."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING );
+ MessageBox(nullptr, TranslateT("This MirFox (Miranda) plugin is too old. Please update it."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING );
}
if (result.errorCode == -4){ //existing csm version is too low -> sb is too old
- MessageBox(NULL, TranslateT("This MirFox (Miranda) plugin cannot start because some other MirFox component is too old. Please, check and update your MirFox components."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING );
+ MessageBox(nullptr, TranslateT("This MirFox (Miranda) plugin cannot start because some other MirFox component is too old. Please, check and update your MirFox components."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING );
}
mirfoxData.setPluginState(MFENUM_PLUGIN_STATE_ERROR);
return;
@@ -319,7 +319,7 @@ void CMirfoxMiranda::unloadSharedMemory() void CMirfoxMiranda::csmThread(void* threadArg)
{
- Thread_Push(0);
+ Thread_Push(nullptr);
CMirfoxMiranda* mirfoxMirandaPtr = (CMirfoxMiranda*)threadArg;
MirfoxData* mirfoxDataPtr = &(mirfoxMirandaPtr->getMirfoxData());
@@ -436,7 +436,7 @@ void CMirfoxMiranda::unloadMessageQueue(uint16_t unloadedMQProcessId) void CMirfoxMiranda::msgQueueThread(void* threadArg)
{
- Thread_Push(0);
+ Thread_Push(nullptr);
CMirfoxMiranda* mirfoxMirandaPtr = (CMirfoxMiranda*)threadArg;
MirfoxData* mirfoxDataPtr = &(mirfoxMirandaPtr->getMirfoxData());
diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp index da4f62ec50..11b7daebd7 100644 --- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp +++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp @@ -28,7 +28,7 @@ static int lua_ShellExecute(lua_State *L) ptrW args(mir_utf8decodeW(lua_tostring(L, 3)));
int flags = lua_tointeger(L, 4);
- ::ShellExecute(NULL, command, file, args, NULL, flags);
+ ::ShellExecute(nullptr, command, file, args, nullptr, flags);
return 0;
}
@@ -41,7 +41,7 @@ static int lua_FindIterator(lua_State *L) wchar_t* path = (wchar_t*)lua_touserdata(L, lua_upvalueindex(2));
WIN32_FIND_DATA ffd = { 0 };
- if (hFind == NULL)
+ if (hFind == nullptr)
{
hFind = FindFirstFile(path, &ffd);
if (hFind == INVALID_HANDLE_VALUE)
@@ -100,7 +100,7 @@ static int lua_Find(lua_State *L) {
wchar_t *path = mir_utf8decodeW(luaL_checkstring(L, 1));
- lua_pushlightuserdata(L, NULL);
+ lua_pushlightuserdata(L, nullptr);
lua_pushlightuserdata(L, path);
lua_pushcclosure(L, lua_FindIterator, 2);
@@ -168,7 +168,7 @@ static int lua_DeleteIniValue(lua_State *L) ptrW section(mir_utf8decodeW(luaL_checkstring(L, 2)));
ptrW key(mir_utf8decodeW(luaL_checkstring(L, 3)));
- bool res = ::WritePrivateProfileString(section, key, NULL, path) != 0;
+ bool res = ::WritePrivateProfileString(section, key, nullptr, path) != 0;
lua_pushboolean(L, res);
return 1;
@@ -182,7 +182,7 @@ static int lua_GetRegValue(lua_State *L) ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2)));
ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3)));
- HKEY hKey = 0;
+ HKEY hKey = nullptr;
LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_READ, &hKey);
if (res != ERROR_SUCCESS)
{
@@ -193,12 +193,12 @@ static int lua_GetRegValue(lua_State *L) DWORD type = 0;
DWORD length = 1024;
BYTE* value = (BYTE*)mir_alloc(length);
- res = ::RegQueryValueEx(hKey, valueName, NULL, &type, (LPBYTE)value, &length);
+ res = ::RegQueryValueEx(hKey, valueName, nullptr, &type, (LPBYTE)value, &length);
while (res == ERROR_MORE_DATA)
{
length += length;
value = (BYTE*)mir_realloc(value, length);
- res = ::RegQueryValueEx(hKey, valueName, NULL, &type, (LPBYTE)value, &length);
+ res = ::RegQueryValueEx(hKey, valueName, nullptr, &type, (LPBYTE)value, &length);
}
if (res == ERROR_SUCCESS)
@@ -243,7 +243,7 @@ static int lua_SetRegValue(lua_State *L) ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2)));
ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3)));
- HKEY hKey = 0;
+ HKEY hKey = nullptr;
LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey);
if (res != ERROR_SUCCESS)
{
@@ -253,7 +253,7 @@ static int lua_SetRegValue(lua_State *L) DWORD type = 0;
DWORD length = 0;
- BYTE* value = NULL;
+ BYTE* value = nullptr;
switch (lua_type(L, 4))
{
case LUA_TNUMBER:
@@ -299,7 +299,7 @@ static int lua_DeleteRegValue(lua_State *L) ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2)));
ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3)));
- HKEY hKey = 0;
+ HKEY hKey = nullptr;
LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey);
if (res != ERROR_SUCCESS)
{
@@ -321,7 +321,7 @@ static int global_FindWindow(lua_State *L) {
const char *cname = luaL_checkstring(L, 1);
const char *wname = luaL_checkstring(L, 2);
- lua_pushnumber(L, (intptr_t)FindWindowA(cname[0] ? cname : NULL, wname[0] ? wname : NULL));
+ lua_pushnumber(L, (intptr_t)FindWindowA(cname[0] ? cname : nullptr, wname[0] ? wname : nullptr));
return(1);
}
@@ -333,8 +333,8 @@ static int global_FindWindowEx(lua_State *L) const char *wname = luaL_checkstring(L, 4);
long lrc = (long)FindWindowExA(parent, childaft,
- cname[0] ? cname : NULL,
- wname[0] ? wname : NULL);
+ cname[0] ? cname : nullptr,
+ wname[0] ? wname : nullptr);
lua_pushnumber(L, lrc);
@@ -575,7 +575,7 @@ static int global_CreateEvent(lua_State *L) const char *name;
sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = NULL;
+ sa.lpSecurityDescriptor = nullptr;
sa.bInheritHandle = FALSE;
if (lua_istable(L, 1)) {
@@ -635,7 +635,7 @@ static int global_CreateMutex(lua_State *L) const char *name;
sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = NULL;
+ sa.lpSecurityDescriptor = nullptr;
sa.bInheritHandle = FALSE;
if (lua_istable(L, 1)) {
@@ -676,7 +676,7 @@ static int global_CreateSemaphore(lua_State *L) const char *name;
sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = NULL;
+ sa.lpSecurityDescriptor = nullptr;
sa.bInheritHandle = FALSE;
if (lua_istable(L, 1)) {
@@ -732,7 +732,7 @@ static int global_CreateProcess(lua_State *L) const char *cd = lua_tostring(L, 8);
psa.nLength = sizeof(psa);
- psa.lpSecurityDescriptor = NULL;
+ psa.lpSecurityDescriptor = nullptr;
psa.bInheritHandle = FALSE;
if (lua_istable(L, 3)) {
lua_pushstring(L, "bInheritHandle");
@@ -743,7 +743,7 @@ static int global_CreateProcess(lua_State *L) }
tsa.nLength = sizeof(tsa);
- tsa.lpSecurityDescriptor = NULL;
+ tsa.lpSecurityDescriptor = nullptr;
tsa.bInheritHandle = FALSE;
if (lua_istable(L, 4)) {
lua_pushstring(L, "bInheritHandle");
@@ -753,7 +753,7 @@ static int global_CreateProcess(lua_State *L) lua_pop(L, 4);
}
- env = NULL;
+ env = nullptr;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
@@ -813,9 +813,9 @@ static int global_CreateProcess(lua_State *L) brc = CreateProcessA(an, (char *)cl, &psa, &tsa, ih, cf, env, cd, &si, &pi);
- if (si.lpDesktop != NULL)
+ if (si.lpDesktop != nullptr)
mir_free(si.lpDesktop);
- if (si.lpTitle != NULL)
+ if (si.lpTitle != nullptr)
mir_free(si.lpTitle);
lua_pushnumber(L, brc);
@@ -900,7 +900,7 @@ static int global_CreateNamedPipe(lua_State *L) DWORD nOutBufferSize = luaL_checknumber(L, 5);
DWORD nInBufferSize = luaL_checknumber(L, 6);
DWORD nDefaultTimeOut = luaL_checknumber(L, 7);
- SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, false };
+ SECURITY_ATTRIBUTES sa = { sizeof(sa), nullptr, false };
HANDLE hPipe = CreateNamedPipeA(lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, &sa);
lua_pushnumber(L, (intptr_t)hPipe);
@@ -941,7 +941,7 @@ static int global_CreateFile(lua_State *L) intptr_t th = 0;
sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = NULL;
+ sa.lpSecurityDescriptor = nullptr;
sa.bInheritHandle = FALSE;
if (lua_istable(L, 4)) {
lua_pushstring(L, "bInheritHandle");
@@ -983,9 +983,9 @@ static int global_ReadFile(lua_State *L) { DWORD btoread = (DWORD)luaL_checknumber(L, 2);
buf = (char*)mir_alloc(btoread);
- if (buf != NULL)
+ if (buf != nullptr)
{
- brc = ReadFile(h, buf, btoread, &bread, NULL);
+ brc = ReadFile(h, buf, btoread, &bread, nullptr);
lua_pushboolean(L, TRUE);
lua_pushlstring(L, buf, bread);
mir_free(buf);
@@ -1022,7 +1022,7 @@ static int global_WriteFile(lua_State *L) { HANDLE h = (HANDLE)(intptr_t)luaL_checknumber(L, 1);
const char *buf = luaL_checklstring(L, 2, (size_t*)&btowrite);
- brc = WriteFile(h, buf, btowrite, &bwrite, NULL);
+ brc = WriteFile(h, buf, btowrite, &bwrite, nullptr);
lua_pushboolean(L, brc);
luaM_PushNumberIf(L, bwrite, brc);
return(2);
@@ -1128,7 +1128,7 @@ static int global_RegQueryValueEx(lua_State *L) rv = RegOpenKeyExA(hkey, subkey, 0, KEY_QUERY_VALUE, &hsk);
if (rv == ERROR_SUCCESS) {
len = sizeof(dwdata);
- rv = RegQueryValueExA(hsk, valuename, NULL, &type, (LPBYTE)&dwdata, &len);
+ rv = RegQueryValueExA(hsk, valuename, nullptr, &type, (LPBYTE)&dwdata, &len);
if ((rv == ERROR_SUCCESS) || (rv == ERROR_MORE_DATA)) {
switch (type) {
case REG_DWORD_BIG_ENDIAN:
@@ -1141,11 +1141,11 @@ static int global_RegQueryValueEx(lua_State *L) case REG_SZ:
if (rv == ERROR_MORE_DATA) {
szdata = (char*)mir_alloc(len);
- if (szdata == NULL) {
+ if (szdata == nullptr) {
lua_pushnil(L);
}
else {
- rv = RegQueryValueExA(hsk, valuename, NULL, &type, (LPBYTE)szdata, &len);
+ rv = RegQueryValueExA(hsk, valuename, nullptr, &type, (LPBYTE)szdata, &len);
if (rv == ERROR_SUCCESS)
lua_pushlstring(L, szdata, mir_strlen(szdata));
else
@@ -1176,7 +1176,7 @@ static int global_RegSetValueEx(lua_State *L) { DWORD type;
DWORD dwdata;
DWORD len = 0;
- char *szdata = NULL;
+ char *szdata = nullptr;
HKEY hkey = (HKEY)(intptr_t)luaL_checknumber(L, 1);
const char *subkey = luaL_checkstring(L, 2);
const char *valuename = luaL_checkstring(L, 3);
@@ -1190,9 +1190,9 @@ static int global_RegSetValueEx(lua_State *L) { type = (DWORD)luaL_optnumber(L, 5, REG_SZ);
}
- rv = RegCreateKeyExA(hkey, subkey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hsk, NULL);
+ rv = RegCreateKeyExA(hkey, subkey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hsk, nullptr);
if (rv == ERROR_SUCCESS) {
- if (szdata == NULL)
+ if (szdata == nullptr)
rv = RegSetValueExA(hsk, valuename, 0, type, (CONST BYTE *) &dwdata, sizeof(dwdata));
else
rv = RegSetValueExA(hsk, valuename, 0, type, (CONST BYTE *) szdata, len + 1);
@@ -1251,7 +1251,7 @@ static int global_RegEnumKeyEx(lua_State *L) {
len = sizeof(name);
if (RegEnumKeyExA(hsk, index, name, &len,
- NULL, NULL, NULL, &ft) != ERROR_SUCCESS)
+ nullptr, nullptr, nullptr, &ft) != ERROR_SUCCESS)
break;
lua_pushnumber(L, index + 1);
lua_pushstring(L, name);
@@ -1282,7 +1282,7 @@ static int global_RegEnumValue(lua_State *L) { {
len = sizeof(name);
if (RegEnumValueA(hsk, index, name, &len,
- NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
+ nullptr, nullptr, nullptr, nullptr) != ERROR_SUCCESS)
break;
lua_pushnumber(L, index + 1);
lua_pushstring(L, name);
@@ -1402,7 +1402,7 @@ static int global_FindFirstFile(lua_State *L) const char *fname = luaL_checkstring(L, 1);
hfd = FindFirstFileA(fname, &wfd);
- if (hfd == NULL) {
+ if (hfd == nullptr) {
lua_pushnumber(L, 0);
lua_pushnil(L);
}
@@ -1509,7 +1509,7 @@ static int global_IsUserAdmin(lua_State *L) &AdministratorsGroup);
if (b)
{
- if (!CheckTokenMembership(NULL, AdministratorsGroup, &b))
+ if (!CheckTokenMembership(nullptr, AdministratorsGroup, &b))
b = FALSE;
FreeSid(AdministratorsGroup);
}
@@ -1525,7 +1525,7 @@ static int global_OpenProcess(lua_State *L) { DWORD pid = (DWORD)luaL_checknumber(L, 3);
h = OpenProcess(da, ih, pid);
- if (h != NULL)
+ if (h != nullptr)
lua_pushnumber(L, (long)h);
else
lua_pushnil(L);
@@ -1539,7 +1539,7 @@ static int global_IsRunning(lua_State *L) { DWORD pid = (DWORD)luaL_checknumber(L, 1);
h = OpenProcess(SYNCHRONIZE, FALSE, pid);
- if (h != NULL) {
+ if (h != nullptr) {
b = TRUE;
CloseHandle(h);
}
@@ -1562,7 +1562,7 @@ static int global_GetWindowThreadProcessId(lua_State *L) static int global_OpenSCManager(lua_State *L)
{
- lua_pushnumber(L, (intptr_t)OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
+ lua_pushnumber(L, (intptr_t)OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS));
return 1;
}
@@ -1657,7 +1657,7 @@ static int global_DeleteService(lua_State *L) static int global_StartService(lua_State *L)
{
SC_HANDLE h = (SC_HANDLE)(intptr_t)luaL_checknumber(L, 1);
- lua_pushboolean(L, StartService(h, 0, NULL));
+ lua_pushboolean(L, StartService(h, 0, nullptr));
return 1;
}
@@ -1665,7 +1665,7 @@ static int global_StartService(lua_State *L) static int global_mciSendString(lua_State *L)
{
const char *cmd = luaL_checkstring(L, 1); // only one string parameter is used
- DWORD lrc = mciSendStringA(cmd, NULL, 0, NULL);
+ DWORD lrc = mciSendStringA(cmd, nullptr, 0, nullptr);
lua_pushnumber(L, lrc);
return(1);
}
@@ -1686,7 +1686,7 @@ static int global_Beep(lua_State *L) static int global_CoInitialize(lua_State *L)
{
- HRESULT lrc = CoInitialize(NULL);
+ HRESULT lrc = CoInitialize(nullptr);
lua_pushinteger(L, lrc);
return(1);
}
@@ -1884,7 +1884,7 @@ static luaM_consts consts[] = { "MB_OK", MB_OK },
{ "BM_CLICK", BM_CLICK },
- { NULL, 0 }
+ { nullptr, 0 }
};
/***********************************************/
@@ -1984,14 +1984,14 @@ static luaL_Reg winApi[] = { "GetCurrentProcessId", global_GetCurrentProcessId },
{ "GetOpenFileName", global_GetOpenFileName },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUA_WINAPI_LIB luaopen_winapi(lua_State *L)
{
luaL_newlib(L, winApi);
- for (size_t i = 0; consts[i].name != NULL; i++)
+ for (size_t i = 0; consts[i].name != nullptr; i++)
{
lua_pushstring(L, consts[i].name);
lua_pushnumber(L, consts[i].value);
diff --git a/plugins/MirLua/Modules/m_popup/src/main.cpp b/plugins/MirLua/Modules/m_popup/src/main.cpp index 62d6bfb43b..35f2b9bb28 100644 --- a/plugins/MirLua/Modules/m_popup/src/main.cpp +++ b/plugins/MirLua/Modules/m_popup/src/main.cpp @@ -35,7 +35,7 @@ static int lua_AddPopup(lua_State *L) {
if (lua_type(L, 1) != LUA_TTABLE)
{
- lua_pushlightuserdata(L, 0);
+ lua_pushlightuserdata(L, nullptr);
return 1;
}
@@ -98,7 +98,7 @@ static int lua_AddPopup2(lua_State *L) {
if (lua_type(L, 1) != LUA_TTABLE)
{
- lua_pushlightuserdata(L, 0);
+ lua_pushlightuserdata(L, nullptr);
return 1;
}
@@ -118,7 +118,7 @@ static luaL_Reg popupApi[] = { "AddPopup", lua_AddPopup },
{ "AddPopup2", lua_AddPopup2 },
- { NULL, NULL }
+ { nullptr, nullptr }
};
extern "C" LUAMOD_API int luaopen_m_popup(lua_State *L)
diff --git a/plugins/MirLua/Modules/m_schedule/src/main.cpp b/plugins/MirLua/Modules/m_schedule/src/main.cpp index 093a95ca94..fd6820ea9f 100644 --- a/plugins/MirLua/Modules/m_schedule/src/main.cpp +++ b/plugins/MirLua/Modules/m_schedule/src/main.cpp @@ -1,8 +1,8 @@ #include "stdafx.h"
static mir_cs threadLock;
-static HANDLE hScheduleEvent = NULL;
-static HANDLE hScheduleThread = NULL;
+static HANDLE hScheduleEvent = nullptr;
+static HANDLE hScheduleThread = nullptr;
#define STOP ((void *) -1)
@@ -24,7 +24,7 @@ struct ScheduleTask ScheduleTask()
{
- timestamp = time(NULL);
+ timestamp = time(nullptr);
interval = 0;
repeat = false;
}
@@ -63,7 +63,7 @@ void ExecuteTaskThread(void *arg) {
mir_cslock lock(threadLock);
- time_t now = time(NULL);
+ time_t now = time(nullptr);
if (task->timestamp + task->interval >= now)
task->timestamp += task->interval;
else
@@ -87,7 +87,7 @@ wait: WaitForSingleObject(hScheduleEvent, waitTime); if (Miranda_IsTerminated())
return;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
if (task->timestamp > now)
{
waitTime = (task->timestamp - now) * 1000;
@@ -165,7 +165,7 @@ static int fluent_Do(lua_State *L) ScheduleTask *task = *(ScheduleTask**)lua_touserdata(L, lua_upvalueindex(1));
- time_t now = time(NULL);
+ time_t now = time(nullptr);
if (task->timestamp < now)
{
if (task->interval == 0)
@@ -200,7 +200,7 @@ static int fluent_From(lua_State *L) const luaL_Reg funcs[] =
{
{ "Do", fluent_Do },
- { NULL, NULL }
+ { nullptr, nullptr }
};
lua_pushvalue(L, lua_upvalueindex(1));
@@ -214,7 +214,7 @@ static const luaL_Reg fluentApi[] = { "From", fluent_From },
{ "Do", fluent_Do },
- { NULL, NULL }
+ { nullptr, nullptr }
};
static int fluent_Second(lua_State *L)
@@ -323,7 +323,7 @@ static int fluent_Week(lua_State *L) static int fluent_Monday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(1 - ti->tm_wday);
@@ -339,7 +339,7 @@ static int fluent_Monday(lua_State *L) static int fluent_Tuesday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(2 - ti->tm_wday);
@@ -355,7 +355,7 @@ static int fluent_Tuesday(lua_State *L) static int fluent_Wednesday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(3 - ti->tm_wday);
@@ -371,7 +371,7 @@ static int fluent_Wednesday(lua_State *L) static int fluent_Thursday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(4 - ti->tm_wday);
@@ -387,7 +387,7 @@ static int fluent_Thursday(lua_State *L) static int fluent_Friday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(5 - ti->tm_wday);
@@ -403,7 +403,7 @@ static int fluent_Friday(lua_State *L) static int fluent_Saturday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(6 - ti->tm_wday);
@@ -419,7 +419,7 @@ static int fluent_Saturday(lua_State *L) static int fluent_Sunday(lua_State *L)
{
- time_t timestamp = time(NULL);
+ time_t timestamp = time(nullptr);
struct tm *ti = localtime(×tamp);
ti->tm_mday += abs(-ti->tm_wday);
@@ -439,14 +439,14 @@ static const luaL_Reg scheduleAtApi[] = {
{ "Do", fluent_Do },
- { NULL, NULL }
+ { nullptr, nullptr }
};
static int schedule_At(lua_State *L)
{
ScheduleTask **task = (ScheduleTask**)lua_newuserdata(L, sizeof(ScheduleTask));
*task = new ScheduleTask();
- (*task)->timestamp = luaM_opttimestamp(L, 1, time(NULL));
+ (*task)->timestamp = luaM_opttimestamp(L, 1, time(nullptr));
lua_newtable(L);
lua_newtable(L);
@@ -475,7 +475,7 @@ static const luaL_Reg scheduleEvery1Api[] = { "Saturday", fluent_Saturday },
{ "Sunday", fluent_Sunday },
- { NULL, NULL }
+ { nullptr, nullptr }
};
static const luaL_Reg scheduleEvery2Api[] =
@@ -485,7 +485,7 @@ static const luaL_Reg scheduleEvery2Api[] = { "Hours", fluent_Hours },
{ "Days", fluent_Days },
- { NULL, NULL }
+ { nullptr, nullptr }
};
static int schedule_Every(lua_State *L)
@@ -522,7 +522,7 @@ static const luaL_Reg scheduleWait1Api[] = { "Day", fluent_Day },
{ "Week", fluent_Week },
- { NULL, NULL }
+ { nullptr, nullptr }
};
static const luaL_Reg scheduleWait2Api[] =
@@ -532,7 +532,7 @@ static const luaL_Reg scheduleWait2Api[] = { "Hours", fluent_Hours },
{ "Days", fluent_Days },
- { NULL, NULL }
+ { nullptr, nullptr }
};
static int schedule_Wait(lua_State *L)
@@ -564,9 +564,9 @@ static const luaL_Reg scheduleApi[] = { "Every", schedule_Every },
{ "Wait", schedule_Wait },
- { "STOP", NULL },
+ { "STOP", nullptr },
- { NULL, NULL }
+ { nullptr, nullptr }
};
/***********************************************/
@@ -577,10 +577,10 @@ extern "C" LUAMOD_API int luaopen_m_schedule(lua_State *L) lua_pushlightuserdata(L, STOP);
lua_setfield(L, -2, "STOP");
- if (hScheduleEvent == NULL)
- hScheduleEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (hScheduleEvent == nullptr)
+ hScheduleEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
- if (hScheduleThread == NULL)
+ if (hScheduleThread == nullptr)
hScheduleThread = mir_forkthread(ScheduleThread);
return 1;
diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp index 17a8d95b00..55c4cf04d8 100644 --- a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp +++ b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp @@ -60,7 +60,7 @@ static int lua_AddButton(lua_State *L) {
if (lua_type(L, 1) != LUA_TTABLE)
{
- lua_pushlightuserdata(L, 0);
+ lua_pushlightuserdata(L, nullptr);
return 1;
}
@@ -98,7 +98,7 @@ static luaL_Reg toptoolbarApi[] = { "AddButton", lua_AddButton },
{ "RemoveButton", lua_RemoveButton },
- { NULL, NULL }
+ { nullptr, nullptr }
};
extern "C" LUAMOD_API int luaopen_m_toptoolbar(lua_State *L)
diff --git a/plugins/MirLua/Modules/m_variables/src/main.cpp b/plugins/MirLua/Modules/m_variables/src/main.cpp index a9c5204f96..dcd2a7e773 100644 --- a/plugins/MirLua/Modules/m_variables/src/main.cpp +++ b/plugins/MirLua/Modules/m_variables/src/main.cpp @@ -11,7 +11,7 @@ static int lua_Parse(lua_State *L) ptrW format(mir_utf8decodeW(luaL_checkstring(L, 1)));
MCONTACT hContact = lua_tointeger(L, 2);
- wchar_t *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
+ wchar_t *res = variables_parse_ex(format, nullptr, hContact, nullptr, 0);
lua_pushstring(L, T2Utf(res));
return 1;
@@ -21,7 +21,7 @@ static luaL_Reg variablesApi[] = {
{ "Parse", lua_Parse },
- { NULL, NULL }
+ { nullptr, nullptr }
};
extern "C" LUAMOD_API int luaopen_m_variables(lua_State *L)
diff --git a/plugins/MirLua/src/m_chat.cpp b/plugins/MirLua/src/m_chat.cpp index f84caa4591..ed57b7b9de 100644 --- a/plugins/MirLua/src/m_chat.cpp +++ b/plugins/MirLua/src/m_chat.cpp @@ -2,7 +2,7 @@ static luaL_Reg chatApi[] =
{
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_chat(lua_State *L)
diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp index d5d8d76a10..cc32c188db 100644 --- a/plugins/MirLua/src/m_clist.cpp +++ b/plugins/MirLua/src/m_clist.cpp @@ -89,7 +89,7 @@ static luaL_Reg clistApi[] = { "AddTrayMenuItem", clist_AddTrayMenuItem },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_clist(lua_State *L)
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index bf3b5233cf..33214d061a 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -65,13 +65,13 @@ static int core_HookEvent(lua_State *L) lua_pushvalue(L, 2);
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
- HANDLE res = NULL;
+ HANDLE res = nullptr;
CMLuaEnviroment *env = CMLuaEnviroment::GetEnviroment(L);
if (env)
res = HookEventObjParam(name, HookEventEnvParam, env, ref);
else
res = HookEventObjParam(name, HookEventLuaStateParam, L, ref);
- if (res == NULL)
+ if (res == nullptr)
{
luaL_unref(L, LUA_REGISTRYINDEX, ref);
lua_pushnil(L);
@@ -94,14 +94,14 @@ static int core_HookTemporaryEvent(lua_State *L) lua_pushvalue(L, 2);
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
- HANDLE res = NULL;
+ HANDLE res = nullptr;
CMLuaEnviroment *env = CMLuaEnviroment::GetEnviroment(L);
if (env)
res = HookEventObjParam(name, HookEventEnvParam, env, ref);
else
res = HookEventObjParam(name, HookEventLuaStateParam, L, ref);
// event does not exists, call hook immideatelly
- if (res == NULL)
+ if (res == nullptr)
{
lua_pushnil(L);
lua_pushnil(L);
@@ -125,7 +125,7 @@ static int core_UnhookEvent(lua_State *L) if (!res)
{
HandleRefParam *param = (HandleRefParam*)CMLua::HookRefs.find(&hEvent);
- if (param != NULL)
+ if (param != nullptr)
{
luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref);
CMLua::HookRefs.remove(param);
@@ -194,7 +194,7 @@ static int core_CreateServiceFunction(lua_State *L) lua_pushvalue(L, 2);
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
- HANDLE res = NULL;
+ HANDLE res = nullptr;
CMLuaEnviroment *env = CMLuaEnviroment::GetEnviroment(L);
if (env)
res = CreateServiceFunctionObjParam(name, CreateServiceFunctionEnvParam, env, ref);
@@ -242,7 +242,7 @@ static int core_DestroyServiceFunction(lua_State *L) HANDLE hService = lua_touserdata(L, 1);
HandleRefParam *param = (HandleRefParam*)CMLua::ServiceRefs.find(&hService);
- if (param != NULL)
+ if (param != nullptr)
{
luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref);
CMLua::ServiceRefs.remove(param);
@@ -303,7 +303,7 @@ static int core_Parse(lua_State *L) static int core_GetFullPath(lua_State *L)
{
wchar_t path[MAX_PATH];
- GetModuleFileName(NULL, path, MAX_PATH);
+ GetModuleFileName(nullptr, path, MAX_PATH);
lua_pushstring(L, ptrA(mir_utf8encodeW(path)));
@@ -405,13 +405,13 @@ luaL_Reg coreApi[] = { "ForkThread", core_ForkThread },
{ "TerminateThread", core_TerminateThread },
- { "Version", NULL },
+ { "Version", nullptr },
- { "NULL", NULL },
- { "INVALID_HANDLE_VALUE", NULL },
- { "CALLSERVICE_NOTFOUND", NULL },
+ { "NULL", nullptr },
+ { "INVALID_HANDLE_VALUE", nullptr },
+ { "CALLSERVICE_NOTFOUND", nullptr },
- { NULL, NULL }
+ { nullptr, nullptr }
};
/***********************************************/
@@ -419,7 +419,7 @@ luaL_Reg coreApi[] = LUAMOD_API int luaopen_m_core(lua_State *L)
{
luaL_newlib(L, coreApi);
- lua_pushlightuserdata(L, NULL);
+ lua_pushlightuserdata(L, nullptr);
lua_setfield(L, -2, "NULL");
lua_pushlightuserdata(L, INVALID_HANDLE_VALUE);
lua_setfield(L, -2, "INVALID_HANDLE_VALUE");
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 7519caa8c8..5556c77e5c 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -87,7 +87,7 @@ static int db_ContactIterator(lua_State *L) static int db_Contacts(lua_State *L)
{
- const char *szModule = NULL;
+ const char *szModule = nullptr;
switch (lua_type(L, 1))
{
@@ -131,7 +131,7 @@ static const char *mods[] = "FullName",
"Uid",
"DisplayName",
- NULL
+ nullptr
};
static int db_GetContactInfo(lua_State *L)
@@ -145,7 +145,7 @@ static int db_GetContactInfo(lua_State *L) type = luaL_checkinteger(L, 2);
break;
case LUA_TSTRING:
- type = luaL_checkoption(L, 2, NULL, mods) + 1;
+ type = luaL_checkoption(L, 2, nullptr, mods) + 1;
break;
default:
luaL_argerror(L, 2, luaL_typename(L, 2));
@@ -641,14 +641,14 @@ static luaL_Reg databaseApi[] = { "SetSetting", db_WriteSetting },
{ "DeleteSetting", db_DeleteSetting },
- { "DBVT_BYTE", NULL },
- { "DBVT_WORD", NULL },
- { "DBVT_DWORD", NULL },
- { "DBVT_ASCIIZ", NULL },
- { "DBVT_UTF8", NULL },
- { "DBVT_WCHAR", NULL },
+ { "DBVT_BYTE", nullptr },
+ { "DBVT_WORD", nullptr },
+ { "DBVT_DWORD", nullptr },
+ { "DBVT_ASCIIZ", nullptr },
+ { "DBVT_UTF8", nullptr },
+ { "DBVT_WCHAR", nullptr },
- { NULL, NULL }
+ { nullptr, nullptr }
};
/***********************************************/
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 4814a7410e..56ab193d52 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -122,7 +122,7 @@ static luaL_Reg genmenuApi[] = { "CheckMenuItem", genmenu_CheckMenuItem },
{ "RemoveMenuItem", genmenu_RemoveMenuItem },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_genmenu(lua_State *L)
diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index 2661197d2a..4988c80332 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -58,7 +58,7 @@ static int hotkeys_Unregister(lua_State *L) return 0;
}
-static const char *mods[] = { "shift", "ctrl", "alt", "ext", NULL };
+static const char *mods[] = { "shift", "ctrl", "alt", "ext", nullptr };
static int hotkeys_MakeHotkey(lua_State *L)
{
@@ -69,11 +69,11 @@ static int hotkeys_MakeHotkey(lua_State *L) mod = luaL_checkinteger(L, 1);
break;
case LUA_TSTRING:
- mod = (1 << (luaL_checkoption(L, 1, NULL, mods) - 1));
+ mod = (1 << (luaL_checkoption(L, 1, nullptr, mods) - 1));
break;
case LUA_TTABLE:
for (lua_pushnil(L); lua_next(L, 1); lua_pop(L, 1))
- mod |= (1 << (luaL_checkoption(L, -1, NULL, mods) - 1));
+ mod |= (1 << (luaL_checkoption(L, -1, nullptr, mods) - 1));
break;
default:
luaL_argerror(L, 1, luaL_typename(L, 1));
@@ -92,7 +92,7 @@ static luaL_Reg hotkeysApi[] = { "Register", hotkeys_Register },
{ "Unregister", hotkeys_Unregister },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_hotkeys(lua_State *L)
diff --git a/plugins/MirLua/src/m_http.cpp b/plugins/MirLua/src/m_http.cpp index ce09fdb392..e1aece0e12 100644 --- a/plugins/MirLua/src/m_http.cpp +++ b/plugins/MirLua/src/m_http.cpp @@ -103,7 +103,7 @@ static const luaL_Reg headersApi[] = { "__index", headers__index }, { "__len", headers__len }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -155,7 +155,7 @@ static const luaL_Reg contentApi[] = { "__len", content__len }, { "__tostring", content__tostring }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -213,7 +213,7 @@ static const luaL_Reg responseApi[] = { "__index", response__index }, { "__gc", response__gc }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -301,7 +301,7 @@ static void request_SetContentType(lua_State *L, int idx, NETLIBHTTPREQUEST *req SetHeader(request, "Content-Type", type); } -static const char *httpMethods[] = { "GET", "POST", "PUT", "DELETE", NULL }; +static const char *httpMethods[] = { "GET", "POST", "PUT", "DELETE", nullptr }; static int request_Send(lua_State *L) { @@ -310,7 +310,7 @@ static int request_Send(lua_State *L) NETLIBHTTPREQUEST *request = CreateRequest(L); lua_getfield(L, 1, "Method"); - request->requestType = (1 << (luaL_checkoption(L, -1, NULL, httpMethods))); + request->requestType = (1 << (luaL_checkoption(L, -1, nullptr, httpMethods))); lua_pop(L, 1); lua_getfield(L, 1, "Url"); @@ -403,7 +403,7 @@ static const luaL_Reg requestApi[] = { { "__gc", request__gc }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -416,7 +416,7 @@ static const luaL_Reg httpApi[] = { "Put", request_Put }, { "Delete", request_Delete }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_http(lua_State *L) diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index d2904be320..d329d07ae4 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -25,7 +25,7 @@ static void MakeSKINICONDESC(lua_State *L, SKINICONDESC &sid) sid.defaultFile.w = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
- if (sid.defaultFile.w == NULL)
+ if (sid.defaultFile.w == nullptr)
{
sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1);
GetModuleFileName(g_hInstance, sid.defaultFile.w, MAX_PATH);
@@ -61,7 +61,7 @@ static int lua_AddIcon(lua_State *L) sid.defaultFile.w = mir_utf8decodeW(lua_tostring(L, 4));
sid.hDefaultIcon = GetIcon(IDI_SCRIPT);
- if (sid.defaultFile.w == NULL)
+ if (sid.defaultFile.w == nullptr)
{
sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1);
GetModuleFileName(g_hInstance, sid.defaultFile.w, MAX_PATH);
@@ -88,7 +88,7 @@ static int lua_GetIcon(lua_State *L) {
bool big = luaM_toboolean(L, 2);
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
switch (lua_type(L, 1))
{
case LUA_TLIGHTUSERDATA:
@@ -144,7 +144,7 @@ static luaL_Reg icolibApi[] = { "GetIconHandle", lua_GetIconHandle },
{ "RemoveIcon", lua_RemoveIcon },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_icolib(lua_State *L)
diff --git a/plugins/MirLua/src/m_json.cpp b/plugins/MirLua/src/m_json.cpp index e4bbf233ef..60f75411e9 100644 --- a/plugins/MirLua/src/m_json.cpp +++ b/plugins/MirLua/src/m_json.cpp @@ -133,7 +133,7 @@ const struct luaL_Reg jsonApi[] = { "__tostring", json__tostring }, { "__gc", json__gc }, - { NULL, NULL } + { nullptr, nullptr } }; @@ -195,7 +195,7 @@ static int lua_Encode(lua_State *L) break; } case LUA_TLIGHTUSERDATA: - if (lua_touserdata(L, 1) == NULL) + if (lua_touserdata(L, 1) == nullptr) { lua_pushliteral(L, "null"); break; @@ -212,7 +212,7 @@ static const luaL_Reg methods[] = { "Decode", lua_Decode }, { "Encode", lua_Encode }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_json(lua_State *L) diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp index 13cbba952d..c02adb0478 100644 --- a/plugins/MirLua/src/m_message.cpp +++ b/plugins/MirLua/src/m_message.cpp @@ -38,7 +38,7 @@ static int message_Send(lua_State *L) {
DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)mir_strlen(message);
dbei.pBlob = (PBYTE)mir_strdup(message);
@@ -59,7 +59,7 @@ static luaL_Reg messageApi[] = { "Paste", message_Paste },
{ "Send", message_Send },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_message(lua_State *L)
diff --git a/plugins/MirLua/src/m_options.cpp b/plugins/MirLua/src/m_options.cpp index ee968a6982..9c549e96a2 100644 --- a/plugins/MirLua/src/m_options.cpp +++ b/plugins/MirLua/src/m_options.cpp @@ -106,7 +106,7 @@ static luaL_Reg optionsApi[] = {
{ "AddPage", opt_AddPage },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_options(lua_State *L)
diff --git a/plugins/MirLua/src/m_protocols.cpp b/plugins/MirLua/src/m_protocols.cpp index ab206489f2..f4ea022175 100644 --- a/plugins/MirLua/src/m_protocols.cpp +++ b/plugins/MirLua/src/m_protocols.cpp @@ -1,10 +1,10 @@ #include "stdafx.h"
-HANDLE hRecvMessage = NULL;
+HANDLE hRecvMessage = nullptr;
static int lua_GetProtocol(lua_State *L)
{
- const char *szProto = NULL;
+ const char *szProto = nullptr;
switch (lua_type(L, 1))
{
@@ -109,7 +109,7 @@ static int lua_ChainRecv(lua_State *L) static int lua_GetAccount(lua_State *L)
{
- const char *name = NULL;
+ const char *name = nullptr;
switch (lua_type(L, 1))
{
@@ -157,7 +157,7 @@ static int lua_AccountIterator(lua_State *L) static int lua_Accounts(lua_State *L)
{
- const char *szProto = NULL;
+ const char *szProto = nullptr;
switch (lua_type(L, 1))
{
@@ -191,7 +191,7 @@ static int lua_Accounts(lua_State *L) static int lua_CallService(lua_State *L)
{
- const char *szModule = NULL;
+ const char *szModule = nullptr;
switch (lua_type(L, 1))
{
@@ -247,7 +247,7 @@ static luaL_Reg protocolsApi[] = { "CallService", lua_CallService },
- { NULL, NULL }
+ { nullptr, nullptr }
};
/***********************************************/
diff --git a/plugins/MirLua/src/m_sounds.cpp b/plugins/MirLua/src/m_sounds.cpp index 2acd36f203..f362e6b264 100644 --- a/plugins/MirLua/src/m_sounds.cpp +++ b/plugins/MirLua/src/m_sounds.cpp @@ -40,7 +40,7 @@ static luaL_Reg soundApi[] = { "PlaySound", lua_PlaySound },
{ "PlayFile", lua_PlayFile },
- { NULL, NULL }
+ { nullptr, nullptr }
};
LUAMOD_API int luaopen_m_sounds(lua_State *L)
diff --git a/plugins/MirLua/src/m_srmm.cpp b/plugins/MirLua/src/m_srmm.cpp index d29ca0d901..232fd0f7c8 100644 --- a/plugins/MirLua/src/m_srmm.cpp +++ b/plugins/MirLua/src/m_srmm.cpp @@ -108,7 +108,7 @@ static luaL_Reg srmmApi[] = { "ModifyButton", lua_ModifyButton }, { "RemoveButton", lua_RemoveButton }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp index 7cb6ce4981..1795c56878 100644 --- a/plugins/MirLua/src/main.cpp +++ b/plugins/MirLua/src/main.cpp @@ -9,7 +9,7 @@ CMLua *g_mLua; HANDLE g_hCLibsFolder;
HANDLE g_hScriptsFolder;
-HNETLIBUSER hNetlib = NULL;
+HNETLIBUSER hNetlib = nullptr;
PLUGININFOEX pluginInfo =
{
@@ -104,7 +104,7 @@ extern "C" int __declspec(dllexport) Unload(void) if (hNetlib)
{
Netlib_CloseHandle(hNetlib);
- hNetlib = NULL;
+ hNetlib = nullptr;
}
return 0;
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 952e528e44..150f5639ab 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -10,7 +10,7 @@ static int CompareScripts(const CMLuaScript* p1, const CMLuaScript* p2) return mir_strcmpi(p1->GetModuleName(), p2->GetModuleName());
}
-CMLua::CMLua() : L(NULL), Scripts(10, CompareScripts)
+CMLua::CMLua() : L(nullptr), Scripts(10, CompareScripts)
{
MUUID muidLast = MIID_LAST;
hMLuaLangpack = GetPluginLangId(muidLast, 0);
@@ -67,7 +67,7 @@ static int mlua_toansi(lua_State *L) int codepage = luaL_optinteger(L, 2, Langpack_GetDefaultCodePage());
ptrA string(mir_strdup(value));
- lua_pushstring(L, mir_utf8decodecp(string, codepage, NULL));
+ lua_pushstring(L, mir_utf8decodecp(string, codepage, nullptr));
return 1;
}
@@ -270,7 +270,7 @@ void CMLua::KillLuaRefs() while (HookRefs.getCount())
{
HandleRefParam *param = (HandleRefParam*)HookRefs[0];
- if (param != NULL)
+ if (param != nullptr)
{
luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref);
HookRefs.remove(0);
@@ -281,7 +281,7 @@ void CMLua::KillLuaRefs() while (ServiceRefs.getCount())
{
HandleRefParam *param = (HandleRefParam*)ServiceRefs[0];
- if (param != NULL)
+ if (param != nullptr)
{
luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref);
ServiceRefs.remove(0);
diff --git a/plugins/MirLua/src/mlua_enviroment.cpp b/plugins/MirLua/src/mlua_enviroment.cpp index 268afc46b0..4e7225fd16 100644 --- a/plugins/MirLua/src/mlua_enviroment.cpp +++ b/plugins/MirLua/src/mlua_enviroment.cpp @@ -23,7 +23,7 @@ CMLuaEnviroment::~CMLuaEnviroment() CMLuaEnviroment* CMLuaEnviroment::GetEnviroment(lua_State *L) { if (!luaM_getenv(L)) - return NULL; + return nullptr; lua_rawgeti(L, -1, NULL); CMLuaEnviroment *env = (CMLuaEnviroment*)lua_touserdata(L, -1); diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp index 92bcd1dcd5..4b13f8c52e 100644 --- a/plugins/MirLua/src/mlua_icons.cpp +++ b/plugins/MirLua/src/mlua_icons.cpp @@ -20,7 +20,7 @@ HICON GetIcon(int iconId) if (Icons[i].defIconID == iconId)
return IcoLib_GetIconByHandle(Icons[i].hIcolib);
- return NULL;
+ return nullptr;
}
HANDLE GetIconHandle(int iconId)
@@ -29,5 +29,5 @@ HANDLE GetIconHandle(int iconId) if (Icons[i].defIconID == iconId)
return Icons[i].hIcolib;
- return NULL;
+ return nullptr;
}
\ No newline at end of file diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index b4e11cb01d..6a2dbd669b 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -61,12 +61,12 @@ void CMLuaOptions::OnInitDialog() wchar_t scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
- PathToRelativeW(scriptDir, relativeScriptDir, NULL);
+ PathToRelativeW(scriptDir, relativeScriptDir, nullptr);
mir_snwprintf(header, L"%s (%s)", TranslateT("Common scripts"), relativeScriptDir);
m_scripts.AddColumn(0, L"Script", 380);
- m_scripts.AddColumn(1, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
- m_scripts.AddColumn(2, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
+ m_scripts.AddColumn(1, nullptr, 32 - GetSystemMetrics(SM_CXVSCROLL));
+ m_scripts.AddColumn(2, nullptr, 32 - GetSystemMetrics(SM_CXVSCROLL));
LoadScripts();
@@ -126,7 +126,7 @@ void CMLuaOptions::OnScriptListClick(CCtrlListView::TEventInfo *evt) switch (lvi.iSubItem)
{
case 1:
- ShellExecute(m_hwnd, L"Open", script->GetFilePath(), NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(m_hwnd, L"Open", script->GetFilePath(), nullptr, nullptr, SW_SHOWNORMAL);
break;
case 2:
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index 9abbc6e492..9275b74a7f 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -32,7 +32,7 @@ void ShowNotification(const char *caption, const char *message, int flags, MCONT return;
}
- MessageBoxA(NULL, message, caption, MB_OK | flags);
+ MessageBoxA(nullptr, message, caption, MB_OK | flags);
}
void ObsoleteMethod(lua_State *L, const char *message)
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index 0791b761e0..4c6108f6d0 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -14,16 +14,16 @@ struct DeleteEventHead { DeleteEventNode *first; DeleteEventNode *last; }; -static DeleteEventHead DeleteEvents = {0,0}; +static DeleteEventHead DeleteEvents = {nullptr,nullptr}; void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) { if (!DeleteEvents.first) return; mir_cslock lck(RemoveChainCS); - DeleteEventNode *prev =0, *current, *next; + DeleteEventNode *prev =nullptr, *current, *next; DBEVENTINFO info = {}; next = DeleteEvents.first; while (current = next) { - if (difftime(time(0), current->timestamp) < 1) break; + if (difftime(time(nullptr), current->timestamp) < 1) break; if (!db_event_get(current->hDbEvent, &info)) // && info.flags&DBEF_READ) { db_event_delete(current->hContact, current->hDbEvent); @@ -37,7 +37,7 @@ void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) { next = current->next; } } - if (!DeleteEvents.first) DeleteEvents.last = 0; + if (!DeleteEvents.first) DeleteEvents.last = nullptr; } @@ -51,7 +51,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) if ((dbei->eventType != EVENTTYPE_MESSAGE) || !(dbei->flags & DBEF_SENT) || (dbei->flags & DBEF_OTR_PREFIXED)) return 0; - if (dbei->cbBlob == 0 || dbei->pBlob == 0) + if (dbei->cbBlob == 0 || dbei->pBlob == nullptr) return 0; // just to be safe const char *proto = GetContactProto(hContact); @@ -133,8 +133,8 @@ int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam) DeleteEventNode *node = new DeleteEventNode(); node->hContact = hContact; node->hDbEvent = lParam; - node->timestamp = time(0); - node->next = 0; + node->timestamp = time(nullptr); + node->next = nullptr; mir_cslock lck(RemoveChainCS); if (DeleteEvents.last) DeleteEvents.last->next = node; @@ -201,7 +201,7 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) ConnContext *context = otr_user_state->context_root; while (context) { - if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == 0 || mir_strcmp(proto, context->protocol) == 0)) { + if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == nullptr || mir_strcmp(proto, context->protocol) == 0)) { MCONTACT hContact = (UINT_PTR)context->app_data; if (hContact) { @@ -257,17 +257,17 @@ void InitDBFilter() hDBEventPreAdd = HookEvent(ME_DB_EVENT_FILTER_ADD, OnDatabaseEventPreAdd); hDBEventAdded = HookEvent(ME_DB_EVENT_ADDED, OnDatabaseEventAdded); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); - timerId = SetTimer(0, 0, 1000, DeleteTimerProc); + timerId = SetTimer(nullptr, 0, 1000, DeleteTimerProc); } void DeinitDBFilter() { UnhookEvent(hDBEventPreAdd); - hDBEventPreAdd = 0; + hDBEventPreAdd = nullptr; UnhookEvent(hDBEventAdded); - hDBEventAdded = 0; + hDBEventAdded = nullptr; UnhookEvent(hContactSettingChanged); - hContactSettingChanged = 0; - if (timerId) KillTimer(0, timerId); - DeleteTimerProc(0, 0, 0, 0); + hContactSettingChanged = nullptr; + if (timerId) KillTimer(nullptr, timerId); + DeleteTimerProc(nullptr, 0, 0, 0); } diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index 98d0d5edef..7bd50fefbd 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -52,7 +52,7 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner; RECT rcOwner, rcDlg, rc; - if ((hwndOwner = GetParent(hwndDlg)) == NULL) { + if ((hwndOwner = GetParent(hwndDlg)) == nullptr) { hwndOwner = GetDesktopWindow(); } @@ -153,7 +153,7 @@ static void SMPInitUpdateDialog(ConnContext *context, bool responder) data->context = context; data->oldlevel = otr_context_get_trust(context); data->responder = responder; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), 0, DlgSMPUpdateProc, (LPARAM)data); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), nullptr, DlgSMPUpdateProc, (LPARAM)data); } static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -233,7 +233,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner = GetParent(hwndDlg); - if (hwndOwner == NULL) + if (hwndOwner == nullptr) hwndOwner = GetDesktopWindow(); RECT rcOwner, rcDlg, rc; @@ -336,7 +336,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner = GetParent(hwndDlg); - if (hwndOwner == NULL) + if (hwndOwner == nullptr) hwndOwner = GetDesktopWindow(); RECT rcOwner, rcDlg, rc; @@ -452,7 +452,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam delete[] answer; SMPInitUpdateDialog(context, false); - otr_start_smp(context, NULL, (const unsigned char*)ans, mir_strlen(ans)); + otr_start_smp(context, nullptr, (const unsigned char*)ans, mir_strlen(ans)); } } @@ -570,7 +570,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam void SMPInitDialog(ConnContext *context) { if (context) - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgProcSMPInitProc, (LPARAM)context); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgProcSMPInitProc, (LPARAM)context); } void SMPDialogUpdate(ConnContext *context, int percent) @@ -608,8 +608,8 @@ void SMPDialogReply(ConnContext *context, const char* question) data->context = context; data->oldlevel = TRUST_NOT_PRIVATE; data->responder = true; - data->question = (question) ? mir_utf8decodeW(question) : NULL; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM)data); + data->question = (question) ? mir_utf8decodeW(question) : nullptr; + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgSMPResponseProc, (LPARAM)data); /* ShowError(L"SMP requires user password (NOT IMPL YET)"); otr_abort_smp(context); @@ -634,7 +634,7 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w // Move window to screen center // Get the owner window and dialog box rectangles. HWND hwndOwner = GetParent(hwndDlg); - if (hwndOwner == NULL) + if (hwndOwner == nullptr) hwndOwner = GetDesktopWindow(); RECT rcOwner, rcDlg, rc; @@ -723,13 +723,13 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w static unsigned int CALLBACK verify_context_thread(void *param) { - Thread_Push(0); + Thread_Push(nullptr); if (param) { ConnContext *context = (ConnContext *)param; MCONTACT hContact = (UINT_PTR)context->app_data; wchar_t msg[1024]; - switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgBoxProcVerifyContext, (LPARAM)param)) { + switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgBoxProcVerifyContext, (LPARAM)param)) { case IDOK: case IDYES: lib_cs_lock(); @@ -742,7 +742,7 @@ static unsigned int CALLBACK verify_context_thread(void *param) case IDNO: lib_cs_lock(); - otrl_context_set_trust(context->active_fingerprint, NULL); + otrl_context_set_trust(context->active_fingerprint, nullptr); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); mir_snwprintf(msg, TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); @@ -758,5 +758,5 @@ static unsigned int CALLBACK verify_context_thread(void *param) void VerifyContextDialog(ConnContext* context) { if (!context) return; - CloseHandle((HANDLE)_beginthreadex(0, 0, verify_context_thread, context, 0, 0)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, verify_context_thread, context, 0, nullptr)); } diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index 1de567c0cb..936bca86c9 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -51,7 +51,7 @@ int ModulesLoaded(WPARAM, LPARAM) db_set_b(0, MODULENAME, "sim_warned", 1);
options.default_policy = OTRL_POLICY_MANUAL_MOD;
SaveOptions();
- MessageBox(0, TranslateW(LANG_OTR_SECUREIM_TEXT), TranslateW(LANG_OTR_SECUREIM_TITLE), 0x30);
+ MessageBox(nullptr, TranslateW(LANG_OTR_SECUREIM_TEXT), TranslateW(LANG_OTR_SECUREIM_TITLE), 0x30);
}
return 0;
}
diff --git a/plugins/MirOTR/src/entities.cpp b/plugins/MirOTR/src/entities.cpp index f049ad0b88..62b0865b73 100644 --- a/plugins/MirOTR/src/entities.cpp +++ b/plugins/MirOTR/src/entities.cpp @@ -277,7 +277,7 @@ static const char *get_named_entity(const char *name) sizeof(named_entities) / sizeof(*named_entities), sizeof(*named_entities), cmp); - return entity ? entity[1] : NULL; + return entity ? entity[1] : nullptr; } static size_t putc_utf8(unsigned long cp, char *buffer) @@ -325,7 +325,7 @@ static bool parse_entity(const char *current, char **to, if(current[1] == '#') { - char *tail = NULL; + char *tail = nullptr; errno = 0; bool hex = current[2] == 'x' || current[2] == 'X'; @@ -395,7 +395,7 @@ char* encode_html_entities_utf8(const char *src) { const char *pos = strpbrk(src, "&<>\"\r"); if (!pos) - return NULL; + return nullptr; const char *start = src; std::string buf; diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 4babd970d7..21ae10a7f9 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -41,11 +41,11 @@ INT_PTR MirOTRMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) { TCheckProcParam *pcpp = (TCheckProcParam*)wParam; - if (pcpp == NULL) + if (pcpp == nullptr) return FALSE; lpMirOTRMenuExecParam cmep = (lpMirOTRMenuExecParam)pcpp->MenuItemOwnerData; - if (cmep == NULL) //this is rootsection...build it + if (cmep == nullptr) //this is rootsection...build it return TRUE; MCONTACT hContact = (MCONTACT)pcpp->wParam, hSub; @@ -94,7 +94,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) INT_PTR FreeOwnerDataMirOTRMenu(WPARAM, LPARAM lParam) { lpMirOTRMenuExecParam cmep = (lpMirOTRMenuExecParam)lParam; - if (cmep != NULL) { + if (cmep != nullptr) { if (cmep->szServiceName) mir_free(cmep->szServiceName); mir_free(cmep); } @@ -141,7 +141,7 @@ void ShowOTRMenu(MCONTACT hContact, POINT pt) SetWindowLongPtr(hDummyPaintWin, GWLP_USERDATA, (LONG_PTR)hContact); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDummyPaintWin, 0); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDummyPaintWin, nullptr); DestroyMenu(hMenu); } @@ -152,7 +152,7 @@ void InitMirOTRMenu(void) wc.lpfnWndProc = PopupMenuWndProc; wc.lpszClassName = L"MirOTRPopupMenuProcessor"; RegisterClass(&wc); - hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", NULL, 0, 0, 0, 1, 1, 0, 0, hInst, 0); + hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", nullptr, 0, 0, 0, 1, 1, nullptr, nullptr, hInst, nullptr); CreateServiceFunction("MirOTRMenuExecService", MirOTRMenuExecService); CreateServiceFunction("MirOTRMenuCheckService", MirOTRMenuCheckService); @@ -170,7 +170,7 @@ void InitMirOTRMenu(void) mi.flags = CMIF_DISABLED | CMIF_UNICODE; mi.name.w = LPGENW("OTR Status"); mi.position = 0; - hStatusInfoItem = AddMirOTRMenuItem(&mi, NULL); + hStatusInfoItem = AddMirOTRMenuItem(&mi, nullptr); mi.flags = CMIF_UNICODE | CMIF_NOTPRIVATE | CMIF_NOTUNVERIFIED; mi.name.w = LANG_MENU_START; @@ -199,14 +199,14 @@ void InitMirOTRMenu(void) mi.flags = CMIF_UNICODE | CMIF_CHECKED; mi.name.w = LANG_MENU_TOGGLEHTML; mi.position = 300001; - mi.hIcolibItem = 0; + mi.hIcolibItem = nullptr; hHTMLConvMenuItem = AddMirOTRMenuItem(&mi, MS_OTR_MENUTOGGLEHTML); } void UninitMirOTRMenu(void) { DestroyWindow(hDummyPaintWin); - hDummyPaintWin = 0; + hDummyPaintWin = nullptr; UnregisterClass(L"MirOTRPopupMenuProcessor", hInst); diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 09d8a7f64a..33b1ee0d35 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -122,7 +122,7 @@ void ReadPrivkeyFiles() DEBUGOUTA("READ privkey"); lib_cs_lock(); otrl_privkey_read(otr_user_state, _T2A(g_private_key_filename)); - otrl_privkey_read_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename), set_context_contact, 0); + otrl_privkey_read_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename), set_context_contact, nullptr); otrl_instag_read(otr_user_state, _T2A(g_instag_filename)); } @@ -233,7 +233,7 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, static unsigned int CALLBACK regen_key_thread(void* param) { - Thread_Push(0); + Thread_Push(nullptr); PROTOREGENKEYOPTIONS *opts = (PROTOREGENKEYOPTIONS *)param; wchar_t buff[512]; @@ -241,7 +241,7 @@ static unsigned int CALLBACK regen_key_thread(void* param) EnableWindow(opts->refresh, FALSE); if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) { char* proto = mir_u2a(opts->proto); - otr_gui_create_privkey(0, proto, proto); + otr_gui_create_privkey(nullptr, proto, proto); mir_free(proto); SendMessage(opts->refresh, WMU_REFRESHPROTOLIST, 0, 0); } @@ -256,7 +256,7 @@ static char* GetProtoName(HWND lv, int iItem) LV_ITEM item; item.iItem = iItem; item.mask = LVIF_PARAM; - return (ListView_GetItem(lv, &item) == -1) ? NULL : (char*)item.lParam; + return (ListView_GetItem(lv, &item) == -1) ? nullptr : (char*)item.lParam; } static void ChangeContactSetting(HWND hwndDlg, int iItem, bool changeHtml) @@ -401,7 +401,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP PROTOREGENKEYOPTIONS *opts = new PROTOREGENKEYOPTIONS(); opts->refresh = hwndDlg; ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, _countof(opts->proto)); - CloseHandle((HANDLE)_beginthreadex(0, 0, regen_key_thread, opts, 0, 0)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, regen_key_thread, opts, 0, nullptr)); } break; @@ -414,7 +414,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP mir_snwprintf(buff, TranslateW(LANG_OTR_ASK_REMOVEKEY), buff_proto); if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION | MB_YESNO)) { char *proto = GetProtoName(lv, sel); - if (proto == NULL) + if (proto == nullptr) break; OtrlPrivKey *key = otrl_privkey_find(otr_user_state, proto, proto); @@ -473,7 +473,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP wchar_t policy[64]; for (int i = 0; i < cnt; ++i) { char *proto = GetProtoName(lv, i); - if (proto == NULL) + if (proto == nullptr) continue; ListView_GetItemText(lv, i, 1, policy, _countof(policy)); @@ -800,7 +800,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w break; case FPM_NOTRUST: - otrl_context_set_trust(it->first, NULL); + otrl_context_set_trust(it->first, nullptr); if (it->first == it->first->context->active_fingerprint) VerifyFingerprint(it->first->context, false); break; @@ -808,7 +808,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w } if (!fpm->empty()) - otr_gui_write_fingerprints(0); + otr_gui_write_fingerprints(nullptr); fpm->clear(); SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0); return TRUE; diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index ccc723812a..5350bca1bb 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -17,17 +17,17 @@ OtrlMessageAppOps ops = { max_message_size,//max_message_size account_name,//account_name account_name_free,//account_name_free - NULL,//received_symkey (optional) - NULL,//otr_error_message (optional, send to remote party so we could send them errors in a language they know) - NULL,//otr_error_message_free (optional) + nullptr,//received_symkey (optional) + nullptr,//otr_error_message (optional, send to remote party so we could send them errors in a language they know) + nullptr,//otr_error_message_free (optional) resent_msg_prefix,//resent_msg_prefix (optional) resent_msg_prefix_free,//resent_msg_prefix_free (optional) handle_smp_event,//handle_smp_event (optional) handle_msg_event,//handle_msg_event (optional) otr_create_instag,//create_instag (optional) - NULL,//convert_msg (optional) - NULL,//convert_free (optional) - NULL,//timer_control (optional) // @todo : implement security timers + nullptr,//convert_msg (optional) + nullptr,//convert_free (optional) + nullptr,//timer_control (optional) // @todo : implement security timers }; struct GenKeyData{ @@ -37,7 +37,7 @@ struct GenKeyData{ static unsigned int CALLBACK generate_key_thread(void* param) { - Thread_Push(0); + Thread_Push(nullptr); GenKeyData *data = (GenKeyData *)param; otrl_privkey_generate(otr_user_state, _T2A(g_private_key_filename), data->proto, data->proto); PostMessage(data->dialog, WMU_ENDDIALOG, 0, 0); @@ -64,7 +64,7 @@ INT_PTR CALLBACK GenKeyDlgBoxProc(HWND hWndDlg, UINT msg, WPARAM, LPARAM lParam) GenKeyData *data = (GenKeyData *)mir_calloc(sizeof(GenKeyData)); data->dialog = hWndDlg; data->proto = (char*)lParam; - CloseHandle((HANDLE)_beginthreadex(0, 0, generate_key_thread, data, 0, 0)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, generate_key_thread, data, 0, nullptr)); }break; case WMU_ENDDIALOG: EndDialog(hWndDlg, 0); @@ -108,7 +108,7 @@ extern "C" { protocol = GetContactProto((UINT_PTR)opdata); } if (!protocol) return; - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), 0, GenKeyDlgBoxProc, (LPARAM)protocol); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol); } @@ -152,12 +152,12 @@ extern "C" { /* A new fingerprint for the given user has been received. */ void otr_gui_new_fingerprint(void *opdata, OtrlUserState us, const char *accountname, const char *protocol, const char *username, unsigned char fingerprint[20]) { DEBUGOUTA("OTR_GUI_NEW_FINGERPRINT\n"); - ConnContext *context = otrl_context_find(us, username, accountname, protocol, OTRL_INSTAG_BEST, TRUE, 0, add_appdata, opdata); - Fingerprint *fp = otrl_context_find_fingerprint(context, fingerprint, TRUE, 0); + ConnContext *context = otrl_context_find(us, username, accountname, protocol, OTRL_INSTAG_BEST, TRUE, nullptr, add_appdata, opdata); + Fingerprint *fp = otrl_context_find_fingerprint(context, fingerprint, TRUE, nullptr); //CloseHandle((HANDLE)_beginthreadex(0, 0, trust_fp_thread, (void *)fp, 0, 0)); - otrl_context_set_trust(fp, NULL); + otrl_context_set_trust(fp, nullptr); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); } diff --git a/plugins/MirOTR/src/striphtml.cpp b/plugins/MirOTR/src/striphtml.cpp index a7d84b69c4..1401ac9a02 100644 --- a/plugins/MirOTR/src/striphtml.cpp +++ b/plugins/MirOTR/src/striphtml.cpp @@ -102,8 +102,8 @@ char * striphtml(char *html) { ekhtml_parser_t *parser = ekhtml_parser_new(&data);
ekhtml_parser_datacb_set(parser, &data_cb);
- ekhtml_parser_startcb_add(parser, NULL, &starttag_cb);
- ekhtml_parser_endcb_add(parser, NULL, &endtag_cb);
+ ekhtml_parser_startcb_add(parser, nullptr, &starttag_cb);
+ ekhtml_parser_endcb_add(parser, nullptr, &endtag_cb);
ekhtml_parser_feed(parser, &ekstring);
ekhtml_parser_flush(parser, 1);
diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp index 4dd0ca4f59..147d79b1e7 100644 --- a/plugins/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/src/svcs_proto.cpp @@ -38,9 +38,9 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ oldmessage = tmpencode; } - char *newmessage = NULL; + char *newmessage = nullptr; char *username = contact_get_id(ccs->hContact); - gcry_error_t err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact, proto, proto, username, OTRL_INSTAG_BEST, oldmessage, NULL, &newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, NULL, add_appdata, (void*)ccs->hContact); + gcry_error_t err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact, proto, proto, username, OTRL_INSTAG_BEST, oldmessage, nullptr, &newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, nullptr, add_appdata, (void*)ccs->hContact); mir_free(username); if (err) { /* Be *sure* not to send out plaintext */ @@ -50,7 +50,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ return 1; } - if (newmessage == NULL) + if (newmessage == nullptr) return Proto_ChainSend(wParam, ccs); if(!newmessage[0]){ @@ -96,10 +96,10 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) if (!oldmessage) return 1; - ConnContext* context=NULL; + ConnContext* context=nullptr; char *uname = contact_get_id(ccs->hContact); - char *newmessage = NULL; - OtrlTLV *tlvs = NULL; + char *newmessage = nullptr; + OtrlTLV *tlvs = nullptr; lib_cs_lock(); int ignore_msg = otrl_message_receiving(otr_user_state, &ops, (void*)ccs->hContact, @@ -122,7 +122,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) otrl_message_free(newmessage); return 1; // discard internal protocol messages } - if (newmessage == NULL) + if (newmessage == nullptr) return Proto_ChainRecv(wParam, ccs); DWORD oldflags = pre->flags; diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index f0d23e5357..66e34d6aaf 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -149,7 +149,7 @@ void DeinitSRMM() IcoLib_Release(ICON_FINISHED, 0); IcoLib_Release(ICON_PRIVATE, 0); IcoLib_Release(ICON_UNVERIFIED, 0); - hIconNotSecure = hIconFinished = hIconPrivate = hIconUnverified =0; + hIconNotSecure = hIconFinished = hIconPrivate = hIconUnverified =nullptr; UninitMirOTRMenu(); } diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 26b4f82bdf..00d34f226c 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -33,7 +33,7 @@ ConnContext * otrl_context_find_miranda(OtrlUserState us, MCONTACT hContact) { const char *proto = GetContactProto(hContact); char *username = contact_get_id(hContact); - ConnContext* ret = otrl_context_find(us, username, proto, proto, OTRL_INSTAG_BEST, 0, NULL, NULL, NULL); + ConnContext* ret = otrl_context_find(us, username, proto, proto, OTRL_INSTAG_BEST, 0, nullptr, nullptr, nullptr); mir_free(username); return ret; } @@ -58,7 +58,7 @@ TrustLevel otr_context_get_trust(ConnContext *context) /* Set verification of fingerprint */ void VerifyFingerprint(ConnContext *context, bool verify) { lib_cs_lock(); - otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":NULL); + otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":nullptr); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); VerifyFingerprintMessage(context, verify); } @@ -106,7 +106,7 @@ __inline const wchar_t* contact_get_nameT(MCONTACT hContact) { wchar_t* ProtoGetNickname(const char* proto) { wchar_t *p = Contact_GetInfo(CNF_NICK, NULL, proto); - return (p != NULL) ? p : mir_wstrdup(L""); + return (p != nullptr) ? p : mir_wstrdup(L""); } void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { @@ -120,12 +120,12 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC int size = int(mir_wstrlen(line1) + mir_wstrlen(line2) + 3); wchar_t *message = new wchar_t[size]; // newline and null terminator mir_snwprintf(message, size, L"%s\r\n%s", line1, line2); - MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION ); + MessageBox( nullptr, message, title, MB_OK | MB_ICONINFORMATION ); delete[] message; } else if(line1) { - MessageBox( NULL, line1, title, MB_OK | MB_ICONINFORMATION ); + MessageBox( nullptr, line1, title, MB_OK | MB_ICONINFORMATION ); } else if(line2) { - MessageBox( NULL, line2, title, MB_OK | MB_ICONINFORMATION ); + MessageBox( nullptr, line2, title, MB_OK | MB_ICONINFORMATION ); } return; } @@ -134,7 +134,7 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC //memset((void *)&ppd, 0, sizeof(POPUPDATAT)); ppd.lchContact = hContact; - ppd.lchIcon = NULL; + ppd.lchIcon = nullptr; if(line1 && line2) { wcsncpy( ppd.lptzContactName, line1, MAX_CONTACTNAME-1 ); @@ -146,8 +146,8 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC ppd.iSeconds = timeout; - ppd.PluginWindowProc = NULL; - ppd.PluginData = NULL; + ppd.PluginWindowProc = nullptr; + ppd.PluginData = nullptr; PUAddPopupT(&ppd); @@ -174,7 +174,7 @@ void ShowWarning(wchar_t *msg) { } break; case ED_MB: - MessageBox(0, msg, buffer, MB_OK | MB_ICONWARNING); + MessageBox(nullptr, msg, buffer, MB_OK | MB_ICONWARNING); break; case ED_BAL: Clist_TrayNotifyW(MODULENAME, buffer, msg, NIIF_WARNING, 10000); @@ -204,7 +204,7 @@ void ShowError(wchar_t *msg) { } break; case ED_MB: - MessageBox(0, msg, buffer, MB_OK | MB_ICONERROR); + MessageBox(nullptr, msg, buffer, MB_OK | MB_ICONERROR); break; case ED_BAL: Clist_TrayNotifyW(MODULENAME, buffer, msg, NIIF_ERROR, 10000); @@ -214,20 +214,20 @@ void ShowError(wchar_t *msg) { void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact) { - wchar_t* l1 = (line1) ? mir_utf8decodeW(line1) : NULL; - wchar_t* l2 = (line2) ? mir_utf8decodeW(line2) : NULL; + wchar_t* l1 = (line1) ? mir_utf8decodeW(line1) : nullptr; + wchar_t* l2 = (line2) ? mir_utf8decodeW(line2) : nullptr; ShowPopup(l1, l2, timeout, hContact); if (l1) mir_free(l1); if (l2) mir_free(l2); } void ShowWarningUtf(char* msg) { - wchar_t* m = (msg) ? mir_utf8decodeW(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeW(msg) : nullptr; ShowWarning(m); if (m) mir_free(m); } void ShowErrorUtf(char* msg) { - wchar_t* m = (msg) ? mir_utf8decodeW(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeW(msg) : nullptr; ShowError(m); if (m) mir_free(m); } @@ -238,7 +238,7 @@ void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) { T2Utf utf(buff); PROTORECVEVENT pre = {0}; - pre.timestamp = time(0); + pre.timestamp = time(nullptr); pre.szMessage = utf; pre.flags = PREF_BYPASS_OTR; ProtoChainRecvMsg(hContact, &pre); @@ -249,7 +249,7 @@ void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg) { mir_snprintf(buff, "%s%s", LANG_INLINE_PREFIX, msg); PROTORECVEVENT pre = {0}; - pre.timestamp = time(0); + pre.timestamp = time(nullptr); pre.szMessage = buff; pre.flags = PREF_BYPASS_OTR; ProtoChainRecvMsg(hContact, &pre); diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 323c1b7c70..3abdd9c0cb 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -24,7 +24,7 @@ CAppletManager *CAppletManager::GetInstance() CAppletManager::CAppletManager() { m_uiTimer = NULL; - m_pLastScreen = NULL; + m_pLastScreen = nullptr; } @@ -84,8 +84,8 @@ bool CAppletManager::Initialize(tstring strAppletName) int iCount; int iProtoCount = 0; PROTOACCOUNT **ppAccounts; - CProtocolData *pProtoData = NULL; - CIRCConnection *pIRCConnection = NULL; + CProtocolData *pProtoData = nullptr; + CIRCConnection *pIRCConnection = nullptr; Proto_EnumAccounts(&iCount, &ppAccounts); for (int i = 0; i < iCount; i++) { @@ -127,7 +127,7 @@ bool CAppletManager::Initialize(tstring strAppletName) m_ahLargeEventBitmaps[3] = (HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE(IDB_EVENT_INFO_LARGE), IMAGE_BITMAP, 8, 8, LR_MONOCHROME); // start the update timer - m_uiTimer = SetTimer(0, 0, 1000 / 10, CAppletManager::UpdateTimer); + m_uiTimer = SetTimer(nullptr, 0, 1000 / 10, CAppletManager::UpdateTimer); return true; } @@ -141,7 +141,7 @@ bool CAppletManager::Shutdown() return false; // stop the update timer - KillTimer(0, m_uiTimer); + KillTimer(nullptr, m_uiTimer); // delete status bitmaps for (int i = 0; i < 8; i++) @@ -230,7 +230,7 @@ CProtocolData* CAppletManager::GetProtocolData(tstring strProtocol) if (m_vProtocolData[i]->strProtocol == strProtocol) return m_vProtocolData[i]; } - return NULL; + return nullptr; } //************************************************************************ @@ -568,7 +568,7 @@ void CAppletManager::HandleEvent(CEvent *pEvent) // check for protocol filters if (pEvent->hContact != NULL && pEvent->eType != EVENT_CONTACT_ADDED) { char *szProto = GetContactProto(pEvent->hContact); - if (szProto == NULL || !CConfig::GetProtocolNotificationFilter(toTstring(szProto))) + if (szProto == nullptr || !CConfig::GetProtocolNotificationFilter(toTstring(szProto))) pEvent->bNotification = false; } pEvent->bLog = pEvent->bNotification; @@ -666,9 +666,9 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = szProto; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); // Check if protocoll is valid - if (dbei.szModule == NULL) + if (dbei.szModule == nullptr) return; dbei.cbBlob = pJob->iBufferSize; @@ -970,7 +970,7 @@ CIRCConnection *CAppletManager::GetIRCConnection(tstring strProtocol) return *iter; iter++; } - return NULL; + return nullptr; } //************************************************************************ @@ -998,7 +998,7 @@ CIRCHistory *CAppletManager::GetIRCHistory(MCONTACT hContact) return *iter; iter++; } - return NULL; + return nullptr; } CIRCHistory *CAppletManager::GetIRCHistoryByName(tstring strProtocol, tstring strChannel) @@ -1009,7 +1009,7 @@ CIRCHistory *CAppletManager::GetIRCHistoryByName(tstring strProtocol, tstring st return *iter; iter++; } - return NULL; + return nullptr; } //************************************************************************ @@ -1041,7 +1041,7 @@ CIRCHistory *CAppletManager::CreateIRCHistory(MCONTACT hContact, tstring strChan { char *szProto = GetContactProto(hContact); if (!szProto) - return NULL; + return nullptr; CIRCHistory *pHistory = GetIRCHistoryByName(toTstring(szProto), strChannel); if (pHistory) { @@ -1085,7 +1085,7 @@ CIRCHistory *CAppletManager::CreateIRCHistoryByName(tstring strProtocol, tstring int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) { GCEVENT *gce = (GCEVENT*)lParam; - if (gce == NULL) { + if (gce == nullptr) { TRACE(L"<< [%s] skipping invalid event\n"); return 0; } @@ -1116,7 +1116,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) Event.iValue = gce->iType; Event.hValue = lParam; - CIRCHistory *pHistory = NULL; + CIRCHistory *pHistory = nullptr; if (gce->ptszID) { tstring strChannel = toTstring(gce->ptszID); tstring::size_type pos = strChannel.find('-'); @@ -1146,7 +1146,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) Event.hContact = NULL; // Ignore events from hidden chatrooms, except for join events - if (gce->ptszID != NULL && db_get_b(Event.hContact, "CList", "Hidden", 0)) { + if (gce->ptszID != nullptr && db_get_b(Event.hContact, "CList", "Hidden", 0)) { if (gce->iType == GC_EVENT_JOIN && pHistory) pHistory->LUsers.push_back(toTstring(gce->ptszNick)); @@ -1282,7 +1282,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(L"OK!\n"); return 0; } - if (gce->bIsMe || gce->ptszID == NULL) + if (gce->bIsMe || gce->ptszID == nullptr) Event.bNotification = false; // set the event's timestamp @@ -1335,7 +1335,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(L"OK!\n"); return 0; } - else if (gce->ptszID != NULL) { + else if (gce->ptszID != nullptr) { TRACE(L"OK!\n"); return 0; } @@ -1429,7 +1429,7 @@ int CAppletManager::HookStatusChanged(WPARAM wParam, LPARAM lParam) tstring strProto = toTstring(szProto); CProtocolData *pProtocolData = CAppletManager::GetInstance()->GetProtocolData(toTstring(szProto)); - if (pProtocolData == NULL) + if (pProtocolData == nullptr) return false; // Fetch the contacts name @@ -1553,7 +1553,7 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam) return 0; CProtocolData *pProtoData = CAppletManager::GetInstance()->GetProtocolData(strProto); - if (pProtoData == NULL) + if (pProtoData == nullptr) return 0; // Skip connecting status diff --git a/plugins/MirandaG15/src/CChatScreen.cpp b/plugins/MirandaG15/src/CChatScreen.cpp index 12020a9630..132b5ad2f2 100644 --- a/plugins/MirandaG15/src/CChatScreen.cpp +++ b/plugins/MirandaG15/src/CChatScreen.cpp @@ -172,14 +172,14 @@ void CChatScreen::UpdateLabels() tstring strProto = L"";
tstring strStatus = L"";
- if(szProto != NULL)
+ if(szProto != nullptr)
{
strProto = L"(" + toTstring(szProto) + L")";
m_iStatus = db_get_w(m_hContact,szProto,"Status",ID_STATUS_OFFLINE);
}
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(m_iStatus, 0);
- if(szStatus != NULL)
+ if(szStatus != nullptr)
strStatus = toTstring(szStatus);
m_UserName.SetText(strNickname.c_str());
@@ -459,7 +459,7 @@ void CChatScreen::ActivateMessageMode() {
m_InfoText.Show(0);
m_TextLog.Show(0);
- m_TextLog.SetScrollbar(NULL);
+ m_TextLog.SetScrollbar(nullptr);
m_Input.SetScrollbar(&m_Scrollbar);
if(m_eReplyState != REPLY_STATE_FAILED)
@@ -532,7 +532,7 @@ void CChatScreen::DeactivateMessageMode() {
m_Input.Reset();
- m_Input.SetScrollbar(NULL);
+ m_Input.SetScrollbar(nullptr);
m_TextLog.SetScrollbar(&m_Scrollbar);
m_TextLog.Show(1);
diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 87e3b43883..351755a572 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -7,7 +7,7 @@ #define FONTF_BOLD 1
#define FONTF_ITALIC 2
-HANDLE CConfig::m_hOptionsInitHook = NULL;
+HANDLE CConfig::m_hOptionsInitHook = nullptr;
bool CConfig::m_bInitializingDialog = false;
bool CConfig::m_abBoolSettings[BOOL_SETTINGS];
int CConfig::m_aiIntSettings[INT_SETTINGS];
@@ -16,7 +16,7 @@ LOGFONT CConfig::m_templogfont[FONT_SETTINGS]; HANDLE CConfig::m_hSampleFont[FONT_SETTINGS];
TEXTMETRIC CConfig::m_tmFontInfo[FONT_SETTINGS];
vector<CProtoFilter*> CConfig::m_ProtoList;
-HWND CConfig::hDeviceBox = NULL;
+HWND CConfig::hDeviceBox = nullptr;
void CConfig::Initialize()
{
@@ -234,7 +234,7 @@ void CConfig::UpdateFontSettings(int iFont) if (m_hSampleFont[iFont])
DeleteObject(m_hSampleFont[iFont]);
m_hSampleFont[iFont] = CreateFontIndirect(&m_logfont[iFont]);
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
SelectObject(hDC, m_hSampleFont[iFont]);
GetTextMetrics(hDC, &m_tmFontInfo[iFont]);
DeleteObject(hDC);
@@ -893,7 +893,7 @@ void CConfig::FillDeviceBox(HWND hBox) int count = 0;
for (int i = 0; i < 10; i++) {
CLCDDevice *device = connection->GetAttachedDevice(i);
- if (device != NULL) {
+ if (device != nullptr) {
SendMessage(hBox, CB_ADDSTRING, 0, (LPARAM)device->GetDisplayName().c_str());
count++;
}
@@ -915,7 +915,7 @@ void CConfig::FillTree(HWND hTree, bool bCList) TreeView_DeleteAllItems(hTree);
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index d8bd87325d..672e686129 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -98,14 +98,14 @@ tstring CContactList::GetContactGroupPath(MCONTACT hContact) //************************************************************************
void CContactList::AddContact(MCONTACT hContact)
{
- CListContainer<CContactListEntry*,CContactListGroup*> *pGroup = NULL;
+ CListContainer<CContactListEntry*,CContactListGroup*> *pGroup = nullptr;
tstring strName = CAppletManager::GetContactDisplayname(hContact);
char *szProto = GetContactProto(hContact);
tstring strGroup = GetContactGroupPath(hContact);
// ignore contacts without a valid protocoll
- if(szProto == NULL)
+ if(szProto == nullptr)
return;
int iStatus = db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE);
@@ -119,7 +119,7 @@ void CContactList::AddContact(MCONTACT hContact) psContact->iStatus = iStatus;
- if(szStatus != NULL)
+ if(szStatus != nullptr)
psContact->strStatus =toTstring(szStatus);
psContact->strProto = toTstring(szProto);
@@ -136,7 +136,7 @@ void CContactList::AddContact(MCONTACT hContact) strGroup = L"";
strGroup += (strGroup.empty()?L"":L"\\")+psContact->strName;
pGroup = GetGroupByString(strGroup);
- if(pGroup == NULL)
+ if(pGroup == nullptr)
pGroup = AddGroupByString(strGroup);
pGroup->GetGroupData()->hMetaContact = hContact;
pGroup->GetGroupData()->pContactListEntry = psContact;
@@ -164,7 +164,7 @@ void CContactList::AddContact(MCONTACT hContact) AddContact(hMetaContact);
}
- CListItem<CContactListEntry*,CContactListGroup*> *pItem = NULL;
+ CListItem<CContactListEntry*,CContactListGroup*> *pItem = nullptr;
if((!db_mc_isSub(hContact) && !CConfig::GetBoolSetting(CLIST_USEGROUPS)) || strGroup.empty())
{
pItem = AddItem(psContact);
@@ -173,7 +173,7 @@ void CContactList::AddContact(MCONTACT hContact) else
{
pGroup = GetGroupByString(strGroup);
- if(pGroup == NULL) {
+ if(pGroup == nullptr) {
pGroup = AddGroupByString(strGroup);
}
pItem = pGroup->AddItem(psContact);
@@ -239,7 +239,7 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) { // removes a contact from the list
//************************************************************************
void CContactList::RemoveContact(MCONTACT hContact) {
- CListContainer<CContactListEntry*,CContactListGroup*> *pGroup = NULL;
+ CListContainer<CContactListEntry*,CContactListGroup*> *pGroup = nullptr;
///tstring strGroup = GetContactGroupPath(hContact);
@@ -255,7 +255,7 @@ void CContactList::RemoveContact(MCONTACT hContact) { RemoveGroup(((CListContainer<CContactListEntry*,CContactListGroup*>*)pContactEntry)->GetGroupData());
} else {
pGroup = (CListContainer<CContactListEntry*,CContactListGroup*>*)pContactEntry->GetParent();
- ASSERT(pGroup != NULL);
+ ASSERT(pGroup != nullptr);
CContactListEntry *pEntry = GetContactData(pContactEntry);
if(!pEntry) {
@@ -285,7 +285,7 @@ void CContactList::RemoveContact(MCONTACT hContact) { }
CListContainer<CContactListEntry*,CContactListGroup*> *pParent = (CListContainer<CContactListEntry*,CContactListGroup*>*)pGroup->GetParent();
- while(pParent != NULL && pGroup->IsEmpty() && !pGroup->GetGroupData()->hMetaContact)
+ while(pParent != nullptr && pGroup->IsEmpty() && !pGroup->GetGroupData()->hMetaContact)
{
pParent->RemoveGroup(pGroup->GetGroupData());
pGroup = pParent;
@@ -308,8 +308,8 @@ CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::GetGroupByS strParse = strParse.substr(pos+1);
pGroup = FindGroupInGroup(strGroup,pGroup);
- if(pGroup == NULL)
- return NULL;
+ if(pGroup == nullptr)
+ return nullptr;
}
pGroup = FindGroupInGroup(strParse,pGroup);
return pGroup;
@@ -324,7 +324,7 @@ CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::AddGroupByS tstring strPath = L"";
CListContainer<CContactListEntry*,CContactListGroup*> *pGroup = (CListContainer<CContactListEntry*,CContactListGroup*>*)this;
- CListContainer<CContactListEntry*,CContactListGroup*> *pGroup2 = NULL;
+ CListContainer<CContactListEntry*,CContactListGroup*> *pGroup2 = nullptr;
tstring::size_type pos;
while((pos = strParse.find('\\')) != tstring::npos )
{
@@ -343,7 +343,7 @@ CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::AddGroupByS pGroup->sort(CContactList::CompareEntries);
pGroup = pGroup2;
}
- ASSERT(pGroup != NULL);
+ ASSERT(pGroup != nullptr);
strPath += L"\\";
}
strPath += strParse;
@@ -399,7 +399,7 @@ void CContactList::DeleteGroup(CContactListGroup*) //************************************************************************
void CContactList::DrawEntry(CLCDGfx *pGfx,CContactListEntry *pEntry,bool bSelected)
{
- if(pEntry == NULL)
+ if(pEntry == nullptr)
return;
tstring strText = L"";
@@ -431,7 +431,7 @@ void CContactList::DrawEntry(CLCDGfx *pGfx,CContactListEntry *pEntry,bool bSelec //************************************************************************
void CContactList::DrawGroup(CLCDGfx *pGfx,CContactListGroup *pGroup,bool bOpen,bool bSelected)
{
- if(pGroup == NULL || ( pGroup->hMetaContact && pGroup->pContactListEntry == NULL)) {
+ if(pGroup == nullptr || ( pGroup->hMetaContact && pGroup->pContactListEntry == nullptr)) {
return;
}
@@ -540,7 +540,7 @@ void CContactList::RefreshList() m_bUseGroups = CConfig::GetBoolSetting(CLIST_USEGROUPS);
m_bUseMetaContacts = db_get_b(NULL,"MetaContacts","Enabled",1) != 0;
- CListEntry<CContactListEntry*,CContactListGroup*> *pContactEntry = NULL;
+ CListEntry<CContactListEntry*,CContactListGroup*> *pContactEntry = nullptr;
MCONTACT hContact = db_find_first();
while(hContact != NULL)
{
@@ -589,7 +589,7 @@ CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::FindGroup(t CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::FindGroupInGroup(tstring strGroup,CListContainer<CContactListEntry*,CContactListGroup*> *pGroup)
{
CListContainer<CContactListEntry*,CContactListGroup*>::iterator iter = pGroup->begin();
- CListContainer<CContactListEntry*,CContactListGroup*> *pItem = NULL;
+ CListContainer<CContactListEntry*,CContactListGroup*> *pItem = nullptr;
while(!pGroup->empty() && iter != pGroup->end())
{
if((*iter)->GetType() == CONTAINER)
@@ -604,7 +604,7 @@ CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::FindGroupIn }
iter++;
}
- return NULL;
+ return nullptr;
}
//************************************************************************
@@ -613,7 +613,7 @@ CListContainer<CContactListEntry*,CContactListGroup*> *CContactList::FindGroupIn CListEntry<CContactListEntry*,CContactListGroup*> *CContactList::FindContact(MCONTACT hContact)
{
if(hContact == NULL)
- return NULL;
+ return nullptr;
return FindContactInGroup(hContact,(CListContainer<CContactListEntry*,CContactListGroup*>*)this);
}
@@ -624,11 +624,11 @@ CListEntry<CContactListEntry*,CContactListGroup*> *CContactList::FindContact(MCO CListEntry<CContactListEntry*,CContactListGroup*> *CContactList::FindContactInGroup(MCONTACT hContact,CListContainer<CContactListEntry*,CContactListGroup*> *pGroup)
{
if(hContact == NULL)
- return NULL;
+ return nullptr;
- CListItem<CContactListEntry*,CContactListGroup*> *pItemEntry = NULL;
- CListEntry<CContactListEntry*,CContactListGroup*> *pEntry = NULL;
- CListContainer<CContactListEntry*,CContactListGroup*> *pGroupEntry = NULL;
+ CListItem<CContactListEntry*,CContactListGroup*> *pItemEntry = nullptr;
+ CListEntry<CContactListEntry*,CContactListGroup*> *pEntry = nullptr;
+ CListContainer<CContactListEntry*,CContactListGroup*> *pGroupEntry = nullptr;
CListContainer<CContactListEntry*,CContactListGroup*>::iterator iter = pGroup->begin();
while(iter != pGroup->end())
{
@@ -650,7 +650,7 @@ CListEntry<CContactListEntry*,CContactListGroup*> *CContactList::FindContactInGr }
iter++;
}
- return NULL;
+ return nullptr;
}
@@ -722,7 +722,7 @@ void CContactList::OnStatusChange(MCONTACT hContact,int iStatus) // Update the list entry
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(iStatus, 0);
- if(szStatus != NULL)
+ if(szStatus != nullptr)
pItemData->strStatus =toTstring(szStatus);
pItemData->iStatus = iStatus;
@@ -828,7 +828,7 @@ void CContactList::OnContactGroupChanged(MCONTACT hContact,tstring strGroup) // Decrease the membercount of the old group
CListEntry<CContactListEntry *,CContactListGroup*> *pContactEntry = FindContact(hContact);
- CContactListGroup *pOldGroup = NULL;
+ CContactListGroup *pOldGroup = nullptr;
// If the contactentry was not found, try adding the contact (metacontacts fix)
if(!pContactEntry) {
return;
@@ -1037,7 +1037,7 @@ CContactListGroup *CContactList::GetGroupObjectByPath(tstring strPath) {
ASSERT(!strPath.empty());
- CContactListGroup *pGroup = NULL;
+ CContactListGroup *pGroup = nullptr;
vector<CContactListGroup*>::iterator iter = m_Groups.begin();
for(;iter != m_Groups.end();iter++)
{
@@ -1058,7 +1058,7 @@ CContactListGroup *CContactList::CreateGroupObjectByPath(tstring strPath) ASSERT(!strPath.empty());
CContactListGroup *pNewGroup = new CContactListGroup();
- CContactListGroup *pParentGroup = NULL;
+ CContactListGroup *pParentGroup = nullptr;
tstring strParsePath = L"";
tstring strName = strPath;
@@ -1085,7 +1085,7 @@ CContactListGroup *CContactList::CreateGroupObjectByPath(tstring strPath) pNewGroup->iGroups = 0;
pNewGroup->iEvents = 0;
pNewGroup->hMetaContact = NULL;
- pNewGroup->pContactListEntry = NULL;
+ pNewGroup->pContactListEntry = nullptr;
m_Groups.push_back(pNewGroup);
diff --git a/plugins/MirandaG15/src/CEventScreen.cpp b/plugins/MirandaG15/src/CEventScreen.cpp index e03a36301e..1d240265a8 100644 --- a/plugins/MirandaG15/src/CEventScreen.cpp +++ b/plugins/MirandaG15/src/CEventScreen.cpp @@ -107,7 +107,7 @@ void CEventScreen::OnConfigChanged() // Update all timestamps
list<CListEntry<CEventLogEntry*>*>::iterator iter = m_EventLog.begin();
- CListItem<CEventLogEntry*> *pItem = NULL;
+ CListItem<CEventLogEntry*> *pItem = nullptr;
while(iter != m_EventLog.end())
{
pItem = static_cast<CListItem<CEventLogEntry*>*>(*iter);
diff --git a/plugins/MirandaG15/src/CNotificationScreen.cpp b/plugins/MirandaG15/src/CNotificationScreen.cpp index 26955ebf78..671c315276 100644 --- a/plugins/MirandaG15/src/CNotificationScreen.cpp +++ b/plugins/MirandaG15/src/CNotificationScreen.cpp @@ -8,7 +8,7 @@ //************************************************************************
CNotificationScreen::CNotificationScreen()
{
- m_pEntry = NULL;
+ m_pEntry = nullptr;
//m_bMessageMode = false;
}
@@ -65,7 +65,7 @@ bool CNotificationScreen::Initialize() //************************************************************************
bool CNotificationScreen::Shutdown()
{
- CNotificationEntry *pEntry = NULL;
+ CNotificationEntry *pEntry = nullptr;
while(!m_LNotifications.empty())
{
pEntry = *(m_LNotifications.begin());
@@ -117,7 +117,7 @@ bool CNotificationScreen::Draw(CLCDGfx *pGfx) //************************************************************************
void CNotificationScreen::DisplayNotification(CNotificationEntry *pEntry)
{
- if(m_pEntry != NULL)
+ if(m_pEntry != nullptr)
delete m_pEntry;
@@ -359,7 +359,7 @@ void CNotificationScreen::OnDeactivation() void CNotificationScreen::OnExpiration()
{
// clear the cached events
- CNotificationEntry *pEntry = NULL;
+ CNotificationEntry *pEntry = nullptr;
while(!m_LNotifications.empty())
{
pEntry = *(m_LNotifications.begin());
@@ -370,5 +370,5 @@ void CNotificationScreen::OnExpiration() m_EventText.SetText(L"");
m_MessageText.SetText(L"");
- m_pEntry = NULL;
+ m_pEntry = nullptr;
}
\ No newline at end of file diff --git a/plugins/MirandaG15/src/CScreen.cpp b/plugins/MirandaG15/src/CScreen.cpp index a49207baf1..3ba1fb845b 100644 --- a/plugins/MirandaG15/src/CScreen.cpp +++ b/plugins/MirandaG15/src/CScreen.cpp @@ -31,7 +31,7 @@ bool CScreen::Initialize() m_aButtons[i].SetSize(17, 3);
m_aButtons[i].Show(0);
m_abShowButtons[i] = false;
- m_ahBitmaps[i] = NULL;
+ m_ahBitmaps[i] = nullptr;
if(GetWidth() == 160) {
m_aButtons[i].SetOrigin(10+i*29+(i/2)*36, GetHeight()-3);
} else {
@@ -65,7 +65,7 @@ bool CScreen::Shutdown() return false;
for(int i=0; i < 4; i++)
- if(m_ahBitmaps[i] != NULL)
+ if(m_ahBitmaps[i] != nullptr)
DeleteObject(m_ahBitmaps[i]);
return true;
@@ -114,7 +114,7 @@ void CScreen::SetButtonBitmap(int iButton, int iBitmap) }
else
{
- if(m_ahBitmaps[iButton] != NULL)
+ if(m_ahBitmaps[iButton] != nullptr)
DeleteObject(m_ahBitmaps[iButton]);
m_ahBitmaps[iButton] = (HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE(iBitmap),
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp index 5ce448769d..b9aadd3bfc 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp @@ -3,7 +3,7 @@ CLCDBitmap::CLCDBitmap()
{
- m_hBitmap = NULL;
+ m_hBitmap = nullptr;
}
CLCDBitmap::~CLCDBitmap()
@@ -43,6 +43,6 @@ bool CLCDBitmap::Draw(CLCDGfx *pGfx) void CLCDBitmap::SetBitmap(HBITMAP hBitmap)
{
- ASSERT(NULL != hBitmap);
+ ASSERT(nullptr != hBitmap);
m_hBitmap = hBitmap;
}
\ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp index 6b449f5db2..929f801d8e 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp @@ -133,7 +133,7 @@ int CLCDConnection::GetColorCount() //************************************************************************
PBYTE CLCDConnection::GetPixelBuffer()
{
- return NULL;
+ return nullptr;
}
//************************************************************************
@@ -141,7 +141,7 @@ PBYTE CLCDConnection::GetPixelBuffer() //************************************************************************
CLCDDevice* CLCDConnection::GetAttachedDevice(int)
{
- return NULL;
+ return nullptr;
}
//************************************************************************
@@ -173,5 +173,5 @@ void CLCDConnection::SetReconnect(bool bSet) //************************************************************************
CLCDDevice* CLCDConnection::GetConnectedDevice()
{
- return NULL;
+ return nullptr;
}
\ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp index 768e586c39..2ec4f18332 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp @@ -27,8 +27,8 @@ void __cdecl initializeDrawingThread(void *pParam) }
void CLCDConnectionLogitech::runDrawingThread() {
- m_hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_hDrawEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ m_hStopEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ m_hDrawEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
DWORD dwRes = 0;
@@ -70,7 +70,7 @@ void CLCDConnectionLogitech::runDrawingThread() { }
// the connection instance
-CLCDConnectionLogitech *CLCDConnectionLogitech::m_pInstance = NULL;
+CLCDConnectionLogitech *CLCDConnectionLogitech::m_pInstance = nullptr;
//************************************************************************
// returns the connection type
@@ -88,9 +88,9 @@ CLCDConnectionLogitech::CLCDConnectionLogitech() m_iNumQVGADevices = 0;
m_iNumBWDevices = 0;
- m_pDrawingBuffer = NULL;
- m_pConnectedDevice = NULL;
- m_hKeyboardHook = NULL;
+ m_pDrawingBuffer = nullptr;
+ m_pConnectedDevice = nullptr;
+ m_hKeyboardHook = nullptr;
m_bVolumeWheelHook = false;
m_dwButtonState = 0;
@@ -98,14 +98,14 @@ CLCDConnectionLogitech::CLCDConnectionLogitech() m_bSetAsForeground = false;
m_dwForegroundCheck = 0;
- m_hHIDDeviceHandle = NULL;
+ m_hHIDDeviceHandle = nullptr;
m_hConnection = LGLCD_INVALID_CONNECTION;
m_hDevice = LGLCD_INVALID_DEVICE;
m_bIsForeground = false;
- m_hDrawEvent = NULL;
- m_hStopEvent = NULL;
+ m_hDrawEvent = nullptr;
+ m_hStopEvent = nullptr;
CLCDConnectionLogitech::m_pInstance = this;
@@ -121,7 +121,7 @@ CLCDConnectionLogitech::~CLCDConnectionLogitech() SetEvent(m_hStopEvent);
} while (WaitForSingleObject(m_hDrawingThread, 500) == WAIT_TIMEOUT);
- if (m_pDrawingBuffer != NULL) {
+ if (m_pDrawingBuffer != nullptr) {
free(m_pDrawingBuffer);
}
SetVolumeWheelHook(false);
@@ -152,9 +152,9 @@ bool CLCDConnectionLogitech::Initialize(tstring strAppletName, bool bAutostart, m_connectContext.onConfigure.configCallback = CLCDOutputManager::configDialogCallback;
}
else {
- m_connectContext.onConfigure.configCallback = NULL;
+ m_connectContext.onConfigure.configCallback = nullptr;
}
- m_connectContext.onConfigure.configContext = NULL;
+ m_connectContext.onConfigure.configContext = nullptr;
lgLcdSetDeviceFamiliesToUse(m_connectContext.connection, LGLCD_DEVICE_FAMILY_ALL, NULL);
@@ -184,7 +184,7 @@ CLgLCDDevice* CLCDConnectionLogitech::GetAttachedDevice(int iIndex) { }
}
- return NULL;
+ return nullptr;
}
//************************************************************************
@@ -194,9 +194,9 @@ bool CLCDConnectionLogitech::Disconnect() { if (!m_bConnected)
return false;
- if (m_pConnectedDevice != NULL) {
+ if (m_pConnectedDevice != nullptr) {
delete m_pConnectedDevice;
- m_pConnectedDevice = NULL;
+ m_pConnectedDevice = nullptr;
}
m_bReconnect = false;
@@ -246,10 +246,10 @@ bool CLCDConnectionLogitech::Connect(int iIndex) // check if the specified device exists
m_pConnectedDevice = GetAttachedDevice(iIndex);
- if (m_pConnectedDevice == NULL) {
+ if (m_pConnectedDevice == nullptr) {
iIndex = (!iIndex || iIndex == LGLCD_DEVICE_BW) ? LGLCD_DEVICE_BW : LGLCD_DEVICE_QVGA;
m_pConnectedDevice = GetAttachedDevice(iIndex);
- if (m_pConnectedDevice == NULL) {
+ if (m_pConnectedDevice == nullptr) {
return false;
}
}
@@ -279,7 +279,7 @@ bool CLCDConnectionLogitech::Connect(int iIndex) // Create the pixel buffer
m_lcdBitmap.hdr.Format = OpenContext.deviceType == LGLCD_DEVICE_QVGA ? LGLCD_BMP_FORMAT_QVGAx32 : LGLCD_BMP_FORMAT_160x43x1;
- if (m_pDrawingBuffer != NULL) {
+ if (m_pDrawingBuffer != nullptr) {
free(m_pDrawingBuffer);
}
@@ -323,7 +323,7 @@ bool CLCDConnectionLogitech::Shutdown() //************************************************************************
bool CLCDConnectionLogitech::HIDReadData(BYTE* data) {
static OVERLAPPED olRead;
- static HANDLE hReadEvent = CreateEvent(NULL, false, true, L"ReadEvent");
+ static HANDLE hReadEvent = CreateEvent(nullptr, false, true, L"ReadEvent");
static BYTE privateBuffer[9];
DWORD TransBytes;
@@ -613,7 +613,7 @@ int CLCDConnectionLogitech::GetColorCount() PBYTE CLCDConnectionLogitech::GetPixelBuffer()
{
if (!GetConnectionState() == CONNECTED)
- return NULL;
+ return nullptr;
return (PBYTE)m_pDrawingBuffer;
}
@@ -676,8 +676,8 @@ bool CLCDConnectionLogitech::HIDInit() LONG Result;
DWORD Length = 0;
- PSP_DEVICE_INTERFACE_DETAIL_DATA detailData = NULL;
- HANDLE hDevInfo = NULL;
+ PSP_DEVICE_INTERFACE_DETAIL_DATA detailData = nullptr;
+ HANDLE hDevInfo = nullptr;
GUID HidGuid;
ULONG Required = 0;
@@ -699,8 +699,8 @@ bool CLCDConnectionLogitech::HIDInit() hDevInfo = SetupDiGetClassDevs
(&HidGuid,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
devInfoData.cbSize = sizeof(devInfoData);
@@ -725,7 +725,7 @@ bool CLCDConnectionLogitech::HIDInit() Result = SetupDiEnumDeviceInterfaces
(hDevInfo,
- 0,
+ nullptr,
&HidGuid,
MemberIndex,
&devInfoData);
@@ -758,10 +758,10 @@ bool CLCDConnectionLogitech::HIDInit() Result = SetupDiGetDeviceInterfaceDetail
(hDevInfo,
&devInfoData,
- NULL,
+ nullptr,
0,
&Length,
- NULL);
+ nullptr);
//Allocate memory for the hDevInfo structure, using the returned Length.
@@ -779,7 +779,7 @@ bool CLCDConnectionLogitech::HIDInit() detailData,
Length,
&Required,
- NULL);
+ nullptr);
// Open a handle to the device.
// To enable retrieving information about a system mouse or keyboard,
@@ -797,10 +797,10 @@ bool CLCDConnectionLogitech::HIDInit() (detailData->DevicePath,
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
- (LPSECURITY_ATTRIBUTES)NULL,
+ nullptr,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
- NULL);
+ nullptr);
/*
API function: HidD_GetAttributes
@@ -875,7 +875,7 @@ bool CLCDConnectionLogitech::HIDDeInit() return false;
CloseHandle(m_hHIDDeviceHandle);
- m_hHIDDeviceHandle = NULL;
+ m_hHIDDeviceHandle = nullptr;
return true;
}
@@ -1001,7 +1001,7 @@ void CLCDConnectionLogitech::SetVolumeWheelHook(bool bEnable) m_bVolumeWheelHook = bEnable;
if (bEnable)
- m_hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDConnectionLogitech::KeyboardHook, GetModuleHandle(NULL), 0);
+ m_hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDConnectionLogitech::KeyboardHook, GetModuleHandle(nullptr), 0);
else if (m_hKeyboardHook)
UnhookWindowsHookEx(m_hKeyboardHook);
}
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index f7bed6776c..8dfc6c98e3 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -23,13 +23,13 @@ CLCDGfx::CLCDGfx(void) {
m_nWidth = 0;
m_nHeight = 0;
- m_pBitmapInfo = NULL;
- m_hDC = NULL;
- m_hBitmap = NULL;
- m_hPrevBitmap = NULL;
- m_pBitmapBits = NULL;
- m_pLcdBitmapBits = NULL;
- m_pSavedBitmapBits = NULL;
+ m_pBitmapInfo = nullptr;
+ m_hDC = nullptr;
+ m_hBitmap = nullptr;
+ m_hPrevBitmap = nullptr;
+ m_pBitmapBits = nullptr;
+ m_pLcdBitmapBits = nullptr;
+ m_pSavedBitmapBits = nullptr;
m_bInitialized = false;
m_bTransition = false;
@@ -57,8 +57,8 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits m_nHeight = nHeight;
m_nBPP = nBPP;
- m_hDC = CreateCompatibleDC(NULL);
- if(NULL == m_hDC)
+ m_hDC = CreateCompatibleDC(nullptr);
+ if(nullptr == m_hDC)
{
TRACE(L"CLCDGfx::Initialize(): failed to create compatible DC.\n");
Shutdown();
@@ -67,7 +67,7 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD);
m_pBitmapInfo = (BITMAPINFO *) new BYTE [nBMISize];
- if(NULL == m_pBitmapInfo)
+ if(nullptr == m_pBitmapInfo)
{
TRACE(L"CLCDGfx::Initialize(): failed to allocate bitmap info.\n");
Shutdown();
@@ -97,8 +97,8 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits }
}
- m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, NULL, 0);
- if(NULL == m_hBitmap)
+ m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, nullptr, 0);
+ if(nullptr == m_hBitmap)
{
TRACE(L"CLCDGfx::Initialize(): failed to create bitmap.\n");
Shutdown();
@@ -125,26 +125,26 @@ bool CLCDGfx::Shutdown(void) {
EndTransition();
- if(NULL != m_hBitmap)
+ if(nullptr != m_hBitmap)
{
DeleteObject(m_hBitmap);
- m_hBitmap = NULL;
- m_pBitmapBits = NULL;
+ m_hBitmap = nullptr;
+ m_pBitmapBits = nullptr;
}
- ASSERT(NULL == m_hPrevBitmap);
- m_hPrevBitmap = NULL;
+ ASSERT(nullptr == m_hPrevBitmap);
+ m_hPrevBitmap = nullptr;
- if(NULL != m_pBitmapInfo)
+ if(nullptr != m_pBitmapInfo)
{
delete [] m_pBitmapInfo;
- m_pBitmapInfo = NULL;
+ m_pBitmapInfo = nullptr;
}
- if(NULL != m_hDC)
+ if(nullptr != m_hDC)
{
DeleteDC(m_hDC);
- m_hDC = NULL;
+ m_hDC = nullptr;
}
m_nWidth = 0;
@@ -159,7 +159,7 @@ bool CLCDGfx::Shutdown(void) //************************************************************************
void CLCDGfx::SetClipRegion(int iX,int iY,int iWidth,int iHeight)
{
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(nullptr != m_hPrevBitmap);
m_rClipRegion.left = iX;
m_rClipRegion.right = iX+iWidth;
@@ -184,11 +184,11 @@ RECT CLCDGfx::GetClipRegion() //************************************************************************
void CLCDGfx::BeginDraw(void)
{
- ASSERT(NULL != m_hBitmap);
- if(m_hPrevBitmap != NULL)
+ ASSERT(nullptr != m_hBitmap);
+ if(m_hPrevBitmap != nullptr)
Sleep(1);
- ASSERT(NULL == m_hPrevBitmap);
- if(NULL == m_hPrevBitmap)
+ ASSERT(nullptr == m_hPrevBitmap);
+ if(nullptr == m_hPrevBitmap)
{
m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hBitmap);
SetTextColor(m_hDC, RGB(255, 255, 255));
@@ -202,7 +202,7 @@ void CLCDGfx::BeginDraw(void) void CLCDGfx::ClearScreen(void)
{
// this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(nullptr != m_hPrevBitmap);
RECT rc = { 0, 0, m_nWidth, m_nHeight };
FillRect(m_hDC, &rc, (HBRUSH) GetStockObject(BLACK_BRUSH));
}
@@ -219,7 +219,7 @@ COLORREF CLCDGfx::GetPixel(int nX, int nY) { //************************************************************************
void CLCDGfx::SetPixel(int nX, int nY, COLORREF color) {
// this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(nullptr != m_hPrevBitmap);
::SetPixel(m_hDC, nX, nY, color);
}
@@ -241,10 +241,10 @@ void CLCDGfx::SetPixel(int nX, int nY, BYTE r, BYTE g, BYTE b) void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2)
{
// this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(nullptr != m_hPrevBitmap);
HPEN hPrevPen = (HPEN) SelectObject(m_hDC, GetStockObject(WHITE_PEN));
- ::MoveToEx(m_hDC, nX1, nY1, NULL);
+ ::MoveToEx(m_hDC, nX1, nY1, nullptr);
::LineTo(m_hDC, nX2, nY2);
SelectObject(m_hDC, hPrevPen);
}
@@ -258,7 +258,7 @@ void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2) void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight)
{
// this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(nullptr != m_hPrevBitmap);
HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
RECT r = { nX, nY, nX + nWidth, nY + nHeight };
@@ -272,7 +272,7 @@ void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight) void CLCDGfx::DrawRect(int iX, int iY, int iWidth, int iHeight)
{
// this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(nullptr != m_hPrevBitmap);
HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
@@ -355,13 +355,13 @@ void CLCDGfx::DrawBitmap(int nX, int nY,int nWidth, int nHeight, HBITMAP hBitmap //************************************************************************
void CLCDGfx::EndDraw(void)
{
- ASSERT(NULL != m_hPrevBitmap);
- if(NULL != m_hPrevBitmap)
+ ASSERT(nullptr != m_hPrevBitmap);
+ if(nullptr != m_hPrevBitmap)
{
GdiFlush();
m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hPrevBitmap);
ASSERT(m_hPrevBitmap == m_hBitmap);
- m_hPrevBitmap = NULL;
+ m_hPrevBitmap = nullptr;
}
if(m_nBPP != 1 || !m_bTransition)
@@ -486,7 +486,7 @@ void CLCDGfx::EndDraw(void) double dPixelPercent = dPercent;
memset(m_pLcdBitmapBits,0x00,m_nHeight * m_nWidth);
- SLCDPixel *pPixel = NULL;
+ SLCDPixel *pPixel = nullptr;
vector<SLCDPixel*>::iterator iter = m_LMovingPixels.begin();
int iIndex = 0,iMoved = 0;
@@ -542,7 +542,7 @@ void CLCDGfx::EndDraw(void) //************************************************************************
HDC CLCDGfx::GetHDC(void)
{
- ASSERT(NULL != m_hDC);
+ ASSERT(nullptr != m_hDC);
return m_hDC;
}
@@ -551,7 +551,7 @@ HDC CLCDGfx::GetHDC(void) //************************************************************************
BITMAPINFO *CLCDGfx::GetBitmapInfo(void)
{
- ASSERT(NULL != m_pBitmapInfo);
+ ASSERT(nullptr != m_pBitmapInfo);
return m_pBitmapInfo;
}
@@ -561,7 +561,7 @@ BITMAPINFO *CLCDGfx::GetBitmapInfo(void) HBITMAP CLCDGfx::GetHBITMAP(void)
{
- ASSERT(NULL != m_hBitmap);
+ ASSERT(nullptr != m_hBitmap);
return m_hBitmap;
}
@@ -609,8 +609,8 @@ void CLCDGfx::Cache() // Initialize pixels
if(m_eTransition == TRANSITION_MORPH)
{
- SLCDPixel *pPixel = NULL;
- SLCDPixel *pSource = NULL;
+ SLCDPixel *pPixel = nullptr;
+ SLCDPixel *pSource = nullptr;
int iIndex = 0;
bool bBreak = false;
@@ -732,7 +732,7 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) if(!m_bInitialized)
return;
- if(rect != NULL) {
+ if(rect != nullptr) {
m_rTransitionRegion.left = rect->left;
m_rTransitionRegion.right = rect->right;
m_rTransitionRegion.top = rect->top;
@@ -751,7 +751,7 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) memcpy(m_pBitmapBits,m_pLcdBitmapBits,sizeof(BYTE)*m_nWidth*m_nHeight*m_nBPP);
}
- if(m_pSavedBitmapBits == NULL)
+ if(m_pSavedBitmapBits == nullptr)
m_pSavedBitmapBits = (BYTE*)malloc(sizeof(BYTE)*m_nWidth*m_nHeight*m_nBPP);
memcpy(m_pSavedBitmapBits, m_pBitmapBits,sizeof(BYTE)* m_nWidth * m_nHeight * m_nBPP);
@@ -763,10 +763,10 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) void CLCDGfx::EndTransition()
{
- if(m_pSavedBitmapBits != NULL)
+ if(m_pSavedBitmapBits != nullptr)
free(m_pSavedBitmapBits);
- m_pSavedBitmapBits = NULL;
+ m_pSavedBitmapBits = nullptr;
if(!m_LMovingPixels.empty())
{
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp index 2a121c22c1..92723e0501 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp @@ -5,9 +5,9 @@ //************************************************************************
// CLCDInput::CLCDInput
//************************************************************************
-CLCDInput::CLCDInput() : m_hKBHook(0), m_bShowSymbols(true), m_bShowMarker(false),
+CLCDInput::CLCDInput() : m_hKBHook(nullptr), m_bShowSymbols(true), m_bShowMarker(false),
m_lInputTime(0), m_iLinePosition(0), m_iLineCount(0), m_iBreakKeys(KEYS_RETURN),
- m_lBlinkTimer(0), m_pScrollbar(NULL)
+ m_lBlinkTimer(0), m_pScrollbar(nullptr)
{
memset(&m_Marker, 0, sizeof(m_Marker));
@@ -101,7 +101,7 @@ bool CLCDInput::Draw(CLCDGfx *pGfx) int iLine = m_iLinePosition;
int iEndLine = m_iLinePosition + m_iLineCount;
int iLen = 0;
- wchar_t *pcOffset = NULL;
+ wchar_t *pcOffset = nullptr;
while(iLine < iEndLine && iLine < m_vLineOffsets.size())
{
// Calculate the text length
@@ -174,7 +174,7 @@ void CLCDInput::SetBreakKeys(int iKeys) //************************************************************************
bool CLCDInput::IsInputActive()
{
- return m_pInput != NULL;
+ return m_pInput != nullptr;
}
@@ -241,7 +241,7 @@ void CLCDInput::ActivateInput() CLCDConnection *pLCDCon = CLCDOutputManager::GetInstance()->GetLCDConnection();
pLCDCon->SetAsForeground(1);
- m_hKBHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDInput::KeyboardHook, GetModuleHandle(NULL), 0);
+ m_hKBHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDInput::KeyboardHook, GetModuleHandle(nullptr), 0);
if(!m_hKBHook)
return;
m_pInput = this;
@@ -256,9 +256,9 @@ void CLCDInput::DeactivateInput() if(!m_pInput)
return;
UnhookWindowsHookEx(m_hKBHook);
- m_hKBHook = NULL;
+ m_hKBHook = nullptr;
- m_pInput = NULL;
+ m_pInput = nullptr;
CLCDConnection *pLCDCon = CLCDOutputManager::GetInstance()->GetLCDConnection();
pLCDCon->SetAsForeground(0);
@@ -267,7 +267,7 @@ void CLCDInput::DeactivateInput() //************************************************************************
// CLCDInput::KeyboardHook
//************************************************************************
-CLCDInput* CLCDInput::m_pInput = NULL;
+CLCDInput* CLCDInput::m_pInput = nullptr;
LRESULT CALLBACK CLCDInput::KeyboardHook(int Code, WPARAM wParam, LPARAM lParam)
{
@@ -484,8 +484,8 @@ void CLCDInput::MoveMarker(int iDir,int iMove,bool bShift) else
iLen = (int)m_strText.length() - m_vLineOffsets[m_Marker[0].iLine].iOffset;
- HDC hDC = CreateCompatibleDC(NULL);
- if(NULL == hDC)
+ HDC hDC = CreateCompatibleDC(nullptr);
+ if(nullptr == hDC)
return;
SelectObject(hDC, m_hFont);
m_Marker[0].iXWidth = 1;
@@ -590,8 +590,8 @@ void CLCDInput::UpdateOffsets(int iModified) if(m_vLineOffsets.size() == 0 && m_strText.empty())
return;
- HDC hDC = CreateCompatibleDC(NULL);
- if(NULL == hDC)
+ HDC hDC = CreateCompatibleDC(nullptr);
+ if(nullptr == hDC)
return;
// Reset the marker
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp index e416be2810..3a87774f97 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp @@ -130,10 +130,10 @@ void CLCDLabel::UpdateCutOffIndex() }
// variables
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
SelectObject(hDC, m_hFont);
- if(NULL == hDC)
+ if(nullptr == hDC)
return;
int iWidth = GetWidth();
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp index cf8c680d12..a40b18d2a8 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp @@ -9,16 +9,16 @@ #include "CLCDOutputManager.h" #include <time.h> -CLCDOutputManager *CLCDOutputManager::m_pInstance = NULL; +CLCDOutputManager *CLCDOutputManager::m_pInstance = nullptr; //************************************************************************ // Constructor //************************************************************************ -CLCDOutputManager::CLCDOutputManager() : m_dwButtonRepeatDelay(300), m_pGfx(0), - m_pdwButtonRepeatTimers(0), m_pdwButtonRepeatStarts(0), m_pbButtonStates(0), - m_pLcdConnection(0), m_bInitialized(false), m_dwLastUpdate(0), m_pActiveScreen(NULL) +CLCDOutputManager::CLCDOutputManager() : m_dwButtonRepeatDelay(300), m_pGfx(nullptr), + m_pdwButtonRepeatTimers(nullptr), m_pdwButtonRepeatStarts(nullptr), m_pbButtonStates(nullptr), + m_pLcdConnection(nullptr), m_bInitialized(false), m_dwLastUpdate(0), m_pActiveScreen(nullptr) { - ASSERT(m_pInstance == NULL); + ASSERT(m_pInstance == nullptr); m_pInstance = this; m_strAppletName = L""; @@ -29,7 +29,7 @@ CLCDOutputManager::CLCDOutputManager() : m_dwButtonRepeatDelay(300), m_pGfx(0), //************************************************************************ CLCDOutputManager::~CLCDOutputManager() { - m_pInstance = NULL; + m_pInstance = nullptr; } //************************************************************************ @@ -37,7 +37,7 @@ CLCDOutputManager::~CLCDOutputManager() //************************************************************************ CLCDOutputManager* CLCDOutputManager::GetInstance() { - ASSERT(m_pInstance != NULL); + ASSERT(m_pInstance != nullptr); return m_pInstance; } @@ -47,7 +47,7 @@ CLCDOutputManager* CLCDOutputManager::GetInstance() //************************************************************************ CLCDConnection *CLCDOutputManager::GetLCDConnection() { - ASSERT(m_pLcdConnection != NULL); + ASSERT(m_pLcdConnection != nullptr); return m_pLcdConnection; } @@ -64,7 +64,7 @@ CLCDScreen *CLCDOutputManager::GetActiveScreen() //************************************************************************ bool CLCDOutputManager::Initialize(tstring strAppletName,bool bAutostart, bool bConfigDialog) { - srand ( time(NULL) ); + srand ( time(nullptr) ); InitDebug(); @@ -96,8 +96,8 @@ bool CLCDOutputManager::IsInitialized() //************************************************************************ bool CLCDOutputManager::Shutdown() { - ASSERT(NULL != m_pLcdConnection); - ASSERT(NULL != m_pGfx); + ASSERT(nullptr != m_pLcdConnection); + ASSERT(nullptr != m_pGfx); // Shutdown all screens vector<CLCDScreen*>::iterator iter = m_Screens.begin(); @@ -194,7 +194,7 @@ bool CLCDOutputManager::Update() ASSERT(m_bInitialized); // Update the active screen - if(m_pActiveScreen != NULL) + if(m_pActiveScreen != nullptr) { m_pActiveScreen->Update(); // Check if the active screen has expired @@ -256,7 +256,7 @@ bool CLCDOutputManager::Update() // Draw - if(m_pActiveScreen != NULL && m_pGfx->IsInitialized()) + if(m_pActiveScreen != nullptr && m_pGfx->IsInitialized()) { m_pGfx->BeginDraw(); m_pGfx->ClearScreen(); @@ -278,11 +278,11 @@ bool CLCDOutputManager::Update() //************************************************************************ bool CLCDOutputManager::DeactivateScreen() { - if(m_pActiveScreen == NULL) + if(m_pActiveScreen == nullptr) return false; CLCDScreen *pActiveScreen = m_pActiveScreen; - m_pActiveScreen = NULL; + m_pActiveScreen = nullptr; if(pActiveScreen->HasExpired()) { @@ -306,7 +306,7 @@ bool CLCDOutputManager::ActivateScreen(CLCDScreen *pScreen) return false; // If another screen is currently active, deactivate it - if(m_pActiveScreen != NULL) + if(m_pActiveScreen != nullptr) DeactivateScreen(); m_pActiveScreen = pScreen; diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp index d599220b69..9373977239 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp @@ -72,7 +72,7 @@ bool CLCDScreen::Update() {
// Loop through all objects and call their update function
vector<CLCDObject*>::iterator iter = m_Objects.begin();
- CLCDObject *pObject = NULL;
+ CLCDObject *pObject = nullptr;
while(iter != m_Objects.end())
{
pObject = *(iter);
@@ -91,7 +91,7 @@ bool CLCDScreen::Draw(CLCDGfx *pGfx) POINT ptPrevViewportOrg = { 0, 0 };
// Loop through all objects and call their draw function
vector<CLCDObject*>::iterator iter = m_Objects.begin();
- CLCDObject *pObject = NULL;
+ CLCDObject *pObject = nullptr;
while(iter != m_Objects.end())
{
pObject = *(iter);
@@ -126,13 +126,13 @@ bool CLCDScreen::Draw(CLCDGfx *pGfx) iter++;
}
// set the clipping region to nothing
- SelectClipRgn(pGfx->GetHDC(), NULL);
+ SelectClipRgn(pGfx->GetHDC(), nullptr);
// restore the viewport origin
SetViewportOrgEx(pGfx->GetHDC(),
0,
0,
- NULL);
+ nullptr);
return true;
}
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp index bbb9b689df..7c8ec5ca69 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp @@ -12,7 +12,7 @@ CLCDTextLog::CLCDTextLog() m_iLogSize = 10;
m_iPosition = 0;
m_iTextLines = 0;
- m_pScrollbar = NULL;
+ m_pScrollbar = nullptr;
m_eExpandMode = EXPAND_SCROLL;
m_eAutoScroll = SCROLL_MESSAGE;
m_iLastScrollDirection = 0;
@@ -78,7 +78,7 @@ bool CLCDTextLog::Draw(CLCDGfx *pGfx) int iSpacing = (GetHeight() - iLineCount*m_iFontHeight)/2;
list<CLogEntry*>::iterator iter = m_Entrys.begin();
- CLogEntry *pEntry = NULL;
+ CLogEntry *pEntry = nullptr;
RECT rBoundary = { 0, iSpacing,GetWidth() , GetHeight()-iSpacing};
int iPosition = 0;
int iLinesDrawn = 0;
@@ -291,10 +291,10 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) pEntry->vLines.clear();
tstring strString = pEntry->strString;
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
SelectObject(hDC, m_hFont);
- if(NULL == hDC)
+ if(nullptr == hDC)
return;
int iLen = (int)strString.size();
@@ -422,7 +422,7 @@ void CLCDTextLog::RefreshLines() m_iTextLines = 0;
- CLogEntry *pEntry = NULL;
+ CLogEntry *pEntry = nullptr;
list<CLogEntry*>::iterator iter = m_Entrys.begin();
while(iter != m_Entrys.end())
{
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp index 236cefc71b..01026cf43d 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp @@ -6,7 +6,7 @@ //************************************************************************
// constructor
//************************************************************************
-CLCDTextObject::CLCDTextObject() : m_bWordWrap(false), m_hFont(NULL), m_iFontHeight(0)
+CLCDTextObject::CLCDTextObject() : m_bWordWrap(false), m_hFont(nullptr), m_iFontHeight(0)
{
// Initialize DRAWTEXTPARAMS
memset(&m_dtp, 0, sizeof(DRAWTEXTPARAMS));
@@ -32,7 +32,7 @@ CLCDTextObject::~CLCDTextObject() bool CLCDTextObject::Initialize()
{
m_hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
- if(NULL != m_hFont)
+ if(nullptr != m_hFont)
{
SetFontFaceName(L"Small Fonts");
SetFontPointSize(6);
@@ -72,7 +72,7 @@ bool CLCDTextObject::SetFont(LOGFONT& lf) if (m_hFont)
{
DeleteObject(m_hFont);
- m_hFont = NULL;
+ m_hFont = nullptr;
}
m_hFont = CreateFontIndirect(&lf);
@@ -81,7 +81,7 @@ bool CLCDTextObject::SetFont(LOGFONT& lf) return false;
// Calculate the font's height
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
SelectObject(hDC, m_hFont);
TEXTMETRIC tmFontInfo;
diff --git a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp Binary files differindex c9b7c2689c..88b2510e1f 100644 --- a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp +++ b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp diff --git a/plugins/MirandaG15/src/LCDFramework/misc.cpp b/plugins/MirandaG15/src/LCDFramework/misc.cpp index d71597c745..f3397cd7ee 100644 --- a/plugins/MirandaG15/src/LCDFramework/misc.cpp +++ b/plugins/MirandaG15/src/LCDFramework/misc.cpp @@ -36,14 +36,14 @@ BOOL IsUnicodeAscii(const wchar_t* pBuffer, int nSize) wstring
toWideString( const char* pStr , int len )
{
- if ( pStr == NULL )
+ if ( pStr == nullptr )
return L"" ;
//ASSERT_PTR( pStr ) ;
ASSERT( len >= 0 || len == -1);
// figure out how many wide characters we are going to get
- int nChars = MultiByteToWideChar( CP_ACP , 0 , pStr , len , NULL , 0 ) ;
+ int nChars = MultiByteToWideChar( CP_ACP , 0 , pStr , len , nullptr , 0 ) ;
if ( len == -1 )
-- nChars ;
if ( nChars == 0 )
@@ -69,7 +69,7 @@ toNarrowString( const wchar_t* pStr , int len ) // figure out how many narrow characters we are going to get
int nChars = WideCharToMultiByte( CP_ACP , 0 ,
- pStr , len , NULL , 0 , NULL , NULL ) ;
+ pStr , len , nullptr , 0 , nullptr , nullptr ) ;
if ( len == -1 )
-- nChars ;
if ( nChars == 0 )
@@ -81,7 +81,7 @@ toNarrowString( const wchar_t* pStr , int len ) buf.resize( nChars ) ;
//char *test = (char*)malloc((nChars+1)*sizeof(char));
WideCharToMultiByte( CP_ACP , 0 , pStr , len ,
- const_cast<char*>(buf.c_str()), nChars , NULL , NULL ) ;
+ const_cast<char*>(buf.c_str()), nChars , nullptr , nullptr ) ;
return buf ;
}
@@ -112,14 +112,14 @@ tstring Utf8_Decode(const char *str) int i;
char *p;
- WCHAR *wszTemp = NULL;
+ WCHAR *wszTemp = nullptr;
- if (str == NULL)
+ if (str == nullptr)
return strRes;
size_t len = mir_strlen(str);
- if ((wszTemp = (WCHAR *) malloc(sizeof(wchar_t) * (len + 2))) == NULL)
+ if ((wszTemp = (WCHAR *) malloc(sizeof(wchar_t) * (len + 2))) == nullptr)
return strRes;
p = (char *) str;
@@ -154,11 +154,11 @@ string Utf8_Encode(const WCHAR *str) {
string strRes = "";
- unsigned char *szOut = NULL;
+ unsigned char *szOut = nullptr;
int len, i;
const WCHAR *wszTemp, *w;
- if (str == NULL)
+ if (str == nullptr)
return strRes;
wszTemp = str;
@@ -171,7 +171,7 @@ string Utf8_Encode(const WCHAR *str) else len += 3;
}
- if ((szOut = (unsigned char *) malloc(len + 2)) == NULL)
+ if ((szOut = (unsigned char *) malloc(len + 2)) == nullptr)
return strRes;
i = 0;
diff --git a/plugins/MirandaG15/src/Miranda.cpp b/plugins/MirandaG15/src/Miranda.cpp index 9c447d28e3..7da57367f3 100644 --- a/plugins/MirandaG15/src/Miranda.cpp +++ b/plugins/MirandaG15/src/Miranda.cpp @@ -163,7 +163,7 @@ int Init(WPARAM, LPARAM) if(CConfig::GetBoolSetting(SKIP_DRIVER_ERROR)) {
tstring text = L"Failed to initialize the LCD connection\n Make sure you have the newest Logitech drivers installed (>=1.03).\n";
tstring title = _A2W(APP_SHORTNAME);
- MessageBox(NULL, text.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
+ MessageBox(nullptr, text.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
}
TRACE(L"Initialization failed!.\n");
diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp index 37dcf57c94..371a802cce 100644 --- a/plugins/MobileState/src/main.cpp +++ b/plugins/MobileState/src/main.cpp @@ -21,7 +21,7 @@ HINSTANCE g_hInst;
int hLangpack;
-HANDLE hExtraIcon = NULL;
+HANDLE hExtraIcon = nullptr;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index 1b60c02fa9..f9bc4d51f1 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -86,7 +86,7 @@ void popupMessage(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) ppd.colorText = options.FG[indx];
ppd.iSeconds = options.Timeout[indx];
- ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(iIcon), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(nullptr, MAKEINTRESOURCE(iIcon), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, LR_SHARED);
mir_wstrcpy(ppd.lptzContactName, lpCaption);
mir_wstrcpy(ppd.lptzText, lpText);
PUAddPopupT(&ppd);
@@ -112,7 +112,7 @@ void HookOnImport(HMODULE hModule, char *lpszImpModName, PVOID lpOrigFunc, PVOID ULONG ulSize;
PIMAGE_IMPORT_DESCRIPTOR pImportDesc = (PIMAGE_IMPORT_DESCRIPTOR)
ImageDirectoryEntryToData(hModule, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &ulSize);
- if (pImportDesc == NULL)
+ if (pImportDesc == nullptr)
return;
for (; pImportDesc->Name; pImportDesc++) {
@@ -136,14 +136,14 @@ void HookOnImport(HMODULE hModule, char *lpszImpModName, PVOID lpOrigFunc, PVOID g_HookError = TRUE;
mir_snwprintf(buf, TranslateT("VirtualProtect failed. Code %d\nTry to call the author"), GetLastError());
- prevMessageBox(0, buf, TranslateT("Error"), MB_OK);
+ prevMessageBox(nullptr, buf, TranslateT("Error"), MB_OK);
}
}
*(PVOID*)ppfn = lpNewFunc;
if (*(PVOID*)ppfn != lpNewFunc) {
if (!g_HookError2) {
g_HookError2 = TRUE;
- prevMessageBox(0, TranslateT("Hmm. Something goes wrong. I can't write into the memory.\nAnd as you can see, there are no any exception raised...\nTry to call the author"), TranslateT("Error"), MB_OK);
+ prevMessageBox(nullptr, TranslateT("Hmm. Something goes wrong. I can't write into the memory.\nAnd as you can see, there are no any exception raised...\nTry to call the author"), TranslateT("Error"), MB_OK);
}
}
}
diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp index 0698089b72..b8883e91db 100644 --- a/plugins/MsgPopup/src/options.cpp +++ b/plugins/MsgPopup/src/options.cpp @@ -54,10 +54,10 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l case WM_COMMAND:
if (LOWORD(wParam) == IDC_PREVIEW) {
- MessageBox(0, TranslateT("Message with question"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONQUESTION);
- MessageBox(0, TranslateT("Message with exclamation"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONEXCLAMATION);
- MessageBox(0, TranslateT("Message with error"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONSTOP);
- MessageBox(0, TranslateT("Message with asterisk"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONASTERISK);
+ MessageBox(nullptr, TranslateT("Message with question"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONQUESTION);
+ MessageBox(nullptr, TranslateT("Message with exclamation"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONEXCLAMATION);
+ MessageBox(nullptr, TranslateT("Message with error"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("Message with asterisk"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONASTERISK);
return FALSE;
}
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index c826b6283a..434e1b025a 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -35,7 +35,7 @@ bool bUseIntViewer = true; tstring sFileViewerPrg;
// handle to the RichEditDll. We need to load this dll to use a RichEdit.
-HMODULE hRichEditDll = NULL;
+HMODULE hRichEditDll = nullptr;
#define CONT(i) ((in[i]&0xc0) == 0x80)
@@ -115,7 +115,7 @@ public: CLHistoryDlg(MCONTACT hContact) : hContact(hContact)
{
- hFindDlg = NULL;
+ hFindDlg = nullptr;
acFindStr[0] = 0;
memset(&fr, 0, sizeof(fr));
fr.lStructSize = sizeof(fr);
@@ -203,7 +203,7 @@ int CLStreamRTFInfo::nWriteHeader(char *pszTarget, int nLen) if (nSrcLen > nLen)
{
- MessageBox(NULL, TranslateT("Failed to write to the Rich Edit the buffer was to small."), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, TranslateT("Failed to write to the Rich Edit the buffer was to small."), MSG_BOX_TITEL, MB_OK);
return 0; // target buffer to small
}
@@ -236,14 +236,14 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) if (nOptimalReadLen < 500)
{
- MessageBox(NULL, TranslateT("Error: Optimal buffer size decreased to a too low size!"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, TranslateT("Error: Optimal buffer size decreased to a too low size!"), MSG_BOX_TITEL, MB_OK);
return 0;
}
DWORD dwRead;
DWORD dwToRead = nOptimalReadLen;
- if (!ReadFile(hFile, abBuf, dwToRead, &dwRead, (LPOVERLAPPED)NULL))
+ if (!ReadFile(hFile, abBuf, dwToRead, &dwRead, (LPOVERLAPPED)nullptr))
return 0;
DWORD dwCurrent = 0;
@@ -293,7 +293,7 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) // and rewinde file
// we will adjust the optima buffer size
nOptimalReadLen -= 50;
- SetFilePointer(hFile, n - dwRead, NULL, FILE_CURRENT);
+ SetFilePointer(hFile, n - dwRead, nullptr, FILE_CURRENT);
return dwCurrent;
}
@@ -326,8 +326,8 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) LONG lExtraRead = (n + 1) - dwRead;
if (lExtraRead >= 0)
- MessageBox(NULL, TranslateT("Internal error! (lExtraRead >= 0)"), MSG_BOX_TITEL, MB_OK);
- SetFilePointer(hFile, lExtraRead, NULL, FILE_CURRENT);
+ MessageBox(nullptr, TranslateT("Internal error! (lExtraRead >= 0)"), MSG_BOX_TITEL, MB_OK);
+ SetFilePointer(hFile, lExtraRead, nullptr, FILE_CURRENT);
bCheckFirstForNick = true;
return dwCurrent;
}
@@ -370,7 +370,7 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) int nValue;
int nLen = __utf8_get_char((const char *)&abBuf[n], &nValue);
if (nLen + n > dwRead) {
- SetFilePointer(hFile, n - dwRead, NULL, FILE_CURRENT);
+ SetFilePointer(hFile, n - dwRead, nullptr, FILE_CURRENT);
break;
}
dwCurrent += sprintf((char*)&pbBuff[dwCurrent], "\\u%d?", nValue); //!!!!!!!!!
@@ -456,7 +456,7 @@ bool bOpenExternaly(MCONTACT hContact) SHELLEXECUTEINFO st = { 0 };
st.cbSize = sizeof(st);
st.fMask = SEE_MASK_INVOKEIDLIST;
- st.hwnd = NULL;
+ st.hwnd = nullptr;
st.lpFile = sPath.c_str();
st.nShow = SW_SHOWDEFAULT;
ShellExecuteEx(&st);
@@ -470,16 +470,16 @@ bool bOpenExternaly(MCONTACT hContact) STARTUPINFO sStartupInfo = { 0 };
GetStartupInfo(&sStartupInfo); // we parse oure owne info on
sStartupInfo.lpTitle = (wchar_t*)sFileViewerPrg.c_str();
- PROCESS_INFORMATION stProcesses = { 0 };
+ PROCESS_INFORMATION stProcesses = {};
- if (!CreateProcess(NULL,
+ if (!CreateProcess(nullptr,
(wchar_t*)sTmp.c_str(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
FALSE,
CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&sStartupInfo,
&stProcesses))
{
@@ -554,7 +554,7 @@ bool bUseInternalViewer(bool bNew) DWORD CALLBACK RichEditStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
- ReadFile((HANDLE)dwCookie, pbBuff, (DWORD)cb, (DWORD *)pcb, (LPOVERLAPPED)NULL);
+ ReadFile((HANDLE)dwCookie, pbBuff, (DWORD)cb, (DWORD *)pcb, (LPOVERLAPPED)nullptr);
return (DWORD)(*pcb >= 0 ? NOERROR : (*pcb = 0, E_FAIL));
}
@@ -568,7 +568,7 @@ DWORD CALLBACK RichEditRTFStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG DWORD CALLBACK RichEditStreamSaveFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
- WriteFile((HANDLE)dwCookie, pbBuff, cb, (DWORD*)pcb, (LPOVERLAPPED)NULL);
+ WriteFile((HANDLE)dwCookie, pbBuff, cb, (DWORD*)pcb, (LPOVERLAPPED)nullptr);
return *pcb != cb;
}
@@ -614,8 +614,8 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) }
HANDLE hFile = CreateFile(pclDlg->sPath.c_str(), GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
int nDBCount = db_event_count(pclDlg->hContact);
wchar_t szTmp[1500];
@@ -707,7 +707,7 @@ bool bAdvancedCopy(HWND hwnd) int nSelLenght = sSelectRange.cpMax - sSelectRange.cpMin + 1; // +1 for null termination
if (nSelLenght > 1)
{
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
EmptyClipboard();
wchar_t *pszSrcBuf = new wchar_t[nSelLenght];
@@ -775,7 +775,7 @@ LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)dwEnd);
ClientToScreen(hwnd, &pt);
}
- TrackPopupMenu(nSubMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, 0);
+ TrackPopupMenu(nSubMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(nSubMenu);
DestroyMenu(nMenu);
@@ -807,7 +807,7 @@ LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (msg == UM_FIND_CMD) {
FINDREPLACE *fr = (FINDREPLACE*)lParam;
if (fr->Flags & FR_DIALOGTERM) {
- pclDlg->hFindDlg = NULL;
+ pclDlg->hFindDlg = nullptr;
return 0;
}
@@ -861,7 +861,7 @@ void SetWindowsCtrls(HWND hwndDlg) GetWindowRect(hButton, &rCurSize);
int nButtonHeight = rCurSize.bottom - rCurSize.top;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_RICHEDIT), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_RICHEDIT), nullptr,
nSpacing, nSpacing,
rNewSize.right - (nSpacing * 2),
rNewSize.bottom - (nSpacing * 3 + nButtonHeight),
@@ -872,17 +872,17 @@ void SetWindowsCtrls(HWND hwndDlg) int nButtonTop = rNewSize.bottom - (nSpacing + nButtonHeight);
int nCurLeft = nButtonSpace;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_FV_FIND), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_FV_FIND), nullptr,
nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
nCurLeft += nButtonSpace + nButtonWidth;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_FV_EXTERNAL), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_FV_EXTERNAL), nullptr,
nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
nCurLeft += nButtonSpace + nButtonWidth;
- SetWindowPos(hButton, 0, nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hButton, nullptr, nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
@@ -952,9 +952,9 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hRichEdit, EM_AUTOURLDETECT, TRUE, 0);
HMENU hSysMenu = GetSystemMenu(hwndDlg, FALSE);
- InsertMenu(hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, 0);
+ InsertMenu(hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr);
InsertMenu(hSysMenu, 0, MF_STRING | MF_BYPOSITION, ID_FV_SAVE_AS_RTF, LPGENW("Save as RTF"));
- InsertMenu(hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, 0);
+ InsertMenu(hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr);
BYTE bUseCC = (BYTE)db_get_b(NULL, MODULE, szFileViewDB "UseCC", 0);
InsertMenu(hSysMenu, 0, MF_STRING | MF_BYPOSITION | (bUseCC ? MF_CHECKED : 0), ID_FV_COLOR, LPGENW("Color..."));
@@ -1104,7 +1104,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, tstring sFile = pclDlg->sPath;
sFile += L".rtf";
HANDLE hFile = CreateFile(sFile.c_str(), GENERIC_WRITE,
- FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
DisplayLastError(LPGENW("Failed to create file"));
@@ -1124,7 +1124,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, CloseHandle(hFile);
tstring sReport = TranslateT("History was saved successfully in file\r\n");
sReport += sFile;
- MessageBox(NULL, sReport.c_str(), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, sReport.c_str(), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
return FALSE;
@@ -1201,7 +1201,7 @@ bool bShowFileViewer(MCONTACT hContact) }
CLHistoryDlg *pcl = new CLHistoryDlg(hContact);
- pcl->hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_FILE_VIEWER), NULL, DlgProcFileViewer, (LPARAM)pcl);
+ pcl->hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_FILE_VIEWER), nullptr, DlgProcFileViewer, (LPARAM)pcl);
if (pcl->hWnd) {
mir_cslock lck(csHistoryList);
clHistoryDlgList.push_front(pcl);
diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 379d25f4ec..e4b7fcaf51 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -19,10 +19,10 @@ #include "stdafx.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hInstance = NULL;
+HINSTANCE hInstance = nullptr;
int hLangpack = 0;
-MWindowList hInternalWindowList = NULL;
+MWindowList hInternalWindowList = nullptr;
/////////////////////////////////////////////////////
// Remember to update the Version in the resource !!!
@@ -208,7 +208,7 @@ extern "C" __declspec(dllexport) int Load() enRenameAction = (ENDialogAction)db_get_b(NULL, MODULE, "RenameAction", enRenameAction);
enDeleteAction = (ENDialogAction)db_get_b(NULL, MODULE, "DeleteAction", enDeleteAction);
- HANDLE hServiceFunñ = 0;
+ HANDLE hServiceFunñ = nullptr;
if (bReplaceHistory)
hServiceFunñ = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowExportHistory); //this need new code
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 8f5eb3ea6a..51b53fe797 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -177,7 +177,7 @@ void exportContactsMessages(void *p) }
SendMessage(hProg, PBM_SETPOS, nCur, 0);
- RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
+ RedrawWindow(hDlg, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW);
nCur++;
}
@@ -204,7 +204,7 @@ void exportContactsMessages(void *p) wstring sFilePath = FileIterator->first;
HANDLE hFile = openCreateFile(sFilePath);
if (hFile == INVALID_HANDLE_VALUE) {
- DisplayErrorDialog(LPGENW("Failed to open or create file :\n"), sFilePath, NULL);
+ DisplayErrorDialog(LPGENW("Failed to open or create file :\n"), sFilePath, nullptr);
continue;
}
@@ -226,7 +226,7 @@ void exportContactsMessages(void *p) CloseHandle(hFile);
SendMessage(hProg, PBM_SETPOS, ++nCur, 0);
- RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
+ RedrawWindow(hDlg, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW);
}
SendMessage(hDlg, WM_CLOSE, 0, 1);
@@ -287,7 +287,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected) }
// Create progress dialog
- HWND hDlg = data->hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), NULL, DialogProc);
+ HWND hDlg = data->hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), nullptr, DialogProc);
ShowWindow(hDlg, SW_SHOWNORMAL);
// Process the export in other thread
@@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar LVITEM sItem = { 0 };
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
- if (pa == NULL)
+ if (pa == nullptr)
continue;
sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
@@ -842,11 +842,11 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar BROWSEINFO sBrowseInfo;
sBrowseInfo.hwndOwner = hwndDlg;
- sBrowseInfo.pidlRoot = NULL;
+ sBrowseInfo.pidlRoot = nullptr;
sBrowseInfo.pszDisplayName = lpDestDir;
sBrowseInfo.lpszTitle = TranslateT("Select Destination Directory");
sBrowseInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX;
- sBrowseInfo.lpfn = NULL;
+ sBrowseInfo.lpfn = nullptr;
sBrowseInfo.lParam = 0;
sBrowseInfo.iImage = 0;
@@ -899,7 +899,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar }
TranslateMenu(hMenu);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndDlg, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndDlg, nullptr);
DestroyMenu(hMainMenu);
}
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index d56a396bfb..7062447709 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -120,7 +120,7 @@ void ShowDebugInfo() sDebug += L"\r\nGetFilePathFromUser(NULL) :";
sDebug += GetFilePathFromUser(NULL);
- MessageBox(NULL, sDebug.c_str(), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, sDebug.c_str(), MSG_BOX_TITEL, MB_OK);
}
@@ -168,12 +168,12 @@ tstring sGetErrorString(DWORD dwError) LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
+ nullptr,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR)&lpMsgBuf,
0,
- NULL);
+ nullptr);
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
@@ -201,7 +201,7 @@ void DisplayLastError(const wchar_t *pszError) mir_snwprintf(szTemp, L"\r\nErrorCode: %d\r\n", error);
sError += szTemp;
sError += sGetErrorString(error);
- MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, sError.c_str(), MSG_BOX_TITEL, MB_OK);
}
/////////////////////////////////////////////////////////////////////
@@ -227,7 +227,7 @@ tstring _DBGetStringW(MCONTACT hContact, const char *szModule, const char *szSet //db_get
if (!db_get_ws(hContact, szModule, szSetting, &dbv)) {
if (dbv.type != DBVT_WCHAR) {
- MessageBox(NULL, TranslateT("Database: Attempt to get wrong type of value, string"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, TranslateT("Database: Attempt to get wrong type of value, string"), MSG_BOX_TITEL, MB_OK);
ret = pszError;
}
else ret = (wchar_t*)dbv.pszVal;
@@ -244,7 +244,7 @@ string _DBGetStringA(MCONTACT hContact, const char *szModule, const char *szSett DBVARIANT dbv = { 0 };
if (!db_get(hContact, szModule, szSetting, &dbv)) {
if (dbv.type != DBVT_ASCIIZ) {
- MessageBox(NULL, TranslateT("Database: Attempt to get wrong type of value, string"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, TranslateT("Database: Attempt to get wrong type of value, string"), MSG_BOX_TITEL, MB_OK);
ret = pszError;
}
else ret = dbv.pszVal;
@@ -309,7 +309,7 @@ bool bCreatePathToFile(tstring sFilePath) return false;
// create directory
- if (!CreateDirectory(sFilePath.c_str(), NULL)) {
+ if (!CreateDirectory(sFilePath.c_str(), nullptr)) {
DWORD dwE = GetLastError();
if (dwE == 183) // Cannot create a file when that file already exists.
return true;
@@ -318,7 +318,7 @@ bool bCreatePathToFile(tstring sFilePath) return false;
// try again
- if (!CreateDirectory(sFilePath.c_str(), NULL))
+ if (!CreateDirectory(sFilePath.c_str(), nullptr))
return false;
}
return true;
@@ -345,7 +345,7 @@ bool bWriteToFile(HANDLE hFile, const char *pszSrc, int nLen = -1) nLen = (int)mir_strlen(pszSrc);
DWORD dwBytesWritten;
- return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen);
+ return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, nullptr) && (dwBytesWritten == (DWORD)nLen);
}
@@ -537,7 +537,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) // Here we will try to avoide the (Unknown Contact) in cases where the protocol for
// this user has been removed.
- if (bNickUsed && (wcsstr(pcli->pfnGetContactDisplayName(hContact, 0), LPGENW("(Unknown Contact)")) != 0))
+ if (bNickUsed && (wcsstr(pcli->pfnGetContactDisplayName(hContact, 0), LPGENW("(Unknown Contact)")) != nullptr))
return sPrevFileName; // Then the filename must have changed from a correct path to one including the (Unknown Contact)
// file name has changed
@@ -548,10 +548,10 @@ tstring GetFilePathFromUser(MCONTACT hContact) HANDLE hPrevFile = CreateFile(sPrevFileName.c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
+ nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
- NULL);
+ nullptr);
if (hPrevFile != INVALID_HANDLE_VALUE) {
CloseHandle(hPrevFile);
@@ -567,7 +567,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) sRemoteUser.c_str(),
sPrevFileName.c_str(),
sFilePath.c_str());
- bTryRename = MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES;
+ bTryRename = MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES;
}
else
bTryRename = true;
@@ -586,7 +586,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) sFilePath.c_str(),
sGetErrorString().c_str());
- if (MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_RETRYCANCEL) != IDRETRY)
+ if (MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_RETRYCANCEL) != IDRETRY)
break;
}
}
@@ -818,7 +818,7 @@ void DisplayErrorDialog(const wchar_t *pszError, tstring& sFilePath, DBEVENTINFO sError += sGetErrorString();
sError += TranslateT("\nMessage has not been saved!\n");
sError += TranslateT("Do you wish to save debug information?");
- if (MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, sError.c_str(), MSG_BOX_TITEL, MB_YESNO) == IDYES) {
OPENFILENAME ofn; // common dialog box structure
wchar_t szFile[260]; // buffer for file name
mir_wstrcpy(szFile, L"DebugInfo.txt");
@@ -831,18 +831,18 @@ void DisplayErrorDialog(const wchar_t *pszError, tstring& sFilePath, DBEVENTINFO ofn.nMaxFile = _countof(szFile);
ofn.lpstrFilter = TranslateT("All\0*.*\0Text\0*.TXT\0\0");
ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
+ ofn.lpstrInitialDir = nullptr;
ofn.Flags = 0 /*OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST*/;
ofn.lpstrDefExt = L"TXT";
// Display the Open dialog box.
if (GetSaveFileName(&ofn)) {
HANDLE hf = CreateFile(ofn.lpstrFile, GENERIC_WRITE,
- 0, (LPSECURITY_ATTRIBUTES)NULL,
+ 0, (LPSECURITY_ATTRIBUTES)nullptr,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
- (HANDLE)NULL); // file handle
+ (HANDLE)nullptr); // file handle
bWriteTextToFile(hf, sError.c_str(), false);
if (dbei) {
@@ -911,14 +911,14 @@ bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, tstring sFilePath, DBEVE if (dwLowSize == INVALID_FILE_SIZE || dwLowSize != 0 || dwHighSize != 0) {
DWORD dwDataRead = 0;
BYTE ucByteOrder[3];
- if (ReadFile(hFile, ucByteOrder, 3, &dwDataRead, NULL))
+ if (ReadFile(hFile, ucByteOrder, 3, &dwDataRead, nullptr))
bWriteUTF8Format = bIsUtf8Header(ucByteOrder);
- DWORD dwPtr = SetFilePointer(hFile, 0, 0, FILE_END);
+ DWORD dwPtr = SetFilePointer(hFile, 0, nullptr, FILE_END);
if (dwPtr == INVALID_SET_FILE_POINTER) {
// we need to aborte mission here because if we continue we risk
// overwriting old log.
- DisplayErrorDialog(LPGENW("Failed to move to the end of the file :\n"), sFilePath, NULL);
+ DisplayErrorDialog(LPGENW("Failed to move to the end of the file :\n"), sFilePath, nullptr);
return false;
}
}
@@ -926,7 +926,7 @@ bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, tstring sFilePath, DBEVE bWriteUTF8Format = bUseUtf8InNewFiles;
if (bWriteUTF8Format) {
if (!bWriteToFile(hFile, szUtf8ByteOrderHeader, sizeof(szUtf8ByteOrderHeader) - 1)) {
- DisplayErrorDialog(LPGENW("Failed to UTF8 byte order code to file :\n"), sFilePath, NULL);
+ DisplayErrorDialog(LPGENW("Failed to UTF8 byte order code to file :\n"), sFilePath, nullptr);
return false;
}
}
@@ -970,7 +970,7 @@ bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, tstring sFilePath, DBEVE ReplaceAll(output, L"%Gender%", szTemp);
if (!bWriteTextToFile(hFile, output.data(), bWriteUTF8Format, (int)output.size())) {
- DisplayErrorDialog(LPGENW("Failed to write user details to file :\n"), sFilePath, NULL);
+ DisplayErrorDialog(LPGENW("Failed to write user details to file :\n"), sFilePath, nullptr);
return false;
}
}
@@ -990,7 +990,7 @@ bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, tstring sFilePath, DBEVE return false;
}
- if (dbei.pBlob != NULL && dbei.cbBlob >= 2) {
+ if (dbei.pBlob != nullptr && dbei.cbBlob >= 2) {
dbei.pBlob[dbei.cbBlob] = 0;
switch (dbei.eventType) {
@@ -1195,12 +1195,12 @@ HANDLE openCreateFile(tstring sFilePath) {
GetLastError();// Clear last error !!
- HANDLE hFile = CreateFile(sFilePath.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(sFilePath.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
// this might be because the path isent created
// so we will try to create it
if (bCreatePathToFile(sFilePath)) {
- hFile = CreateFile(sFilePath.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hFile = CreateFile(sFilePath.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
}
}
@@ -1230,7 +1230,7 @@ int nExportEvent(WPARAM hContact, LPARAM hDbEvent) tstring sFilePath = GetFilePathFromUser(hContact);
HANDLE hFile = openCreateFile(sFilePath);
if (hFile == INVALID_HANDLE_VALUE) {
- DisplayErrorDialog(LPGENW("Failed to open or create file :\n"), sFilePath, NULL);
+ DisplayErrorDialog(LPGENW("Failed to open or create file :\n"), sFilePath, nullptr);
return 0;
}
@@ -1299,7 +1299,7 @@ bool bWriteIndentedToFile(HANDLE hFile, int nIndent, const char *pszSrc, bool bU bool bWriteIndentedToFile(HANDLE hFile, int nIndent, const wchar_t *pszSrc, bool bUtf8File)
{
- if (pszSrc == NULL)
+ if (pszSrc == nullptr)
return true;
bool bOk = true;
@@ -1358,7 +1358,7 @@ bool bWriteIndentedToFile(HANDLE hFile, int nIndent, const wchar_t *pszSrc, bool if (pszPrev == pszSrc) {
// this is an programming error we have not moved forward in string
- MessageBox(NULL, L"Programming error on line __LINE__ please report this", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, L"Programming error on line __LINE__ please report this", MSG_BOX_TITEL, MB_OK);
break;
}
}
@@ -1403,10 +1403,10 @@ int nContactDeleted(WPARAM wparam, LPARAM /*lparam*/) HANDLE hPrevFile = CreateFile(sFilePath.c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
+ nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
- NULL);
+ nullptr);
if (hPrevFile != INVALID_HANDLE_VALUE) {
CloseHandle(hPrevFile);
@@ -1416,7 +1416,7 @@ int nContactDeleted(WPARAM wparam, LPARAM /*lparam*/) TranslateT("User has been deleted. Do you want to delete the file?"), sFilePath.c_str());
if (enDeleteAction == eDAAutomatic ||
- MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES) {
+ MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES) {
if (!DeleteFile(sFilePath.c_str())) {
mir_snwprintf(szTemp,
L"%s\r\n%s",
@@ -1466,5 +1466,5 @@ void SaveSettings() wchar_t* GetMyOwnNick(MCONTACT hContact)
{
wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(hContact));
- return (p != NULL) ? p : mir_wstrdup(TranslateT("No_Nick"));
+ return (p != nullptr) ? p : mir_wstrdup(TranslateT("No_Nick"));
}
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index d0ab1a3ba2..fe0dafb388 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. static char *StatusModeToDbSetting(int status, const char *suffix);
-ProtocolArray *protocols = NULL;
+ProtocolArray *protocols = nullptr;
void InitProtocolData()
{
@@ -33,7 +33,7 @@ void InitProtocolData() for (int i = 0; i < count; i++) {
PROTOACCOUNT *acc = protos[i];
- if (acc->szModuleName == NULL || acc->szModuleName[0] == '\0' || acc->bIsVirtual)
+ if (acc->szModuleName == nullptr || acc->szModuleName[0] == '\0' || acc->bIsVirtual)
continue;
// Found a protocol
@@ -244,7 +244,7 @@ bool Protocol::HasAvatar() {
GetAvatar();
- return avatar_bmp != NULL;
+ return avatar_bmp != nullptr;
}
bool Protocol::CanGetAvatar()
@@ -259,12 +259,12 @@ void Protocol::GetAvatar() return;
avatar_file[0] = '\0';
- avatar_bmp = NULL;
- ace = NULL;
+ avatar_bmp = nullptr;
+ ace = nullptr;
// Get HBITMAP from cache
ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)name);
- if (ace != NULL)
+ if (ace != nullptr)
avatar_bmp = ace->hbmPic;
data_changed = true;
@@ -300,7 +300,7 @@ void Protocol::SetNick(const wchar_t *nick) if (!CanSetNick())
return;
- if (nick == NULL)
+ if (nick == nullptr)
return;
// Get it
@@ -365,7 +365,7 @@ ProtocolArray::ProtocolArray(int max_size) ProtocolArray::~ProtocolArray()
{
- if (buffer != NULL) {
+ if (buffer != nullptr) {
for (int i = 0; i < buffer_len; i++)
delete buffer[i];
free(buffer);
@@ -388,20 +388,20 @@ void ProtocolArray::Add(Protocol *p) Protocol *ProtocolArray::Get(int i)
{
- return (i >= buffer_len) ? NULL : buffer[i];
+ return (i >= buffer_len) ? nullptr : buffer[i];
}
Protocol *ProtocolArray::Get(const char *name)
{
- if (name == NULL)
- return NULL;
+ if (name == nullptr)
+ return nullptr;
for (int i = 0; i < buffer_len; i++)
if (mir_strcmp(name, buffer[i]->name) == 0)
return buffer[i];
- return NULL;
+ return nullptr;
}
@@ -453,7 +453,7 @@ void ProtocolArray::SetAvatars(const wchar_t *file_name) void ProtocolArray::SetNicks(const wchar_t *nick)
{
- if (nick == NULL || nick[0] == '\0')
+ if (nick == nullptr || nick[0] == '\0')
return;
mir_wstrncpy(default_nick, nick, _countof(default_nick));
@@ -520,7 +520,7 @@ wchar_t *ProtocolArray::GetDefaultStatusMsg(int status) status = ID_STATUS_OFFLINE;
wchar_t *tmp = (wchar_t *)CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM)status, 0);
- if (tmp != NULL) {
+ if (tmp != nullptr) {
mir_wstrncpy(default_status_message, tmp, _countof(default_status_message));
mir_free(tmp);
}
@@ -559,7 +559,7 @@ static char *StatusModeToDbSetting(int status, const char *suffix) case ID_STATUS_ONTHEPHONE: prefix = "Otp"; break;
case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
case ID_STATUS_IDLE: prefix = "Idl"; break;
- default: return NULL;
+ default: return nullptr;
}
mir_strcpy(str, prefix);
mir_strcat(str, suffix);
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 03afeafc70..14b878a9b5 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -47,13 +47,13 @@ Boston, MA 02111-1307, USA. #define MWM_LISTENINGTO_CHANGED (WM_USER + 15)
-HWND hwnd_frame = NULL;
-HWND hwnd_container = NULL;
+HWND hwnd_frame = nullptr;
+HWND hwnd_container = nullptr;
int frame_id = -1;
bool g_bFramesExist = false;
-HGENMENU hMenuShowHideFrame = 0;
+HGENMENU hMenuShowHideFrame = nullptr;
#define FONT_NICK 0
#define FONT_PROTO 1
@@ -182,19 +182,19 @@ void DeInitFrames() CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)frame_id, 0);
for (int i = 0; i < NUM_FONTS; i++)
- if (hFont[i] != 0)
+ if (hFont[i] != nullptr)
DeleteObject(hFont[i]);
- if (hwnd_frame != NULL)
+ if (hwnd_frame != nullptr)
DestroyWindow(hwnd_frame);
- if (hwnd_container != NULL)
+ if (hwnd_container != nullptr)
DestroyWindow(hwnd_container);
}
int ReloadFont(WPARAM, LPARAM)
{
for (int i = 0; i < NUM_FONTS; i++) {
- if (hFont[i] != 0)
+ if (hFont[i] != nullptr)
DeleteObject(hFont[i]);
LOGFONT log_font;
@@ -223,7 +223,7 @@ int SmileyAddOptionsChangedHook(WPARAM, LPARAM) int CreateFrame()
{
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
Colour_Register(&bg_colour);
Colour_Register(&av_colour);
@@ -252,7 +252,7 @@ int CreateFrame() Font_RegisterW(&font_id[i]);
}
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
ReloadFont(0, 0);
HookEvent(ME_FONT_RELOAD, ReloadFont);
@@ -263,16 +263,16 @@ int CreateFrame() wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.hIcon = nullptr;
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = WINDOW_CLASS_NAME;
RegisterClass(&wndclass);
if (g_bFramesExist) {
hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, nullptr);
CLISTFrame Frame = { 0 };
@@ -308,19 +308,19 @@ int CreateFrame() wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.hIcon = nullptr;
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = CONTAINER_CLASS_NAME;
RegisterClass(&wndclass);
hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, TranslateT("My details"),
(WS_THICKFRAME | WS_CAPTION | WS_SYSMENU) & ~WS_VISIBLE,
- 0, 0, 200, 130, pcli->hwndContactList, NULL, hInst, NULL);
+ 0, 0, 200, 130, pcli->hwndContactList, nullptr, hInst, nullptr);
hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, hwnd_container, NULL, hInst, NULL);
+ 0, 0, 10, 10, hwnd_container, nullptr, hInst, nullptr);
SetWindowLongPtr(hwnd_container, GWLP_USERDATA, (LONG_PTR)hwnd_frame);
SendMessage(hwnd_container, WM_SIZE, 0, 0);
@@ -380,8 +380,8 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP RECT r;
GetClientRect(hwnd, &r);
- SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
- InvalidateRect(child, NULL, TRUE);
+ SetWindowPos(child, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ InvalidateRect(child, nullptr, TRUE);
}
return TRUE;
@@ -495,10 +495,10 @@ RECT GetRect(HDC hdc, RECT rc, const wchar_t *text, const wchar_t *def_text, Pro // Only first line
wchar_t *tmp2 = mir_wstrdup(tmp);
wchar_t *pos = wcschr(tmp2, '\r');
- if (pos != NULL)
+ if (pos != nullptr)
pos[0] = '\0';
pos = wcschr(tmp2, '\n');
- if (pos != NULL)
+ if (pos != nullptr)
pos[0] = '\0';
if (smileys)
@@ -524,11 +524,11 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_BAR_CLASSES;
if (!InitCommonControlsEx(&iccex))
- return NULL;
+ return nullptr;
/* CREATE A TOOLTIP WINDOW */
- HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, NULL, hInst, NULL); // handle to the ToolTip control
+ HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, nullptr, hInst, nullptr); // handle to the ToolTip control
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
TOOLINFO ti;
@@ -553,34 +553,34 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) void DeleteTooltipWindows(MyDetailsFrameData *data)
{
- if (data->nick_tt_hwnd != NULL) {
+ if (data->nick_tt_hwnd != nullptr) {
DestroyWindow(data->nick_tt_hwnd);
- data->nick_tt_hwnd = NULL;
+ data->nick_tt_hwnd = nullptr;
}
- if (data->status_tt_hwnd != NULL) {
+ if (data->status_tt_hwnd != nullptr) {
DestroyWindow(data->status_tt_hwnd);
- data->status_tt_hwnd = NULL;
+ data->status_tt_hwnd = nullptr;
}
- if (data->next_proto_tt_hwnd != NULL) {
+ if (data->next_proto_tt_hwnd != nullptr) {
DestroyWindow(data->next_proto_tt_hwnd);
- data->next_proto_tt_hwnd = NULL;
+ data->next_proto_tt_hwnd = nullptr;
}
- if (data->prev_proto_tt_hwnd != NULL) {
+ if (data->prev_proto_tt_hwnd != nullptr) {
DestroyWindow(data->prev_proto_tt_hwnd);
- data->prev_proto_tt_hwnd = NULL;
+ data->prev_proto_tt_hwnd = nullptr;
}
- if (data->away_msg_tt_hwnd != NULL) {
+ if (data->away_msg_tt_hwnd != nullptr) {
DestroyWindow(data->away_msg_tt_hwnd);
- data->away_msg_tt_hwnd = NULL;
+ data->away_msg_tt_hwnd = nullptr;
}
- if (data->listening_to_tt_hwnd != NULL) {
+ if (data->listening_to_tt_hwnd != nullptr) {
DestroyWindow(data->listening_to_tt_hwnd);
- data->listening_to_tt_hwnd = NULL;
+ data->listening_to_tt_hwnd = nullptr;
}
}
@@ -590,11 +590,11 @@ void CalcRectangles(HWND hwnd) HFONT hOldFont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (hdc == NULL || data == NULL)
+ if (hdc == nullptr || data == nullptr)
return;
Protocol *proto = protocols->Get(data->protocol_number);
- if (proto == NULL)
+ if (proto == nullptr)
return;
data->recalc_rectangles = false;
@@ -621,14 +621,14 @@ void CalcRectangles(HWND hwnd) if (rf.bottom - rf.top != size) {
if (FrameIsFloating()) {
HWND parent = GetParent(hwnd);
- if (parent != NULL) {
+ if (parent != nullptr) {
RECT rp_client, rp_window, r_window;
GetClientRect(parent, &rp_client);
GetWindowRect(parent, &rp_window);
GetWindowRect(hwnd, &r_window);
int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top) + r_window.top - rp_window.top;
- SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ SetWindowPos(parent, nullptr, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
}
@@ -663,7 +663,7 @@ void CalcRectangles(HWND hwnd) // Draw image?
if (proto->CanGetAvatar()) {
- if (proto->avatar_bmp != NULL) {
+ if (proto->avatar_bmp != nullptr) {
data->draw_img = true;
BITMAP bmp;
@@ -961,14 +961,14 @@ void CalcRectangles(HWND hwnd) if (FrameIsFloating()) {
HWND parent = GetParent(hwnd);
- if (parent != NULL) {
+ if (parent != nullptr) {
RECT rp_client, rp_window, r_window;
GetClientRect(parent, &rp_client);
GetWindowRect(parent, &rp_window);
GetWindowRect(hwnd, &r_window);
int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top) + r_window.top - rp_window.top;
- SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ SetWindowPos(parent, nullptr, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
else if (IsWindowVisible(hwnd)) {
@@ -998,11 +998,11 @@ HBITMAP CreateBitmap32(int cx, int cy) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- HBITMAP DirectBitmap = CreateDIBSection(NULL,
+ HBITMAP DirectBitmap = CreateDIBSection(nullptr,
&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
(void **)&ptPixels,
- NULL, 0);
+ nullptr, 0);
return DirectBitmap;
}
@@ -1032,10 +1032,10 @@ void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, REC // Only first line
wchar_t *tmp2 = mir_wstrdup(tmp);
wchar_t *pos = wcsrchr(tmp2, '\r');
- if (pos != NULL)
+ if (pos != nullptr)
pos[0] = '\0';
pos = wcschr(tmp2, '\n');
- if (pos != NULL)
+ if (pos != nullptr)
pos[0] = '\0';
@@ -1078,7 +1078,7 @@ void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, REC if (mouse_over)
DrawText(hdc, L" ...", 4, &rc_tmp, uFormat);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
if (mouse_over)
@@ -1092,7 +1092,7 @@ void Draw(HWND hwnd, HDC hdc_orig) MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
Protocol *proto = protocols->Get(data->protocol_number);
- if (proto == NULL) {
+ if (proto == nullptr) {
EraseBackground(hwnd, hdc_orig);
return;
}
@@ -1159,7 +1159,7 @@ void Draw(HWND hwnd, HDC hdc_orig) CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr);
// Clipping rgn
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
}
@@ -1175,7 +1175,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DrawTextWithRect(hdc, proto->nickname, DEFAULT_NICKNAME, rc, uFormat, data->mouse_over_nick && proto->CanSetNick(), proto);
// Clipping rgn
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
}
@@ -1186,12 +1186,12 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectClipRgn(hdc, rgn);
HICON icon = IcoLib_GetIcon("MYDETAILS_NEXT_PROTOCOL");
- if (icon == NULL)
+ if (icon == nullptr)
icon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RIGHT_ARROW));
- DrawIconEx(hdc, data->next_proto_rect.left, data->next_proto_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, data->next_proto_rect.left, data->next_proto_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(icon);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
rc = GetInnerRect(data->prev_proto_rect, r);
@@ -1199,12 +1199,12 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectClipRgn(hdc, rgn);
icon = IcoLib_GetIcon("MYDETAILS_PREV_PROTOCOL");
- if (icon == NULL)
+ if (icon == nullptr)
icon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RIGHT_ARROW));
- DrawIconEx(hdc, data->prev_proto_rect.left, data->prev_proto_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, data->prev_proto_rect.left, data->prev_proto_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(icon);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
}
@@ -1226,7 +1226,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DrawText(hdc, proto->description, -1, &rr, uFormat);
// Clipping rgn
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
if (data->mouse_over_proto)
@@ -1252,12 +1252,12 @@ void Draw(HWND hwnd, HDC hdc_orig) else
status_icon = Skin_LoadProtoIcon(proto->name, proto->status);
- if (status_icon != NULL) {
- DrawIconEx(hdc, data->status_icon_rect.left, data->status_icon_rect.top, status_icon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
+ if (status_icon != nullptr) {
+ DrawIconEx(hdc, data->status_icon_rect.left, data->status_icon_rect.top, status_icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(status_icon);
}
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
rc = GetInnerRect(data->status_text_rect, rr);
@@ -1269,7 +1269,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DRAW_TEXT(hdc, proto->status_name, (int)mir_wstrlen(proto->status_name), &rc, uFormat, proto->name);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
if (data->mouse_over_status)
@@ -1289,7 +1289,7 @@ void Draw(HWND hwnd, HDC hdc_orig) data->mouse_over_away_msg && proto->CanSetStatusMsg(), proto);
// Clipping rgn
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
}
@@ -1307,7 +1307,7 @@ void Draw(HWND hwnd, HDC hdc_orig) data->mouse_over_listening_to && protocols->CanSetListeningTo(), proto);
// Clipping rgn
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
}
else {
@@ -1323,12 +1323,12 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectClipRgn(hdc, rgn);
HICON icon = IcoLib_GetIcon("LISTENING_TO_ICON");
- if (icon == NULL)
+ if (icon == nullptr)
icon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LISTENINGTO));
- DrawIconEx(hdc, data->listening_to_icon_rect.left, data->listening_to_icon_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, data->listening_to_icon_rect.left, data->listening_to_icon_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(icon);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
rc = GetInnerRect(data->listening_to_text_rect, rr);
@@ -1340,7 +1340,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DrawText(hdc, proto->listening_to, -1, &rc, uFormat);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
if (data->mouse_over_listening_to && protocols->CanSetListeningTo())
@@ -1366,11 +1366,11 @@ bool InsideRect(POINT *p, RECT *r) void MakeHover(HWND hwnd, bool draw, bool *hover, POINT *p, RECT *r)
{
- if (draw && p != NULL && r != NULL && InsideRect(p, r)) {
+ if (draw && p != nullptr && r != nullptr && InsideRect(p, r)) {
if (!*hover) {
*hover = true;
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
TRACKMOUSEEVENT tme = { 0 };
tme.cbSize = sizeof(TRACKMOUSEEVENT);
@@ -1382,7 +1382,7 @@ void MakeHover(HWND hwnd, bool draw, bool *hover, POINT *p, RECT *r) }
else if (*hover) {
*hover = false;
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
}
}
@@ -1395,7 +1395,7 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, POINT &p) ClientToScreen(hwnd, &p);
int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, nullptr);
if (ret)
Clist_MenuProcessCommand(LOWORD(ret), MPCF_MAINMENU, 0);
@@ -1404,12 +1404,12 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, POINT &p) void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
{
HMENU menu = Menu_GetStatusMenu();
- HMENU submenu = NULL;
+ HMENU submenu = nullptr;
- if (menu != NULL) {
+ if (menu != nullptr) {
// Find the correct menu item
int count = GetMenuItemCount(menu);
- for (int i = 0; i < count && submenu == NULL; i++) {
+ for (int i = 0; i < count && submenu == nullptr; i++) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING;
@@ -1428,17 +1428,17 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto }
}
- if (submenu == NULL && protocols->GetSize() == 1)
+ if (submenu == nullptr && protocols->GetSize() == 1)
submenu = menu;
}
- if (submenu != NULL) {
+ if (submenu != nullptr) {
p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left);
p.y = data->status_rect.bottom + 1;
ClientToScreen(hwnd, &p);
int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, nullptr);
if (ret)
Clist_MenuProcessCommand(LOWORD(ret), MPCF_MAINMENU, 0);
@@ -1463,7 +1463,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto ClientToScreen(hwnd, &p);
int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
if (ret)
proto->SetStatus(ret);
@@ -1509,7 +1509,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P ClientToScreen(hwnd, &p);
int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
switch (ret) {
@@ -1606,7 +1606,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_LBUTTONUP:
proto = protocols->Get(data->protocol_number);
- if (proto != NULL) {
+ if (proto != nullptr) {
POINT p;
p.x = LOWORD(lParam);
p.y = HIWORD(lParam);
@@ -1683,7 +1683,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar p.y = data->proto_rect.bottom + 1;
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(menu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(menu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
if (ret != 0)
@@ -1702,7 +1702,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_CONTEXTMENU:
proto = protocols->Get(data->protocol_number);
- if (proto != NULL) {
+ if (proto != nullptr) {
POINT p = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
ScreenToClient(hwnd, &p);
@@ -1735,7 +1735,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
switch (ret) {
@@ -1775,7 +1775,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
switch (ret) {
@@ -1842,7 +1842,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
switch (ret) {
@@ -1985,7 +1985,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, nullptr);
DestroyMenu(menu);
switch (ret) {
@@ -2058,12 +2058,12 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar TrackMouseEvent(&tme);
}
case WM_NCMOUSEMOVE:
- MakeHover(hwnd, data->draw_img, &data->mouse_over_img, NULL, NULL);
- MakeHover(hwnd, data->draw_nick, &data->mouse_over_nick, NULL, NULL);
- MakeHover(hwnd, data->draw_proto, &data->mouse_over_proto, NULL, NULL);
- MakeHover(hwnd, data->draw_status, &data->mouse_over_status, NULL, NULL);
- MakeHover(hwnd, data->draw_away_msg, &data->mouse_over_away_msg, NULL, NULL);
- MakeHover(hwnd, data->draw_listening_to, &data->mouse_over_listening_to, NULL, NULL);
+ MakeHover(hwnd, data->draw_img, &data->mouse_over_img, nullptr, nullptr);
+ MakeHover(hwnd, data->draw_nick, &data->mouse_over_nick, nullptr, nullptr);
+ MakeHover(hwnd, data->draw_proto, &data->mouse_over_proto, nullptr, nullptr);
+ MakeHover(hwnd, data->draw_status, &data->mouse_over_status, nullptr, nullptr);
+ MakeHover(hwnd, data->draw_away_msg, &data->mouse_over_away_msg, nullptr, nullptr);
+ MakeHover(hwnd, data->draw_listening_to, &data->mouse_over_listening_to, nullptr, nullptr);
break;
case WM_MOUSEHOVER:
@@ -2077,7 +2077,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
case WM_MOUSEMOVE:
proto = protocols->Get(data->protocol_number);
- if (proto != NULL) {
+ if (proto != nullptr) {
POINT p = { LOWORD(lParam), HIWORD(lParam) };
MakeHover(hwnd, data->draw_img, &data->mouse_over_img, &p, &data->img_rect);
MakeHover(hwnd, data->draw_nick, &data->mouse_over_nick, &p, &data->nick_rect);
@@ -2119,7 +2119,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_DESTROY:
KillTimer(hwnd, ID_FRAME_TIMER);
- if (data != NULL) {
+ if (data != nullptr) {
DeleteTooltipWindows(data);
delete data;
}
@@ -2128,12 +2128,12 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // Custom Messages //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case MWM_REFRESH:
KillTimer(hwnd, ID_RECALC_TIMER);
- SetTimer(hwnd, ID_RECALC_TIMER, RECALC_TIME, NULL);
+ SetTimer(hwnd, ID_RECALC_TIMER, RECALC_TIME, nullptr);
break;
case MWM_AVATAR_CHANGED:
proto = protocols->Get((const char *)wParam);
- if (proto != NULL) {
+ if (proto != nullptr) {
proto->GetAvatar();
RefreshFrame();
}
@@ -2141,7 +2141,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case MWM_NICK_CHANGED:
proto = protocols->Get((const char *)wParam);
- if (proto != NULL) {
+ if (proto != nullptr) {
proto->GetNick();
RefreshFrame();
}
@@ -2149,7 +2149,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case MWM_STATUS_CHANGED:
proto = protocols->Get((const char *)wParam);
- if (proto != NULL) {
+ if (proto != nullptr) {
proto->GetStatus();
proto->GetStatusMsg();
proto->GetNick();
@@ -2166,7 +2166,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case MWM_LISTENINGTO_CHANGED:
if (wParam != NULL) {
proto = protocols->Get((const char *)wParam);
- if (proto != NULL)
+ if (proto != nullptr)
proto->GetListeningTo();
}
@@ -2239,14 +2239,14 @@ void FixMainMenu() void RedrawFrame()
{
if (frame_id == -1)
- InvalidateRect(hwnd_container, NULL, TRUE);
+ InvalidateRect(hwnd_container, nullptr, TRUE);
else
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)FU_TBREDRAW | FU_FMREDRAW);
}
void RefreshFrameAndCalcRects()
{
- if (hwnd_frame != NULL) {
+ if (hwnd_frame != nullptr) {
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
data->recalc_rectangles = true;
@@ -2256,7 +2256,7 @@ void RefreshFrameAndCalcRects() void RefreshFrame()
{
- if (hwnd_frame != NULL)
+ if (hwnd_frame != nullptr)
PostMessage(hwnd_frame, MWM_REFRESH, 0, 0);
}
@@ -2268,13 +2268,13 @@ bool MyDetailsFrameVisible() void SetMyDetailsFrameVisible(bool visible)
{
- if (frame_id == -1 && hwnd_container != 0)
+ if (frame_id == -1 && hwnd_container != nullptr)
ShowWindow(hwnd_container, visible ? SW_SHOW : SW_HIDE);
}
void SetCycleTime()
{
- if (hwnd_frame != NULL)
+ if (hwnd_frame != nullptr)
SetCycleTime(hwnd_frame);
}
@@ -2283,12 +2283,12 @@ void SetCycleTime(HWND hwnd) KillTimer(hwnd, ID_FRAME_TIMER);
if (opts.cycle_through_protocols)
- SetTimer(hwnd, ID_FRAME_TIMER, opts.seconds_to_show_protocol * 1000, 0);
+ SetTimer(hwnd, ID_FRAME_TIMER, opts.seconds_to_show_protocol * 1000, nullptr);
}
void SetStatusMessageRefreshTime()
{
- if (hwnd_frame != NULL)
+ if (hwnd_frame != nullptr)
SetStatusMessageRefreshTime(hwnd_frame);
}
@@ -2298,12 +2298,12 @@ void SetStatusMessageRefreshTime(HWND hwnd) opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12);
if (opts.refresh_status_message_timer > 0)
- SetTimer(hwnd, ID_STATUSMESSAGE_TIMER, opts.refresh_status_message_timer * 1000, NULL);
+ SetTimer(hwnd, ID_STATUSMESSAGE_TIMER, opts.refresh_status_message_timer * 1000, nullptr);
}
INT_PTR PluginCommand_ShowNextProtocol(WPARAM, LPARAM)
{
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return -1;
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
@@ -2325,7 +2325,7 @@ INT_PTR PluginCommand_ShowNextProtocol(WPARAM, LPARAM) INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM, LPARAM)
{
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return -1;
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
@@ -2348,7 +2348,7 @@ INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM, LPARAM) INT_PTR PluginCommand_ShowProtocol(WPARAM, LPARAM lParam)
{
char *proto = (char *)lParam;
- if (proto == NULL)
+ if (proto == nullptr)
return -1;
int proto_num = -1;
@@ -2362,7 +2362,7 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM, LPARAM lParam) if (proto_num == -1)
return -2;
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return -3;
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
@@ -2381,12 +2381,12 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM, LPARAM lParam) int SettingsChangedHook(WPARAM wParam, LPARAM lParam)
{
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- if ((HANDLE)wParam == NULL) {
+ if ((HANDLE)wParam == nullptr) {
Protocol *proto = protocols->Get(cws->szModule);
if (!strcmp(cws->szSetting, "MyHandle")
@@ -2397,13 +2397,13 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) || !strcmp(cws->szSetting, "LastName")
|| !strcmp(cws->szSetting, "JID")) {
// Name changed
- if (proto != NULL)
+ if (proto != nullptr)
PostMessage(hwnd_frame, MWM_NICK_CHANGED, (WPARAM)proto->name, 0);
}
else if (strstr(cws->szModule, "Away"))
// Status message changed
PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, 0, 0);
- else if (proto != NULL && strcmp(cws->szSetting, "ListeningTo") == 0)
+ else if (proto != nullptr && strcmp(cws->szSetting, "ListeningTo") == 0)
PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, (WPARAM)proto->name, 0);
}
@@ -2412,12 +2412,12 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) int AvatarChangedHook(WPARAM wParam, LPARAM)
{
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return 0;
Protocol *proto = protocols->Get((const char *)wParam);
- if (proto != NULL)
+ if (proto != nullptr)
PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM)proto->name, 0);
return 0;
@@ -2425,7 +2425,7 @@ int AvatarChangedHook(WPARAM wParam, LPARAM) int ProtoAckHook(WPARAM, LPARAM lParam)
{
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return 0;
ACKDATA *ack = (ACKDATA *)lParam;
@@ -2435,17 +2435,17 @@ int ProtoAckHook(WPARAM, LPARAM lParam) Protocol *proto = protocols->Get(ack->szModule);
switch (ack->type) {
case ACKTYPE_STATUS:
- if (proto != NULL)
+ if (proto != nullptr)
PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM)proto->name, 0);
break;
case ACKTYPE_AWAYMSG:
- if (proto != NULL)
+ if (proto != nullptr)
PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, (WPARAM)proto->name, 0);
break;
case ACKTYPE_AVATAR:
- if (proto != NULL)
+ if (proto != nullptr)
PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM)proto->name, 0);
break;
}
@@ -2455,10 +2455,10 @@ int ProtoAckHook(WPARAM, LPARAM lParam) int ListeningtoEnableStateChangedHook(WPARAM wParam, LPARAM)
{
- if (hwnd_frame == NULL)
+ if (hwnd_frame == nullptr)
return 0;
- if (wParam == NULL || protocols->Get((const char *)wParam) != NULL)
+ if (wParam == NULL || protocols->Get((const char *)wParam) != nullptr)
PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, wParam, 0);
return 0;
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 1c62064f17..459ee0572d 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -97,7 +97,7 @@ static int MainInit(WPARAM, LPARAM) mi.flags = CMIF_UNICODE;
mi.root = hMenuRoot;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
if (protocols->CanSetAvatars()) {
SET_UID(mi, 0xe5b2d79e, 0xd25a, 0x4f72, 0xa4, 0x1a, 0x21, 0xfd, 0x48, 0x6b, 0xb5, 0x6);
@@ -153,7 +153,7 @@ extern "C" __declspec(dllexport) int Load() // Options
InitOptions();
- if (IcoLib_GetIcon("LISTENING_TO_ICON") == NULL)
+ if (IcoLib_GetIcon("LISTENING_TO_ICON") == nullptr)
Icon_Register(hInst, LPGEN("Contact list"), iconList, 1);
Icon_Register(hInst, LPGEN("My details"), iconList + 1, _countof(iconList) - 1);
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index aa474bb453..2935ffa351 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -75,7 +75,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowText(hwndDlg, tmp);
HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0);
- if (hIcon != NULL) {
+ if (hIcon != nullptr) {
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
DestroyIcon(hIcon);
}
@@ -127,7 +127,7 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam) char *proto = (char *)lParam;
int proto_num = -1;
- if (proto != NULL) {
+ if (proto != nullptr) {
int i;
for (i = 0; i < protocols->GetSize(); i++) {
if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
@@ -147,7 +147,7 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam) if (!nickname_dialog_open) {
InterlockedExchange(&nickname_dialog_open, 1);
- hwndSetNickname = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETNICKNAME), NULL, DlgProcSetNickname);
+ hwndSetNickname = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETNICKNAME), nullptr, DlgProcSetNickname);
SendMessage(hwndSetNickname, WMU_SETDATA, proto_num, 0);
}
@@ -162,7 +162,7 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam) INT_PTR PluginCommand_SetMyNickname(WPARAM wParam, LPARAM lParam)
{
char *proto = (char *)wParam;
- if (proto != NULL) {
+ if (proto != nullptr) {
for (int i = 0; i < protocols->GetSize(); i++) {
if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
if (!protocols->Get(i)->CanSetNick())
@@ -183,17 +183,17 @@ INT_PTR PluginCommand_SetMyNickname(WPARAM wParam, LPARAM lParam) INT_PTR PluginCommand_GetMyNickname(WPARAM wParam, LPARAM lParam)
{
wchar_t *ret = (wchar_t *)lParam;
- if (ret == NULL)
+ if (ret == nullptr)
return -1;
char *proto = (char *)wParam;
- if (proto == NULL) {
+ if (proto == nullptr) {
mir_wstrncpy(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
}
else {
Protocol *protocol = protocols->Get(proto);
- if (protocol != NULL) {
+ if (protocol != nullptr) {
mir_wstrncpy(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
}
@@ -209,7 +209,7 @@ INT_PTR PluginCommand_SetMyAvatarUI(WPARAM, LPARAM lParam) char *proto = (char *)lParam;
int proto_num = -1;
- if (proto != NULL) {
+ if (proto != nullptr) {
int i;
for (i = 0; i < protocols->GetSize(); i++) {
if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
@@ -226,9 +226,9 @@ INT_PTR PluginCommand_SetMyAvatarUI(WPARAM, LPARAM lParam) }
if (proto_num == -1)
- protocols->SetAvatars(NULL);
+ protocols->SetAvatars(nullptr);
else
- protocols->Get(proto_num)->SetAvatar(NULL);
+ protocols->Get(proto_num)->SetAvatar(nullptr);
return 0;
}
@@ -236,7 +236,7 @@ INT_PTR PluginCommand_SetMyAvatarUI(WPARAM, LPARAM lParam) INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
char *proto = (char *)wParam;
- if (proto != NULL) {
+ if (proto != nullptr) {
for (int i = 0; i < protocols->GetSize(); i++) {
if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
if (!protocols->Get(i)->CanSetAvatar())
@@ -259,10 +259,10 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam) wchar_t *ret = (wchar_t *)lParam;
char *proto = (char *)wParam;
- if (ret == NULL)
+ if (ret == nullptr)
return -1;
- if (proto == NULL) {
+ if (proto == nullptr) {
mir_wstrncpy(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
return 0;
}
@@ -327,7 +327,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w Protocol *proto = protocols->Get(data->proto_num);
HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0);
- if (hIcon != NULL) {
+ if (hIcon != nullptr) {
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
DestroyIcon(hIcon);
}
@@ -339,7 +339,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg());
}
else if (data->status != 0) {
- Window_SetProtoIcon_IcoLib(hwndDlg, NULL, data->status);
+ Window_SetProtoIcon_IcoLib(hwndDlg, nullptr, data->status);
wchar_t title[256];
mir_snwprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0));
@@ -402,12 +402,12 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam) int status = (int)wParam;
char *proto_name = (char *)lParam;
int proto_num = -1;
- Protocol *proto = NULL;
+ Protocol *proto = nullptr;
if (status != 0 && (status < ID_STATUS_OFFLINE || status > ID_STATUS_OUTTOLUNCH))
return -10;
- if (proto_name != NULL) {
+ if (proto_name != nullptr) {
for (int i = 0; i < protocols->GetSize(); i++) {
proto = protocols->Get(i);
@@ -426,18 +426,18 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam) else if (ServiceExists(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG)) {
if (status != 0)
CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, status, (LPARAM)proto_name);
- else if (proto != 0)
+ else if (proto != nullptr)
CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, proto->status, (LPARAM)proto_name);
else
CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, protocols->GetGlobalStatus(), NULL);
return 0;
} // fallthrough
- if (proto == NULL || proto->status != ID_STATUS_OFFLINE) {
+ if (proto == nullptr || proto->status != ID_STATUS_OFFLINE) {
if (!status_msg_dialog_open) {
InterlockedExchange(&status_msg_dialog_open, 1);
- hwndSetStatusMsg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETSTATUSMESSAGE), NULL, DlgProcSetStatusMessage);
+ hwndSetStatusMsg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETSTATUSMESSAGE), nullptr, DlgProcSetStatusMessage);
SendMessage(hwndSetStatusMsg, WMU_SETDATA, status, proto_num);
}
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index b0b313b999..3ded4b59c6 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -56,7 +56,7 @@ void MySetPos(HWND hwndParent) pt.x = CWOldPos.left;
pt.y = CWOldPos.top;
ScreenToClient(hwndParent, &pt);
- SetWindowPos(hCurWnd, NULL, pt.x + dx, pt.y + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
+ SetWindowPos(hCurWnd, nullptr, pt.x + dx, pt.y + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
hCurWnd = GetNextWindow(hCurWnd, GW_HWNDNEXT);
}
}
@@ -124,7 +124,7 @@ static Dlg1Buttons[] = { static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int ChangeLock = 0;
- static CMsgTree* MsgTree = NULL;
+ static CMsgTree* MsgTree = nullptr;
switch (msg) {
case WM_INITDIALOG:
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY:
delete MsgTree;
- MsgTree = NULL;
+ MsgTree = nullptr;
g_MessagesOptPage.SetWnd(NULL);
break;
}
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 9d97e205b9..4ab5f98280 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -73,7 +73,7 @@ HICON GetIcon(int iconId, bool size) if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);
- return NULL;
+ return nullptr;
}
PLUGININFOEX pluginInfo = {
@@ -265,7 +265,7 @@ int StatusChanged(WPARAM wParam, LPARAM lParam) memset(dat, 0, sizeof(SetAwayMsgData));
dat->szProtocol = (char*)lParam;
dat->IsModeless = false;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
}
return 0;
}
@@ -312,7 +312,7 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) int iContactMode = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
wchar_t szSetStr[256], szReadStr[256];
szSetStr[0] = szReadStr[0] = 0;
- HICON hReadMsgIcon = NULL;
+ HICON hReadMsgIcon = nullptr;
if (szProto) {
int i;
@@ -383,7 +383,7 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM) dat->hInitContact = hContact;
dat->szProtocol = GetContactProto(hContact);
dat->IsModeless = false;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index f83dc3a0be..92dbffb9c4 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -25,8 +25,8 @@ #define PARSE_INTERVAL 10000
-HANDLE g_hTerminateUpdateMsgsThread = NULL;
-HANDLE g_hUpdateMsgsThread = NULL;
+HANDLE g_hTerminateUpdateMsgsThread = nullptr;
+HANDLE g_hUpdateMsgsThread = nullptr;
void __cdecl UpdateMsgsThreadProc(void *)
{
@@ -71,11 +71,11 @@ void InitUpdateMsgs() SetEvent(g_hTerminateUpdateMsgsThread);
QueueUserAPC(DummyAPCFunc, g_hUpdateMsgsThread, 0); // wake up the thread, as it's most probably in SleepEx() now
WaitForSingleObject(g_hUpdateMsgsThread, INFINITE);
- g_hUpdateMsgsThread = NULL;
+ g_hUpdateMsgsThread = nullptr;
CloseHandle(g_hTerminateUpdateMsgsThread);
}
else if (!g_hUpdateMsgsThread && UpdateMsgs) {
- g_hTerminateUpdateMsgsThread = CreateEvent(NULL, TRUE, FALSE, NULL);
+ g_hTerminateUpdateMsgsThread = CreateEvent(nullptr, TRUE, FALSE, nullptr);
g_hUpdateMsgsThread = (HANDLE)mir_forkthread(UpdateMsgsThreadProc, NULL);
}
}
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index 561292c9b1..99a50335fa 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -171,7 +171,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA tvi.iImage = tvi.iSelectedImage = lParam;
TreeView_SetItem(hWnd, &tvi);
dat->SortContacts();
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
}
break;
@@ -252,7 +252,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA // if it was a click on the selected item and there's need to do something in this case, then send SELCHANGED notification by ourselves, as the tree control doesn't do anything
if (hItem == TreeView_GetSelection(hWnd) && (dat->SelectedItems.GetSize() != 1 || (dat->SelectedItems.GetSize() == 1 && dat->SelectedItems[0] != hItem))) {
TreeView_SetItemState(hWnd, hItem, TVIS_SELECTED, TVIS_SELECTED);
- NMTREEVIEW nm = { 0 };
+ NMTREEVIEW nm = {};
nm.hdr.code = TVN_SELCHANGED;
nm.hdr.hwndFrom = hWnd;
nm.hdr.idFrom = GetDlgCtrlID(hWnd);
@@ -277,7 +277,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA case WM_SIZE:
case WM_HSCROLL:
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
break;
case WM_MEASUREITEM:
@@ -293,7 +293,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA case WM_CONTEXTMENU:
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
- HTREEITEM hItem = NULL;
+ HTREEITEM hItem = nullptr;
if (pt.x == -1 && pt.y == -1) {
if (dat->SelectedItems.GetSize() == 1) {
hItem = dat->SelectedItems[0];
@@ -309,7 +309,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA ScreenToClient(hWnd, &pt);
hItem = dat->HitTest(&pt, &hitFlags);
if (!(hitFlags & MCLCHT_ONITEM))
- hItem = NULL;
+ hItem = nullptr;
}
if (hItem) {
MCONTACT hContact = dat->GetItemData(hItem).hContact;
@@ -338,7 +338,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA CCList::CCList(HWND hTreeView) :
hTreeView(hTreeView),
- ExtraImageList(NULL)
+ ExtraImageList(nullptr)
{
CWndUserData(GetParent(hTreeView)).SetCList(this);
OrigTreeViewProc = (WNDPROC)SetWindowLongPtr(hTreeView, GWLP_WNDPROC, (LONG_PTR)ContactListSubclassProc);
@@ -354,7 +354,7 @@ CCList::~CCList() _ASSERT(GetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC) == (LONG_PTR)ParentSubclassProc); // we won't allow anyone to change our WNDPROC. otherwise we're not sure that we're setting the right WNDPROC back
SetWindowLongPtr(hTreeView, GWLP_WNDPROC, (LONG_PTR)OrigTreeViewProc);
SetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC, (LONG_PTR)OrigParentProc);
- CWndUserData(GetParent(hTreeView)).SetCList(NULL);
+ CWndUserData(GetParent(hTreeView)).SetCList(nullptr);
}
// adds a new contact if it doesn't exist yet; returns its hItem
@@ -384,14 +384,14 @@ HTREEITEM CCList::AddGroup(TCString GroupName) MGROUP hGroupId = Clist_GroupExists(GroupName);
if (hGroupId == NULL)
- return NULL;
+ return nullptr;
MCONTACT hContact = UINT_PTR(hGroupId) - 1 + HCONTACT_ISGROUP;
HTREEITEM hGroupItem = FindContact(hContact);
if (hGroupItem)
return hGroupItem; // exists already, just return its handle
- TVINSERTSTRUCT tvIns = { 0 };
+ TVINSERTSTRUCT tvIns = {};
tvIns.hParent = TVI_ROOT;
tvIns.item.pszText = wcsrchr(GroupName, '\\');
if (tvIns.item.pszText) {
@@ -411,7 +411,7 @@ HTREEITEM CCList::AddGroup(TCString GroupName) HTREEITEM CCList::AddInfo(TCString Title, HTREEITEM hParent, HTREEITEM hInsertAfter, LPARAM lParam, HICON hIcon)
{
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvi.item.pszText = Title;
tvi.hParent = hParent;
@@ -463,7 +463,7 @@ int CALLBACK CompareItemsCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamS void CCList::SortContacts()
{
- TVSORTCB tvSort = { 0 };
+ TVSORTCB tvSort = {};
tvSort.lpfnCompare = CompareItemsCallback;
tvSort.hParent = TVI_ROOT;
tvSort.lParam = (LPARAM)this;
@@ -491,7 +491,7 @@ void CCList::SetExtraImage(HTREEITEM hItem, int iColumn, int iImage) // set iIma void CCList::SetExtraImageList(HIMAGELIST hImgList)
{
ExtraImageList = hImgList;
- InvalidateRect(hTreeView, NULL, false);
+ InvalidateRect(hTreeView, nullptr, false);
}
int CCList::GetItemType(HTREEITEM hItem) // returns a MCLCIT_ (see below)
@@ -519,7 +519,7 @@ HTREEITEM CCList::GetNextItem(DWORD Flags, HTREEITEM hItem) hItem = hNextItem;
hNextItem = TreeView_GetLastChild(hTreeView, hNextItem);
} while (hNextItem);
- return (hItem == TVI_ROOT) ? NULL : hItem;
+ return (hItem == TVI_ROOT) ? nullptr : hItem;
}
case MCLGN_CHILD:
@@ -534,7 +534,7 @@ HTREEITEM CCList::GetNextItem(DWORD Flags, HTREEITEM hItem) case MCLGN_NEXT:
do {
if (Flags & MCLGN_MULTILEVEL) {
- HTREEITEM hNextItem = NULL;
+ HTREEITEM hNextItem = nullptr;
if ((Flags & MCLGN_NOTCHILD) != MCLGN_NOTCHILD)
hNextItem = TreeView_GetChild(hTreeView, hItem);
@@ -582,7 +582,7 @@ HTREEITEM CCList::GetNextItem(DWORD Flags, HTREEITEM hItem) default:
_ASSERT(0);
}
- return NULL;
+ return nullptr;
}
MCONTACT CCList::GethContact(HTREEITEM hItem) // returns hContact, hGroup or hInfo
@@ -688,7 +688,7 @@ HTREEITEM CCList::FindContact(MCONTACT hContact) }
tvi.hItem = GetNextItem(MCLGN_NEXT | MCLGN_ANY | MCLGN_MULTILEVEL, tvi.hItem);
}
- return NULL;
+ return nullptr;
}
void CCList::SelectGroups(HTREEITEM hCurItem, bool bSelected)
diff --git a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp index 4ec48644bb..8fda499b09 100644 --- a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp +++ b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp @@ -51,7 +51,7 @@ class CCheckboxData
{
public:
- CCheckboxData(): OldWndProc(NULL), Style(0), State(0), hFont(NULL) {};
+ CCheckboxData(): OldWndProc(nullptr), Style(0), State(0), hFont(nullptr) {};
WNDPROC OldWndProc;
int Style; // BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE or BS_AUTO3STATE
@@ -90,7 +90,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l if (hTheme) {
WCHAR *szText = (WCHAR*)_alloca(Len * sizeof(WCHAR));
GetWindowTextW(hWnd, szText, Len);
- GetThemeTextExtent(hTheme, hdc, BP_GROUPBOX, IsWindowEnabled(hWnd) ? GBS_NORMAL : GBS_DISABLED, szText, -1, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE, 0, &rcText);
+ GetThemeTextExtent(hTheme, hdc, BP_GROUPBOX, IsWindowEnabled(hWnd) ? GBS_NORMAL : GBS_DISABLED, szText, -1, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE, nullptr, &rcText);
}
else {
SIZE size;
@@ -109,7 +109,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l OffsetRect(&rcText, CG_CHECKBOX_INDENT + CG_CHECKBOX_WIDTH + CG_TEXT_INDENT, 0);
RECT rc;
GetClientRect(hWnd, &rc);
- SetWindowPos(hWnd, 0, 0, 0, rcText.right + CG_ADDITIONAL_WIDTH, rc.bottom, SWP_NOMOVE | SWP_NOZORDER);
+ SetWindowPos(hWnd, nullptr, 0, 0, rcText.right + CG_ADDITIONAL_WIDTH, rc.bottom, SWP_NOMOVE | SWP_NOZORDER);
}
break;
@@ -126,7 +126,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l wParam = BST_CHECKED;
dat->State &= ~CGSM_ISCHECKED;
dat->State |= wParam;
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
SendMessage(GetParent(hWnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hWnd), BN_CLICKED), (LPARAM)hWnd);
return 0;
@@ -135,7 +135,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l dat->State |= CGS_PRESSED;
else
dat->State &= ~CGS_PRESSED;
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
return 0;
case BM_GETSTATE:
@@ -146,7 +146,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l case WM_THEMECHANGED:
case WM_ENABLE:
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
return 0;
case WM_SETTEXT:
@@ -203,21 +203,21 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l GetCursorPos(&pt);
if ((WindowFromPoint(pt) == hWnd) ^ ((dat->State & CGS_HOVERED) != 0)) {
dat->State ^= CGS_HOVERED;
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
}
return 0;
case WM_MOUSELEAVE:
if (dat->State & CGS_HOVERED) {
dat->State &= ~CGS_HOVERED;
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
}
return 0;
case WM_SETFOCUS:
case WM_KILLFOCUS:
case WM_SYSCOLORCHANGE:
- InvalidateRect(hWnd, NULL, false);
+ InvalidateRect(hWnd, nullptr, false);
return 0;
case WM_PAINT:
@@ -232,7 +232,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hbmMem);
HTHEME hTheme = OpenThemeData(hWnd, L"BUTTON");
if (hTheme)
- DrawThemeParentBackground(hWnd, hdcMem, NULL);
+ DrawThemeParentBackground(hWnd, hdcMem, nullptr);
else
FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE));
@@ -287,7 +287,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l if (GetFocus() == hWnd) {
RECT rcText = { 0 };
if (hTheme)
- GetThemeTextExtent(hTheme, hdcMem, BP_GROUPBOX, IsWindowEnabled(hWnd) ? GBS_NORMAL : GBS_DISABLED, szTextT, -1, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE, 0, &rcText);
+ GetThemeTextExtent(hTheme, hdcMem, BP_GROUPBOX, IsWindowEnabled(hWnd) ? GBS_NORMAL : GBS_DISABLED, szTextT, -1, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE, nullptr, &rcText);
else {
SIZE size;
GetTextExtentPoint32(hdcMem, szTextT, (int)mir_wstrlen(szTextT), &size);
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 97b64d22e3..6316a5d50f 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -133,7 +133,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) return 0;
// remove outdated events first
- DWORD CurTime = time(NULL);
+ DWORD CurTime = time(nullptr);
int i;
for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
@@ -155,7 +155,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) // ugly workaround for metacontacts, part i; store all metacontacts' events to a temporary array, so we'll be able to get the 'source' protocol when subcontact event happens later. we need the protocol to get its status and per-status settings properly
if (!mir_strcmp(szProto, META_PROTO)) {
// remove outdated events first
- DWORD CurTime = time(NULL);
+ DWORD CurTime = time(nullptr);
for (int i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
MetacontactEvents.RemoveElem(i);
@@ -224,7 +224,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) TCString Reply(*(TCString*)AutoreplyOptData.GetValue(IDC_REPLYDLG_PREFIX));
if (Reply != NULL && ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) {
wchar_t *szResult = variables_parse(Reply, VarParseData.Message, hContact);
- if (szResult != NULL) {
+ if (szResult != nullptr) {
Reply = szResult;
mir_free(szResult);
}
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp index 57720cc77f..3dc99705b2 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.cpp +++ b/plugins/NewAwaySysMod/src/MsgTree.cpp @@ -73,7 +73,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L case TVN_BEGINDRAG:
{
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam;
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
COptItem_TreeCtrl *TreeCtrl = dat->GetTreeCtrl();
int Order = TreeCtrl->hItemToOrder(pnmtv->itemNew.hItem);
_ASSERT(Order != -1);
@@ -97,7 +97,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L return 0;
else {
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam;
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
COptItem_TreeCtrl *TreeCtrl = dat->GetTreeCtrl();
if (pnmtv->itemOld.hItem) {
int Order = TreeCtrl->IDToOrder(pnmtv->itemOld.lParam);
@@ -134,7 +134,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L if (Order >= 0) {
TreeCtrl->m_value[Order].Title = ptvdi->item.pszText;
TreeCtrl->SetModified(true);
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
nm.ItemNew = &TreeCtrl->m_value[Order];
nm.hdr.code = MTN_ITEMRENAMED;
nm.hdr.hwndFrom = dat->hTreeView;
@@ -195,7 +195,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L TreeView_HitTest(dat->hTreeView, &hti);
if (hti.hItem) {
TreeView_SelectDropTarget(dat->hTreeView, hti.hItem);
- SetTimer(hWnd, MSGTREE_TIMER_ID, MSGTREE_DRAGANDDROP_GROUPEXPANDTIME, NULL);
+ SetTimer(hWnd, MSGTREE_TIMER_ID, MSGTREE_DRAGANDDROP_GROUPEXPANDTIME, nullptr);
}
else {
if (hti.flags & TVHT_ABOVE)
@@ -221,7 +221,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L ScreenToClient(dat->hTreeView, &hti.pt);
TreeView_HitTest(dat->hTreeView, &hti);
if (hti.hItem && dat->hDragItem != hti.hItem) {
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
COptItem_TreeCtrl *TreeCtrl = dat->GetTreeCtrl();
int OrderOld = TreeCtrl->hItemToOrder(dat->hDragItem);
int OrderNew = TreeCtrl->hItemToOrder(hti.hItem);
@@ -237,7 +237,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L dat->UpdateLock--;
}
}
- dat->hDragItem = NULL;
+ dat->hDragItem = nullptr;
}
break;
@@ -285,7 +285,7 @@ LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM dat->UpdateLock++;
dat->MsgTreePage.DBToMemToPage();
dat->UpdateLock--;
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
int Order = TreeCtrl->IDToOrder(TreeCtrl->GetSelectedItemID(GetParent(hWnd)));
if (Order != -1) {
nm.ItemNew = (Order <= TREECTRL_ROOTORDEROFFS) ? (CBaseTreeItem*)&TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)] : (CBaseTreeItem*)&TreeCtrl->m_value[Order];
@@ -400,7 +400,7 @@ LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM if (TreeCtrl->m_value[Order].ID == (int)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
SetMenuItemInfo(hPopupMenu, SettingsList[i].MenuItemID, false, &mii);
- int MenuResult = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, ht.pt.x, ht.pt.y, 0, hWnd, NULL);
+ int MenuResult = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, ht.pt.x, ht.pt.y, 0, hWnd, nullptr);
switch (MenuResult) {
case IDM_MSGTREEMENU_NEWMESSAGE:
dat->AddMessage();
@@ -461,7 +461,7 @@ LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM return CallWindowProc(dat->OrigTreeViewProc, hWnd, Msg, wParam, lParam);
}
-CMsgTree::CMsgTree(HWND hTreeView) : MsgTreePage(g_MsgTreePage), hTreeView(hTreeView), hDragItem(NULL), hPrevDropTarget(NULL), UpdateLock(0)
+CMsgTree::CMsgTree(HWND hTreeView) : MsgTreePage(g_MsgTreePage), hTreeView(hTreeView), hDragItem(nullptr), hPrevDropTarget(nullptr), UpdateLock(0)
{
CWndUserData(GetParent(hTreeView)).SetMsgTree(this);
OrigParentProc = (WNDPROC)SetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC, (LONG_PTR)ParentSubclassProc);
@@ -485,7 +485,7 @@ CMsgTree::~CMsgTree() _ASSERT(GetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC) == (LONG_PTR)ParentSubclassProc); // we won't allow anyone to change our WNDPROC. otherwise we're not sure that we're setting the right WNDPROC back
SetWindowLongPtr(hTreeView, GWLP_WNDPROC, (GetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC) == (LONG_PTR)ParentSubclassProc) ? (LONG_PTR)OrigTreeViewProc : (LONG_PTR)DefDlgProc); // yeah, if that crazy Help plugin substituted MY WndProc again, he won't get his WndProc back.. he-he >:)
SetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC, (LONG_PTR)OrigParentProc);
- CWndUserData(GetParent(hTreeView)).SetMsgTree(NULL);
+ CWndUserData(GetParent(hTreeView)).SetMsgTree(nullptr);
WindowList_Remove(hMTWindowList, hTreeView);
ImageList_Destroy(hImageList);
}
@@ -495,7 +495,7 @@ CBaseTreeItem* CMsgTree::GetSelection() // returns NULL if there's nothing selec COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
int Order = TreeCtrl->IDToOrder(TreeCtrl->GetSelectedItemID(GetParent(hTreeView)));
if (Order == -1)
- return NULL;
+ return nullptr;
return (Order <= TREECTRL_ROOTORDEROFFS) ? (CBaseTreeItem*)&TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)] : (CBaseTreeItem*)&TreeCtrl->m_value[Order];
}
@@ -573,7 +573,7 @@ void CMsgTree::UpdateItem(int ID) // updates item title, and expanded/collapsed TreeView_GetItem(hTreeView, &tvi);
if (TreeItem->Title != (const wchar_t*)tvi.pszText) {
TreeCtrl->SetModified(true);
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
nm.ItemNew = TreeItem;
nm.hdr.code = MTN_ITEMRENAMED;
nm.hdr.hwndFrom = hTreeView;
@@ -600,7 +600,7 @@ bool CMsgTree::DeleteSelectedItem() // returns true if the item was deleted TranslateT("Do you really want to delete this category with its messages?") :
TranslateT("Do you really want to delete this message?")),
TranslateT("New Away System"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
nm.ItemOld = SelectedItem;
nm.hdr.code = MTN_DELETEITEM;
nm.hdr.hwndFrom = hTreeView;
@@ -623,7 +623,7 @@ CTreeItem* CMsgTree::AddCategory() TreeItem->Title = tvi.pszText = TranslateT("New category");
TreeView_SetItem(hTreeView, &tvi);
TreeView_EditLabel(hTreeView, TreeItem->hItem);
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
nm.ItemNew = TreeItem;
nm.hdr.code = MTN_NEWCATEGORY;
nm.hdr.hwndFrom = hTreeView;
@@ -642,7 +642,7 @@ CTreeItem* CMsgTree::AddMessage() TreeItem->Title = tvi.pszText = TranslateT("New message");
TreeView_SetItem(hTreeView, &tvi);
TreeView_EditLabel(hTreeView, TreeItem->hItem);
- NMMSGTREE nm = { 0 };
+ NMMSGTREE nm = {};
nm.ItemNew = TreeItem;
nm.hdr.code = MTN_NEWMESSAGE;
nm.hdr.hwndFrom = hTreeView;
@@ -671,9 +671,9 @@ CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem *Item) // Item is default: _ASSERT(0);
}
- int Order = TreeCtrl->hItemToOrder(TreeView_GetNextItem(hTreeView, TreeItem ? TreeItem->hItem : NULL, TVFlag));
+ int Order = TreeCtrl->hItemToOrder(TreeView_GetNextItem(hTreeView, TreeItem ? TreeItem->hItem : nullptr, TVFlag));
if (Order == -1)
- return NULL;
+ return nullptr;
return (Order <= TREECTRL_ROOTORDEROFFS) ? (CBaseTreeItem*)&TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)] : (CBaseTreeItem*)&TreeCtrl->m_value[Order];
}
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index dd33eb8d02..0afce411de 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -98,7 +98,7 @@ COptItem *COptPage::Find(int m_dlgItemID) return Items[i];
_ASSERT(0);
- return 0;
+ return nullptr;
}
COptPage& COptPage::operator = (const COptPage& Page)
@@ -282,7 +282,7 @@ int TreeReadEnum(const char *szSetting, LPARAM lParam) pItem.ID = ID;
pItem.ParentID = ParentID;
pItem.Flags = Flags;
- pItem.hItem = NULL;
+ pItem.hItem = nullptr;
pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
db_get_s(NULL, pData->sModule,
@@ -372,7 +372,7 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd) SetWindowLongPtr(hTreeView, GWL_STYLE, Style | TVS_CHECKBOXES);
}
- TVINSERTSTRUCT tvIn = { 0 };
+ TVINSERTSTRUCT tvIn = {};
int ScrollPos = GetScrollPos(hTreeView, SB_VERT);
int SelectOrder = IDToOrder(GetSelectedItemID(hWnd));
SendMessage(hTreeView, WM_SETREDRAW, false, 0);
@@ -524,7 +524,7 @@ CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item) TVITEM tvi;
int SelOrder = -1;
Item.ParentID = RootItems[0].ID;
- TVINSERTSTRUCT tvIn = { 0 };
+ TVINSERTSTRUCT tvIn = {};
tvIn.hParent = RootItems[0].hItem;
tvIn.hInsertAfter = TVI_FIRST;
if (tvi.hItem = TreeView_GetSelection(hTreeView)) {
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 6f1fbdef28..a48da5b3ee 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -29,7 +29,7 @@ void ResetContactSettingsOnStatusChange(MCONTACT hContact) db_unset(hContact, MOD_NAME, DB_MESSAGECOUNT);
}
-void ResetSettingsOnStatusChange(const char *szProto = NULL, int bResetPersonalMsgs = false, int Status = 0)
+void ResetSettingsOnStatusChange(const char *szProto = nullptr, int bResetPersonalMsgs = false, int Status = 0)
{
if (bResetPersonalMsgs)
bResetPersonalMsgs = !g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_SAVEPERSONALMSGS);
@@ -87,7 +87,7 @@ CProtoState::CStatus& CProtoState::CStatus::operator = (int Status) }
}
if (bStatusModified)
- ResetSettingsOnStatusChange(NULL, true, Status);
+ ResetSettingsOnStatusChange(nullptr, true, Status);
}
if (bModified && g_SetAwayMsgPage.GetWnd())
SendMessage(g_SetAwayMsgPage.GetWnd(), UM_SAM_PROTOSTATUSCHANGED, (WPARAM)(char*)m_szProto, 0);
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 25ee3f12f7..75c0c05758 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -86,7 +86,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam // done with the event
if (awayData->hAwayMsgEvent) {
UnhookEvent(awayData->hAwayMsgEvent);
- awayData->hAwayMsgEvent = NULL;
+ awayData->hAwayMsgEvent = nullptr;
}
const wchar_t *ptszStatusMsg = (const wchar_t*)ack->lParam;
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_MSG, ptszStatusMsg);
@@ -121,7 +121,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam READAWAYMSGDATA *awayData = (READAWAYMSGDATA*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (awayData->hAwayMsgEvent) {
UnhookEvent(awayData->hAwayMsgEvent);
- awayData->hAwayMsgEvent = NULL;
+ awayData->hAwayMsgEvent = nullptr;
}
delete awayData;
Utils_SaveWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING);
@@ -135,6 +135,6 @@ INT_PTR GetContactStatMsg(WPARAM wParam, LPARAM) if (HWND hWnd = WindowList_Find(g_hReadWndList, wParam)) // already have it
SetForegroundWindow(hWnd);
else
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_READAWAYMSG), nullptr, ReadAwayMsgDlgProc, wParam);
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index f2884ee947..9f5ea5db36 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -182,5 +182,5 @@ INT_PTR InvokeStatusWindow(WPARAM wParam, LPARAM) dat->IsModeless = true;
if (iswi->cbSize > sizeof(NAS_ISWINFOv1))
dat->ISW_Flags = iswi->Flags;
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)dat);
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
}
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 426e8c97b3..56aedf56e1 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -105,7 +105,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, return HTCLIENT;
case WM_SETCURSOR:
- SetCursor(LoadCursor(NULL, IDC_SIZEWE));
+ SetCursor(LoadCursor(nullptr, IDC_SIZEWE));
return true;
case WM_LBUTTONDOWN:
@@ -305,7 +305,7 @@ void SetExtraIcon(CCList *CList, int nColumn, HTREEITEM hItem, int nIcon) void SetCListGroupIcons(CCList *CList)
{
_ASSERT(CList);
- HTREEITEM hItem = CList->GetNextItem(MCLGN_LAST, NULL); // start from last item, so every item is processed before its parents
+ HTREEITEM hItem = CList->GetNextItem(MCLGN_LAST, nullptr); // start from last item, so every item is processed before its parents
if (!hItem)
return;
@@ -340,7 +340,7 @@ void SetCListGroupIcons(CCList *CList) }
-int GetSelContactsNum(CCList *CList, PTREEITEMARRAY Selection = NULL, bool *bOnlyInfo = NULL) // "SelContacts" mean not only contacts, but everything with "personal" status messages and settings - i.e. "All contacts" and protocol items are counted too.
+int GetSelContactsNum(CCList *CList, PTREEITEMARRAY Selection = nullptr, bool *bOnlyInfo = nullptr) // "SelContacts" mean not only contacts, but everything with "personal" status messages and settings - i.e. "All contacts" and protocol items are counted too.
{
if (!CList)
return (Selection == CLSEL_DAT_NOTHING) ? 0 : 1; // Selection == NULL means we need to retrieve current selection by ourselves, and current selection is always CLSEL_DAT_CONTACT in this case
@@ -362,7 +362,7 @@ int GetSelContactsNum(CCList *CList, PTREEITEMARRAY Selection = NULL, bool *bOnl return nContacts;
}
-void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY Selection = NULL)
+void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY Selection = nullptr)
{
TCString Message;
HWND hwndDlg = g_SetAwayMsgPage.GetWnd();
@@ -466,8 +466,8 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA static HWND hWndTooltips;
static int UpdateLock = 0;
static int Countdown;
- static CMsgTree *MsgTree = NULL;
- static CCList *CList = NULL;
+ static CMsgTree *MsgTree = nullptr;
+ static CCList *CList = nullptr;
NMCLIST nm;
@@ -534,7 +534,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA DlgPosX = rcWorkArea.left;
DlgPosY = rcWorkArea.top;
}
- SetWindowPos(hwndDlg, NULL, DlgPosX, DlgPosY, DlgSizeX, DlgSizeY, SWP_NOZORDER);
+ SetWindowPos(hwndDlg, nullptr, DlgPosX, DlgPosY, DlgSizeX, DlgSizeY, SWP_NOZORDER);
g_MsgSplitterX = MsgSplitterX;
g_ContactSplitterX = ContactSplitterX;
}
@@ -545,7 +545,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // Attention: it's important to call NEW and DELETE in a proper order, as CMsgTree and CCList are setting their own WNDPROCs for the parent window, so we must prevent WNDPROC conflicts.
MsgTree = new CMsgTree(GetDlgItem(hwndDlg, IDC_SAWAYMSG_TREE));
- CList = NULL;
+ CList = nullptr;
if (g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_SHOWCONTACTTREE))
SendMessage(hwndDlg, UM_SAM_INITCLIST, 0, 0);
else {
@@ -591,7 +591,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetDlgItemText(hwndDlg, IDC_OK, TranslateT("OK"));
else {
SendMessage(hwndDlg, WM_TIMER, SAM_TIMER_ID, NULL);
- SetTimer(hwndDlg, SAM_TIMER_ID, 1000, NULL);
+ SetTimer(hwndDlg, SAM_TIMER_ID, 1000, nullptr);
}
// init image buttons
@@ -759,7 +759,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (nNewContacts == 1) {
WindowTitle += TCString(TranslateT("\" ("));
MCONTACT hContact = NULL;
- char *szProto = NULL;
+ char *szProto = nullptr;
if (CList) {
for (int i = 0; i < pnm->NewSelection->GetSize(); i++) {
HTREEITEM hItem = (*pnm->NewSelection)[i];
@@ -908,7 +908,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case UM_SAM_APPLYANDCLOSE:
KillTimer(hwndDlg, SAM_TIMER_ID);
if (CList)
- CList->SelectItem(NULL);
+ CList->SelectItem(nullptr);
else {
nm.hdr.code = MCLN_SELCHANGED;
nm.hdr.hwndFrom = GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSTREE);
@@ -1071,7 +1071,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!VariablesInstalled)
EnableMenuItem(hPopupMenu, IDM_SAM_OPTIONS_DISABLEVARIABLES, MF_BYCOMMAND | MF_GRAYED);
- switch (TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()), 0, hwndDlg, NULL)) {
+ switch (TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()), 0, hwndDlg, nullptr)) {
case IDM_SAM_OPTIONS_SHOWMSGTREE:
{
int bShow = !g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_SHOWMSGTREE);
@@ -1080,7 +1080,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA GetWindowRect(hwndDlg, &rcDlg);
rcDlg.left -= bShow ? g_MsgSplitterX : -g_MsgSplitterX;
SendMessage(hwndDlg, WM_SIZING, WMSZ_LEFT, (LPARAM)&rcDlg);
- SetWindowPos(hwndDlg, NULL, rcDlg.left, rcDlg.top, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, SWP_NOZORDER);
+ SetWindowPos(hwndDlg, nullptr, rcDlg.left, rcDlg.top, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, SWP_NOZORDER);
SendMessage(hwndDlg, WM_SIZE, 0, 0); // show/hide dialog controls accordingly
}
break;
@@ -1101,7 +1101,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA GetWindowRect(hwndDlg, &rcDlg);
rcDlg.right += bShow ? g_ContactSplitterX : -g_ContactSplitterX;
SendMessage(hwndDlg, WM_SIZING, WMSZ_RIGHT, (LPARAM)&rcDlg);
- SetWindowPos(hwndDlg, NULL, 0, 0, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hwndDlg, nullptr, 0, 0, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, SWP_NOZORDER | SWP_NOMOVE);
SendMessage(hwndDlg, WM_SIZE, 0, 0); // show/hide dialog controls accordingly
}
break;
@@ -1309,20 +1309,20 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA pt.y = (short)HIWORD(GetMessagePos());
ScreenToClient(hTreeView, &pt);
CList->HitTest(&pt, &hitFlags);
- HCURSOR hCursor = NULL;
+ HCURSOR hCursor = nullptr;
if (hitFlags & (MCLCHT_ONITEM | MCLCHT_ONITEMEXTRA)) {
SetClassLong(hTreeView, GCLP_HCURSOR, NULL);
- hCursor = LoadCursor(NULL, IDC_HAND); // set mouse cursor to a hand when hovering over items or their extra images
+ hCursor = LoadCursor(nullptr, IDC_HAND); // set mouse cursor to a hand when hovering over items or their extra images
}
- else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
+ else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(nullptr, IDC_ARROW));
if (!hCursor)
- hCursor = LoadCursor(NULL, IDC_ARROW);
+ hCursor = LoadCursor(nullptr, IDC_ARROW);
SetCursor(hCursor);
return true;
}
- else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
+ else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(nullptr, IDC_ARROW));
}
break;
@@ -1338,11 +1338,11 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA delete dat;
if (CList) {
delete CList;
- CList = NULL;
+ CList = nullptr;
}
delete MsgTree;
- MsgTree = NULL;
- g_SetAwayMsgPage.SetWnd(NULL);
+ MsgTree = nullptr;
+ g_SetAwayMsgPage.SetWnd(nullptr);
DestroyWindow(hWndTooltips);
return false;
}
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index d2b07adf78..bb33f4a236 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -168,7 +168,7 @@ int CheckMsgWnd(MCONTACT hContact) {
MessageWindowData mwd;
if (!Srmm_GetWindowData(hContact, mwd))
- if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
+ if (mwd.hwndWindow != nullptr && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
return 1;
return 0;
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 0f800ea5e9..7e1c92c14a 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -231,10 +231,10 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L options->bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
options->bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
options->bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
- options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, NULL, FALSE);
- options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, NULL, FALSE);
- options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, NULL, FALSE);
- options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, NULL, FALSE);
+ options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, nullptr, FALSE);
+ options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, nullptr, FALSE);
+ options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, nullptr, FALSE);
+ options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, nullptr, FALSE);
options->bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
options->bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
options->bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
@@ -244,7 +244,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L options->bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
options->bShowON = BST_UNCHECKED == IsDlgButtonChecked(hWnd, IDC_RDNEW);
options->bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
- options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, NULL, FALSE);
+ options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, nullptr, FALSE);
options->bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
options->bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
//update items' states
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index e354f6a573..83e0469cac 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -59,17 +59,17 @@ static void FreePopupEventData(PLUGIN_DATA* pdata) if (eventData->next) {
eventData = eventData->next;
mir_free(eventData->prev);
- eventData->prev = NULL;
+ eventData->prev = nullptr;
}
else {
mir_free(eventData);
- eventData = NULL;
+ eventData = nullptr;
}
}
- pdata->lastEventData = pdata->firstEventData = pdata->firstShowEventData = NULL;
+ pdata->lastEventData = pdata->firstEventData = pdata->firstShowEventData = nullptr;
// remove from popup list if present
if (FindPopupData(pdata) != -1)
- PopupList[FindPopupData(pdata)] = NULL;
+ PopupList[FindPopupData(pdata)] = nullptr;
}
int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
@@ -81,12 +81,12 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pdata->hContact, 0); // JK, use core (since 0.3.3+)
else {
EVENT_DATA_EX *eventData = pdata->firstEventData;
- if (eventData == NULL)
+ if (eventData == nullptr)
return 0;
for (int idx = 0;; idx++) {
CLISTEVENT *cle = pcli->pfnGetEvent(pdata->hContact, idx);
- if (cle == NULL)
+ if (cle == nullptr)
break;
if (cle->hDbEvent == eventData->hEvent) {
@@ -124,7 +124,7 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PLUGIN_DATA *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd);
- if (pdata == NULL)
+ if (pdata == nullptr)
return FALSE;
switch (message) {
@@ -140,7 +140,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA return TRUE;
case UM_INITPOPUP:
pdata->hWnd = hWnd;
- SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL);
+ SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr);
break;
case WM_MOUSEWHEEL:
if ((short)HIWORD(wParam) > 0 && pdata->firstShowEventData->prev &&
@@ -170,9 +170,9 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
{
- wchar_t *comment1 = NULL;
- wchar_t *comment2 = NULL;
- char *commentFix = NULL;
+ wchar_t *comment1 = nullptr;
+ wchar_t *comment2 = nullptr;
+ char *commentFix = nullptr;
//now get text
switch (dbei->eventType) {
@@ -248,7 +248,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (dbei->pBlob) {
char szUin[16];
wchar_t szBuf[2048];
- wchar_t* szNick = NULL;
+ wchar_t* szNick = nullptr;
char *pszNick = (char *)dbei->pBlob + 8;
char *pszFirst = pszNick + mir_strlen(pszNick) + 1;
char *pszLast = pszFirst + mir_strlen(pszFirst) + 1;
@@ -284,7 +284,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (dbei->pBlob) {
DB_AUTH_BLOB blob(dbei->pBlob);
- wchar_t *szNick = NULL;
+ wchar_t *szNick = nullptr;
if (blob.get_nick())
szNick = dbei->getString(blob.get_nick());
else if (blob.get_email())
@@ -441,8 +441,8 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, U EVENT_DATA_EX *eventData = (EVENT_DATA_EX*)mir_alloc(sizeof(EVENT_DATA_EX));
eventData->hEvent = hEvent;
eventData->number = 1;
- eventData->next = NULL;
- eventData->prev = NULL;
+ eventData->next = nullptr;
+ eventData->prev = nullptr;
// retrieve correct hContact for AUTH events
if (dbe.pBlob && (eventType == EVENTTYPE_ADDED || eventType == EVENTTYPE_AUTHREQUEST))
@@ -505,12 +505,12 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) pdata->lastEventData = pdata->lastEventData->next;
pdata->lastEventData->hEvent = hEvent;
pdata->lastEventData->number = pdata->lastEventData->prev->number + 1;
- pdata->lastEventData->next = NULL;
+ pdata->lastEventData->next = nullptr;
if (!pdata->pluginOptions->bShowON && pdata->countEvent > pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg)
pdata->firstShowEventData = pdata->firstShowEventData->next;
//re-init timer delay
KillTimer(pdata->hWnd, TIMER_TO_ACTION);
- SetTimer(pdata->hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL);
+ SetTimer(pdata->hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr);
}
wchar_t lpzText[MAX_SECONDLINE*2] = L"\0\0";
@@ -533,7 +533,7 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) //get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
DBEVENTINFO dbe = {};
- dbe.pBlob = NULL;
+ dbe.pBlob = nullptr;
dbe.cbBlob = 0;
if (pdata->pluginOptions->bPreview && eventData->hEvent) {
dbe.cbBlob = db_event_getBlobSize(eventData->hEvent);
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index 6c7d5e9ee5..9e6224f92b 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -65,7 +65,7 @@ wchar_t *SelectSound(HWND hwndDlg, wchar_t *buff, size_t bufflen) HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
ListView_GetItemText(hList, ListView_GetNextItem(hList, -1, LVNI_SELECTED), 1, buff, (DWORD)bufflen);
if (!mir_wstrcmp(buff, TranslateW(DEFAULT_SOUND)))
- buff = NULL;
+ buff = nullptr;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = GetParent(hwndDlg);
@@ -84,15 +84,15 @@ wchar_t *SelectSound(HWND hwndDlg, wchar_t *buff, size_t bufflen) if (GetOpenFileName(&ofn))
return buff;
- return NULL;
+ return nullptr;
}
HIMAGELIST GetStatusIconsImgList(char *szProto)
{
- HIMAGELIST hList = NULL;
+ HIMAGELIST hList = nullptr;
if (szProto) {
hList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, STATUS_COUNT - 1, 0);
- if (hList != NULL) {
+ if (hList != nullptr) {
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
ImageList_AddIcon(hList, Skin_LoadProtoIcon(szProto, i));
ImageList_AddIcon(hList, Skin_LoadIcon(SKINICON_OTHER_USERONLINE));
@@ -201,7 +201,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED);
if (iSel != -1) {
wchar_t stzFilePath[MAX_PATH];
- if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != NULL) {
+ if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != nullptr) {
iSel = -1;
while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1)
ListView_SetItemText(hList, iSel, 1, stzFilePath);
@@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_INDSNDLIST:
if (((LPNMHDR)lParam)->code == NM_DBLCLK) {
wchar_t stzFilePath[MAX_PATH];
- if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != NULL) {
+ if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != nullptr) {
int iSel = -1;
while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1)
ListView_SetItemText(hList, iSel, 1, stzFilePath);
@@ -470,7 +470,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) SetAllContactsIcons(hList);
//fall through
case CLN_CONTACTMOVED:
- SetGroupsIcons(hList, (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetGroupsIcons(hList, (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
break;
case CLN_OPTIONSCHANGED:
ResetListOptions(hList);
@@ -486,7 +486,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) // Find clicked item
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL)
+ if (hItem == nullptr)
break;
if (!(hitFlags & CLCHT_ONITEMEXTRA))
break;
@@ -532,7 +532,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) }
// Update the all/none icons
- SetGroupsIcons(hList, (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetGroupsIcons(hList, (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
// Activate Apply button
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index a05e146a39..eea1cf800f 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -94,7 +94,7 @@ HANDLE GetIconHandle(char *szIcon) static int __inline CheckStr(char *str, int not_empty, int empty)
{
- if (str == NULL || str[0] == '\0')
+ if (str == nullptr || str[0] == '\0')
return empty;
else
return not_empty;
@@ -102,7 +102,7 @@ static int __inline CheckStr(char *str, int not_empty, int empty) static int __inline CheckStrW(WCHAR *str, int not_empty, int empty)
{
- if (str == NULL || str[0] == L'\0')
+ if (str == nullptr || str[0] == L'\0')
return empty;
else
return not_empty;
@@ -114,33 +114,33 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, switch (cws_new->value.type) {
case DBVT_ASCIIZ:
- smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_a2u_cp(cws_new->value.pszVal, CP_ACP));
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? nullptr : mir_a2u_cp(cws_new->value.pszVal, CP_ACP));
break;
case DBVT_UTF8:
- smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_a2u_cp(cws_new->value.pszVal, CP_UTF8));
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? nullptr : mir_a2u_cp(cws_new->value.pszVal, CP_UTF8));
break;
case DBVT_WCHAR:
- smi->newstatusmsg = (CheckStrW(cws_new->value.pwszVal, 0, 1) ? NULL : mir_wstrdup(cws_new->value.pwszVal));
+ smi->newstatusmsg = (CheckStrW(cws_new->value.pwszVal, 0, 1) ? nullptr : mir_wstrdup(cws_new->value.pwszVal));
break;
case DBVT_DELETED:
default:
- smi->newstatusmsg = NULL;
+ smi->newstatusmsg = nullptr;
break;
}
if (!db_get_s(smi->hContact, "UserOnline", szSetting, &dbv_old, 0)) {
switch (dbv_old.type) {
case DBVT_ASCIIZ:
- smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_a2u_cp(dbv_old.pszVal, CP_ACP));
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? nullptr : mir_a2u_cp(dbv_old.pszVal, CP_ACP));
break;
case DBVT_UTF8:
- smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_a2u_cp(dbv_old.pszVal, CP_UTF8));
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? nullptr : mir_a2u_cp(dbv_old.pszVal, CP_UTF8));
break;
case DBVT_WCHAR:
- smi->oldstatusmsg = (CheckStrW(dbv_old.pwszVal, 0, 1) ? NULL : mir_wstrdup(dbv_old.pwszVal));
+ smi->oldstatusmsg = (CheckStrW(dbv_old.pwszVal, 0, 1) ? nullptr : mir_wstrdup(dbv_old.pwszVal));
break;
default:
- smi->oldstatusmsg = NULL;
+ smi->oldstatusmsg = nullptr;
break;
}
@@ -176,7 +176,7 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, else
ret = COMPARE_DIFF;
- smi->oldstatusmsg = NULL;
+ smi->oldstatusmsg = nullptr;
}
return ret;
@@ -184,8 +184,8 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt)
{
- if (n == NULL || tmplt == NULL || tmplt[0] == '\0')
- return NULL;
+ if (n == nullptr || tmplt == nullptr || tmplt[0] == '\0')
+ return nullptr;
CMStringW res;
size_t len = mir_wstrlen(tmplt);
@@ -202,7 +202,7 @@ wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt) break;
case 'o':
- if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == '\0' || mir_wstrcmp(n->oldstatusmsg, TranslateT("<no status message>")) == 0)
+ if (n->oldstatusmsg == nullptr || n->oldstatusmsg[0] == '\0' || mir_wstrcmp(n->oldstatusmsg, TranslateT("<no status message>")) == 0)
res.Append(TranslateT("<no status message>"));
else
AddCR(res, n->oldstatusmsg);
@@ -271,7 +271,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt) dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.szModule = MODULE;
MEVENT hDBEvent = db_event_add(smi->hContact, &dbei);
@@ -356,7 +356,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.szModule = MODULE;
MEVENT hDBEvent = db_event_add(hContact, &dbei);
@@ -375,7 +375,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) if (!mir_strcmp(szProto, META_PROTO)) { //this contact is Meta
MCONTACT hSubContact = db_mc_getMostOnline(hContact);
char *szSubProto = GetContactProto(hSubContact);
- if (szSubProto == NULL)
+ if (szSubProto == nullptr)
return 0;
if (newStatus == ID_STATUS_OFFLINE) {
@@ -431,8 +431,8 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) PLUGINDATA *pdp = (PLUGINDATA *)mir_calloc(sizeof(PLUGINDATA));
pdp->oldStatus = oldStatus;
pdp->newStatus = newStatus;
- pdp->hAwayMsgHook = NULL;
- pdp->hAwayMsgProcess = NULL;
+ pdp->hAwayMsgHook = nullptr;
+ pdp->hAwayMsgProcess = nullptr;
ShowChangePopup(hContact, Skin_LoadProtoIcon(szProto, newStatus), newStatus, str, pdp);
}
@@ -453,8 +453,8 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) if (opt.LogToFile) {
wchar_t stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime));
- GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", stzTime, _countof(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"dd/MM/yyyy", stzDate, _countof(stzDate));
mir_snwprintf(stzText, TranslateT("%s, %s. %s changed status to %s (was %s)\r\n"),
stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText,
StatusList[Index(oldStatus)].lpzStandardText);
@@ -535,8 +535,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (strstr(cws->szSetting, "title")) {
smi.compare = CompareStatusMsg(&smi, cws, szSetting);
if (smi.compare == COMPARE_SAME) {
- replaceStrW(smi.newstatusmsg, 0);
- replaceStrW(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, nullptr);
+ replaceStrW(smi.oldstatusmsg, nullptr);
}
if (cws->value.type == DBVT_DELETED)
@@ -544,7 +544,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) else
db_set(hContact, "UserOnline", szSetting, &cws->value);
- xsc = NewXSC(hContact, szProto, type, smi.compare, smi.newstatusmsg, NULL);
+ xsc = NewXSC(hContact, szProto, type, smi.compare, smi.newstatusmsg, nullptr);
ExtraStatusChanged(xsc);
}
else if (strstr(cws->szSetting, "text")) {
@@ -552,8 +552,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) mir_snprintf(dbSetting, "%s%s", szSetting, "Msg");
smi.compare = CompareStatusMsg(&smi, cws, dbSetting);
if (smi.compare == COMPARE_SAME) {
- replaceStrW(smi.newstatusmsg, 0);
- replaceStrW(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, nullptr);
+ replaceStrW(smi.oldstatusmsg, nullptr);
}
if (cws->value.type == DBVT_DELETED)
@@ -561,7 +561,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) else
db_set(hContact, "UserOnline", dbSetting, &cws->value);
- xsc = NewXSC(hContact, szProto, type, smi.compare * 4, NULL, smi.newstatusmsg);
+ xsc = NewXSC(hContact, szProto, type, smi.compare * 4, nullptr, smi.newstatusmsg);
ExtraStatusChanged(xsc);
}
return 1;
@@ -574,8 +574,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (mir_strcmp(cws->szSetting, "XStatusName") == 0) {
smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusName");
if (smi.compare == COMPARE_SAME) {
- replaceStrW(smi.newstatusmsg, 0);
- replaceStrW(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, nullptr);
+ replaceStrW(smi.oldstatusmsg, nullptr);
}
if (cws->value.type == DBVT_DELETED)
@@ -583,14 +583,14 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) else
db_set(hContact, "UserOnline", "LastXStatusName", &cws->value);
- xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare, smi.newstatusmsg, NULL);
+ xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare, smi.newstatusmsg, nullptr);
ExtraStatusChanged(xsc);
}
else if (!mir_strcmp(cws->szSetting, "XStatusMsg")) {
smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusMsg");
if (smi.compare == COMPARE_SAME) {
- replaceStrW(smi.newstatusmsg, 0);
- replaceStrW(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, nullptr);
+ replaceStrW(smi.oldstatusmsg, nullptr);
}
if (cws->value.type == DBVT_DELETED)
@@ -598,7 +598,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) else
db_set(hContact, "UserOnline", "LastXStatusMsg", &cws->value);
- xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare * 4, NULL, smi.newstatusmsg);
+ xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare * 4, nullptr, smi.newstatusmsg);
ExtraStatusChanged(xsc);
}
return 1;
@@ -678,7 +678,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) {
// cut message if needed
- wchar_t *copyText = NULL;
+ wchar_t *copyText = nullptr;
if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_wstrlen(smi.newstatusmsg) > opt.PSMsgLen)) {
wchar_t buff[MAX_TEXT_LEN + 3];
copyText = mir_wstrdup(smi.newstatusmsg);
@@ -747,8 +747,8 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (opt.SMsgLogToFile && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1)) {
wchar_t stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime));
- GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", stzTime, _countof(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"dd/MM/yyyy", stzDate, _countof(stzDate));
wchar_t *str;
if (smi.compare == COMPARE_DEL)
@@ -763,8 +763,8 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) }
skip_notify:
- replaceStrW(smi.newstatusmsg, 0);
- replaceStrW(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, nullptr);
+ replaceStrW(smi.oldstatusmsg, nullptr);
return 1;
}
@@ -774,7 +774,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
@@ -796,7 +796,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) int StatusModeChanged(WPARAM wParam, LPARAM lParam)
{
char *szProto = (char *)lParam;
- if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) {
+ if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == nullptr)) {
if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) {
char szSetting[12];
mir_snprintf(szSetting, "p%d", wParam);
@@ -1112,7 +1112,7 @@ void InitSound() int InitTopToolbar(WPARAM, LPARAM)
{
- TTBButton tbb = { 0 };
+ TTBButton tbb = {};
tbb.pszService = MS_STATUSCHANGE_MENUCOMMAND;
tbb.dwFlags = (opt.TempDisabled ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON;
tbb.name = LPGEN("Toggle status notification");
@@ -1135,10 +1135,10 @@ int ModulesLoaded(WPARAM, LPARAM) SecretWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", L"ConnectionTimerWindow", 0,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
- NULL, hInst, NULL);
+ nullptr, hInst, nullptr);
int count = 0;
- PROTOACCOUNT **accounts = NULL;
+ PROTOACCOUNT **accounts = nullptr;
Proto_EnumAccounts(&count, &accounts);
for (int i = 0; i < count; i++)
if (Proto_IsAccountEnabled(accounts[i]))
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 6e2ca296df..82705d78b0 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -403,12 +403,12 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_wstrcat(str, TranslateT("This is status message"));
}
- ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, i), i, str);
+ ShowChangePopup(NULL, Skin_LoadProtoIcon(nullptr, i), i, str);
}
wcsncpy(str, TranslateT("This is extra status"), _countof(str));
- ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str);
+ ShowChangePopup(NULL, Skin_LoadProtoIcon(nullptr, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str);
wcsncpy(str, TranslateT("This is status message"), _countof(str));
- ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str);
+ ShowChangePopup(NULL, Skin_LoadProtoIcon(nullptr, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str);
return FALSE;
}
@@ -449,8 +449,8 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM opt.ReadAwayMsg = IsDlgButtonChecked(hwndDlg, IDC_READAWAYMSG);
opt.ShowPreviousStatus = IsDlgButtonChecked(hwndDlg, IDC_SHOWPREVIOUSSTATUS);
opt.ShowGroup = IsDlgButtonChecked(hwndDlg, IDC_SHOWGROUP);
- opt.PopupTimeout = GetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE, 0, TRUE);
- opt.PopupConnectionTimeout = GetDlgItemInt(hwndDlg, IDC_CONNECTIONTIMEOUT_VALUE, 0, TRUE);
+ opt.PopupTimeout = GetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
+ opt.PopupConnectionTimeout = GetDlgItemInt(hwndDlg, IDC_CONNECTIONTIMEOUT_VALUE, nullptr, TRUE);
opt.LeftClickAction = (BYTE)SendDlgItemMessage(hwndDlg, IDC_STATUS_LC, CB_GETCURSEL, 0, 0);
opt.RightClickAction = (BYTE)SendDlgItemMessage(hwndDlg, IDC_STATUS_RC, CB_GETCURSEL, 0, 0);
@@ -617,7 +617,7 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM opt.PXOnConnect = IsDlgButtonChecked(hwndDlg, IDC_XONCONNECT);
opt.PXDisableForMusic = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEMUSIC);
opt.PXMsgTruncate = IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTMSG);
- opt.PXMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, 0, FALSE);
+ opt.PXMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_MSGLEN, nullptr, FALSE);
templates.PopupXFlags = 0;
templates.PopupXFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSCHANGE) ? NOTIFY_NEW_XSTATUS : 0) |
@@ -662,7 +662,7 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM bool IsSuitableProto(PROTOACCOUNT *pa)
{
- return (pa != NULL && !pa->bDynDisabled && pa->bIsEnabled && CallProtoService(pa->szProtoName, PS_GETCAPS, PFLAGNUM_2, 0) != 0 && CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV);
+ return (pa != nullptr && !pa->bDynDisabled && pa->bIsEnabled && CallProtoService(pa->szProtoName, PS_GETCAPS, PFLAGNUM_2, 0) != 0 && CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV);
}
INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -829,7 +829,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (((LPNMHDR)lParam)->code == PSN_APPLY) {
opt.PSMsgOnConnect = IsDlgButtonChecked(hwndDlg, IDC_ONCONNECT);
opt.PSMsgTruncate = IsDlgButtonChecked(hwndDlg, IDC_CHK_CUTSMSG);
- opt.PSMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_SMSGLEN, 0, FALSE);
+ opt.PSMsgLen = GetDlgItemInt(hwndDlg, IDC_ED_SMSGLEN, nullptr, FALSE);
templates.PopupSMsgFlags = 0;
templates.PopupSMsgFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_NEWSMSG) ? NOTIFY_NEW_MESSAGE : 0) |
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index 386f9f3196..8b4593ce47 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -62,7 +62,7 @@ void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj)
{
PLUGINDATA *pdp = (PLUGINDATA *)pObj;
- if (pdp == NULL)
+ if (pdp == nullptr)
return 0;
ACKDATA *ack = (ACKDATA *)lParam;
@@ -71,7 +71,7 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj) //The first thing we do is removing the hook from the chain to avoid useless calls.
UnhookEvent(pdp->hAwayMsgHook);
- pdp->hAwayMsgHook = NULL;
+ pdp->hAwayMsgHook = nullptr;
if (ack->result != ACKRESULT_SUCCESS)
return 0;
@@ -80,7 +80,7 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj) ptrW pstzLast(db_get_wsa(hContact, MODULE, "LastPopupText"));
wchar_t *tszStatus = (wchar_t *)ack->lParam;
- if (tszStatus == NULL || *tszStatus == 0)
+ if (tszStatus == nullptr || *tszStatus == 0)
return 0;
wchar_t stzText[1024];
@@ -125,7 +125,7 @@ void PopupAction(HWND hWnd, BYTE action) POINT pt = { 0 };
GetCursorPos(&pt);
HMENU hMenu = Menu_BuildContactMenu(hContact);
- TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hWnd, NULL);
+ TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hWnd, nullptr);
DestroyMenu(hMenu);
}
return;
@@ -151,7 +151,7 @@ void PopupAction(HWND hWnd, BYTE action) LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- PLUGINDATA *pdp = NULL;
+ PLUGINDATA *pdp = nullptr;
switch (message) {
case WM_MEASUREITEM: // Needed by the contact's context menu
@@ -174,10 +174,10 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case UM_FREEPLUGINDATA:
pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
- if (pdp != NULL) {
- if (pdp->hAwayMsgHook != NULL) {
+ if (pdp != nullptr) {
+ if (pdp->hAwayMsgHook != nullptr) {
UnhookEvent(pdp->hAwayMsgHook);
- pdp->hAwayMsgHook = NULL;
+ pdp->hAwayMsgHook = nullptr;
}
mir_free(pdp);
@@ -186,7 +186,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case UM_INITPOPUP:
pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
- if (pdp != NULL) {
+ if (pdp != nullptr) {
char *szProto = GetContactProto(PUGetContact(hwnd));
if (szProto && opt.ReadAwayMsg && StatusHasAwayMessage(szProto, pdp->newStatus)) {
WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp index 56ef4931c7..120964b038 100644 --- a/plugins/NewXstatusNotify/src/utils.cpp +++ b/plugins/NewXstatusNotify/src/utils.cpp @@ -28,7 +28,7 @@ bool CheckMsgWnd(MCONTACT hContact) if (Srmm_GetWindowData(hContact, mwd) != NULL)
return false;
- if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
+ if (mwd.hwndWindow != nullptr && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
return true;
return false;
@@ -49,14 +49,14 @@ int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSe void ShowLog(wchar_t *file)
{
- INT_PTR res = (INT_PTR)ShellExecute(NULL, L"open", file, NULL, NULL, SW_SHOW);
+ INT_PTR res = (INT_PTR)ShellExecute(nullptr, L"open", file, nullptr, nullptr, SW_SHOW);
if (res <= 32) // error
- MessageBox(0, TranslateT("Can't open the log file!"), TranslateT("NewXstatusNotify"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Can't open the log file!"), TranslateT("NewXstatusNotify"), MB_OK | MB_ICONERROR);
}
BOOL StatusHasAwayMessage(char *szProto, int status)
{
- if (szProto != NULL) {
+ if (szProto != nullptr) {
unsigned long iSupportsSM = (unsigned long)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0);
return (iSupportsSM & Proto_Status2Flag(status)) ? TRUE : FALSE;
}
@@ -87,7 +87,7 @@ void LogToFile(wchar_t *stzText) void AddCR(CMStringW &str, const wchar_t *stzText)
{
- if (stzText == NULL)
+ if (stzText == nullptr)
return;
CMStringW res(stzText);
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 0ebdb88bb1..a3cacaecb0 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -92,7 +92,7 @@ wchar_t* GetStatusTypeAsString(int type, wchar_t *buff) CMStringW ReplaceVars(XSTATUSCHANGE *xsc, const wchar_t *tmplt)
{
- if (xsc == NULL || tmplt == NULL || tmplt[0] == '\0')
+ if (xsc == nullptr || tmplt == nullptr || tmplt[0] == '\0')
return CMStringW();
size_t len = mir_wstrlen(tmplt);
@@ -108,14 +108,14 @@ CMStringW ReplaceVars(XSTATUSCHANGE *xsc, const wchar_t *tmplt) break;
case 't':
- if (xsc->stzTitle == NULL || xsc->stzTitle[0] == '\0')
+ if (xsc->stzTitle == nullptr || xsc->stzTitle[0] == '\0')
res.Append(TranslateT("<no title>"));
else
res.Append(xsc->stzTitle);
break;
case 'm':
- if (xsc->stzText == NULL || xsc->stzText[0] == '\0')
+ if (xsc->stzText == nullptr || xsc->stzText[0] == '\0')
res.Append(TranslateT("<no status message>"));
else
AddCR(res, xsc->stzText);
@@ -162,10 +162,10 @@ CMStringW ReplaceVars(XSTATUSCHANGE *xsc, const wchar_t *tmplt) void ShowXStatusPopup(XSTATUSCHANGE *xsc)
{
- if (xsc == NULL)
+ if (xsc == nullptr)
return;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
switch (xsc->type) {
case TYPE_JABBER_MOOD:
@@ -184,11 +184,11 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc) hIcon = (HICON)CallProtoService(xsc->szProto, PS_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
}
- if (hIcon == NULL)
+ if (hIcon == nullptr)
hIcon = Skin_LoadProtoIcon(xsc->szProto, db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_ONLINE));
// cut message if needed
- wchar_t *copyText = NULL;
+ wchar_t *copyText = nullptr;
if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (mir_wstrlen(xsc->stzText) > opt.PXMsgLen)) {
wchar_t buff[MAX_TEXT_LEN + 3];
copyText = mir_wstrdup(xsc->stzText);
@@ -220,10 +220,10 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc) void BlinkXStatusIcon(XSTATUSCHANGE *xsc)
{
- if (xsc == NULL)
+ if (xsc == nullptr)
return;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
wchar_t str[256] = { 0 };
wchar_t stzType[32];
mir_snwprintf(str, TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType));
@@ -247,7 +247,7 @@ void BlinkXStatusIcon(XSTATUSCHANGE *xsc) }
}
- if (hIcon == NULL)
+ if (hIcon == nullptr)
hIcon = Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
BlinkIcon(xsc->hContact, hIcon, str);
@@ -270,7 +270,7 @@ void PlayXStatusSound(MCONTACT hContact, int action) void LogChangeToDB(XSTATUSCHANGE *xsc)
{
- if (xsc == NULL || (opt.XLogToDB_WinOpen && !CheckMsgWnd(xsc->hContact)))
+ if (xsc == nullptr || (opt.XLogToDB_WinOpen && !CheckMsgWnd(xsc->hContact)))
return;
wchar_t *Template = L"";
@@ -301,7 +301,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) dbei.pBlob = (PBYTE)(char*)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.szModule = MODULE;
MEVENT hDBEvent = db_event_add(xsc->hContact, &dbei);
@@ -316,13 +316,13 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) void LogChangeToFile(XSTATUSCHANGE *xsc)
{
- if (xsc == NULL)
+ if (xsc == nullptr)
return;
wchar_t stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN];
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime));
- GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", stzTime, _countof(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"dd/MM/yyyy", stzDate, _countof(stzDate));
wchar_t *Template = L"";
switch (xsc->action) {
@@ -344,7 +344,7 @@ void LogChangeToFile(XSTATUSCHANGE *xsc) void ExtraStatusChanged(XSTATUSCHANGE *xsc)
{
- if (xsc == NULL)
+ if (xsc == nullptr)
return;
BOOL bEnablePopup = true, bEnableSound = true, bEnableLog = opt.XLogToDB;
@@ -463,7 +463,7 @@ wchar_t* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, void LogXstatusChange(MCONTACT hContact, char *szProto, int xstatusType, wchar_t *stzTitle, wchar_t *stzText)
{
- XSTATUSCHANGE *xsc = NewXSC(hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_wstrdup(stzTitle) : NULL, stzText[0] ? mir_wstrdup(stzText) : NULL);
+ XSTATUSCHANGE *xsc = NewXSC(hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_wstrdup(stzTitle) : nullptr, stzText[0] ? mir_wstrdup(stzText) : nullptr);
LogChangeToDB(xsc);
FreeXSC(xsc);
@@ -474,7 +474,7 @@ void AddXStatusEventThread(void *arg) MCONTACT hContact = (MCONTACT)(DWORD_PTR)arg;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return;
wchar_t stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN];
@@ -507,7 +507,7 @@ void AddSMsgEventThread(void *arg) STATUSMSGINFO smi;
smi.hContact = hContact;
smi.proto = GetContactProto(hContact);
- if (smi.proto == NULL)
+ if (smi.proto == nullptr)
return;
smi.newstatusmsg = db_get_wsa(smi.hContact, "CList", "StatusMsg");
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index 64c9208d97..8111d29887 100644 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -39,7 +39,7 @@ void setClistIcon(MCONTACT hContact) bool enabled = isContactSecured(hContact);
extern HANDLE g_hCLIcon;
MCONTACT hMC = db_mc_tryMeta(hContact);
- const char *szIconId = (enabled) ? "secured" : NULL;
+ const char *szIconId = (enabled) ? "secured" : nullptr;
ExtraIcon_SetIconByName(g_hCLIcon, hContact, szIconId);
if(hMC != hContact)
ExtraIcon_SetIconByName(g_hCLIcon, hMC, szIconId);
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 79a68b4bba..27bfb72b0f 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -18,15 +18,15 @@ //global variables
bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
-wchar_t *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
+wchar_t *inopentag = nullptr, *inclosetag = nullptr, *outopentag = nullptr, *outclosetag = nullptr, *password = nullptr;
list <JabberAccount*> Accounts;
CLIST_INTERFACE *pcli;
HINSTANCE hInst;
-HFONT bold_font = NULL;
-HANDLE hLoadPubKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL;
-HGENMENU hSendKey = NULL, hToggleEncryption = NULL;
+HFONT bold_font = nullptr;
+HANDLE hLoadPubKey = nullptr, g_hCLIcon = nullptr, hExportGpgKeys = nullptr, hImportGpgKeys = nullptr;
+HGENMENU hSendKey = nullptr, hToggleEncryption = nullptr;
RECT key_from_keyserver_rect = {0}, firstrun_rect = {0}, new_key_rect = {0}, key_gen_rect = {0}, load_key_rect = {0}, import_key_rect = {0}, key_password_rect = {0}, load_existing_key_rect = {0};
int hLangpack = 0;
diff --git a/plugins/New_GPG/src/jabber_account.cpp b/plugins/New_GPG/src/jabber_account.cpp index 29f561d5e2..c8fe82d0e9 100644 --- a/plugins/New_GPG/src/jabber_account.cpp +++ b/plugins/New_GPG/src/jabber_account.cpp @@ -71,12 +71,12 @@ HJHANDLER JabberAccount::getMessageHandler() JabberAccount::JabberAccount()
{
- AccountName = NULL;
+ AccountName = nullptr;
hSendHandler = INVALID_HANDLE_VALUE;
hPrescenseHandler = INVALID_HANDLE_VALUE;
hMessageHandler = INVALID_HANDLE_VALUE;
AccountNumber = -1;
- JabberInterface = NULL;
+ JabberInterface = nullptr;
}
JabberAccount::~JabberAccount()
{
diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp index 362344c46f..675589111d 100644 --- a/plugins/New_GPG/src/log.cpp +++ b/plugins/New_GPG/src/log.cpp @@ -79,7 +79,7 @@ void logtofile::init() }
logtofile::logtofile()
{
- path = NULL;
+ path = nullptr;
}
logtofile::~logtofile()
{
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 6d954f7451..48bc61e07d 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -23,11 +23,11 @@ extern bool bAutoExchange; void ShowFirstRunDialog(); -HWND hwndFirstRun = NULL, hwndSetDirs = NULL, hwndNewKey = NULL, hwndKeyGen = NULL, hwndSelectExistingKey = NULL; +HWND hwndFirstRun = nullptr, hwndSetDirs = nullptr, hwndNewKey = nullptr, hwndKeyGen = nullptr, hwndSelectExistingKey = nullptr; int itemnum = 0; -HWND hwndList_g = NULL; +HWND hwndList_g = nullptr; BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting); wchar_t key_id_global[17] = { 0 }; @@ -41,7 +41,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (uMsg) { case WM_INITDIALOG: { - SetWindowPos(hwndDlg, 0, firstrun_rect.left, firstrun_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(hwndDlg, nullptr, firstrun_rect.left, firstrun_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); SetWindowText(hwndDlg, TranslateT("Set own key")); EnableWindow(GetDlgItem(hwndDlg, IDC_COPY_PUBKEY), 0); @@ -124,7 +124,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, break; stop = p; p2 = out.find("/", p) - 1; - wchar_t *key_len = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str()), *creation_date = NULL, *expire_date = NULL; + wchar_t *key_len = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str()), *creation_date = nullptr, *expire_date = nullptr; p2 += 2; p = out.find(" ", p2); std::wstring key_id = toUTF16(out.substr(p2, p - p2)); @@ -445,7 +445,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, string::size_type s = out.find("Key fingerprint = "); s += mir_strlen("Key fingerprint = "); string::size_type s2 = out.find("\n", s); - wchar_t *str = NULL; + wchar_t *str = nullptr; { string tmp = out.substr(s, s2 - s - 1).c_str(); string::size_type p = 0; @@ -511,7 +511,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, path.append(L"\\new_key"); wfstream f(path.c_str(), std::ios::out); if (!f.is_open()) { - MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f << "Key-Type: RSA"; @@ -655,14 +655,14 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, boost::algorithm::erase_all(out, "\r"); HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, out.size() + 1); if (!hMem) { - MessageBox(0, TranslateT("Failed to allocate memory"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Failed to allocate memory"), TranslateT("Error"), MB_OK); break; } char *szKey = (char*)GlobalLock(hMem); if (!szKey) { wchar_t msg[64]; mir_snwprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError()); - MessageBox(0, msg, TranslateT("Error"), MB_OK); + MessageBox(nullptr, msg, TranslateT("Error"), MB_OK); GlobalFree(hMem); } memcpy(szKey, out.c_str(), out.size()); @@ -673,7 +673,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, GlobalFree(hMem); wchar_t msg[64]; mir_snwprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError()); - MessageBox(0, msg, TranslateT("Error"), MB_OK); + MessageBox(nullptr, msg, TranslateT("Error"), MB_OK); } CloseClipboard(); } @@ -774,7 +774,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, GetWindowRect(hwndDlg, &firstrun_rect); db_set_dw(NULL, szGPGModuleName, "FirstrunWindowX", firstrun_rect.left); db_set_dw(NULL, szGPGModuleName, "FirstrunWindowY", firstrun_rect.top); - hwndFirstRun = NULL; + hwndFirstRun = nullptr; break; } @@ -806,7 +806,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (boost::filesystem::exists(gpg_lang_path.c_str())) lang_exists = true; if (gpg_exists && !lang_exists) - MessageBox(0, TranslateT("GPG binary found in Miranda folder, but English locale does not exist.\nIt's highly recommended that you place \\gnupg.nls\\en@quot.mo in GnuPG folder under Miranda root.\nWithout this file you may experience many problems with GPG output on non-English systems\nand plugin may completely not work.\nYou have been warned."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("GPG binary found in Miranda folder, but English locale does not exist.\nIt's highly recommended that you place \\gnupg.nls\\en@quot.mo in GnuPG folder under Miranda root.\nWithout this file you may experience many problems with GPG output on non-English systems\nand plugin may completely not work.\nYou have been warned."), TranslateT("Warning"), MB_OK); } DWORD len = MAX_PATH; bool bad_version = false; @@ -816,7 +816,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", (SHGetValueW(HKEY_CURRENT_USER, L"Software\\GNU\\GnuPG", L"gpgProgram", 0, (void*)path.c_str(), &len) == ERROR_SUCCESS) ? path.c_str() : L""); if (tmp[0]) if (!boost::filesystem::exists((wchar_t*)tmp)) - MessageBox(0, TranslateT("Wrong GPG binary location found in system.\nPlease choose another location"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Wrong GPG binary location found in system.\nPlease choose another location"), TranslateT("Warning"), MB_OK); } else tmp = mir_wstrdup(path.c_str()); @@ -844,10 +844,10 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } else { bad_version = false; - MessageBox(0, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Error"), MB_OK); } if (bad_version) - MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } } { @@ -858,7 +858,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, mir_wstrcat(mir_path, L"\\gpg"); if (_waccess(mir_path, 0) != -1) { tmp = mir_wstrdup(mir_path); - MessageBox(0, TranslateT("\"GPG\" directory found in Miranda root.\nAssuming it's GPG home directory.\nGPG home directory set."), TranslateT("Info"), MB_OK); + MessageBox(nullptr, TranslateT("\"GPG\" directory found in Miranda root.\nAssuming it's GPG home directory.\nGPG home directory set."), TranslateT("Info"), MB_OK); } else { wstring path_ = _wgetenv(L"APPDATA"); @@ -870,7 +870,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } //TODO: additional check for write access if (gpg_exists && lang_exists && !bad_version) - MessageBox(0, TranslateT("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), TranslateT("Info"), MB_OK); + MessageBox(nullptr, TranslateT("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), TranslateT("Info"), MB_OK); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), TRUE); return TRUE; } @@ -915,12 +915,12 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, PathToAbsoluteW(L"\\", mir_path); SetCurrentDirectoryW(mir_path); if (!boost::filesystem::exists(tmp)) { - MessageBox(0, TranslateT("GPG binary does not exist.\nPlease choose another location"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("GPG binary does not exist.\nPlease choose another location"), TranslateT("Warning"), MB_OK); break; } } else { - MessageBox(0, TranslateT("Please choose GPG binary location"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Please choose GPG binary location"), TranslateT("Warning"), MB_OK); break; } { @@ -947,17 +947,17 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } else { bad_version = false; - MessageBox(0, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } if (bad_version) - MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } db_set_ws(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp)); while (tmp[mir_wstrlen(tmp) - 1] == '\\') tmp[mir_wstrlen(tmp) - 1] = '\0'; if (!tmp[0]) { - MessageBox(0, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } db_set_ws(NULL, szGPGModuleName, "szHomePath", tmp); @@ -985,12 +985,12 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, PathToAbsoluteW(L"\\", mir_path); SetCurrentDirectoryW(mir_path); if (!boost::filesystem::exists(tmp)) { - MessageBox(0, TranslateT("GPG binary does not exist.\nPlease choose another location"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("GPG binary does not exist.\nPlease choose another location"), TranslateT("Warning"), MB_OK); break; } } else { - MessageBox(0, TranslateT("Please choose GPG binary location"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Please choose GPG binary location"), TranslateT("Warning"), MB_OK); break; } { @@ -1017,17 +1017,17 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } else { bad_version = false; - MessageBox(0, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } if (bad_version) - MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } db_set_ws(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp)); while (tmp[mir_wstrlen(tmp) - 1] == '\\') tmp[mir_wstrlen(tmp) - 1] = '\0'; if (!tmp[0]) { - MessageBox(0, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } db_set_ws(NULL, szGPGModuleName, "szHomePath", tmp); @@ -1049,7 +1049,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, path.append(L"\\new_key"); wfstream f(path.c_str(), std::ios::out); if (!f.is_open()) { - MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f << "Key-Type: RSA"; @@ -1154,7 +1154,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, DestroyWindow(hwndDlg); break; case WM_DESTROY: - hwndSetDirs = NULL; + hwndSetDirs = nullptr; void InitCheck(); InitCheck(); break; @@ -1173,7 +1173,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara { hContact = new_key_hcnt; //new_key_hcnt_mutex.unlock(); - SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(hwndDlg, nullptr, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); wchar_t *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0] ? TranslateT("There is existing key for contact, would you like to replace it with new key?") : TranslateT("New public key was received, do you want to import it?")); @@ -1218,7 +1218,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara db_set_dw(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left); db_set_dw(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top); } - hwndNewKey = NULL; + hwndNewKey = nullptr; break; } @@ -1230,7 +1230,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) { case WM_INITDIALOG: { - SetWindowPos(hwndDlg, 0, key_gen_rect.left, key_gen_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(hwndDlg, nullptr, key_gen_rect.left, key_gen_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); SetWindowText(hwndDlg, TranslateT("Key Generation dialog")); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), L"RSA", 0); @@ -1255,8 +1255,8 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara wchar_t *tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 5); GetDlgItemText(hwndDlg, IDC_KEY_TYPE, tmp, 5); if (mir_wstrlen(tmp) < 3) { - mir_free(tmp); tmp = NULL; - MessageBox(0, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK); + mir_free(tmp); tmp = nullptr; + MessageBox(nullptr, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK); break; } if (tmp) @@ -1266,13 +1266,13 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara int length = _wtoi(tmp); mir_free(tmp); if (length < 1024 || length > 4096) { - MessageBox(0, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK); break; } tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 12); GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 11); if (mir_wstrlen(tmp) != 10 && tmp[0] != '0') { - MessageBox(0, TranslateT("Invalid date"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Invalid date"), TranslateT("Error"), MB_OK); mir_free(tmp); break; } @@ -1280,12 +1280,12 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128); GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 127); if (mir_wstrlen(tmp) < 5) { - MessageBox(0, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK); mir_free(tmp); break; } else if (wcschr(tmp, '(') || wcschr(tmp, ')')) { - MessageBox(0, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK); mir_free(tmp); break; } @@ -1293,7 +1293,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128); GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128); if ((mir_wstrlen(tmp)) < 5 || (!wcschr(tmp, '@')) || (!wcschr(tmp, '.'))) { - MessageBox(0, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK); mir_free(tmp); break; } @@ -1308,7 +1308,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara path.append(L"\\new_key"); wfstream f(path.c_str(), std::ios::out); if (!f.is_open()) { - MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f << "Key-Type: "; @@ -1509,7 +1509,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara db_set_dw(NULL, szGPGModuleName, "KeyGenWindowX", key_gen_rect.left); db_set_dw(NULL, szGPGModuleName, "KeyGenWindowY", key_gen_rect.top); } - hwndKeyGen = NULL; + hwndKeyGen = nullptr; break; } @@ -1529,7 +1529,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP switch (msg) { case WM_INITDIALOG: { - SetWindowPos(hwndDlg, 0, load_existing_key_rect.left, load_existing_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(hwndDlg, nullptr, load_existing_key_rect.left, load_existing_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); col.pszText = L"Key ID"; col.mask = LVCF_TEXT | LVCF_WIDTH; @@ -1704,10 +1704,10 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP mir_free(tmp); } else - MessageBox(NULL, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); } else - MessageBox(NULL, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); + MessageBox(nullptr, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); // SetDlgItemText(hPubKeyEdit, IDC_PUBLIC_KEY_EDIT, tmp); } DestroyWindow(hwndDlg); @@ -1740,7 +1740,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP GetWindowRect(hwndDlg, &load_existing_key_rect); db_set_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowX", load_existing_key_rect.left); db_set_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowY", load_existing_key_rect.top); - hwndSelectExistingKey = NULL; + hwndSelectExistingKey = nullptr; break; } @@ -1756,7 +1756,7 @@ static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wP { hContact = new_key_hcnt; new_key_hcnt_mutex.unlock(); - SetWindowPos(hwndDlg, 0, import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(hwndDlg, nullptr, import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), L"subkeys.pgp.net", 0); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), L"keys.gnupg.net", 0); @@ -1783,7 +1783,7 @@ static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wP params.code = &code; params.result = &result; gpg_launcher(params); - MessageBoxA(0, out.c_str(), "GPG output", MB_OK); + MessageBoxA(nullptr, out.c_str(), "GPG output", MB_OK); } break; } @@ -1807,8 +1807,8 @@ extern HINSTANCE hInst; void ShowFirstRunDialog() { - if (hwndFirstRun == NULL) { - hwndFirstRun = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, DlgProcFirstRun); + if (hwndFirstRun == nullptr) { + hwndFirstRun = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), nullptr, DlgProcFirstRun); } SetForegroundWindow(hwndFirstRun); } @@ -1816,37 +1816,37 @@ void ShowFirstRunDialog() void ShowSetDirsDialog() { - if (hwndSetDirs == NULL) { - hwndSetDirs = CreateDialog(hInst, MAKEINTRESOURCE(IDD_BIN_PATH), NULL, DlgProcGpgBinOpts); + if (hwndSetDirs == nullptr) { + hwndSetDirs = CreateDialog(hInst, MAKEINTRESOURCE(IDD_BIN_PATH), nullptr, DlgProcGpgBinOpts); } SetForegroundWindow(hwndSetDirs); } void ShowNewKeyDialog() { - hwndNewKey = CreateDialog(hInst, MAKEINTRESOURCE(IDD_NEW_KEY), NULL, DlgProcNewKeyDialog); + hwndNewKey = CreateDialog(hInst, MAKEINTRESOURCE(IDD_NEW_KEY), nullptr, DlgProcNewKeyDialog); SetForegroundWindow(hwndNewKey); } void ShowKeyGenDialog() { - if (hwndKeyGen == NULL) { - hwndKeyGen = CreateDialog(hInst, MAKEINTRESOURCE(IDD_KEY_GEN), NULL, DlgProcKeyGenDialog); + if (hwndKeyGen == nullptr) { + hwndKeyGen = CreateDialog(hInst, MAKEINTRESOURCE(IDD_KEY_GEN), nullptr, DlgProcKeyGenDialog); } SetForegroundWindow(hwndKeyGen); } void ShowSelectExistingKeyDialog() { - if (hwndSelectExistingKey == NULL) { - hwndSelectExistingKey = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LOAD_EXISTING_KEY), NULL, DlgProcLoadExistingKey); + if (hwndSelectExistingKey == nullptr) { + hwndSelectExistingKey = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LOAD_EXISTING_KEY), nullptr, DlgProcLoadExistingKey); } SetForegroundWindow(hwndSelectExistingKey); } void ShowImportKeyDialog() { - CreateDialog(hInst, MAKEINTRESOURCE(IDD_IMPORT_KEY), NULL, DlgProcImportKeyDialog); + CreateDialog(hInst, MAKEINTRESOURCE(IDD_IMPORT_KEY), nullptr, DlgProcImportKeyDialog); } void FirstRun() @@ -1899,7 +1899,7 @@ void InitCheck() mir_wstrncat(buf, temp_access ? TranslateT("Temp dir write access granted (this is good).\n") : TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), _countof(buf) - mir_wstrlen(buf)); if (!gpg_valid) mir_wstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), _countof(buf) - mir_wstrlen(buf)); - MessageBox(0, buf, TranslateT("GPG plugin problems"), MB_OK); + MessageBox(nullptr, buf, TranslateT("GPG plugin problems"), MB_OK); } if (!gpg_valid) return; @@ -1951,7 +1951,7 @@ void InitCheck() question += Translate(" for account "); question += toUTF8(accounts[i]->tszAccountName); question += Translate(" deleted from GPG secret keyring.\nDo you want to set another key?"); - if (MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) + if (MessageBoxA(nullptr, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } p2 = p; @@ -1989,7 +1989,7 @@ void InitCheck() question += Translate(" for account "); question += toUTF8(accounts[i]->tszAccountName); question += Translate(" expired and will not work.\nDo you want to set another key?"); - if (MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) + if (MessageBoxA(nullptr, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } mir_free(expire_date); @@ -2005,13 +2005,13 @@ void InitCheck() char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); if (!db_get_b(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0])) { question = Translate("You didn't set a private key.\nWould you like to set it now?"); - if (MessageBoxA(0, question.c_str(), Translate("Own private key warning"), MB_YESNO) == IDYES) + if (MessageBoxA(nullptr, question.c_str(), Translate("Own private key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } if ((p = out.find(keyid)) == string::npos) { question += keyid; question += Translate(" deleted from GPG secret keyring.\nDo you want to set another key?"); - if (MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) + if (MessageBoxA(nullptr, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } p2 = p; @@ -2047,7 +2047,7 @@ void InitCheck() if (expired) { question += keyid; question += Translate(" expired and will not work.\nDo you want to set another key?"); - if (MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) + if (MessageBoxA(nullptr, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } mir_free(expire_date); @@ -2071,7 +2071,7 @@ void InitCheck() Proto_EnumAccounts(&count, &accounts); ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); - cap.hIcon = 0; + cap.hIcon = nullptr; strncpy(cap.name, "GPG Key AutoExchange", MAX_CAPNAME); strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); @@ -2085,7 +2085,7 @@ void InitCheck() Proto_EnumAccounts(&count, &accounts); ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); - cap.hIcon = 0; + cap.hIcon = nullptr; strncpy(cap.name, "GPG Encrypted FileTransfers", MAX_CAPNAME); strncpy(cap.caps, "GPGFileTransfer", sizeof(cap.caps)); @@ -2101,7 +2101,7 @@ void ImportKey() new_key_hcnt_mutex.unlock(); bool for_all_sub = false; if (db_mc_isMeta(hContact)) { - if (MessageBox(0, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) + if (MessageBox(nullptr, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) for_all_sub = true; if (for_all_sub) { @@ -2159,7 +2159,7 @@ void ImportKey() for (int i = 0; i < count; i++) { MCONTACT hcnt = db_mc_getSub(hContact, i); if (hcnt) { - char *tmp = NULL; + char *tmp = nullptr; string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(hcnt, szGPGModuleName, "KeyID", output.substr(s, s2 - s).c_str()); @@ -2182,7 +2182,7 @@ void ImportKey() if (s != string::npos && s2 != string::npos) { tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s - (uncommon ? 1 : 0)).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s - (uncommon ? 1 : 0)).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hcnt, szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); } @@ -2196,7 +2196,7 @@ void ImportKey() if (output[s] == ')') { tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hcnt, szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s += 3; @@ -2204,7 +2204,7 @@ void ImportKey() if (s != string::npos && s2 != string::npos) { tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } @@ -2212,7 +2212,7 @@ void ImportKey() else { tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2, s - s2).c_str()); mir_free(tmp); } @@ -2222,7 +2222,7 @@ void ImportKey() } } else { - char *tmp = NULL; + char *tmp = nullptr; string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s, s2 - s).c_str()); @@ -2245,7 +2245,7 @@ void ImportKey() if (s != string::npos && s2 != string::npos) { tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s - (uncommon ? 1 : 0)).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s - (uncommon ? 1 : 0)).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); } @@ -2258,7 +2258,7 @@ void ImportKey() if (output[s] == ')') { tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s += 3; @@ -2266,7 +2266,7 @@ void ImportKey() if (s != string::npos && s2 != string::npos) { tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } @@ -2274,7 +2274,7 @@ void ImportKey() else { tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2, s - s2).c_str()); mir_free(tmp); } @@ -2283,7 +2283,7 @@ void ImportKey() } } else { - char *tmp = NULL; + char *tmp = nullptr; string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); db_set_s(hContact, szGPGModuleName, "KeyID", output.substr(s, s2 - s).c_str()); @@ -2306,7 +2306,7 @@ void ImportKey() if (s != string::npos && s2 != string::npos) { tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s - (uncommon ? 1 : 0)).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s - (uncommon ? 1 : 0)).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hContact, szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); } @@ -2319,7 +2319,7 @@ void ImportKey() if (output[s] == ')') { tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hContact, szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s += 3; @@ -2327,7 +2327,7 @@ void ImportKey() if (s != string::npos && s2 != string::npos) { tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hContact, szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } @@ -2335,7 +2335,7 @@ void ImportKey() else { tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2, s - s2).c_str()); mir_free(tmp); } @@ -2343,6 +2343,6 @@ void ImportKey() db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); } - MessageBox(0, toUTF16(output).c_str(), L"", MB_OK); + MessageBox(nullptr, toUTF16(output).c_str(), L"", MB_OK); boost::filesystem::remove(tmp2); } diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 2469cd3692..62d33a8839 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -37,7 +37,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR { if (bDebugLog) debuglog << std::string(time_str() + ": info: received encrypted message from: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)) + " with turned off encryption"); - if (MessageBox(0, TranslateT("We received encrypted message from contact with encryption turned off.\nDo you want to turn on encryption for this contact?"), TranslateT("Warning"), MB_YESNO) == IDYES) + if (MessageBox(nullptr, TranslateT("We received encrypted message from contact with encryption turned off.\nDo you want to turn on encryption for this contact?"), TranslateT("Warning"), MB_YESNO) == IDYES) { if (!isContactHaveKey(hContact)) { @@ -59,7 +59,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR setClistIcon(hContact); } } - else if (MessageBox(0, TranslateT("Do you want to try to decrypt encrypted message?"), TranslateT("Warning"), MB_YESNO) == IDNO) + else if (MessageBox(nullptr, TranslateT("Do you want to try to decrypt encrypted message?"), TranslateT("Warning"), MB_YESNO) == IDNO) { HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags)); return; @@ -112,7 +112,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR cmd.push_back(L"--batch"); { char *inkeyid = UniGetContactSettingUtf(db_mc_isMeta(hContact) ? metaGetMostOnline(hContact) : hContact, szGPGModuleName, "InKeyID", ""); - wchar_t *pass = NULL; + wchar_t *pass = nullptr; if (inkeyid[0]) { string dbsetting = "szKey_"; dbsetting += inkeyid; @@ -486,7 +486,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) return 1; } */ { - char *tmp = NULL; + char *tmp = nullptr; s1 = output.find("gpg: key ") + mir_strlen("gpg: key "); s2 = output.find(":", s1); db_set_s(ccs->hContact, szGPGModuleName, "KeyID", output.substr(s1, s2 - s1).c_str()); @@ -505,7 +505,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) s2 = output.find("<", s1); tmp = (char*)mir_alloc(output.substr(s1, s2 - s1 - 1).length() + 1); mir_strcpy(tmp, output.substr(s1, s2 - s1 - 1).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(ccs->hContact, szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); if ((s1 = output.find(")", s2)) == string::npos) @@ -517,14 +517,14 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) { tmp = (char*)mir_alloc(output.substr(s2, s1 - s2).length() + 1); mir_strcpy(tmp, output.substr(s2, s1 - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(ccs->hContact, szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s1 += 3; s2 = output.find(">", s1); tmp = (char*)mir_alloc(output.substr(s1, s2 - s1).length() + 1); mir_strcpy(tmp, output.substr(s1, s2 - s1).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(ccs->hContact, szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } @@ -532,7 +532,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) { tmp = (char*)mir_alloc(output.substr(s2, s1 - s2).length() + 1); mir_strcpy(tmp, output.substr(s2, s1 - s2).c_str()); - mir_utf8decode(tmp, 0); + mir_utf8decode(tmp, nullptr); db_set_s(ccs->hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2, s1 - s2).c_str()); mir_free(tmp); } @@ -746,7 +746,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) if (out.find("There is no assurance this key belongs to the named user") != string::npos) { out.clear(); - if (MessageBox(0, TranslateT("We're trying to encrypt with untrusted key. Do you want to trust this key permanently?"), TranslateT("Warning"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("We're trying to encrypt with untrusted key. Do you want to trust this key permanently?"), TranslateT("Warning"), MB_YESNO) == IDYES) { db_set_b(hContact, szGPGModuleName, "bAlwaysTrust", 1); std::vector<std::wstring> tmp; tmp.push_back(L"--trust-model"); @@ -779,7 +779,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) // return; // } if (out.find("usage: ") != string::npos) { - MessageBox(0, TranslateT("Something is wrong, GPG does not understand us, aborting encryption."), TranslateT("Warning"), MB_OK); + MessageBox(nullptr, TranslateT("Something is wrong, GPG does not understand us, aborting encryption."), TranslateT("Warning"), MB_OK); //mir_free(msg); ProtoChainSend(hContact, PSS_MESSAGE, flags, (LPARAM)msg); if(!bDebugLog) @@ -1003,13 +1003,13 @@ int HookSendMsg(WPARAM w, LPARAM l) static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { - char *inkeyid = NULL; + char *inkeyid = nullptr; switch (msg) { case WM_INITDIALOG: inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); new_key_hcnt_mutex.unlock(); - SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(hwndDlg, nullptr, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); { string questionstr = "Please enter password for key with ID: "; @@ -1073,5 +1073,5 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam void ShowLoadKeyPasswordWindow() { extern HINSTANCE hInst; - DialogBox(hInst, MAKEINTRESOURCE(IDD_KEY_PASSWD), NULL, DlgProcKeyPassword); + DialogBox(hInst, MAKEINTRESOURCE(IDD_KEY_PASSWD), nullptr, DlgProcKeyPassword); } diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index e6fd670fbe..35824da12b 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -70,8 +70,8 @@ int GpgOptInit(WPARAM wParam, LPARAM) map<int, MCONTACT> user_data;
int item_num = 0;
-HWND hwndList_p = NULL;
-HWND hwndCurKey_p = NULL;
+HWND hwndList_p = nullptr;
+HWND hwndCurKey_p = nullptr;
void ShowLoadPublicKeyDialog();
static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -222,7 +222,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
}
if (!keep)
- if (MessageBox(0, TranslateT("This key is not used by any contact. Do you want to remove it from public keyring?"), TranslateT("Key info"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("This key is not used by any contact. Do you want to remove it from public keyring?"), TranslateT("Key info"), MB_YESNO) == IDYES) {
std::vector<wstring> cmd;
string output;
DWORD exitcode;
@@ -246,13 +246,13 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L break;
}
if (output.find("--delete-secret-keys") != string::npos)
- MessageBox(0, TranslateT("we have secret key for this public key, do not removing from GPG keyring"), TranslateT("info"), MB_OK);
+ MessageBox(nullptr, TranslateT("we have secret key for this public key, do not removing from GPG keyring"), TranslateT("info"), MB_OK);
else
- MessageBox(0, TranslateT("Key removed from GPG keyring"), TranslateT("info"), MB_OK);
+ MessageBox(nullptr, TranslateT("Key removed from GPG keyring"), TranslateT("info"), MB_OK);
}
mir_free(tmp);
if (ismetacontact) {
- if (MessageBox(0, TranslateT("Do you want to remove key from entire metacontact (all subcontacts)?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Do you want to remove key from entire metacontact (all subcontacts)?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) {
MCONTACT hcnt = NULL;
int count = db_mc_getSubCount(meta);
for (int i = 0; i < count; i++) {
@@ -326,14 +326,14 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L boost::algorithm::replace_all(str, "\n", "\r\n");
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.size() + 1);
if (!hMem) {
- MessageBox(0, TranslateT("Failed to allocate memory"), TranslateT("Error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Failed to allocate memory"), TranslateT("Error"), MB_OK);
break;
}
szKey = (char*)GlobalLock(hMem);
if (!szKey) {
wchar_t msg[64];
mir_snwprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError());
- MessageBox(0, msg, TranslateT("Error"), MB_OK);
+ MessageBox(nullptr, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
else {
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L GlobalFree(hMem);
wchar_t msg[64];
mir_snwprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError());
- MessageBox(0, msg, TranslateT("Error"), MB_OK);
+ MessageBox(nullptr, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
}
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else {
wchar_t msg[64];
mir_snwprintf(msg, TranslateT("Failed to open clipboard with error %d"), GetLastError());
- MessageBox(0, msg, TranslateT("Error"), MB_OK);
+ MessageBox(nullptr, msg, TranslateT("Error"), MB_OK);
}
break;
@@ -456,7 +456,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, }
else {
bad_version = false;
- MessageBox(0, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK);
+ MessageBox(nullptr, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK);
}
/* if(bad_version) //looks like working fine with gpg2
MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), L"Warning", MB_OK); */
@@ -627,7 +627,7 @@ static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
-HWND hPubKeyEdit = NULL;
+HWND hPubKeyEdit = nullptr;
static LRESULT CALLBACK editctrl_ctrl_a(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa case WM_INITDIALOG:
{
hContact = user_data[1];
- SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ SetWindowPos(hwndDlg, nullptr, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), editctrl_ctrl_a);
MCONTACT hcnt = db_mc_tryMeta(hContact);
TranslateDialogDefault(hwndDlg);
@@ -671,7 +671,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa if (hcnt) {
wchar_t *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", L"");
wstring str = tmp;
- mir_free(tmp); tmp = NULL;
+ mir_free(tmp); tmp = nullptr;
if (!str.empty()) {
wstring::size_type p = 0, stop = 0;
for (;;) {
@@ -760,14 +760,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa mir_wstrcpy(end, L"-----END PGP PRIVATE KEY BLOCK-----");
}
else {
- MessageBox(0, TranslateT("This is not public or private key"), L"INFO", MB_OK);
+ MessageBox(nullptr, TranslateT("This is not public or private key"), L"INFO", MB_OK);
break;
}
ws2 += mir_wstrlen(end);
bool allsubcontacts = false;
{
if (db_mc_isMeta(hContact)) {
- if (MessageBox(0, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) {
allsubcontacts = true;
int count = db_mc_getSubCount(hContact);
for (int i = 0; i < count; i++) {
@@ -837,7 +837,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa }
{
if (output.find("already in secret keyring") != string::npos) {
- MessageBox(0, TranslateT("Key already in secret keyring."), TranslateT("Info"), MB_OK);
+ MessageBox(nullptr, TranslateT("Key already in secret keyring."), TranslateT("Info"), MB_OK);
boost::filesystem::remove(tmp2);
break;
}
@@ -846,7 +846,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa {
char *tmp3 = (char*)mir_alloc((output.substr(s, s2 - s).length() + 1)*sizeof(char));
mir_strcpy(tmp3, output.substr(s, s2 - s).c_str());
- mir_utf8decode(tmp3, 0);
+ mir_utf8decode(tmp3, nullptr);
{
if (db_mc_isMeta(hContact)) {
if (allsubcontacts) {
@@ -889,7 +889,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa {
char *tmp3 = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s - (uncommon ? 1 : 0)).length() + 1));
mir_strcpy(tmp3, output.substr(s, s2 - s - (uncommon ? 1 : 0)).c_str());
- mir_utf8decode(tmp3, 0);
+ mir_utf8decode(tmp3, nullptr);
if (hContact) {
if (db_mc_isMeta(hContact)) {
if (allsubcontacts) {
@@ -919,7 +919,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa if (output[s] == ')') {
char *tmp3 = (char*)mir_alloc((output.substr(s2, s - s2).length() + 1)*sizeof(char));
mir_strcpy(tmp3, output.substr(s2, s - s2).c_str());
- mir_utf8decode(tmp3, 0);
+ mir_utf8decode(tmp3, nullptr);
if (hContact) {
if (db_mc_isMeta(hContact)) {
if (allsubcontacts) {
@@ -939,7 +939,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa s2 = output.find(">", s);
tmp3 = (char*)mir_alloc((output.substr(s, s2 - s).length() + 1) * sizeof(char));
mir_strcpy(tmp3, output.substr(s, s2 - s).c_str());
- mir_utf8decode(tmp3, 0);
+ mir_utf8decode(tmp3, nullptr);
if (hContact) {
if (db_mc_isMeta(hContact)) {
if (allsubcontacts) {
@@ -963,7 +963,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa else {
char *tmp3 = (char*)mir_alloc(output.substr(s2, s - s2).length() + 1);
mir_strcpy(tmp3, output.substr(s2, s - s2).c_str());
- mir_utf8decode(tmp3, 0);
+ mir_utf8decode(tmp3, nullptr);
if (hContact) {
if (db_mc_isMeta(hContact)) {
if (allsubcontacts) {
@@ -1021,7 +1021,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa }
}
tmp = mir_wstrdup(toUTF16(output).c_str());
- MessageBox(0, tmp, L"", MB_OK);
+ MessageBox(nullptr, tmp, L"", MB_OK);
mir_free(tmp);
boost::filesystem::remove(tmp2);
}
@@ -1066,7 +1066,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa wfstream f(tmp, std::ios::in | std::ios::ate | std::ios::binary);
delete[] tmp;
if (!f.is_open()) {
- MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK);
break;
}
if (f.is_open()) {
@@ -1092,7 +1092,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa ws1 = key_buf.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----");
}
if (ws2 == wstring::npos || ws1 == wstring::npos) {
- MessageBox(0, TranslateT("There is no public or private key."), TranslateT("Info"), MB_OK);
+ MessageBox(nullptr, TranslateT("There is no public or private key."), TranslateT("Info"), MB_OK);
break;
}
ws2 += mir_wstrlen(L"-----END PGP PUBLIC KEY BLOCK-----");
@@ -1139,5 +1139,5 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa void ShowLoadPublicKeyDialog()
{
- DialogBox(hInst, MAKEINTRESOURCE(IDD_LOAD_PUBLIC_KEY), NULL, DlgProcLoadPublicKey);
+ DialogBox(hInst, MAKEINTRESOURCE(IDD_LOAD_PUBLIC_KEY), nullptr, DlgProcLoadPublicKey);
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index ac9cbdbba8..76f9a4282c 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -27,7 +27,7 @@ extern HGENMENU hToggleEncryption, hSendKey; wchar_t* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule, const char* szSetting, wchar_t* szDef) { DBVARIANT dbv = { DBVT_DELETED }; - wchar_t* szRes = NULL; + wchar_t* szRes = nullptr; if (db_get_ws(hContact, szModule, szSetting, &dbv)) return mir_wstrdup(szDef); else if (dbv.pszVal) @@ -42,7 +42,7 @@ wchar_t* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModu char* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule, const char* szSetting, char* szDef) { DBVARIANT dbv = { DBVT_DELETED }; - char* szRes = NULL; + char* szRes = nullptr; if (db_get_s(hContact, szModule, szSetting, &dbv)) return mir_strdup(szDef); else if (dbv.pszVal) @@ -103,13 +103,13 @@ wchar_t *GetFilePath(wchar_t *WindowTittle, wchar_t *szExt, wchar_t *szExtDesc, if (!save_file) { if (!GetOpenFileName(&ofn)) { delete[] str; - return NULL; + return nullptr; } } else { if (!GetSaveFileName(&ofn)) { delete[] str; - return NULL; + return nullptr; } } return str; @@ -117,16 +117,16 @@ wchar_t *GetFilePath(wchar_t *WindowTittle, wchar_t *szExt, wchar_t *szExtDesc, void GetFolderPath(wchar_t *WindowTittle, char*) { - BROWSEINFO pbi = { 0 }; + BROWSEINFO pbi = {}; pbi.lpszTitle = WindowTittle; pbi.ulFlags = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_SHAREABLE; LPITEMIDLIST pidl = SHBrowseForFolder(&pbi); - if (pidl != 0) { + if (pidl != nullptr) { wchar_t path[MAX_PATH]; if (SHGetPathFromIDList(pidl, path)) { db_set_ws(NULL, szGPGModuleName, "szHomePath", path); } - IMalloc * imalloc = 0; + IMalloc * imalloc = nullptr; if (SUCCEEDED(SHGetMalloc(&imalloc))) { imalloc->Free(pidl); imalloc->Release(); @@ -194,7 +194,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM) BYTE enc; if (db_mc_isMeta(hContact)) { enc = db_get_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); - if (MessageBox(0, TranslateT("Do you want to toggle encryption for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Do you want to toggle encryption for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) { int count = db_mc_getSubCount(hContact); for (int i = 0; i < count; i++) { MCONTACT hcnt = db_mc_getSub(hContact, i); @@ -273,11 +273,11 @@ int onProtoAck(WPARAM, LPARAM l) case ACKRESULT_SUCCESS: if (ack->hProcess) { PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*)ack->hProcess; - if (f == NULL) + if (f == nullptr) break; if ((f->flags & PFTS_SENDING) != PFTS_SENDING) { - wchar_t *filename = NULL; + wchar_t *filename = nullptr; if (f->flags & PFTS_UNICODE) { if (f->tszCurrentFile && f->tszCurrentFile[0]) filename = mir_wstrdup(f->tszCurrentFile); @@ -312,14 +312,14 @@ int onProtoAck(WPARAM, LPARAM l) wstring::size_type p1 = file.rfind(L".gpg"); file.erase(p1, mir_wstrlen(L".gpg")); if (boost::filesystem::exists(file)) { - if (MessageBox(0, TranslateT("Target file exists, do you want to replace it?"), TranslateT("Warning"), MB_YESNO) == IDNO) + if (MessageBox(nullptr, TranslateT("Target file exists, do you want to replace it?"), TranslateT("Warning"), MB_YESNO) == IDNO) return 0; } cmd.push_back(file); boost::filesystem::remove(file); extern wchar_t *password; { // password - wchar_t *pass = NULL; + wchar_t *pass = nullptr; char *keyid = UniGetContactSettingUtf(ack->hContact, szGPGModuleName, "KeyID", ""); if (mir_strlen(keyid) > 0) { string dbsetting = "szKey_"; @@ -463,20 +463,20 @@ std::wstring encrypt_file(MCONTACT hContact, wchar_t *filename) params.result = &result; delete[] file_out; if (!gpg_launcher(params, boost::posix_time::minutes(3))) - return 0; + return nullptr; if (out.find("There is no assurance this key belongs to the named user") != string::npos) { out.clear(); - if (MessageBox(0, TranslateT("We're trying to encrypt with untrusted key. Do you want to trust this key permanently?"), TranslateT("Warning"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("We're trying to encrypt with untrusted key. Do you want to trust this key permanently?"), TranslateT("Warning"), MB_YESNO) == IDYES) { db_set_b(hcnt, szGPGModuleName, "bAlwaysTrust", 1); std::vector<std::wstring> tmp; tmp.push_back(L"--trust-model"); tmp.push_back(L"always"); cmd.insert(cmd.begin(), tmp.begin(), tmp.end()); if (!gpg_launcher(params, boost::posix_time::minutes(3))) - return 0; + return nullptr; } else - return 0; + return nullptr; } return path_out; } @@ -526,11 +526,11 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) mir_free(jid); } if (supported_proto && !cap_found) { - if (MessageBox(0, TranslateT("Capability to decrypt file not found on other side.\nRecipient may be unable to decrypt file(s).\nDo you want to encrypt file(s) anyway?"), TranslateT("File transfer warning"), MB_YESNO) == IDNO) + if (MessageBox(nullptr, TranslateT("Capability to decrypt file not found on other side.\nRecipient may be unable to decrypt file(s).\nDo you want to encrypt file(s) anyway?"), TranslateT("File transfer warning"), MB_YESNO) == IDNO) return Proto_ChainSend(w, ccs); } if (!supported_proto) { - if (MessageBox(0, TranslateT("Unable to check encryption support on other side.\nRecipient may be unable to decrypt file(s).\nCurrently capability check supported only for ICQ and Jabber protocols.\nIt will work for any other proto if Miranda with New_GPG is used on other side.\nDo you want to encrypt file(s) anyway?"), TranslateT("File transfer warning"), MB_YESNO) == IDNO) + if (MessageBox(nullptr, TranslateT("Unable to check encryption support on other side.\nRecipient may be unable to decrypt file(s).\nCurrently capability check supported only for ICQ and Jabber protocols.\nIt will work for any other proto if Miranda with New_GPG is used on other side.\nDo you want to encrypt file(s) anyway?"), TranslateT("File transfer warning"), MB_YESNO) == IDNO) return Proto_ChainSend(w, ccs); } HistoryLog(ccs->hContact, db_event(Translate("encrypting file for transfer"), 0, 0, DBEF_SENT)); @@ -576,7 +576,7 @@ void HistoryLog(MCONTACT hContact, db_event evt) Event.eventType = evt.eventType; Event.flags = evt.flags; if (!evt.timestamp) - Event.timestamp = (DWORD)time(NULL); + Event.timestamp = (DWORD)time(nullptr); else Event.timestamp = evt.timestamp; Event.cbBlob = (DWORD)mir_strlen((char*)evt.pBlob) + 1; @@ -651,7 +651,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) break; } - if (str == NULL) + if (str == nullptr) continue; // TODO: make following block more readable @@ -1002,7 +1002,7 @@ bool isGPGKeyExist() } bool isGPGValid() { - wchar_t *tmp = NULL; + wchar_t *tmp = nullptr; bool gpg_exists = false, is_valid = true; tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L""); boost::filesystem::path p(tmp); @@ -1011,7 +1011,7 @@ bool isGPGValid() gpg_exists = true; else { mir_free(tmp); - tmp = NULL; + tmp = nullptr; wchar_t *path = (wchar_t*)mir_alloc(sizeof(wchar_t)*MAX_PATH); wchar_t *mir_path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t)); PathToAbsoluteW(L"\\", mir_path); @@ -1023,7 +1023,7 @@ bool isGPGValid() mir_wstrcpy(gpg_path, tmp); mir_wstrcat(gpg_path, L"\\GnuPG\\gpg.exe"); mir_free(tmp); - tmp = NULL; + tmp = nullptr; p = boost::filesystem::path(gpg_path); if (boost::filesystem::exists(p) && boost::filesystem::is_regular_file(p)) { gpg_exists = true; @@ -1037,7 +1037,7 @@ bool isGPGValid() if (gpg_exists) { db_set_ws(NULL, szGPGModuleName, "szGpgBinPath", tmp); mir_free(tmp); - tmp = NULL; + tmp = nullptr; string out; DWORD code; std::vector<wstring> cmd; @@ -1056,7 +1056,7 @@ bool isGPGValid() } if (tmp) { mir_free(tmp); - tmp = NULL; + tmp = nullptr; } /* if(!gpg_exists) { @@ -1126,7 +1126,7 @@ unsigned __stdcall sttFakeAck(void *param) WaitForSingleObject(tParam->hEvent, INFINITE); Sleep(100); - if (tParam->msg == NULL) + if (tParam->msg == nullptr) SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->id, 0); else SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, LPARAM(tParam->msg)); @@ -1140,9 +1140,9 @@ unsigned __stdcall sttFakeAck(void *param) int returnNoError(MCONTACT hContact) { - HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + HANDLE hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); unsigned int tID; - CloseHandle((HANDLE)_beginthreadex(NULL, 0, sttFakeAck, new TFakeAckParams(hEvent, hContact, 777, 0), 0, &tID)); + CloseHandle((HANDLE)_beginthreadex(nullptr, 0, sttFakeAck, new TFakeAckParams(hEvent, hContact, 777, nullptr), 0, &tID)); SetEvent(hEvent); return 777; } @@ -1416,7 +1416,7 @@ void ExportGpGKeysFunc(int type) mir_snwprintf(msg, TranslateT("We have successfully exported all private keys.")); else if (!type) mir_snwprintf(msg, TranslateT("We have successfully exported %d public keys."), exported_keys); - MessageBox(NULL, msg, TranslateT("Keys export result"), MB_OK); + MessageBox(nullptr, msg, TranslateT("Keys export result"), MB_OK); } INT_PTR ExportGpGKeys(WPARAM, LPARAM) @@ -1640,7 +1640,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) processed_keys++; { if (output.find("already in secret keyring") != string::npos) { - MessageBox(0, TranslateT("Key already in secret keyring."), TranslateT("Info"), MB_OK); + MessageBox(nullptr, TranslateT("Key already in secret keyring."), TranslateT("Info"), MB_OK); boost::filesystem::remove(path); break; } @@ -1649,7 +1649,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) string::size_type s2 = output.find(":", s); tmp2 = (char*)mir_alloc((output.substr(s, s2 - s).length() + 1) * sizeof(char)); mir_strcpy(tmp2, output.substr(s, s2 - s).c_str()); - mir_utf8decode(tmp2, 0); + mir_utf8decode(tmp2, nullptr); db_set_s(hContact, szGPGModuleName, "KeyID", tmp2); mir_free(tmp2); s = output.find("“", s2); @@ -1666,7 +1666,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) if (s2 != string::npos) { tmp2 = (char*)mir_alloc((output.substr(s, s2 - s - 1).length() + 1) * sizeof(char)); mir_strcpy(tmp2, output.substr(s, s2 - s - 1).c_str()); - mir_utf8decode(tmp2, 0); + mir_utf8decode(tmp2, nullptr); if (hContact) { db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); } @@ -1679,7 +1679,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) if (output[s] == ')') { tmp2 = (char*)mir_alloc((output.substr(s2, s - s2).length() + 1) * sizeof(char)); mir_strcpy(tmp2, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp2, 0); + mir_utf8decode(tmp2, nullptr); if (hContact) db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2, s - s2).c_str()); mir_free(tmp2); @@ -1687,7 +1687,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) s2 = output.find(">", s); tmp2 = (char*)mir_alloc((output.substr(s, s2 - s).length() + 1) * sizeof(char)); mir_strcpy(tmp2, output.substr(s, s2 - s).c_str()); - mir_utf8decode(tmp2, 0); + mir_utf8decode(tmp2, nullptr); if (hContact) db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s, s2 - s).c_str()); mir_free(tmp2); @@ -1695,7 +1695,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) else { tmp2 = (char*)mir_alloc((output.substr(s2, s - s2).length() + 1) * sizeof(char)); mir_strcpy(tmp2, output.substr(s2, s - s2).c_str()); - mir_utf8decode(tmp2, 0); + mir_utf8decode(tmp2, nullptr); if (hContact) db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2, s - s2).c_str()); mir_free(tmp2); @@ -1752,7 +1752,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) mir_snwprintf(msg, TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys); else mir_snwprintf(msg, TranslateT("We have successfully processed %d public keys."), processed_keys); - MessageBox(NULL, msg, TranslateT("Keys import result"), MB_OK); + MessageBox(nullptr, msg, TranslateT("Keys import result"), MB_OK); return 0; } @@ -1839,7 +1839,7 @@ static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARA void ShowEncryptedFileMsgBox() { extern HINSTANCE hInst; - DialogBox(hInst, MAKEINTRESOURCE(IDD_ENCRYPTED_FILE_MSG_BOX), NULL, DlgProcEncryptedFileMsgBox); + DialogBox(hInst, MAKEINTRESOURCE(IDD_ENCRYPTED_FILE_MSG_BOX), nullptr, DlgProcEncryptedFileMsgBox); } static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) @@ -1877,7 +1877,7 @@ static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam, void ShowExportKeysDlg() { - DialogBox(hInst, MAKEINTRESOURCE(IDD_EXPORT_TYPE), NULL, DlgProcExportKeys); + DialogBox(hInst, MAKEINTRESOURCE(IDD_EXPORT_TYPE), nullptr, DlgProcExportKeys); } static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) @@ -1975,8 +1975,8 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara void ShowChangePasswdDlg() { extern HINSTANCE hInst; - HWND hwndPaaswdDlg = NULL; - hwndPaaswdDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CHANGE_PASSWD), NULL, DlgProcChangePasswd); + HWND hwndPaaswdDlg = nullptr; + hwndPaaswdDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CHANGE_PASSWD), nullptr, DlgProcChangePasswd); SetForegroundWindow(hwndPaaswdDlg); } diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index 62cd91361f..4d01851929 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg)
{
- wchar_t *tlogin = NULL, *tpass = NULL;
+ wchar_t *tlogin = nullptr, *tpass = nullptr;
if (hContact && db_get_b(hContact, MODULE, "UseAuth", 0)) {
tlogin = db_get_wsa(hContact, MODULE, "Login");
tpass = db_get_wsa(hContact, MODULE, "Password");
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 2be3a3d965..11e482f5e0 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -22,18 +22,18 @@ Boston, MA 02111-1307, USA. LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg)
{
Netlib_LogfW(hNetlibUser, L"Started validating feed %s.", tszURL);
- char *szData = NULL;
+ char *szData = nullptr;
GetNewsData(tszURL, &szData, NULL, hwndDlg);
if (szData) {
wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
tszData = mir_a2u(szData);
int bytesParsed = 0;
- HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
+ HXML hXml = xmlParseString(tszData, &bytesParsed, nullptr);
mir_free(tszData);
mir_free(szData);
- if (hXml != NULL) {
- LPCTSTR codepage = NULL;
+ if (hXml != nullptr) {
+ LPCTSTR codepage = nullptr;
int childcount = 0;
HXML node;
HXML tmpnode = xmlGetFirstChild(hXml);
@@ -107,7 +107,7 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) wchar_t mes[MAX_PATH];
mir_snwprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR);
- return NULL;
+ return nullptr;
}
static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStringW &descr, CMStringW &author, CMStringW &comments, CMStringW &guid, CMStringW &category, time_t stamp)
@@ -176,7 +176,7 @@ static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStr if (!MesExist) {
if (stamp == 0)
- stamp = time(NULL);
+ stamp = time(nullptr);
T2Utf pszMessage(message);
@@ -194,13 +194,13 @@ void CheckCurrentFeed(MCONTACT hContact) return;
wchar_t *szURL = db_get_wsa(hContact, MODULE, "URL");
- if (szURL == NULL)
+ if (szURL == nullptr)
return;
Netlib_LogfW(hNetlibUser, L"Started checking feed %s.", szURL);
- char *szData = NULL;
- GetNewsData(szURL, &szData, hContact, NULL);
+ char *szData = nullptr;
+ GetNewsData(szURL, &szData, hContact, nullptr);
mir_free(szURL);
if (szData) {
@@ -208,13 +208,13 @@ void CheckCurrentFeed(MCONTACT hContact) if (!tszData)
tszData = mir_a2u(szData);
int bytesParsed = 0;
- HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
+ HXML hXml = xmlParseString(tszData, &bytesParsed, nullptr);
mir_free(tszData);
mir_free(szData);
CMStringW szValue;
- if (hXml != NULL) {
- LPCTSTR codepage = NULL;
+ if (hXml != nullptr) {
+ LPCTSTR codepage = nullptr;
int childcount = 0;
HXML node;
HXML tmpnode = xmlGetFirstChild(hXml);
@@ -265,7 +265,7 @@ void CheckCurrentFeed(MCONTACT hContact) HXML child = xmlGetChild(chan, j);
LPCTSTR childName = xmlGetName(child);
if (!mir_wstrcmpi(childName, L"title")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -277,7 +277,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "FirstName", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"link")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -289,7 +289,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "Homepage", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"description")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -304,7 +304,7 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
else if (!mir_wstrcmpi(childName, L"language")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -316,7 +316,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "Language1", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"managingEditor")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -328,7 +328,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "e-mail", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"category")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -340,7 +340,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "Interest0Text", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"copyright")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -382,7 +382,7 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
else if (!mir_wstrcmpi(childName, L"lastBuildDate")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -392,10 +392,10 @@ void CheckCurrentFeed(MCONTACT hContact) szChildText = xmlGetText(child);
if (szChildText) {
time_t stamp = DateToUnixTime(szChildText, 0);
- double deltaupd = difftime(time(NULL), stamp);
- double deltacheck = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double deltaupd = difftime(time(nullptr), stamp);
+ double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
xmlDestroyNode(hXml);
return;
}
@@ -407,7 +407,7 @@ void CheckCurrentFeed(MCONTACT hContact) for (int z = 0; z < xmlGetChildCount(child); z++) {
HXML itemval = xmlGetChild(child, z);
LPCTSTR itemName = xmlGetName(itemval);
- LPCTSTR value = NULL;
+ LPCTSTR value = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(itemval)), -1, buf, _countof(buf));
@@ -525,10 +525,10 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) {
wchar_t *lastupdtime = (wchar_t *)szChildText;
time_t stamp = DateToUnixTime(lastupdtime, 1);
- double deltaupd = difftime(time(NULL), stamp);
- double deltacheck = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double deltaupd = difftime(time(nullptr), stamp);
+ double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
xmlDestroyNode(hXml);
return;
}
@@ -601,7 +601,7 @@ void CheckCurrentFeed(MCONTACT hContact) xmlDestroyNode(hXml);
}
}
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
}
void CheckCurrentFeedAvatar(MCONTACT hContact)
@@ -610,24 +610,24 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) return;
wchar_t *szURL = db_get_wsa(hContact, MODULE, "URL");
- if (szURL == NULL)
+ if (szURL == nullptr)
return;
- char *szData = NULL;
- GetNewsData(szURL, &szData, hContact, NULL);
+ char *szData = nullptr;
+ GetNewsData(szURL, &szData, hContact, nullptr);
mir_free(szURL);
- if (szData == NULL)
+ if (szData == nullptr)
return;
wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
tszData = mir_a2u(szData);
int bytesParsed = 0;
- HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
+ HXML hXml = xmlParseString(tszData, &bytesParsed, nullptr);
mir_free(tszData);
mir_free(szData);
- if (hXml == NULL)
+ if (hXml == nullptr)
return;
int childcount = 0;
diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index e959797d1b..b2c22b55d3 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -43,8 +43,8 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t FileName[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, _countof(FileName));
int bytesParsed = 0;
- HXML hXml = xmlParseFile(FileName, &bytesParsed, NULL);
- if(hXml != NULL) {
+ HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
+ if(hXml != nullptr) {
HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
bool isTextUTF = false, isURLUTF = false, isSiteURLUTF = false, isGroupUTF = false;
HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
@@ -74,7 +74,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else if (!xmlUrl && outlineChildsCount)
node = xmlGetFirstChild(node);
else if (xmlUrl) {
- wchar_t *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL;
+ wchar_t *text = nullptr, *url = nullptr, *siteurl = nullptr, *group = nullptr;
BYTE NeedToImport = FALSE;
for (int i = 0; i < outlineAttr; i++) {
if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
@@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM parent = xmlGetParent(parent);
}
- wchar_t *ptszGroup = NULL;
+ wchar_t *ptszGroup = nullptr;
if (group) {
ptszGroup = mir_utf8decodeW(_T2A(group));
if ( !ptszGroup) {
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t tmp[MAX_PATH];
mir_snwprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -227,8 +227,8 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (GetOpenFileName(&ofn)) {
int bytesParsed = 0;
- HXML hXml = xmlParseFile(FileName, &bytesParsed, NULL);
- if(hXml != NULL) {
+ HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
+ if(hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
if ( !node)
node = xmlGetChildByPath(hXml, L"body/outline", 0);
@@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "ExportDlg");
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
wchar_t *message = db_get_wsa(hContact, MODULE, "Nick");
- if (message != NULL) {
+ if (message != nullptr) {
SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)message);
mir_free(message);
}
@@ -479,7 +479,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t tmp[MAX_PATH];
mir_snwprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -489,11 +489,11 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.lpstrDefExt = L"";
if (GetSaveFileName(&ofn)) {
- HXML hXml = xmlCreateNode(L"opml", NULL, FALSE);
+ HXML hXml = xmlCreateNode(L"opml", nullptr, FALSE);
xmlAddAttr(hXml, L"version", L"1.0");
- HXML header = xmlAddChild(hXml, L"head", NULL);
+ HXML header = xmlAddChild(hXml, L"head", nullptr);
xmlAddChild(header, L"title", L"Miranda NG NewsAggregator plugin export");
- header = xmlAddChild(hXml, L"body", NULL);
+ header = xmlAddChild(hXml, L"body", nullptr);
int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0);
for (int i = 0; i < count; i++) {
@@ -510,23 +510,23 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (group)
{
wchar_t *section = wcstok(group, L"\\");
- while (section != NULL)
+ while (section != nullptr)
{
HXML existgroup = xmlGetChildByAttrValue(header, L"outline", L"title", section);
if ( !existgroup)
{
- elem = xmlAddChild(elem, L"outline", NULL);
+ elem = xmlAddChild(elem, L"outline", nullptr);
xmlAddAttr(elem, L"title", section);
xmlAddAttr(elem, L"text", section);
} else {
elem = existgroup;
}
- section = wcstok(NULL, L"\\");
+ section = wcstok(nullptr, L"\\");
}
- elem = xmlAddChild(elem, L"outline", NULL);
+ elem = xmlAddChild(elem, L"outline", nullptr);
}
else
- elem = xmlAddChild(elem, L"outline", NULL);
+ elem = xmlAddChild(elem, L"outline", nullptr);
xmlAddAttr(elem, L"text", title);
xmlAddAttr(elem, L"title", title);
xmlAddAttr(elem, L"type", L"rss");
diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp index 8cfd2716e2..763890c580 100644 --- a/plugins/NewsAggregator/Src/Icons.cpp +++ b/plugins/NewsAggregator/Src/Icons.cpp @@ -49,5 +49,5 @@ HANDLE GetIconHandle(const char *name) if ( !mir_strcmp(iconList[i].szName, name))
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index 76cb73248a..73128cf5be 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -67,7 +67,7 @@ void InitMenu() // adding contact menu items
SET_UID(mi, 0x92be499c, 0x928c, 0x4789, 0x8f, 0x36, 0x28, 0xa2, 0x9f, 0xb7, 0x1a, 0x97);
- mi.root = NULL;
+ mi.root = nullptr;
mi.position = -0x7FFFFFFA;
mi.hIcolibItem = GetIconHandle("checkfeed");
mi.name.w = LPGENW("Check feed");
@@ -79,5 +79,5 @@ void InitMenu() mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED;
hService2[6] = Menu_AddContactMenuItem(&mi, MODULE);
- Menu_ModifyItem(hService2[0], NULL, GetIconHandle(db_get_b(NULL, MODULE, "AutoUpdate", 1) ? "enabled" : "disabled"));
+ Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(db_get_b(NULL, MODULE, "AutoUpdate", 1) ? "enabled" : "disabled"));
}
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index 44c9e4d035..01a57f1ac1 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -19,12 +19,12 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
int hLangpack;
-HANDLE hPrebuildMenuHook = NULL;
+HANDLE hPrebuildMenuHook = nullptr;
HWND hAddFeedDlg;
-MWindowList hChangeFeedDlgList = NULL;
+MWindowList hChangeFeedDlgList = nullptr;
wchar_t tszRoot[MAX_PATH] = {0};
HANDLE hUpdateMutex;
@@ -62,7 +62,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, NewsAggrInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, NewsAggrPreShutdown);
- hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
+ hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr);
hChangeFeedDlgList = WindowList_Create();
// register weather protocol
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index d9868930f3..e5061b1e38 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -62,7 +62,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
db_set_ws(hContact, MODULE, "URL", str);
db_set_b(hContact, MODULE, "CheckState", 1);
- db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
+ db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ws(hContact, MODULE, "MsgFormat", str);
db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
@@ -115,7 +115,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
wchar_t tszURL[MAX_PATH] = { 0 };
- wchar_t *tszTitle = NULL;
+ wchar_t *tszTitle = nullptr;
if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0)
tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
else
@@ -132,7 +132,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_DESTROY:
- hAddFeedDlg = 0;
+ hAddFeedDlg = nullptr;
Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "AddDlg");
break;
}
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_ws(SelItem->hContact, MODULE, "URL", str);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ws(SelItem->hContact, MODULE, "Nick", str);
- db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
+ db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ws(SelItem->hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
@@ -374,7 +374,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_ws(hContact, MODULE, "URL", str);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ws(hContact, MODULE, "Nick", str);
- db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
+ db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ws(hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
@@ -474,14 +474,14 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_ADD:
- if (hAddFeedDlg == 0)
+ if (hAddFeedDlg == nullptr)
hAddFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcAddFeedOpts, (LPARAM)hwndList);
return FALSE;
case IDC_CHANGE:
sel = ListView_GetSelectionMark(hwndList);
{
- ItemInfo SelItem = { 0 };
+ ItemInfo SelItem = {};
ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
SelItem.hwndList = hwndList;
@@ -552,7 +552,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case NM_DBLCLK:
sel = ListView_GetHotItem(hwndList);
if (sel != -1) {
- ItemInfo SelItem = { 0 };
+ ItemInfo SelItem = {};
ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
SelItem.hwndList = hwndList;
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 2ca891def2..ef78723338 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. int g_nStatus = ID_STATUS_ONLINE;
UINT_PTR timerId = 0;
-HANDLE hTBButton = NULL, hNewsAggregatorFolder = NULL;
+HANDLE hTBButton = nullptr, hNewsAggregatorFolder = nullptr;
void SetContactStatus(MCONTACT hContact, int nNewStatus)
{
@@ -44,7 +44,7 @@ int NewsAggrInit(WPARAM, LPARAM) for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
- db_set_dw(hContact, MODULE, "LastCheck", time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", time(nullptr));
SetContactStatus(hContact, ID_STATUS_ONLINE);
}
@@ -55,7 +55,7 @@ int NewsAggrInit(WPARAM, LPARAM) HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
// timer for the first update
- timerId = SetTimer(NULL, 0, 10000, timerProc2); // first update is 10 sec after load
+ timerId = SetTimer(nullptr, 0, 10000, timerProc2); // first update is 10 sec after load
return 0;
}
@@ -67,7 +67,7 @@ int NewsAggrPreShutdown(WPARAM, LPARAM) WindowList_Broadcast(hChangeFeedDlgList, WM_CLOSE, 0, 0);
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
NetlibUnInit();
return 0;
}
@@ -151,15 +151,15 @@ INT_PTR CheckAllFeeds(WPARAM, LPARAM lParam) UpdateListAdd(hContact);
}
if (!ThreadRunning)
- mir_forkthread(UpdateThreadProc, 0);
+ mir_forkthread(UpdateThreadProc, nullptr);
return 0;
}
INT_PTR AddFeed(WPARAM, LPARAM)
{
- if (hAddFeedDlg == 0)
- hAddFeedDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ADDFEED), NULL, DlgProcAddFeedOpts);
+ if (hAddFeedDlg == nullptr)
+ hAddFeedDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ADDFEED), nullptr, DlgProcAddFeedOpts);
ShowWindow(hAddFeedDlg, SW_SHOW);
return 0;
}
@@ -168,7 +168,7 @@ INT_PTR ChangeFeed(WPARAM hContact, LPARAM) {
HWND hChangeFeedDlg = WindowList_Find(hChangeFeedDlgList, hContact);
if (!hChangeFeedDlg) {
- hChangeFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), NULL, DlgProcChangeFeedMenu, hContact);
+ hChangeFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), nullptr, DlgProcChangeFeedMenu, hContact);
ShowWindow(hChangeFeedDlg, SW_SHOW);
} else {
SetForegroundWindow(hChangeFeedDlg);
@@ -179,13 +179,13 @@ INT_PTR ChangeFeed(WPARAM hContact, LPARAM) INT_PTR ImportFeeds(WPARAM, LPARAM)
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), NULL, DlgProcImportOpts);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), nullptr, DlgProcImportOpts);
return 0;
}
INT_PTR ExportFeeds(WPARAM, LPARAM)
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), NULL, DlgProcExportOpts);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), nullptr, DlgProcExportOpts);
return 0;
}
@@ -212,7 +212,7 @@ INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam, LPARAM lParam) mir_forkthread(UpdateThreadProc, (void *)TRUE);
wchar_t *ptszImageURL = db_get_wsa(pai->hContact, MODULE, "ImageURL");
- if(ptszImageURL == NULL)
+ if(ptszImageURL == nullptr)
return GAIR_NOAVATAR;
mir_free(ptszImageURL);
@@ -246,7 +246,7 @@ INT_PTR EnableDisable(WPARAM, LPARAM) int OnToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.name = LPGEN("Enable/disable auto update");
ttb.pszService = MS_NEWSAGGREGATOR_ENABLED;
ttb.pszTooltipUp = LPGEN("Auto Update Enabled");
diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp index 245229e698..07489d7dd8 100644 --- a/plugins/NewsAggregator/Src/Update.cpp +++ b/plugins/NewsAggregator/Src/Update.cpp @@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. // check if Feed is currently updating
bool ThreadRunning;
-UPDATELIST *UpdateListHead = NULL;
-UPDATELIST *UpdateListTail = NULL;
+UPDATELIST *UpdateListHead = nullptr;
+UPDATELIST *UpdateListTail = nullptr;
// main auto-update timer
void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
@@ -32,7 +32,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) bool HaveUpdates = FALSE;
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) {
- double diff = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double diff = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) {
UpdateListAdd(hContact);
HaveUpdates = TRUE;
@@ -40,7 +40,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) }
}
if (!ThreadRunning && HaveUpdates)
- mir_forkthread(UpdateThreadProc, 0);
+ mir_forkthread(UpdateThreadProc, nullptr);
}
}
@@ -48,13 +48,13 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) // when this is run, it kill the old startup timer and create the permenant one above
void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
ThreadRunning = FALSE;
if (db_get_b(NULL, MODULE, "AutoUpdate", 1) && !Miranda_IsTerminated()) {
if (db_get_b(NULL, MODULE, "StartupRetrieve", 1))
CheckAllFeeds(0, 1);
- timerId = SetTimer(NULL, 0, 30000, (TIMERPROC)timerProc);
+ timerId = SetTimer(nullptr, 0, 30000, (TIMERPROC)timerProc);
}
}
@@ -62,11 +62,11 @@ void UpdateListAdd(MCONTACT hContact) {
UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST));
newItem->hContact = hContact;
- newItem->next = NULL;
+ newItem->next = nullptr;
WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListTail == NULL)
+ if (UpdateListTail == nullptr)
UpdateListHead = newItem;
else UpdateListTail->next = newItem;
UpdateListTail = newItem;
@@ -80,14 +80,14 @@ MCONTACT UpdateGetFirst() WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListHead != NULL) {
+ if (UpdateListHead != nullptr) {
UPDATELIST* Item = UpdateListHead;
hContact = Item->hContact;
UpdateListHead = Item->next;
mir_free(Item);
- if (UpdateListHead == NULL)
- UpdateListTail = NULL;
+ if (UpdateListHead == nullptr)
+ UpdateListTail = nullptr;
}
ReleaseMutex(hUpdateMutex);
@@ -101,13 +101,13 @@ void DestroyUpdateList(void) // free the list one by one
UPDATELIST *temp = UpdateListHead;
- while (temp != NULL) {
+ while (temp != nullptr) {
UpdateListHead = temp->next;
mir_free(temp);
temp = UpdateListHead;
}
// make sure the entire list is clear
- UpdateListTail = NULL;
+ UpdateListTail = nullptr;
ReleaseMutex(hUpdateMutex);
}
@@ -122,11 +122,11 @@ void UpdateThreadProc(void *AvatarCheck) ThreadRunning = TRUE; // prevent 2 instance of this thread running
ReleaseMutex(hUpdateMutex);
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
// update news by getting the first station from the queue until the queue is empty
- while (UpdateListHead != NULL && !Miranda_IsTerminated()) {
- if (AvatarCheck != NULL)
+ while (UpdateListHead != nullptr && !Miranda_IsTerminated()) {
+ if (AvatarCheck != nullptr)
CheckCurrentFeedAvatar(UpdateGetFirst());
else
CheckCurrentFeed(UpdateGetFirst());
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index c456ef21d9..db6f67eab5 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -19,14 +19,14 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HNETLIBUSER hNetlibUser = NULL;
+HNETLIBUSER hNetlibUser = nullptr;
HNETLIBCONN hNetlibHttp;
bool UpdateListFlag = FALSE;
bool IsMyContact(MCONTACT hContact)
{
const char *szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(MODULE, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(MODULE, szProto) == 0;
}
void NetlibInit()
@@ -41,7 +41,7 @@ void NetlibInit() void NetlibUnInit()
{
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
}
void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg)
@@ -53,7 +53,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
- if (wcsstr(tszUrl, L"https://") != NULL)
+ if (wcsstr(tszUrl, L"https://") != nullptr)
nlhr.flags |= NLHRF_SSL;
char *szUrl = mir_u2a(tszUrl);
nlhr.szUrl = szUrl;
@@ -93,7 +93,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg }
else if (nlhrReply->resultCode == 401) {
Netlib_LogfW(hNetlibUser, L"Code 401: feed %s needs auth data.", tszUrl);
- ItemInfo SelItem = { 0 };
+ ItemInfo SelItem = {};
SelItem.hwndList = hwndDlg;
SelItem.hContact = hContact;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AUTHENTICATION), hwndDlg, AuthenticationProc, (LPARAM)&SelItem) == IDOK)
@@ -175,7 +175,7 @@ time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType) int i, y;
time_t t;
- if (stamp == NULL)
+ if (stamp == nullptr)
return 0;
wchar_t *p = NEWWSTR_ALLOCA(stamp);
@@ -195,7 +195,7 @@ time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType) int day, month = 0, year, hour, min, sec, timezoneh, timezonem;
if (wcsstr(p, L",")) {
weekday = wcstok(p, L",");
- p = wcstok(NULL, L",");
+ p = wcstok(nullptr, L",");
swscanf(p + 1, L"%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem);
if (!mir_wstrcmpi(monthstr, L"Jan"))
month = 1;
@@ -308,7 +308,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
if (pReply) {
if ((200 == pReply->resultCode) && (pReply->dataLength > 0)) {
- char *date = NULL, *size = NULL;
+ char *date = nullptr, *size = nullptr;
for (int i = 0; i < pReply->headersCount; i++) {
if (!mir_strcmpi(pReply->headers[i].szName, "Last-Modified")) {
date = pReply->headers[i].szValue;
@@ -319,7 +319,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) continue;
}
}
- if (date != NULL && size != NULL) {
+ if (date != nullptr && size != nullptr) {
wchar_t *tdate = mir_a2u(date);
wchar_t *tsize = mir_a2u(size);
struct _stat buf;
@@ -331,8 +331,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) time_t filemodtime = mktime(localtime(&buf.st_atime));
if (modtime > filemodtime && buf.st_size != _wtoi(tsize)) {
DWORD dwBytes;
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -341,8 +341,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) }
else {
DWORD dwBytes;
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -352,8 +352,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) }
else {
DWORD dwBytes;
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -371,23 +371,23 @@ typedef HRESULT(MarkupCallback)(IHTMLDocument3 *, BSTR &message); HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &message)
{
- IHTMLDocument3 *pHtmlDocRoot = NULL;
+ IHTMLDocument3 *pHtmlDocRoot = nullptr;
// Create the root document -- a "workspace" for parsing.
- HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pHtmlDocRoot));
+ HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pHtmlDocRoot));
if (SUCCEEDED(hr) && pHtmlDocRoot) {
- IPersistStreamInit *pPersistStreamInit = NULL;
+ IPersistStreamInit *pPersistStreamInit = nullptr;
hr = pHtmlDocRoot->QueryInterface(IID_PPV_ARGS(&pPersistStreamInit));
if (SUCCEEDED(hr)) {
// Initialize the root document to a default state -- ready for parsing.
pPersistStreamInit->InitNew();
- IMarkupServices *pMarkupServices = NULL;
+ IMarkupServices *pMarkupServices = nullptr;
hr = pHtmlDocRoot->QueryInterface(IID_PPV_ARGS(&pMarkupServices));
if (SUCCEEDED(hr)) {
- IMarkupPointer *pMarkupBegin = NULL;
- IMarkupPointer *pMarkupEnd = NULL;
+ IMarkupPointer *pMarkupBegin = nullptr;
+ IMarkupPointer *pMarkupEnd = nullptr;
// These markup pointers indicate the insertion point.
hr = pMarkupServices->CreateMarkupPointer(&pMarkupBegin);
@@ -395,13 +395,13 @@ HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &messa hr = pMarkupServices->CreateMarkupPointer(&pMarkupEnd);
if (SUCCEEDED(hr) && pMarkupBegin && pMarkupEnd) {
- IMarkupContainer *pMarkupContainer = NULL;
+ IMarkupContainer *pMarkupContainer = nullptr;
// Parse the string -- the markup container contains the parsed HTML.
// Markup pointers are updated to point to begining and end of new container.
hr = pMarkupServices->ParseString(bstrHtml, 0, &pMarkupContainer, pMarkupBegin, pMarkupEnd);
if (SUCCEEDED(hr) && pMarkupContainer) {
- IHTMLDocument3 *pHtmlDoc = NULL;
+ IHTMLDocument3 *pHtmlDoc = nullptr;
// Retrieve the document interface to the markup container.
hr = pMarkupContainer->QueryInterface(IID_PPV_ARGS(&pHtmlDoc));
@@ -429,15 +429,15 @@ HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &messa HRESULT TestDocumentText(IHTMLDocument3 *pHtmlDoc, BSTR &message)
{
- IHTMLDocument2 *pDoc = NULL;
- IHTMLElement *pElem = NULL;
+ IHTMLDocument2 *pDoc = nullptr;
+ IHTMLElement *pElem = nullptr;
BSTR bstrId = SysAllocString(L"test");
HRESULT hr = pHtmlDoc->QueryInterface(IID_PPV_ARGS(&pDoc));
if (SUCCEEDED(hr) && pDoc) {
hr = pDoc->get_body(&pElem);
if (SUCCEEDED(hr) && pElem) {
- BSTR bstrText = NULL;
+ BSTR bstrText = nullptr;
pElem->get_innerText(&bstrText);
message = SysAllocString(bstrText);
SysFreeString(bstrText);
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index ebf869ffdf..f20a68161b 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -24,7 +24,7 @@ struct EventListNode { EventListNode *next;
};
-EventListNode *event_list = 0;
+EventListNode *event_list = nullptr;
// plugin stuff
PLUGININFOEX pluginInfo =
@@ -59,7 +59,7 @@ void RemoveReadEvents(MCONTACT hContact = 0) bool remove;
mir_cslock lck(list_cs);
- EventListNode *node = event_list, *prev = 0;
+ EventListNode *node = event_list, *prev = nullptr;
while(node) {
remove = false;
if (hContact == 0 || hContact == node->hContact) {
@@ -133,7 +133,7 @@ int OnDatabaseEventAdd(WPARAM hContact, LPARAM hDBEvent) INT_PTR ServiceClear(WPARAM hContact, LPARAM)
{
- if (MessageBox(0, TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"), TranslateT("Clear History"), MB_YESNO | MB_ICONWARNING) == IDYES)
+ if (MessageBox(nullptr, TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"), TranslateT("Clear History"), MB_YESNO | MB_ICONWARNING) == IDYES)
RemoveAllEvents(hContact);
return 0;
diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index 52e874fb38..92877a43b7 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -118,7 +118,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
SetAllContactIcons(hwndList);
- SetListGroupIcons(hwndList,(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL);
+ SetListGroupIcons(hwndList,(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,nullptr);
SendDlgItemMessage(hwndDlg, IDC_SPN_TIMEOUT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(60 * 60, 1));
return FALSE;
@@ -141,7 +141,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetAllContactIcons(hwndList);
//fall through
case CLN_CONTACTMOVED:
- SetListGroupIcons(hwndList,(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL);
+ SetListGroupIcons(hwndList,(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,nullptr);
break;
case CLN_OPTIONSCHANGED:
@@ -157,7 +157,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA // Find clicked item
DWORD hitFlags;
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x,nm->pt.y));
- if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA))
break;
// Get image in clicked column (0=none, 1=visible, 2=invisible)
@@ -181,7 +181,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetAllChildIcons(hwndList, hItem, nm->iColumn, iImage);
}
// Update the all/none icons
- SetListGroupIcons(hwndList, (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(hwndList, (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
// Activate Apply button
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 11ac955a3a..a9b27e33eb 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -58,7 +58,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) return FALSE;
}
-static WNDPROC g_PrevBtnWndProc = 0;
+static WNDPROC g_PrevBtnWndProc = nullptr;
LRESULT CALLBACK ButtWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -73,7 +73,7 @@ LRESULT CALLBACK ButtWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar rc.top += (rc.bottom - rc.top - 16) / 2;
if (isPressed)
OffsetRect(&rc, 1, 1);
- DrawIconEx(dc, rc.left, rc.top, (HICON)GetWindowLongPtr(hWnd, GWLP_USERDATA), 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(dc, rc.left, rc.top, (HICON)GetWindowLongPtr(hWnd, GWLP_USERDATA), 16, 16, 0, nullptr, DI_NORMAL);
ReleaseDC(hWnd, dc);
}
@@ -87,7 +87,7 @@ int BrowseForFolder(HWND hwnd, char *szPath) if (SUCCEEDED(CoGetMalloc(1, &pMalloc))) {
ptrW tszPath(mir_a2u(szPath));
- BROWSEINFO bi = { 0 };
+ BROWSEINFO bi = {};
bi.hwndOwner = hwnd;
bi.pszDisplayName = tszPath;
bi.lpszTitle = TranslateT("Select Folder");
@@ -132,7 +132,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP /* group*/
wchar_t *szGroup;
- for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++)
+ for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++)
SendDlgItemMessage(hwnd, IDC_GROUP, CB_INSERTSTRING, 0, LPARAM(szGroup));
if (!db_get_ws(hContact, "CList", "Group", &dbv)) {
@@ -631,7 +631,7 @@ INT_PTR ImportContacts(WPARAM, LPARAM) }
}
- if (MessageBoxA(0, msg, modFullname, MB_YESNO) == IDYES) {
+ if (MessageBoxA(nullptr, msg, modFullname, MB_YESNO) == IDYES) {
if (!(hContact = db_add_contact())) {
msg("contact did get created", "");
continue;
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index 7b441b99e8..3a70ccde26 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -123,7 +123,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_HELPMSG:
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_HELP), 0, HelpWindowDlgProc);
+ CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
break;
case IDCANCEL:
@@ -205,13 +205,13 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) INT_PTR testStringReplacer(WPARAM, LPARAM)
{
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TEST_LINE), 0, TestWindowDlgProc);
+ CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
return 0;
}
INT_PTR LoadFilesDlg(WPARAM, LPARAM)
{
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_ADD_FILE), 0, DlgProcFiles);
+ CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
return 0;
}
@@ -243,44 +243,44 @@ void DoPropertySheet(MCONTACT hContact) psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[0].hInstance = g_hInst;
psp[0].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_INFO);
- psp[0].pszIcon = NULL;
+ psp[0].pszIcon = nullptr;
psp[0].pfnDlgProc = DlgProcContactInfo;
psp[0].pszTitle = Translate("Contacts Display Info");
psp[0].lParam = hContact;
- psp[0].pfnCallback = NULL;
+ psp[0].pfnCallback = nullptr;
/* other settings */
psp[1].dwSize = sizeof(PROPSHEETPAGE);
psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[1].hInstance = g_hInst;
psp[1].pszTemplate = MAKEINTRESOURCEA(IDD_OTHER_STUFF);
- psp[1].pszIcon = NULL;
+ psp[1].pszIcon = nullptr;
psp[1].pfnDlgProc = DlgProcOtherStuff;
psp[1].pszTitle = Translate("Link and Contact list Settings");
psp[1].lParam = hContact;
- psp[1].pfnCallback = NULL;
+ psp[1].pfnCallback = nullptr;
/* copy contact */
psp[2].dwSize = sizeof(PROPSHEETPAGE);
psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[2].hInstance = g_hInst;
psp[2].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COPYEXPORT);
- psp[2].pszIcon = NULL;
+ psp[2].pszIcon = nullptr;
psp[2].pfnDlgProc = DlgProcCopy;
psp[2].pszTitle = Translate("Copy Contact");
psp[2].lParam = hContact;
- psp[2].pfnCallback = NULL;
+ psp[2].pfnCallback = nullptr;
/* files */
psp[3].dwSize = sizeof(PROPSHEETPAGE);
psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[3].hInstance = g_hInst;
psp[3].pszTemplate = MAKEINTRESOURCEA(IDD_ADD_FILE);
- psp[3].pszIcon = NULL;
+ psp[3].pszIcon = nullptr;
psp[3].pfnDlgProc = DlgProcFiles;
psp[3].pszTitle = Translate("Files");
psp[3].lParam = 0;
- psp[3].pfnCallback = NULL;
+ psp[3].pfnCallback = nullptr;
/* propery sheet header.. dont touch !!!! */
PROPSHEETHEADERA psh = { sizeof(psh) };
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index bbc4788ae4..232532dc4a 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -7,7 +7,7 @@ INT_PTR exportContacts(WPARAM, LPARAM) return 0;
FILE* file;
- if (MessageBox(0, TranslateT("Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append these contacts to the end of the file."), _A2W(modFullname), MB_YESNO) == IDYES)
+ if (MessageBox(nullptr, TranslateT("Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append these contacts to the end of the file."), _A2W(modFullname), MB_YESNO) == IDYES)
file = fopen(fn, "w");
else
file = fopen(fn, "a");
@@ -116,7 +116,7 @@ void readFile(HWND hwnd) FILE *filen = fopen(szFileName, "r");
if (!filen) {
- MessageBox(0, TranslateT("File couldn't be opened,2"), _A2W(modFullname), MB_OK);
+ MessageBox(nullptr, TranslateT("File couldn't be opened,2"), _A2W(modFullname), MB_OK);
return;
}
lineNumber = 0;
@@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) char* getMimDir(char* file)
{
- GetModuleFileNameA(NULL, file, MAX_PATH);
+ GetModuleFileNameA(nullptr, file, MAX_PATH);
char *p1 = strrchr(file, '\\');
if (p1)
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 03b2a77ad1..5f7f769469 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -38,7 +38,7 @@ INT_PTR doubleClick(WPARAM wParam, LPARAM) if (strstr(program, "http://") || strstr(program, "https://"))
Utils_OpenUrl(program);
else
- shellEXEerror = (INT_PTR)ShellExecuteA(NULL, NULL, program, params, NULL, SW_SHOW); //ignore the warning, its M$'s backwards compatabilty screwup :)
+ shellEXEerror = (INT_PTR)ShellExecuteA(nullptr, nullptr, program, params, nullptr, SW_SHOW); //ignore the warning, its M$'s backwards compatabilty screwup :)
if (shellEXEerror == ERROR_FILE_NOT_FOUND || shellEXEerror == ERROR_PATH_NOT_FOUND)
Utils_OpenUrl(program);
}
@@ -181,7 +181,7 @@ extern "C" __declspec(dllexport) int Load() Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0x1033e16d, 0x8a7c, 0x43db, 0xa9, 0x83, 0x56, 0x2f, 0x8a, 0x16, 0x7c, 0xe9);
- mi.root = NULL;
+ mi.root = nullptr;
mi.position = -2000080000;
mi.name.a = LPGEN("E&dit Contact Settings");
mi.pszService = "EditLCcontact";
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 4077e12eb6..cb1103260b 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -6,7 +6,7 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) mir_snprintf(dbSetting, "fn%d", fileNumber);
char *szVar = db_get_sa(NULL, MODNAME, dbSetting);
- if (szVar == NULL)
+ if (szVar == nullptr)
return 0;
char tszFileName[MAX_PATH];
@@ -17,7 +17,7 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) mir_free(szVar);
FILE* file = fopen(tszFileName, "r");
- if (file == NULL)
+ if (file == nullptr)
return 0;
// read the file into the FileContents array
@@ -29,7 +29,7 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) else temp[mir_strlen(temp)] = '\0';
FileContents[i] = (char*)malloc(mir_strlen(temp) + 1);
- if (FileContents[i] == NULL) break;
+ if (FileContents[i] == nullptr) break;
mir_strcpy(FileContents[i], temp);
}
fclose(file);
@@ -214,9 +214,9 @@ void checkStringForcompare(CMStringA &str) if (!strncmp(str.c_str()+i, "compare(\"", mir_strlen("compare(\""))) {
i += (int)mir_strlen("compare(\"");
A = strtok(©OfStr[i], "\",\"");
- B = strtok(NULL, "\",\"");
- X = strtok(NULL, "\",\"");
- Y = strtok(NULL, ",\")");
+ B = strtok(nullptr, "\",\"");
+ X = strtok(nullptr, "\",\"");
+ Y = strtok(nullptr, ",\")");
j = Y - ©OfStr[i] + (int)mir_strlen(Y) + 1;
if (A && B && X && Y) {
if (!mir_strcmp(A, B))
@@ -243,7 +243,7 @@ void checkStringForSave(MCONTACT hContact, CMStringA &str) if (!strncmp(str.c_str()+i, "save(\"", mir_strlen("save(\""))) {
i += (int)mir_strlen("save(\"");
A = strtok(©OfStr[i], "\",\"");
- B = strtok(NULL, ",\")");
+ B = strtok(nullptr, ",\")");
j = B - ©OfStr[i] + (int)mir_strlen(B) + 1;
if (A && B)
db_set_s(hContact, MODNAME, A, B);
@@ -294,9 +294,9 @@ void checkStringForSaveN(CMStringA &str) if (!strncmp(str.c_str()+i, "saveN(\"", mir_strlen("saveN(\""))) {
i += (int)mir_strlen("saveN(\"");
A = strtok(©OfStr[i], "\",\"");
- B = strtok(NULL, ",\"");
- C = strtok(NULL, ",\"");
- D = strtok(NULL, ",\")");
+ B = strtok(nullptr, ",\"");
+ C = strtok(nullptr, ",\"");
+ D = strtok(nullptr, ",\")");
j = D - ©OfStr[i] + (int)mir_strlen(D) + 1;
if (A && B && C && D) {
switch (D[0]) {
@@ -337,7 +337,7 @@ void checkStringForLoadN(CMStringA &str) if (!strncmp(str.c_str()+i, "loadN(\"", mir_strlen("loadN(\""))) {
i += (int)mir_strlen("loadN(\"");
char *A = strtok(©OfStr[i], "\",\"");
- char *B = strtok(NULL, ",\")");
+ char *B = strtok(nullptr, ",\")");
if (A && B) {
j = B - ©OfStr[i] + (int)mir_strlen(B) + 1;
DBVARIANT dbv;
@@ -378,7 +378,7 @@ BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString) // Convert the last-write time to local time.
FileTimeToSystemTime(&ftWrite, &stUTC);
- SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
+ SystemTimeToTzSpecificLocalTime(nullptr, &stUTC, &stLocal);
// Build a string showing the date and time.
wsprintfA(lpszString, "%02d/%02d/%d %02d:%02d",
@@ -401,7 +401,7 @@ int lastChecked(CMStringA &szNewStr, const char *str) mir_snprintf(szSetting, "fn%d", file);
char *szVar = db_get_sa(NULL, MODNAME, szSetting);
- if (szVar == NULL)
+ if (szVar == nullptr)
return 0;
if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 8))
@@ -410,7 +410,7 @@ int lastChecked(CMStringA &szNewStr, const char *str) mir_strncpy(tszFileName, szVar, _countof(tszFileName));
mir_free(szVar);
- HANDLE hFile = CreateFileA(tszFileName, 0, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFileA(tszFileName, 0, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return 0;
@@ -443,7 +443,7 @@ int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hCont int tempInt;
int startLine = 0, endLine = 0, startChar = 0, endChar = 0, wholeLine = -1, linesInFile;
int positionInOldString = 0;
- char *fileContents[MAXLINES] = { NULL }, tempString[MAX_STRING_LENGTH];
+ char *fileContents[MAXLINES] = {}, tempString[MAX_STRING_LENGTH];
// setup the variable names
szNewString.Empty();
@@ -556,7 +556,7 @@ int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hCont }
}
// free the file strings
- for (tempInt = 0; (tempInt < MAXLINES) && (fileContents[tempInt] != NULL); tempInt++)
+ for (tempInt = 0; (tempInt < MAXLINES) && (fileContents[tempInt] != nullptr); tempInt++)
free(fileContents[tempInt]);
// check for load("A","B")
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index 18fdf21778..dc20309a9b 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -63,7 +63,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) //
int startTimer(int interval)
{
- timerId = SetTimer(NULL, 0, interval, timerProc);
+ timerId = SetTimer(nullptr, 0, interval, timerProc);
return 0;
}
@@ -78,7 +78,7 @@ int killTimer() {
if (timerId != 0) {
db_set_w(NULL, MODNAME, "timerCount", 0);
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
timerId = 0;
}
return 0;
diff --git a/plugins/NotesAndReminders/src/hotkeys.cpp b/plugins/NotesAndReminders/src/hotkeys.cpp index 89e5133846..f04531cd9f 100644 --- a/plugins/NotesAndReminders/src/hotkeys.cpp +++ b/plugins/NotesAndReminders/src/hotkeys.cpp @@ -47,7 +47,7 @@ LRESULT CALLBACK NotifyHotKeyWndProc(HWND AHwnd, UINT Message, WPARAM wParam, LP case WM_TIMER:
KillTimer(HKHwnd, 1026);
BOOL b = CheckRemindersAndStart();
- SetTimer(HKHwnd, 1026, b ? REMINDER_UPDATE_INTERVAL_SHORT : REMINDER_UPDATE_INTERVAL, 0);
+ SetTimer(HKHwnd, 1026, b ? REMINDER_UPDATE_INTERVAL_SHORT : REMINDER_UPDATE_INTERVAL, nullptr);
return FALSE;
}
@@ -57,7 +57,7 @@ LRESULT CALLBACK NotifyHotKeyWndProc(HWND AHwnd, UINT Message, WPARAM wParam, LP void CreateMsgWindow(void)
{
- HWND hParent = NULL;
+ HWND hParent = nullptr;
WNDCLASSEX TWC = { 0 };
if (!GetClassInfoEx(hmiranda, MSG_WND_CLASS, &TWC)) {
@@ -65,10 +65,10 @@ void CreateMsgWindow(void) TWC.cbClsExtra = 0;
TWC.cbWndExtra = 0;
TWC.hInstance = hmiranda;
- TWC.hIcon = 0;
- TWC.hCursor = 0;
- TWC.hbrBackground = 0;
- TWC.lpszMenuName = NULL;
+ TWC.hIcon = nullptr;
+ TWC.hCursor = nullptr;
+ TWC.hbrBackground = nullptr;
+ TWC.lpszMenuName = nullptr;
TWC.lpszClassName = MSG_WND_CLASS;
TWC.cbSize = sizeof(TWC);
TWC.lpfnWndProc = NotifyHotKeyWndProc;
@@ -77,8 +77,8 @@ void CreateMsgWindow(void) hParent = HWND_MESSAGE;
- HKHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, MSG_WND_CLASS, "StickyNotes", 0, 0, 0, 0, 0, hParent, NULL, hmiranda, NULL);
- SetTimer(HKHwnd, 1026, REMINDER_UPDATE_INTERVAL, 0);
+ HKHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, MSG_WND_CLASS, "StickyNotes", 0, 0, 0, 0, 0, hParent, nullptr, hmiranda, nullptr);
+ SetTimer(HKHwnd, 1026, REMINDER_UPDATE_INTERVAL, nullptr);
}
void DestroyMsgWindow(void)
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index e006e4f13b..0ea7fd65e3 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -1,16 +1,16 @@ #include "globals.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hinstance = NULL;
-HINSTANCE hmiranda = NULL;
+HINSTANCE hinstance = nullptr;
+HINSTANCE hmiranda = nullptr;
int hLangpack;
-HANDLE hkOptInit = NULL;
-HANDLE hkTopToolbarInit = NULL;
-HANDLE hkModulesLoaded = NULL;
-HANDLE hkFontChange = NULL;
-HANDLE hkColorChange = NULL;
-HMODULE hRichedDll = NULL;
+HANDLE hkOptInit = nullptr;
+HANDLE hkTopToolbarInit = nullptr;
+HANDLE hkModulesLoaded = nullptr;
+HANDLE hkFontChange = nullptr;
+HANDLE hkColorChange = nullptr;
+HMODULE hRichedDll = nullptr;
extern TREEELEMENT *g_Stickies;
extern TREEELEMENT *RemindersList;
@@ -39,7 +39,7 @@ void CloseReminderList(); INT_PTR PluginMenuCommandAddNew(WPARAM, LPARAM)
{
- STICKYNOTE *PSN = NewNote(0,0,0,0,NULL,NULL,TRUE,TRUE,0);
+ STICKYNOTE *PSN = NewNote(0,0,0,0,nullptr,nullptr,TRUE,TRUE,0);
if(PSN)
SetFocus(PSN->REHwnd);
return 0;
@@ -47,7 +47,7 @@ INT_PTR PluginMenuCommandAddNew(WPARAM, LPARAM) INT_PTR PluginMenuCommandDeleteAll(WPARAM, LPARAM)
{
- if (g_Stickies && MessageBox(NULL, Translate("Are you sure you want to delete all notes?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
+ if (g_Stickies && MessageBox(nullptr, Translate("Are you sure you want to delete all notes?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
DeleteNotes();
return 0;
}
@@ -66,7 +66,7 @@ static INT_PTR PluginMenuCommandViewNotes(WPARAM, LPARAM) static INT_PTR PluginMenuCommandAllBringFront(WPARAM, LPARAM)
{
- BringAllNotesToFront(NULL);
+ BringAllNotesToFront(nullptr);
return 0;
}
@@ -84,7 +84,7 @@ static INT_PTR PluginMenuCommandViewReminders(WPARAM, LPARAM) static INT_PTR PluginMenuCommandDeleteReminders(WPARAM, LPARAM)
{
- if (RemindersList && MessageBox(NULL, Translate("Are you sure you want to delete all reminders?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
+ if (RemindersList && MessageBox(nullptr, Translate("Are you sure you want to delete all reminders?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
DeleteReminders();
return 0;
}
@@ -129,7 +129,7 @@ static int OnOptInitialise(WPARAM w, LPARAM) int OnTopToolBarInit(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.hIconHandleUp = iconList[14].hIcolib;
@@ -178,7 +178,7 @@ static void InitServices() static void addMenuItem(CMenuItem &mi)
{
if (g_AddContListMI) {
- HGENMENU save = mi.root; mi.root = NULL;
+ HGENMENU save = mi.root; mi.root = nullptr;
Menu_AddContactMenuItem(&mi);
mi.root = save;
}
@@ -300,7 +300,7 @@ extern "C" __declspec(dllexport) int Load(void) {
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- hmiranda = GetModuleHandle(NULL);
+ hmiranda = GetModuleHandle(nullptr);
INITCOMMONCONTROLSEX ctrls = { 0 };
ctrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
@@ -309,7 +309,7 @@ extern "C" __declspec(dllexport) int Load(void) hRichedDll = LoadLibrary("Msftedit.dll");
if (!hRichedDll) {
- if (MessageBox(0, Translate("Miranda could not load the Notes & Reminders plugin, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), SECTIONNAME, MB_YESNO | MB_ICONINFORMATION) != IDYES)
+ if (MessageBox(nullptr, Translate("Miranda could not load the Notes & Reminders plugin, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), SECTIONNAME, MB_YESNO | MB_ICONINFORMATION) != IDYES)
return 1;
return 0;
}
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp index 5add0c6e07..04d08f00ed 100644 --- a/plugins/NotesAndReminders/src/miscutils.cpp +++ b/plugins/NotesAndReminders/src/miscutils.cpp @@ -33,7 +33,7 @@ void ReadSettingBlob(MCONTACT hContact, char *ModuleName, char *SettingName, WOR dbv.type = DBVT_BLOB;
if (db_get(hContact, ModuleName, SettingName, &dbv)) {
*pSize = 0;
- *pbBlob = NULL;
+ *pbBlob = nullptr;
}
else {
*pSize = LOWORD(dbv.cpbVal);
@@ -88,11 +88,11 @@ void TreeAddSorted(TREEELEMENT **root, void *Data, int(*CompareCb)(TREEELEMENT*, return;
NTE->ptrdata = Data;
- NTE->next = NULL;
+ NTE->next = nullptr;
// insert sorted
- TREEELEMENT *Prev = NULL;
+ TREEELEMENT *Prev = nullptr;
TREEELEMENT *TTE = *root;
while (TTE) {
@@ -119,7 +119,7 @@ void TreeAddSorted(TREEELEMENT **root, void *Data, int(*CompareCb)(TREEELEMENT*, void TreeDelete(TREEELEMENT **root, void *iItem)
{
- TREEELEMENT *TTE = *root, *Prev = NULL;
+ TREEELEMENT *TTE = *root, *Prev = nullptr;
if (!TTE)
return;
@@ -139,7 +139,7 @@ void TreeDelete(TREEELEMENT **root, void *iItem) void *TreeGetAt(TREEELEMENT *root, int iItem)
{
if (!root)
- return NULL;
+ return nullptr;
TREEELEMENT *TTE = root;
int i = 0;
@@ -147,7 +147,7 @@ void *TreeGetAt(TREEELEMENT *root, int iItem) TTE = (TREEELEMENT*)TTE->next;
i++;
}
- return (!TTE) ? NULL : TTE->ptrdata;
+ return (!TTE) ? nullptr : TTE->ptrdata;
}
int TreeGetCount(TREEELEMENT *root)
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index bb4dfb0393..2cfde03695 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -82,7 +82,7 @@ static struct ColorPreset clrPresets[] = { LPGEN("White"), RGB(255,255,255) } }; -TREEELEMENT *g_Stickies = NULL; +TREEELEMENT *g_Stickies = nullptr; LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); @@ -155,9 +155,9 @@ static void InitStickyNoteLogFont(STICKYNOTEFONT *pCustomFont, LOGFONT *lf) if (!pCustomFont->size) { SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE); lf->lfHeight = 10; - HDC hdc = GetDC(0); + HDC hdc = GetDC(nullptr); lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); - ReleaseDC(0, hdc); + ReleaseDC(nullptr, hdc); } else { lf->lfHeight = pCustomFont->size; @@ -191,7 +191,7 @@ static BOOL CreateStickyNoteFont(STICKYNOTEFONT *pCustomFont, LOGFONT *plf) pCustomFont->hFont = CreateFontIndirect(plf); - return pCustomFont->hFont != NULL; + return pCustomFont->hFont != nullptr; } @@ -212,14 +212,14 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER TWC.cbClsExtra = 0; TWC.cbWndExtra = 0; TWC.hInstance = hmiranda; - TWC.hIcon = LoadIcon(0, IDI_APPLICATION); - TWC.hCursor = LoadCursor(0, IDC_ARROW); - TWC.hbrBackground = 0; - TWC.lpszMenuName = 0; + TWC.hIcon = LoadIcon(nullptr, IDI_APPLICATION); + TWC.hCursor = LoadCursor(nullptr, IDC_ARROW); + TWC.hbrBackground = nullptr; + TWC.lpszMenuName = nullptr; TWC.lpszClassName = NOTE_WND_CLASS; TWC.cbSize = sizeof(WNDCLASSEX); TWC.lpfnWndProc = StickyNoteWndProc; - if (!RegisterClassEx(&TWC)) return NULL; + if (!RegisterClassEx(&TWC)) return nullptr; } if (!TData || Aw < 0 || Ah < 0) { @@ -257,7 +257,7 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER TSN->CustomTitle = TRUE; } else { - TSN->title = NULL; + TSN->title = nullptr; InitNoteTitle(TSN); } @@ -278,7 +278,7 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER // NOTE: loaded note positions stem from GetWindowPlacement, which normally have a different coord space than // CreateWindow/SetWindowPos, BUT since we now use WS_EX_TOOLWINDOW they use the same coord space so // we don't have to worry about notes "drifting" between sessions - TSN->SNHwnd = CreateWindowEx(L1, NOTE_WND_CLASS, "StickyNote", L2, Ax, Ay, Aw, Ah, NULL, 0, hmiranda, TSN); + TSN->SNHwnd = CreateWindowEx(L1, NOTE_WND_CLASS, "StickyNote", L2, Ax, Ay, Aw, Ah, nullptr, nullptr, hmiranda, TSN); if (g_Transparency < 255) SetLayeredWindowAttributes(TSN->SNHwnd, 0, (BYTE)g_Transparency, LWA_ALPHA); @@ -296,7 +296,7 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER if (Ay < TWP.rcNormalPosition.top + 50 || Ay > TWP.rcNormalPosition.bottom - 50) Ay = ((TWP.rcNormalPosition.bottom - TWP.rcNormalPosition.top) / 4) + (rand() & 0x1f); - SetWindowPos(TSN->SNHwnd, NULL, Ax, Ay, Aw, Ah, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(TSN->SNHwnd, nullptr, Ax, Ay, Aw, Ah, SWP_NOZORDER | SWP_NOACTIVATE); } } @@ -323,16 +323,16 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER STICKYNOTE* NewNote(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER *ID, BOOL bVisible, BOOL bOnTop, int scrollV) { - return NewNoteEx(Ax, Ay, Aw, Ah, Data, ID, bVisible, bOnTop, scrollV, 0, 0, NULL, NULL, FALSE); + return NewNoteEx(Ax, Ay, Aw, Ah, Data, ID, bVisible, bOnTop, scrollV, 0, 0, nullptr, nullptr, FALSE); } void LoadNotes(BOOL bIsStartup) { WORD Size = 0; - char *Value = NULL, *TVal = NULL; + char *Value = nullptr, *TVal = nullptr; char ValueName[32]; - g_Stickies = NULL; + g_Stickies = nullptr; int NotesCount = db_get_dw(0, MODULENAME, "NotesData", 0); @@ -343,7 +343,7 @@ void LoadNotes(BOOL bIsStartup) if (Value) { FreeSettingBlob(Size, Value); - Value = NULL; + Value = nullptr; } Size = 65535; // does not get used @@ -356,10 +356,10 @@ void LoadNotes(BOOL bIsStartup) if (Value[0] == 'X') { // new eXtended/fleXible data format - STICKYNOTE note = { 0 }; + STICKYNOTE note = {}; int i, rect[4]; int scrollV = 0; - STICKYNOTEFONT *pCustomFont = NULL; + STICKYNOTEFONT *pCustomFont = nullptr; DWORD flags; DelPos = strchr(Value + 1, 0x1B); @@ -373,7 +373,7 @@ void LoadNotes(BOOL bIsStartup) continue; *TVal++ = 0; - note.ID.QuadPart = _strtoui64(Value + 1, NULL, 16); + note.ID.QuadPart = _strtoui64(Value + 1, nullptr, 16); for (i = 0; i<4; i++) { char *sep = strchr(TVal, ':'); @@ -381,12 +381,12 @@ void LoadNotes(BOOL bIsStartup) goto skip; *sep++ = 0; - rect[i] = strtol(TVal, NULL, 10); + rect[i] = strtol(TVal, nullptr, 10); TVal = sep; } - flags = strtoul(TVal, NULL, 16); + flags = strtoul(TVal, nullptr, 16); if (flags & 1) note.bVisible = TRUE; @@ -410,7 +410,7 @@ void LoadNotes(BOOL bIsStartup) if (!sep || (DelPos && sep > DelPos)) goto skip; - tag = strtoul(TVal, NULL, 10); + tag = strtoul(TVal, nullptr, 10); TVal = sep + 1; switch (tag) { @@ -419,15 +419,15 @@ void LoadNotes(BOOL bIsStartup) break; case DATATAG_SCROLLPOS: - scrollV = (int)strtoul(TVal, NULL, 10); + scrollV = (int)strtoul(TVal, nullptr, 10); break; case DATATAG_BGCOL: - note.BgColor = strtoul(TVal, NULL, 16) | 0xff000000; + note.BgColor = strtoul(TVal, nullptr, 16) | 0xff000000; break; case DATATAG_FGCOL: - note.FgColor = strtoul(TVal, NULL, 16) | 0xff000000; + note.FgColor = strtoul(TVal, nullptr, 16) | 0xff000000; break; case DATATAG_TITLE: @@ -447,21 +447,21 @@ void LoadNotes(BOOL bIsStartup) if (!sep || (DelPos && sep > DelPos)) goto skip; *sep++ = 0; - fsize = strtol(TVal2, NULL, 10); + fsize = strtol(TVal2, nullptr, 10); TVal2 = sep; sep = strchr(TVal2, ':'); if (!sep || (DelPos && sep > DelPos)) goto skip; *sep++ = 0; - fstyle = strtoul(TVal2, NULL, 10); + fstyle = strtoul(TVal2, nullptr, 10); TVal2 = sep; sep = strchr(TVal2, ':'); if (!sep || (DelPos && sep > DelPos)) goto skip; *sep++ = 0; - fcharset = strtoul(TVal2, NULL, 10); + fcharset = strtoul(TVal2, nullptr, 10); TVal2 = sep; if (TVal2 >= DelPos) @@ -472,11 +472,11 @@ void LoadNotes(BOOL bIsStartup) pCustomFont->style = (BYTE)fstyle; pCustomFont->charset = (BYTE)fcharset; mir_strcpy(pCustomFont->szFace, TVal2); - pCustomFont->hFont = NULL; + pCustomFont->hFont = nullptr; - if (!CreateStickyNoteFont(pCustomFont, NULL)) { + if (!CreateStickyNoteFont(pCustomFont, nullptr)) { free(pCustomFont); - pCustomFont = NULL; + pCustomFont = nullptr; } } break; @@ -503,46 +503,46 @@ void LoadNotes(BOOL bIsStartup) OT = 1; TV = 1; Tx = 100; Ty = 100; Tw = 179; Th = 35; - Data = NULL; ID = NULL; + Data = nullptr; ID = nullptr; if (DelPos = strchr(Value, 0x1B)) { // get first delimiter // int PartLen = DelPos - TVal; - Data = NULL; - ID = NULL; + Data = nullptr; + ID = nullptr; TVal = Value; DelPos[0] = 0x0; - Tx = strtol(TVal, NULL, 10); + Tx = strtol(TVal, nullptr, 10); TVal = DelPos + 1; DelPos = strchr(TVal, 0x1B); if (!DelPos) continue; // setting is broken, do not crash DelPos[0] = 0x0; - Ty = strtol(TVal, NULL, 10); + Ty = strtol(TVal, nullptr, 10); TVal = DelPos + 1; DelPos = strchr(TVal, 0x1B); if (!DelPos) continue; // setting is broken, do not crash DelPos[0] = 0x0; - Tw = strtol(TVal, NULL, 10); + Tw = strtol(TVal, nullptr, 10); TVal = DelPos + 1; DelPos = strchr(TVal, 0x1B); if (!DelPos) continue; // setting is broken, do not crash DelPos[0] = 0x0; - Th = strtol(TVal, NULL, 10); + Th = strtol(TVal, nullptr, 10); TVal = DelPos + 1; DelPos = strchr(TVal, 0x1B); if (!DelPos) continue; // setting is broken, do not crash DelPos[0] = 0x0; - TV = strtol(TVal, NULL, 10); + TV = strtol(TVal, nullptr, 10); TVal = DelPos + 1; DelPos = strchr(TVal, 0x1B); if (!DelPos) continue; // setting is broken, do not crash DelPos[0] = 0x0; - OT = strtol(TVal, NULL, 10); + OT = strtol(TVal, nullptr, 10); TVal = DelPos + 1; DelPos = strchr(TVal, 0x1B); @@ -562,7 +562,7 @@ void LoadNotes(BOOL bIsStartup) if (strchr(ID, '-')) { // validate format (otherwise create new) if (mir_strlen(ID) < 19 || ID[2] != '-' || ID[5] != '-' || ID[10] != ' ' || ID[13] != ':' || ID[16] != ':') { - ID = NULL; + ID = nullptr; } else { SYSTEMTIME tm; @@ -570,21 +570,21 @@ void LoadNotes(BOOL bIsStartup) ID[2] = ID[5] = ID[10] = ID[13] = ID[16] = 0; memset(&tm, 0, sizeof(tm)); - tm.wDay = (WORD)strtoul(ID, NULL, 10); - tm.wMonth = (WORD)strtoul(ID + 3, NULL, 10); - tm.wYear = (WORD)strtoul(ID + 6, NULL, 10); - tm.wHour = (WORD)strtoul(ID + 11, NULL, 10); - tm.wMinute = (WORD)strtoul(ID + 14, NULL, 10); - tm.wSecond = (WORD)strtoul(ID + 17, NULL, 10); + tm.wDay = (WORD)strtoul(ID, nullptr, 10); + tm.wMonth = (WORD)strtoul(ID + 3, nullptr, 10); + tm.wYear = (WORD)strtoul(ID + 6, nullptr, 10); + tm.wHour = (WORD)strtoul(ID + 11, nullptr, 10); + tm.wMinute = (WORD)strtoul(ID + 14, nullptr, 10); + tm.wSecond = (WORD)strtoul(ID + 17, nullptr, 10); SYSTEMTIMEtoFILETIME(&tm, (FILETIME*)&newid); } } else { - ID = NULL; + ID = nullptr; } - NewNoteEx(Tx, Ty, Tw, Th, Data, ID ? &newid : NULL, V, (BOOL)OT, 0, 0, 0, NULL, NULL, TRUE); + NewNoteEx(Tx, Ty, Tw, Th, Data, ID ? &newid : nullptr, V, (BOOL)OT, 0, 0, 0, nullptr, nullptr, TRUE); } } skip:; @@ -618,7 +618,7 @@ static void PurgeNotesTree() TreeDelete(&g_Stickies, pt); SAFE_FREE((void**)&pt); } - g_Stickies = NULL; + g_Stickies = nullptr; } void PurgeNotes(void) @@ -667,7 +667,7 @@ void BringAllNotesToFront(STICKYNOTE *pActive) } // pModified optionally points to the modified note that invoked the JustSaveNotesEx call -static void JustSaveNotesEx(STICKYNOTE *pModified = NULL) +static void JustSaveNotesEx(STICKYNOTE *pModified = nullptr) { int I = 0, NotesCount = TreeGetCount(g_Stickies); int n, l; @@ -687,7 +687,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified = NULL) STICKYNOTE *pNote = (STICKYNOTE*)TTE->ptrdata; BOOL bDeleteTData = TRUE; scrollV = 0; - tData = NULL; + tData = nullptr; // window pos and size wp.length = sizeof(WINDOWPLACEMENT); @@ -924,7 +924,7 @@ static BOOL DoContextMenu(HWND AhWnd, WPARAM, LPARAM lParam) } TranslateMenu(FhMenu); - TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, 0); + TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, nullptr); DestroyMenu(hMenuLoad); return TRUE; } @@ -983,7 +983,7 @@ static BOOL GetClipboardText_Title(char *pOut, int size) { BOOL bResult = FALSE; - if (OpenClipboard(NULL)) { + if (OpenClipboard(nullptr)) { HANDLE hData = GetClipboardData(CF_TEXT); LPCSTR buffer; @@ -1067,7 +1067,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA MoveWindow(H, 0, 0, SZ.right, SZ.bottom, TRUE); KillTimer(hdlg, 1025); - SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, 0); + SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, nullptr); return TRUE; } @@ -1083,7 +1083,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA case WM_MOVE: KillTimer(hdlg, 1025); - SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, 0); + SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, nullptr); return TRUE; case WM_CREATE: @@ -1098,7 +1098,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA BringWindowToTop(hdlg); mystyle = WS_CHILD | WS_VISIBLE | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN; if (g_ShowScrollbar) mystyle |= WS_VSCROLL; - HWND H = CreateWindowW(MSFTEDIT_CLASS, 0, mystyle, 0, 0, CS->cx - 3 - 3, CS->cy - 3 - (3 + 14), hdlg, (HMENU)1, hmiranda, 0); + HWND H = CreateWindowW(MSFTEDIT_CLASS, nullptr, mystyle, 0, 0, CS->cx - 3 - 3, CS->cy - 3 - (3 + 14), hdlg, (HMENU)1, hmiranda, nullptr); SN->REHwnd = H; SendMessage(H, EM_SETTEXTMODE, TM_PLAINTEXT, 0); SendMessage(H, EM_LIMITTEXT, MAX_NOTE_LEN, 0); @@ -1196,7 +1196,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA } if (wParam && wParam != 1) - SelectClipRgn(hdc, NULL); + SelectClipRgn(hdc, nullptr); ReleaseDC(hdlg, hdc); } @@ -1214,7 +1214,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA case WM_NCACTIVATE: // update window (so that parts that potentially became visible through activation get redrawn immediately) - RedrawWindow(hdlg, NULL, NULL, RDW_UPDATENOW); + RedrawWindow(hdlg, nullptr, nullptr, RDW_UPDATENOW); return TRUE; case WM_NOTIFY: @@ -1325,7 +1325,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA case EN_VSCROLL: case EN_HSCROLL: KillTimer(hdlg, 1025); - SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, 0); + SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, nullptr); break; } @@ -1336,7 +1336,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (id >= IDM_COLORPRESET_BG && id <= IDM_COLORPRESET_BG + _countof(clrPresets)) { SN->BgColor = clrPresets[id - IDM_COLORPRESET_BG].color | 0xff000000; SendMessage(H, EM_SETBKGNDCOLOR, 0, SN->BgColor & 0xffffff); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); return FALSE; } @@ -1347,7 +1347,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA CF.dwMask = CFM_COLOR; CF.crTextColor = SN->FgColor & 0xffffff; SendMessage(H, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CF); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); return FALSE; } @@ -1371,7 +1371,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (ChooseColor(&cc) && cc.rgbResult != orgclr) { SN->BgColor = cc.rgbResult | 0xff000000; SendMessage(H, EM_SETBKGNDCOLOR, 0, SN->BgColor & 0xffffff); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); } } @@ -1394,7 +1394,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA CF.dwMask = CFM_COLOR; CF.crTextColor = SN->FgColor & 0xffffff; SendMessage(H, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CF); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); } } @@ -1408,7 +1408,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (SN->pCustomFont) InitStickyNoteLogFont(SN->pCustomFont, &lf); else - LoadNRFont(NR_FONTID_BODY, &lf, NULL); + LoadNRFont(NR_FONTID_BODY, &lf, nullptr); cf.lStructSize = sizeof(cf); cf.hwndOwner = SN->SNHwnd; @@ -1419,7 +1419,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (ChooseFont(&cf)) { if (!SN->pCustomFont) { SN->pCustomFont = (STICKYNOTEFONT*)malloc(sizeof(STICKYNOTEFONT)); - SN->pCustomFont->hFont = NULL; + SN->pCustomFont->hFont = nullptr; } SN->pCustomFont->size = (char)lf.lfHeight; @@ -1430,14 +1430,14 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (!CreateStickyNoteFont(SN->pCustomFont, &lf)) { // failed free(SN->pCustomFont); - SN->pCustomFont = NULL; + SN->pCustomFont = nullptr; } // clear text first to force a reformatting w.r.w scrollbar SetWindowText(H, ""); SendMessage(H, WM_SETFONT, (WPARAM)(SN->pCustomFont ? SN->pCustomFont->hFont : hBodyFont), FALSE); SetNoteTextControl(SN); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); } } @@ -1446,7 +1446,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA case ID_BACKGROUNDCOLOR_RESET: SN->BgColor = 0; SendMessage(H, EM_SETBKGNDCOLOR, 0, (LPARAM)BodyColor); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); break; @@ -1458,7 +1458,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA CF.dwMask = CFM_COLOR; CF.crTextColor = BodyFontColor; SendMessage(H, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CF); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); } JustSaveNotesEx(); break; @@ -1467,13 +1467,13 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (SN->pCustomFont) { DeleteObject(SN->pCustomFont->hFont); free(SN->pCustomFont); - SN->pCustomFont = NULL; + SN->pCustomFont = nullptr; // clear text first to force a reformatting w.r.w scrollbar SetWindowText(H, ""); SendMessage(H, WM_SETFONT, (WPARAM)hBodyFont, FALSE); SetNoteTextControl(SN); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); } break; @@ -1486,7 +1486,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA free(SN->title); SN->title = _strdup(s); SN->CustomTitle = TRUE; - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); } } @@ -1496,10 +1496,10 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (SN->CustomTitle) { if (SN->title) { free(SN->title); - SN->title = NULL; + SN->title = nullptr; } InitNoteTitle(SN); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); JustSaveNotesEx(); } break; @@ -1537,7 +1537,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA case IDM_TOGGLEONTOP: SN->bOnTop = !SN->bOnTop; SetWindowPos(hdlg, SN->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); - RedrawWindow(hdlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hdlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); JustSaveNotesEx(); break; @@ -1614,7 +1614,7 @@ char* GetPreviewString(const char *lpsz) } if (!s) - return NULL; + return nullptr; // convert line breaks and tabs to spaces @@ -1712,7 +1712,7 @@ static BOOL DoListContextMenu(HWND AhWnd, WPARAM wParam, LPARAM lParam, STICKYNO } TranslateMenu(FhMenu); - TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, 0); + TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, nullptr); DestroyMenu(hMenuLoad); return TRUE; } @@ -1723,11 +1723,11 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara switch (Message) { case WM_SIZE: OnListResize(Dialog); - UpdateGeomFromWnd(Dialog, g_notesListGeom, NULL, 0); + UpdateGeomFromWnd(Dialog, g_notesListGeom, nullptr, 0); break; case WM_MOVE: - UpdateGeomFromWnd(Dialog, g_notesListGeom, NULL, 0); + UpdateGeomFromWnd(Dialog, g_notesListGeom, nullptr, 0); break; case WM_GETMINMAXINFO: @@ -1745,7 +1745,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara case WM_CONTEXTMENU: { - STICKYNOTE *pNote = NULL; + STICKYNOTE *pNote = nullptr; HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS); if (ListView_GetSelectedCount(H)) { @@ -1851,7 +1851,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara LPNMHEADER NM = (LPNMHEADER)lParam; switch (NM->hdr.code) { case HDN_ENDTRACK: - UpdateGeomFromWnd(Dialog, NULL, g_notesListColGeom, _countof(g_notesListColGeom)); + UpdateGeomFromWnd(Dialog, nullptr, g_notesListColGeom, _countof(g_notesListColGeom)); break; } } @@ -1895,7 +1895,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara STICKYNOTE *SN = (STICKYNOTE*)TreeGetAt(g_Stickies, I); SN->bOnTop = !SN->bOnTop; SetWindowPos(SN->SNHwnd, SN->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); - RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); JustSaveNotesEx(); } } @@ -1933,7 +1933,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara return TRUE; case ID_CONTEXTMENUNOTEPOPUP_BRINGALLTOTOP: - BringAllNotesToFront(NULL); + BringAllNotesToFront(nullptr); return TRUE; } } @@ -1947,7 +1947,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara void ListNotes(void) { if (!ListNotesVisible) { - CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), 0, DlgProcViewNotes); + CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), nullptr, DlgProcViewNotes); ListNotesVisible = TRUE; } else BringWindowToTop(LV); diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index b1de471297..37773c7b03 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -7,19 +7,19 @@ extern HANDLE hkFontChange; extern HANDLE hkColorChange;
BOOL g_CloseAfterAddReminder, g_UseDefaultPlaySound;
-HICON g_hReminderIcon = NULL;
+HICON g_hReminderIcon = nullptr;
LOGFONT lfBody,lfCaption;
-HFONT hBodyFont = NULL, hCaptionFont = NULL;
+HFONT hBodyFont = nullptr, hCaptionFont = nullptr;
long BodyColor;
long CaptionFontColor,BodyFontColor;
BOOL g_ShowNotesAtStart,g_ShowScrollbar,g_AddContListMI,g_ShowNoteButtons;
int g_NoteTitleDate, g_NoteTitleTime;
int g_NoteWidth,g_NoteHeight;
int g_Transparency;
-char *g_RemindSMS = NULL;
+char *g_RemindSMS = nullptr;
-char *g_lpszAltBrowser = NULL;
+char *g_lpszAltBrowser = nullptr;
int g_reminderListGeom[4] = {0};
int g_reminderListColGeom[2] = { 150, 205 };
@@ -169,9 +169,9 @@ static BYTE MsgDlgGetFontDefaultCharset(const char *szFont) lf.lfCharSet = MsgDlgGetCPDefaultCharset();
// check if the font supports specified charset
- HDC hdc = GetDC(0);
+ HDC hdc = GetDC(nullptr);
EnumFontFamiliesEx(hdc, &lf, &EnumFontFamExProc, (LPARAM)&found, 0);
- ReleaseDC(0, hdc);
+ ReleaseDC(nullptr, hdc);
if (found)
return lf.lfCharSet;
@@ -234,9 +234,9 @@ void RegisterFontServiceFonts() strncpy(fontid.dbSettingsGroup, MODULENAME, _countof(fontid.dbSettingsGroup));
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
- HDC hDC = GetDC(NULL);
+ HDC hDC = GetDC(nullptr);
int nFontScale = GetDeviceCaps(hDC, LOGPIXELSY);
- ReleaseDC(NULL, hDC);
+ ReleaseDC(nullptr, hDC);
for (int i = 0; i < _countof(fontOptionsList); i++) {
fontid.order = i;
@@ -397,12 +397,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l TrimString(g_lpszAltBrowser);
if (!*g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
}
else if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
if (g_lpszAltBrowser)
@@ -457,7 +457,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l SetDlgItemText(hdlg, IDC_EDIT_EMAILSMS, "");
if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, "");
g_ShowNotesAtStart = TRUE;
@@ -515,12 +515,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l void InitSettings(void)
{
- void *P = NULL;
+ void *P = nullptr;
short Sz1 = MAX_PATH;
ReadSettingBlob(0, MODULENAME, "RemindEmail", (WORD*)&Sz1, &P);
if (!(Sz1 && P))
- g_RemindSMS = NULL;
+ g_RemindSMS = nullptr;
else {
g_RemindSMS = (char*)malloc(Sz1 + 1);
memcpy(g_RemindSMS, P, Sz1);
@@ -572,6 +572,6 @@ void TermSettings(void) if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
}
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 3bb2361b9a..1b6b8854cc 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -41,11 +41,11 @@ #define NOTIFY_LIST() if (ListReminderVisible) PostMessage(LV,WM_RELOAD,0,0)
-TREEELEMENT *RemindersList = NULL;
+TREEELEMENT *RemindersList = nullptr;
static UINT QueuedReminderCount = 0;
static BOOL ListReminderVisible = FALSE;
static BOOL NewReminderVisible = FALSE;
-static REMINDERDATA *pEditReminder = NULL;
+static REMINDERDATA *pEditReminder = nullptr;
static HWND LV;
static SOCKET S;
@@ -68,7 +68,7 @@ void UtcToTzLocalFT(const FILETIME *lpUtc, FILETIME *lpLocal) {
SYSTEMTIME tm, tmLocal;
FILETIMEtoSYSTEMTIME(lpUtc, &tm);
- SystemTimeToTzSpecificLocalTime(NULL, &tm, &tmLocal);
+ SystemTimeToTzSpecificLocalTime(nullptr, &tm, &tmLocal);
SYSTEMTIMEtoFILETIME(&tmLocal, lpLocal);
}
@@ -76,7 +76,7 @@ void TzLocalToUtcFT(const FILETIME *lpLocal, FILETIME *lpUtc) {
SYSTEMTIME tm, tmUtc;
FILETIMEtoSYSTEMTIME(lpLocal, &tm);
- TzSpecificLocalTimeToSystemTime(NULL, &tm, &tmUtc);
+ TzSpecificLocalTimeToSystemTime(nullptr, &tm, &tmUtc);
SYSTEMTIMEtoFILETIME(&tmUtc, lpUtc);
}
@@ -84,13 +84,13 @@ void FileTimeToTzLocalST(const FILETIME *lpUtc, SYSTEMTIME *tmLocal) {
SYSTEMTIME tm;
FILETIMEtoSYSTEMTIME(lpUtc, &tm);
- SystemTimeToTzSpecificLocalTime(NULL, &tm, tmLocal);
+ SystemTimeToTzSpecificLocalTime(nullptr, &tm, tmLocal);
}
void TzLocalSTToFileTime(const SYSTEMTIME *tmLocal, FILETIME *lpUtc)
{
SYSTEMTIME tm;
- TzSpecificLocalTimeToSystemTime(NULL, (SYSTEMTIME*)tmLocal, &tm);
+ TzSpecificLocalTimeToSystemTime(nullptr, (SYSTEMTIME*)tmLocal, &tm);
SYSTEMTIMEtoFILETIME(&tm, lpUtc);
}
@@ -122,7 +122,7 @@ try_next:; static REMINDERDATA* FindReminder(DWORD uid)
{
if (!RemindersList)
- return NULL;
+ return nullptr;
for (TREEELEMENT *TTE = RemindersList; TTE; TTE = (TREEELEMENT *)TTE->next) {
REMINDERDATA *pReminder = (REMINDERDATA*)TTE->ptrdata;
@@ -132,7 +132,7 @@ static REMINDERDATA* FindReminder(DWORD uid) }
}
- return NULL;
+ return nullptr;
}
@@ -170,7 +170,7 @@ void PurgeReminders(void) void JustSaveReminders(void)
{
int I = 0, n, l;
- char *tmpReminder = NULL, *Value;
+ char *tmpReminder = nullptr, *Value;
char ValueName[32];
int ReminderCount;
@@ -185,7 +185,7 @@ void JustSaveReminders(void) if (pReminder->Reminder && mir_strlen(pReminder->Reminder))
tmpReminder = pReminder->Reminder;
else
- tmpReminder = NULL;
+ tmpReminder = nullptr;
if (!tmpReminder)
tmpReminder = "";
@@ -248,19 +248,19 @@ void LoadReminders(void) char ValueName[32];
BOOL GenerateUids = FALSE;
- RemindersList = NULL;
+ RemindersList = nullptr;
int RemindersCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
for (int I = 0; I < RemindersCount; I++) {
Size = 65535;
- Value = NULL;
+ Value = nullptr;
mir_snprintf(ValueName, "RemindersData%d", I);
ReadSettingBlob(0, MODULENAME, ValueName, &Size, (void**)&Value);
if (Size && Value) // was the blob found
{
- REMINDERDATA rem = { 0 };
+ REMINDERDATA rem = {};
char *TVal;
REMINDERDATA *TempRem;
char *DelPos = strchr(Value, 0x1B);
@@ -281,8 +281,8 @@ void LoadReminders(void) continue;
*TVal++ = 0;
- rem.uid = strtoul(Value + 1, NULL, 10);
- rem.When.QuadPart = _strtoui64(TVal, NULL, 16) * FILETIME_TICKS_PER_SEC;
+ rem.uid = strtoul(Value + 1, nullptr, 10);
+ rem.When.QuadPart = _strtoui64(TVal, nullptr, 16) * FILETIME_TICKS_PER_SEC;
// optional \033 separated params
while (DelPos) {
@@ -301,7 +301,7 @@ void LoadReminders(void) if (!sep || (DelPos && sep > DelPos))
goto skip;
- tag = strtoul(TVal, NULL, 10);
+ tag = strtoul(TVal, nullptr, 10);
TVal = sep + 1;
switch (tag) {
@@ -310,11 +310,11 @@ void LoadReminders(void) break;
case DATATAG_SNDREPEAT:
- rem.RepeatSound = strtoul(TVal, NULL, 10);
+ rem.RepeatSound = strtoul(TVal, nullptr, 10);
break;
case DATATAG_SNDSEL:
- rem.SoundSel = strtol(TVal, NULL, 10);
+ rem.SoundSel = strtol(TVal, nullptr, 10);
if (rem.SoundSel > 2) rem.SoundSel = 2;
break;
}
@@ -338,7 +338,7 @@ void LoadReminders(void) struct tm *stm;
time_t tt;
- tt = (time_t)strtoul(Value, NULL, 10);
+ tt = (time_t)strtoul(Value, nullptr, 10);
stm = localtime(&tt);
tm.wDayOfWeek = 0;
tm.wSecond = 0;
@@ -417,7 +417,7 @@ static void PurgeReminderTree() if (pt->handle) DestroyWindow(pt->handle);
DeleteReminder(pt);
}
- RemindersList = NULL;
+ RemindersList = nullptr;
}
void SaveReminders(void)
@@ -446,13 +446,13 @@ void GetTriggerTimeString(const ULARGE_INTEGER *When, char *s, UINT strSize, BOO else
FILETIMEtoSYSTEMTIME((FILETIME*)When, &tm);
- if (GetDateFormat(lc, DATE_LONGDATE, &tm, NULL, s, strSize)) {
+ if (GetDateFormat(lc, DATE_LONGDATE, &tm, nullptr, s, strSize)) {
// append time
int n = (int)mir_strlen(s);
s[n++] = ' ';
s[n] = 0;
- if (!GetTimeFormat(lc, LOCALE_NOUSEROVERRIDE | TIME_NOSECONDS, &tm, NULL, s + n, strSize - n))
+ if (!GetTimeFormat(lc, LOCALE_NOUSEROVERRIDE | TIME_NOSECONDS, &tm, nullptr, s + n, strSize - n))
mir_snprintf(s + n, strSize - n, "%02d:%02d", tm.wHour, tm.wMinute);
}
else mir_snprintf(s, strSize, "%d-%02d-%02d %02d:%02d", tm.wYear, tm.wMonth, tm.wDay, tm.wHour, tm.wMinute);
@@ -481,7 +481,7 @@ static void Skin_PlaySoundPoly(LPCSTR pszSoundName) char s[512];
GetShortPathNameA(szFull, szShort, sizeof(szShort));
mir_snprintf(s, "play \"%s\"", szShort);
- mciSendStringA(s, NULL, 0, NULL);
+ mciSendStringA(s, nullptr, 0, nullptr);
}
db_free(&dbv);
@@ -832,12 +832,12 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S SendDlgItemMessage(Dialog, nIDTime, CB_RESETCONTENT, 0, 0);
// ensure that we start on midnight local time
- SystemTimeToTzSpecificLocalTime(NULL, (SYSTEMTIME*)tmUtc, &tm2);
+ SystemTimeToTzSpecificLocalTime(nullptr, (SYSTEMTIME*)tmUtc, &tm2);
tm2.wHour = 0;
tm2.wMinute = 0;
tm2.wSecond = 0;
tm2.wMilliseconds = 0;
- TzSpecificLocalTimeToSystemTime(NULL, &tm2, &tm2);
+ TzSpecificLocalTimeToSystemTime(nullptr, &tm2, &tm2);
SYSTEMTIMEtoFILETIME(&tm2, (FILETIME*)&li);
// from 00:00 to 23:30 in 30 minute steps
@@ -1016,7 +1016,7 @@ static int ReformatTimeInputEx(HWND Dialog, UINT nIDTime, UINT nIDRefTime, int h // get reference time (UTC) from hidden control
{
GetDlgItemText(Dialog, nIDRefTime, buf, 30);
- li.QuadPart = ref = _strtoui64(buf, NULL, 16);
+ li.QuadPart = ref = _strtoui64(buf, nullptr, 16);
}
// clamp delta time to 23.5 hours (coule be issues otherwise as relative combo only handles <24)
@@ -1077,7 +1077,7 @@ static int ReformatTimeInputEx(HWND Dialog, UINT nIDTime, UINT nIDRefTime, int h // get reference time (UTC) from hidden control
{
GetDlgItemText(Dialog, nIDRefTime, buf, 30);
- ref = _strtoui64(buf, NULL, 16);
+ ref = _strtoui64(buf, nullptr, 16);
}
FileTimeToTzLocalST((FILETIME*)&ref, &tmRefLocal);
@@ -1180,7 +1180,7 @@ output_result: static __inline int ReformatTimeInput(HWND Dialog, UINT nIDTime, UINT nIDRefTime, int h, int m, const SYSTEMTIME *pDateLocal)
{
- return ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDateLocal, NULL);
+ return ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDateLocal, nullptr);
}
// in: pDate contains the desired trigger date in LOCAL time
@@ -1194,7 +1194,7 @@ static BOOL GetTriggerTime(HWND Dialog, UINT nIDTime, UINT nIDRefTime, SYSTEMTIM // get reference (UTC) time from hidden control
{
GetDlgItemText(Dialog, nIDRefTime, buf, 30);
- li.QuadPart = _strtoui64(buf, NULL, 16);
+ li.QuadPart = _strtoui64(buf, nullptr, 16);
}
int n = SendDlgItemMessage(Dialog, nIDTime, CB_GETCURSEL, 0, 0);
@@ -1259,7 +1259,7 @@ preset_value:; return TRUE;
}
else {
- if (ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDate, NULL))
+ if (ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDate, nullptr))
return FALSE;
// check if reformatted value is a preset
@@ -1294,7 +1294,7 @@ static void OnDateChanged(HWND Dialog, UINT nDateID, UINT nTimeID, UINT nRefTime SendDlgItemMessage(Dialog, nDateID, DTM_GETSYSTEMTIME, 0, (LPARAM)&Date);
- TzSpecificLocalTimeToSystemTime(NULL, &Date, &DateUtc);
+ TzSpecificLocalTimeToSystemTime(nullptr, &Date, &DateUtc);
PopulateTimeCombo(Dialog, nTimeID, FALSE, &DateUtc);
if (h < 0) {
@@ -1553,7 +1553,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM // update reminder text
{
- char *ReminderText = NULL;
+ char *ReminderText = nullptr;
int SzT = SendDlgItemMessage(Dialog, IDC_REMDATA, WM_GETTEXTLENGTH, 0, 0);
if (SzT) {
if (SzT > MAX_REMINDER_LEN) SzT = MAX_REMINDER_LEN;
@@ -1566,7 +1566,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM }
pReminder->RemVisible = FALSE;
- pReminder->handle = NULL;
+ pReminder->handle = nullptr;
// re-insert tree item sorted
TreeDelete(&RemindersList, pReminder);
@@ -1589,7 +1589,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM if (pReminder->handle == Dialog) {
// get up-to-date reminder text
- char *ReminderText = NULL;
+ char *ReminderText = nullptr;
int SzT = SendDlgItemMessage(Dialog, IDC_REMDATA, WM_GETTEXTLENGTH, 0, 0);
if (SzT) {
if (SzT > MAX_REMINDER_LEN) SzT = MAX_REMINDER_LEN;
@@ -1597,7 +1597,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM GetDlgItemText(Dialog, IDC_REMDATA, ReminderText, SzT + 1);
}
- SetFocus(NewNote(0, 0, -1, -1, ReminderText, 0, TRUE, TRUE, 0)->REHwnd);
+ SetFocus(NewNote(0, 0, -1, -1, ReminderText, nullptr, TRUE, TRUE, 0)->REHwnd);
break;
}
}
@@ -1611,7 +1611,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
switch (Message) {
case WM_INITDIALOG:
{
@@ -1766,7 +1766,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa }
DestroyWindow(Dialog);
NewReminderVisible = FALSE;
- pEditReminder = NULL;
+ pEditReminder = nullptr;
return TRUE;
case WM_NOTIFY:
@@ -1838,7 +1838,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa }
DestroyWindow(Dialog);
NewReminderVisible = FALSE;
- pEditReminder = NULL;
+ pEditReminder = nullptr;
return TRUE;
case IDC_VIEWREMINDERS:
@@ -1861,7 +1861,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa RepeatSound = 0;
int SzT = SendDlgItemMessage(Dialog, IDC_REMINDER, WM_GETTEXTLENGTH, 0, 0);
- char *ReminderText = NULL;
+ char *ReminderText = nullptr;
if (SzT) {
if (SzT > MAX_REMINDER_LEN) SzT = MAX_REMINDER_LEN;
ReminderText = (char*)malloc(SzT + 1);
@@ -1904,7 +1904,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa if (g_CloseAfterAddReminder || NewReminderVisible == 2) {
DestroyWindow(Dialog);
NewReminderVisible = FALSE;
- pEditReminder = NULL;
+ pEditReminder = nullptr;
}
}
}
@@ -1938,7 +1938,7 @@ INT_PTR OpenTriggeredReminder(WPARAM, LPARAM l) pReminder->RemVisible = TRUE;
- HWND H = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_NOTIFYREMINDER), 0, DlgProcNotifyReminder);
+ HWND H = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_NOTIFYREMINDER), nullptr, DlgProcNotifyReminder);
pReminder->handle = H;
mir_snprintf(S2, "%s! - %s", Translate("Reminder"), S1);
@@ -1957,7 +1957,7 @@ void NewReminder(void) {
if (!NewReminderVisible) {
NewReminderVisible = TRUE;
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), 0, DlgProcNewReminder);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), nullptr, DlgProcNewReminder);
}
}
@@ -1971,7 +1971,7 @@ void EditReminder(REMINDERDATA *p) p->RemVisible = TRUE;
NewReminderVisible = 2;
pEditReminder = p;
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), 0, DlgProcNewReminder);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), nullptr, DlgProcNewReminder);
}
else {
BringWindowToTop(p->handle);
@@ -2056,7 +2056,7 @@ void OnListResize(HWND Dialog) clsr.left -= btnw + 2;
MoveWindow(hBtnNew, clsr.left, clsr.top, btnw, btnh, FALSE);
- RedrawWindow(Dialog, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
+ RedrawWindow(Dialog, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
//UpdateWindow(Dialog);
}
@@ -2102,7 +2102,7 @@ static BOOL DoListContextMenu(HWND AhWnd, WPARAM wParam, LPARAM lParam, REMINDER EnableMenuItem(FhMenu, IDM_DELETEREMINDER, MF_GRAYED | MF_BYCOMMAND);
TranslateMenu(FhMenu);
- TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, 0);
+ TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, nullptr);
DestroyMenu(hMenuLoad);
return TRUE;
}
@@ -2114,11 +2114,11 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w switch (Message) {
case WM_SIZE:
OnListResize(Dialog);
- UpdateGeomFromWnd(Dialog, g_reminderListGeom, NULL, 0);
+ UpdateGeomFromWnd(Dialog, g_reminderListGeom, nullptr, 0);
break;
case WM_MOVE:
- UpdateGeomFromWnd(Dialog, g_reminderListGeom, NULL, 0);
+ UpdateGeomFromWnd(Dialog, g_reminderListGeom, nullptr, 0);
break;
case WM_GETMINMAXINFO:
@@ -2136,7 +2136,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w case WM_CONTEXTMENU:
{
- REMINDERDATA *pReminder = NULL;
+ REMINDERDATA *pReminder = nullptr;
HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
@@ -2218,7 +2218,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w LPNMHEADER NM = (LPNMHEADER)lParam;
switch (NM->hdr.code) {
case HDN_ENDTRACK:
- UpdateGeomFromWnd(Dialog, NULL, g_reminderListColGeom, _countof(g_reminderListColGeom));
+ UpdateGeomFromWnd(Dialog, nullptr, g_reminderListColGeom, _countof(g_reminderListColGeom));
break;
}
}
@@ -2284,7 +2284,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w void ListReminders(void)
{
if (!ListReminderVisible) {
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), 0, DlgProcViewReminders);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), nullptr, DlgProcViewReminders);
ListReminderVisible = TRUE;
}
else {
@@ -2318,16 +2318,16 @@ int WS_Send(SOCKET s, char *data, int datalen) unsigned long WS_ResolveName(char *name, WORD *port, int defaultPort)
{
char *nameCopy = _strdup(name);
- if (port != NULL)
+ if (port != nullptr)
*port = defaultPort;
char *pcolon = strchr(nameCopy, ':');
- if (pcolon != NULL) {
- if (port != NULL) *port = atoi(pcolon + 1);
+ if (pcolon != nullptr) {
+ if (port != nullptr) *port = atoi(pcolon + 1);
*pcolon = 0;
}
if (inet_addr(nameCopy) == INADDR_NONE) {
HOSTENT *lk = gethostbyname(nameCopy);
- if (lk == 0)
+ if (lk == nullptr)
return SOCKET_ERROR;
free(nameCopy);
@@ -2342,7 +2342,7 @@ void Send(char *user, char *host, char *Msg, char *server) {
SOCKADDR_IN sockaddr;
WORD port;
- char *ch = NULL;
+ char *ch = nullptr;
S = socket(AF_INET, SOCK_STREAM, 0);
if (!server) server = host;
if ((sockaddr.sin_addr.S_un.S_addr = WS_ResolveName(server,
diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 598837dfc3..5367ea5fa4 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -107,7 +107,7 @@ void showLastError() LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL);
+ nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, nullptr);
dbg_msg((wchar_t *)lpMsgBuf, SM_WARNING);
@@ -154,11 +154,11 @@ HICON getIcon(const std::wstring &name) init = true;
// windows icons
- icons[L"exclamation"] = icons[L"warning"] = LoadIcon(NULL, IDI_WARNING);
- deficon = icons[L"information"] = icons[L"asterisk"] = LoadIcon(NULL, IDI_ASTERISK);
- icons[L"hand"] = icons[L"error"] = LoadIcon(NULL, IDI_ERROR);
- icons[L"question"] = LoadIcon(NULL, IDI_QUESTION);
- icons[L"winlogo"] = LoadIcon(NULL, IDI_WINLOGO);
+ icons[L"exclamation"] = icons[L"warning"] = LoadIcon(nullptr, IDI_WARNING);
+ deficon = icons[L"information"] = icons[L"asterisk"] = LoadIcon(nullptr, IDI_ASTERISK);
+ icons[L"hand"] = icons[L"error"] = LoadIcon(nullptr, IDI_ERROR);
+ icons[L"question"] = LoadIcon(nullptr, IDI_QUESTION);
+ icons[L"winlogo"] = LoadIcon(nullptr, IDI_WINLOGO);
// miranda icons
icons[L"online"] = Skin_LoadIcon(SKINICON_STATUS_ONLINE);
@@ -184,8 +184,8 @@ HICON getIcon(const std::wstring &name) size_t p = name.rfind(',');
if (p == name.npos) {
// try to load icon file
- HANDLE h = LoadImage(NULL, name.c_str(), IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
- if (h != NULL)
+ HANDLE h = LoadImage(nullptr, name.c_str(), IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
+ if (h != nullptr)
return icons[name] = (HICON)h;
showLastError();
@@ -200,7 +200,7 @@ HICON getIcon(const std::wstring &name) return deficon;
}
- HMODULE module = LoadLibraryEx(file.c_str(), NULL, LOAD_LIBRARY_AS_DATAFILE);
+ HMODULE module = LoadLibraryEx(file.c_str(), nullptr, LOAD_LIBRARY_AS_DATAFILE);
if (!module) {
showLastError();
return deficon;
@@ -302,7 +302,7 @@ void getAll(std::vector<std::wstring> &out, std::wstring &in, wchar_t sep, bool const wchar_t *decode_se_arg(std::wstring &str)
{
- return (str.empty()) ? 0 : str.c_str();
+ return (str.empty()) ? nullptr : str.c_str();
}
void processSingleAction(const std::wstring &what, bool &closeflag)
@@ -357,7 +357,7 @@ void processSingleAction(const std::wstring &what, bool &closeflag) const wchar_t *cargs = decode_se_arg(args);
- if ((INT_PTR)ShellExecute(0, L"open", file.c_str(), cargs, 0, SW_SHOWNORMAL) <= 32)
+ if ((INT_PTR)ShellExecute(nullptr, L"open", file.c_str(), cargs, nullptr, SW_SHOWNORMAL) <= 32)
throw L"Failed to open: " + file + L" " + args;
}
@@ -381,7 +381,7 @@ void processSingleAction(const std::wstring &what, bool &closeflag) args = strip(args);
dir = /*unquote(*/strip(dir)/*)*/;
- if ((INT_PTR)ShellExecute(0, decode_se_arg(verb), decode_se_arg(file), decode_se_arg(args), decode_se_arg(dir), SW_SHOWNORMAL) <= 32)
+ if ((INT_PTR)ShellExecute(nullptr, decode_se_arg(verb), decode_se_arg(file), decode_se_arg(args), decode_se_arg(dir), SW_SHOWNORMAL) <= 32)
throw L"Failed: " + what;
}
else if (what == L"close")
@@ -575,7 +575,7 @@ COLORREF parseColor(const std::wstring &buf, bool &ok) void loadDefaults(popup_t &msg, char ch)
{
- msg.hwnd = NULL;
+ msg.hwnd = nullptr;
msg.replace = xno;
msg.delay = 0;
switch (ch) {
@@ -930,7 +930,7 @@ void __cdecl udptcpThreadFunc(void *useUdp) mir_strcpy(buf, Translate("NotifyAnything: Failed to format error message"));
DWORD fm = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, ec, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 4096, NULL);
+ nullptr, ec, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 4096, nullptr);
if (!fm) {
t += Translate("NotifyAnything: FormatMessage failed, error code was 0x");
@@ -940,7 +940,7 @@ void __cdecl udptcpThreadFunc(void *useUdp) else
t += buf;
- MessageBoxA(0, t.c_str(), Translate("Error"), MB_OK);
+ MessageBoxA(nullptr, t.c_str(), Translate("Error"), MB_OK);
return;
}
}
@@ -949,7 +949,7 @@ void start_threads() {
g_exit_threads = false;
g_udp_thread = mir_forkthread(udptcpThreadFunc, (void *)1);
- g_tcp_thread = mir_forkthread(udptcpThreadFunc, 0);
+ g_tcp_thread = mir_forkthread(udptcpThreadFunc, nullptr);
}
void stop_threads()
diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 84929e4c7e..abeea38393 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -112,7 +112,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara buf[0] = '\0';
int port = _wtoi(buf);
if (port <= 0 || port > 65535)
- MessageBox(0, TranslateT("Invalid port number"), TranslateT("NotifyAnything"), MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, TranslateT("Invalid port number"), TranslateT("NotifyAnything"), MB_ICONWARNING | MB_OK);
else
s.port = port;
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 5c90b286ae..990546769b 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -48,7 +48,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam, LPARAM lParam) INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
{
char *protoName = GetContactProto(hContact);
- int diff = time(NULL) - db_get_dw(hContact, "Nudge", "LastSent", time(NULL) - 30);
+ int diff = time(nullptr) - db_get_dw(hContact, "Nudge", "LastSent", time(nullptr) - 30);
if (diff < GlobalNudge.sendTimeSec) {
wchar_t msg[500];
mir_snwprintf(msg, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
@@ -64,7 +64,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam) return 0;
}
- db_set_dw(hContact, "Nudge", "LastSent", time(NULL));
+ db_set_dw(hContact, "Nudge", "LastSent", time(nullptr));
if (GlobalNudge.useByProtocol) {
for (int i = 0; i < arNudges.getCount(); i++) {
@@ -92,7 +92,7 @@ int NudgeReceived(WPARAM hContact, LPARAM lParam) {
char *protoName = GetContactProto(hContact);
- DWORD currentTimestamp = time(NULL);
+ DWORD currentTimestamp = time(nullptr);
DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp;
int diff = currentTimestamp - db_get_dw(hContact, "Nudge", "LastReceived", currentTimestamp - 30);
@@ -248,7 +248,7 @@ static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) static int TabsrmmButtonInit(WPARAM, LPARAM)
{
- HOTKEYDESC hkd = { "srmm_nudge", LPGEN("Send nudge"), BB_HK_SECTION, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), LPARAM(hInst) };
+ HOTKEYDESC hkd = { "srmm_nudge", LPGEN("Send nudge"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), LPARAM(hInst) };
Hotkey_Register(&hkd);
BBButton bbd = {};
@@ -287,7 +287,7 @@ static int ContactWindowOpen(WPARAM, LPARAM lParam) static int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
bool isChat = db_get_b(hContact, szProto, "ChatRoom", false) != 0;
NudgeShowMenu((WPARAM)szProto, !isChat);
}
@@ -311,7 +311,7 @@ int ModulesLoaded(WPARAM, LPARAM) int AccListChanged(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *proto = (PROTOACCOUNT*)wParam;
- if (proto == NULL)
+ if (proto == nullptr)
return 0;
if (lParam == PRAC_ADDED)
@@ -421,7 +421,7 @@ int Preview() if (p.openMessageWindow)
CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
if (p.shakeChat)
- ShakeChat(hContact, (LPARAM)time(NULL));
+ ShakeChat(hContact, (LPARAM)time(nullptr));
}
}
}
@@ -437,7 +437,7 @@ int Preview() if (DefaultNudge.openMessageWindow)
CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
if (DefaultNudge.shakeChat)
- ShakeChat(hContact, (LPARAM)time(NULL));
+ ShakeChat(hContact, (LPARAM)time(nullptr));
}
}
return 0;
@@ -472,7 +472,7 @@ void Nudge_ShowPopup(CNudgeElement*, MCONTACT hContact, wchar_t * Message) CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&NudgePopup, 0);
}
- else MessageBox(NULL, Message, lpzContactName, 0);
+ else MessageBox(nullptr, Message, lpzContactName, 0);
}
void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact)
@@ -482,7 +482,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact) DBEVENTINFO dbei = {};
dbei.szModule = MODULENAME;
dbei.flags = DBEF_SENT | DBEF_UTF;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.eventType = 1;
dbei.cbBlob = (DWORD)mir_strlen(buff) + 1;
dbei.pBlob = (PBYTE)buff;
@@ -508,7 +508,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) char str[MAXMODULELABELLENGTH + 10];
mir_snprintf(str, "%s/Nudge", proto->szModuleName);
HANDLE hevent = HookEvent(str, NudgeReceived);
- if (hevent == NULL)
+ if (hevent == nullptr)
return;
nProtocol++;
diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp index be47266c4b..fce6159268 100644 --- a/plugins/Nudge/src/options.cpp +++ b/plugins/Nudge/src/options.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-CNudgeElement* ActualNudge = NULL;
+CNudgeElement* ActualNudge = nullptr;
static int GetSelProto(HWND hwnd, HTREEITEM hItem)
{
@@ -8,7 +8,7 @@ static int GetSelProto(HWND hwnd, HTREEITEM hItem) TVITEM tvi = { 0 };
tvi.mask = TVIF_IMAGE;
- tvi.hItem = hItem == NULL ? TreeView_GetSelection(hLstView) : hItem;
+ tvi.hItem = hItem == nullptr ? TreeView_GetSelection(hLstView) : hItem;
TreeView_GetItem(hLstView, &tvi);
@@ -19,8 +19,8 @@ static void UpdateControls(HWND hwnd) {
int proto = nProtocol;
if (GlobalNudge.useByProtocol) {
- proto = GetSelProto(hwnd, NULL);
- ActualNudge = NULL;
+ proto = GetSelProto(hwnd, nullptr);
+ ActualNudge = nullptr;
for (int i = 0; i < arNudges.getCount(); i++) {
CNudgeElement &p = arNudges[i];
if (p.iProtoNumber == proto)
@@ -70,7 +70,7 @@ static void CheckChange(HWND hwnd, HTREEITEM hItem) int proto = nProtocol;
if (GlobalNudge.useByProtocol) {
proto = GetSelProto(hwnd, hItem);
- ActualNudge = NULL;
+ ActualNudge = nullptr;
for (int i = 0; i < arNudges.getCount(); i++) {
CNudgeElement &p = arNudges[i];
if (p.iProtoNumber == proto)
@@ -174,7 +174,7 @@ static void PopulateProtocolList(HWND hWnd) TreeView_DeleteAllItems(hLstView);
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE;
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index a6a03d9acb..d66d7ad6be 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -37,14 +37,14 @@ INT_PTR ShakeClist(WPARAM, LPARAM) INT_PTR ShakeChat(WPARAM wParam, LPARAM)
{
- if (((HANDLE)wParam) == NULL) return -1;
+ if (((HANDLE)wParam) == nullptr) return -1;
MessageWindowData mwd;
Srmm_GetWindowData(db_mc_tryMeta(wParam), mwd);
HWND parent;
HWND hWnd = mwd.hwndWindow;
- while ((parent = GetParent(hWnd)) != 0) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm)
+ while ((parent = GetParent(hWnd)) != nullptr) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm)
mir_forkthread(ShakeChatWindow, (void*)hWnd);
return 0;
@@ -57,16 +57,16 @@ int CShake::ShakeChat(HWND hWnd) RECT rect;
GetWindowRect(hWnd, &rect);
for (int i = 0; i < nMoveChat; i++) {
- SetWindowPos(hWnd, 0, rect.left - nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left - nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleChat, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top - nScaleChat, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left + nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left + nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleChat, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top + nScaleChat, 0, 0, SWP_NOSIZE);
Sleep(10);
}
- SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE); //SWP_DRAWFRAME
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top, 0, 0, SWP_NOSIZE); //SWP_DRAWFRAME
ShakingChat = false;
}
return 0;
@@ -79,16 +79,16 @@ int CShake::ShakeClist(HWND hWnd) RECT rect;
GetWindowRect(hWnd, &rect);
for (int i = 0; i < nMoveClist; i++) {
- SetWindowPos(hWnd, 0, rect.left - nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left - nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleClist, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top - nScaleClist, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left + nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left + nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleClist, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top + nScaleClist, 0, 0, SWP_NOSIZE);
Sleep(10);
}
- SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top, 0, 0, SWP_NOSIZE);
Shaking = false;
}
return 0;
diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 4bb1a12aa4..97509a117b 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -30,15 +30,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) static INT_PTR MenuCommand_OpenFolder(WPARAM, LPARAM)
{
wchar_t szMirandaPath[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, _countof(szMirandaPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szMirandaPath, _countof(szMirandaPath));
wchar_t *p = wcsrchr(szMirandaPath, '\\');
if (p)
p[1] = 0;
if ( GetAsyncKeyState( VK_CONTROL ) & 0x8000 )
- ShellExecute(0, L"explore", szMirandaPath, 0, 0, SW_SHOWNORMAL);
+ ShellExecute(nullptr, L"explore", szMirandaPath, nullptr, nullptr, SW_SHOWNORMAL);
else
- ShellExecute(0, L"open", szMirandaPath, 0, 0, SW_SHOWNORMAL);
+ ShellExecute(nullptr, L"open", szMirandaPath, nullptr, nullptr, SW_SHOWNORMAL);
return 0;
}
@@ -46,7 +46,7 @@ static INT_PTR MenuCommand_OpenFolder(WPARAM, LPARAM) // toptoolbar (if plugin is installed)
static int ToptoolBarHook(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconHandleUp = icon.hIcolib;
ttb.pszService = MS_OPENFOLDER_OPEN;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
diff --git a/plugins/OpenSSL/src/ssl_openssl.cpp b/plugins/OpenSSL/src/ssl_openssl.cpp index 9089c0f48c..e18614f382 100644 --- a/plugins/OpenSSL/src/ssl_openssl.cpp +++ b/plugins/OpenSSL/src/ssl_openssl.cpp @@ -86,7 +86,7 @@ static bool SSL_library_load(void) const char* SSL_GetCipherName(SslHandle *ssl) { if (!ssl || !ssl->session) - return NULL; + return nullptr; return SSL_CIPHER_get_name(SSL_get_current_cipher(ssl->session)); } @@ -111,11 +111,11 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false) default: wchar_t szMsgBuf[256]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), NULL); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), nullptr); tszMsg += szMsgBuf; } - Netlib_LogfW(0, tszMsg); + Netlib_LogfW(nullptr, tszMsg); SetLastError(scRet); PUShowMessageT(tszMsg.GetBuffer(), SM_WARNING); @@ -139,23 +139,23 @@ static bool ClientConnect(SslHandle *ssl, const char*) // contrary to what it's named, SSLv23 announces all supported ciphers/versions, // generally TLS1.2 in a TLS1.0 Client Hello if (!meth) { - Netlib_Logf(0, "SSL setup failure: client method"); + Netlib_Logf(nullptr, "SSL setup failure: client method"); return false; } ssl->ctx = SSL_CTX_new(meth); if (!ssl->ctx) { - Netlib_Logf(0, "SSL setup failure: context"); + Netlib_Logf(nullptr, "SSL setup failure: context"); return false; } // disable dangerous cipher suites - SSL_CTX_ctrl(ssl->ctx, SSL_CTRL_OPTIONS, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3, NULL); + SSL_CTX_ctrl(ssl->ctx, SSL_CTRL_OPTIONS, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3, nullptr); // SSL_read/write should transparently handle renegotiations - SSL_CTX_ctrl(ssl->ctx, SSL_CTRL_MODE, SSL_MODE_AUTO_RETRY, NULL); + SSL_CTX_ctrl(ssl->ctx, SSL_CTRL_MODE, SSL_MODE_AUTO_RETRY, nullptr); RAND_screen(); ssl->session = SSL_new(ssl->ctx); if (!ssl->session) { - Netlib_Logf(0, "SSL setup failure: session"); + Netlib_Logf(nullptr, "SSL setup failure: session"); return false; } SSL_set_fd(ssl->session, ssl->s); @@ -164,20 +164,20 @@ static bool ClientConnect(SslHandle *ssl, const char*) if (err != 1) { err = SSL_get_error(ssl->session, err); - Netlib_Logf(0, "SSL negotiation failure (%d)", err); + Netlib_Logf(nullptr, "SSL negotiation failure (%d)", err); return false; } const char *suite = SSL_GetCipherName(ssl); - if (suite != NULL) - Netlib_Logf(0, "SSL established with %s", suite); + if (suite != nullptr) + Netlib_Logf(nullptr, "SSL established with %s", suite); return true; } static PCCERT_CONTEXT SSL_X509ToCryptCert(X509 * x509) { - unsigned char *buf = NULL; - PCCERT_CONTEXT pCertContext = NULL; + unsigned char *buf = nullptr; + PCCERT_CONTEXT pCertContext = nullptr; int len = i2d_X509(x509, &buf); if ((len >= 0) && buf) { @@ -193,9 +193,9 @@ static PCCERT_CONTEXT SSL_CertChainToCryptAnchor(SSL* session) /* convert the active certificate chain provided in the handshake of 'session' into the format used by CryptAPI. */ - PCCERT_CONTEXT anchor = NULL; + PCCERT_CONTEXT anchor = nullptr; // create cert store - HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); + HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, nullptr); if (store) { X509 *server_cert = SSL_get_peer_certificate(session); @@ -209,7 +209,7 @@ static PCCERT_CONTEXT SSL_CertChainToCryptAnchor(SSL* session) if (server_chain) { for (int i = 0; i < server_chain->stack.num; i++) { X509 *next_cert = (X509 *)server_chain->stack.data[i]; - CertAddCertificateContextToStore(store, SSL_X509ToCryptCert(next_cert), CERT_STORE_ADD_USE_EXISTING, NULL); + CertAddCertificateContextToStore(store, SSL_X509ToCryptCert(next_cert), CERT_STORE_ADD_USE_EXISTING, nullptr); } } @@ -243,15 +243,15 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF HTTPSPolicyCallbackData polHttps = { 0 }; CERT_CHAIN_POLICY_PARA PolicyPara = { 0 }; CERT_CHAIN_POLICY_STATUS PolicyStatus = { 0 }; - PCCERT_CHAIN_CONTEXT pChainContext = NULL; - PCCERT_CONTEXT pServerCert = NULL; + PCCERT_CHAIN_CONTEXT pChainContext = nullptr; + PCCERT_CONTEXT pServerCert = nullptr; DWORD scRet; PWSTR pwszServerName = mir_a2u(pszServerName); pServerCert = SSL_CertChainToCryptAnchor(ssl->session); - if (pServerCert == NULL) { + if (pServerCert == nullptr) { scRet = SEC_E_WRONG_PRINCIPAL; goto cleanup; } @@ -260,8 +260,8 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF ChainPara.RequestedUsage.dwType = USAGE_MATCH_TYPE_OR; ChainPara.RequestedUsage.Usage.cUsageIdentifier = _countof(rgszUsages); ChainPara.RequestedUsage.Usage.rgpszUsageIdentifier = rgszUsages; - if (!CertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore, - &ChainPara, 0, NULL, &pChainContext)) { + if (!CertGetCertificateChain(nullptr, pServerCert, nullptr, pServerCert->hCertStore, + &ChainPara, 0, nullptr, &pChainContext)) { scRet = GetLastError(); goto cleanup; } @@ -319,13 +319,13 @@ SslHandle* NetlibSslConnect(SOCKET s, const char* host, int verify) return ssl; delete ssl; - return NULL; + return nullptr; } void NetlibSslShutdown(SslHandle *ssl) { /* Close SSL session, but keep socket open */ - if (ssl == NULL || ssl->session == NULL) + if (ssl == nullptr || ssl->session == nullptr) return; SSL_shutdown(ssl->session); @@ -346,12 +346,12 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek) if (err <= 0) { int err2 = SSL_get_error(ssl->session, err); if (err2 == SSL_ERROR_ZERO_RETURN) { - Netlib_Logf(0, "SSL connection gracefully closed"); + Netlib_Logf(nullptr, "SSL connection gracefully closed"); ssl->state = sockClosed; return 0; } - Netlib_Logf(0, "SSL failure recieving data (%d, %d, %d)", err, err2, WSAGetLastError()); + Netlib_Logf(nullptr, "SSL failure recieving data (%d, %d, %d)", err, err2, WSAGetLastError()); ssl->state = sockError; return SOCKET_ERROR; } @@ -372,11 +372,11 @@ int NetlibSslWrite(SslHandle *ssl, const char *buf, int num) int err2 = SSL_get_error(ssl->session, err); switch (err2) { case SSL_ERROR_ZERO_RETURN: - Netlib_Logf(0, "SSL connection gracefully closed"); + Netlib_Logf(nullptr, "SSL connection gracefully closed"); ssl->state = sockClosed; break; default: - Netlib_Logf(0, "SSL failure sending data (%d, %d, %d)", err, err2, WSAGetLastError()); + Netlib_Logf(nullptr, "SSL failure sending data (%d, %d, %d)", err, err2, WSAGetLastError()); ssl->state = sockError; return SOCKET_ERROR; } @@ -386,7 +386,7 @@ int NetlibSslWrite(SslHandle *ssl, const char *buf, int num) static INT_PTR GetSslApi(WPARAM, LPARAM lParam) { SSL_API *pSsl = (SSL_API*)lParam; - if (pSsl == NULL) + if (pSsl == nullptr) return FALSE; if (pSsl->cbSize != sizeof(SSL_API)) @@ -404,11 +404,11 @@ static INT_PTR GetSslApi(WPARAM, LPARAM lParam) int LoadSslModule(void) { if (!SSL_library_load()) { - MessageBoxW(NULL, TranslateT("OpenSSL library loading failed"), TranslateT("OpenSSL error"), MB_ICONERROR | MB_OK); + MessageBoxW(nullptr, TranslateT("OpenSSL library loading failed"), TranslateT("OpenSSL error"), MB_ICONERROR | MB_OK); return 1; } CreateServiceFunction(MS_SYSTEM_GET_SI, GetSslApi); - g_hSslMutex = CreateMutex(NULL, FALSE, NULL); + g_hSslMutex = CreateMutex(nullptr, FALSE, nullptr); return 0; } diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp index be0be7c32d..71abc60030 100644 --- a/plugins/PackUpdater/Src/Events.cpp +++ b/plugins/PackUpdater/Src/Events.cpp @@ -38,7 +38,7 @@ int ModulesLoaded(WPARAM, LPARAM) if (AllowUpdateOnStartup())
DoCheck(UpdateOnStartup);
- Timer = CreateWaitableTimer(NULL, FALSE, NULL);
+ Timer = CreateWaitableTimer(nullptr, FALSE, nullptr);
InitTimer();
return 0;
@@ -54,14 +54,14 @@ INT_PTR MenuCommand(WPARAM, LPARAM) INT_PTR EmptyFolder(WPARAM, LPARAM lParam)
{
SHFILEOPSTRUCT file_op = {
- NULL,
+ nullptr,
FO_DELETE,
tszRoot,
L"",
FOF_NOERRORUI |
FOF_SILENT,
false,
- 0,
+ nullptr,
L"" };
if (lParam)
file_op.fFlags |= FOF_NOCONFIRMATION;
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index ea1778f311..7ce39467bf 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HWND hDlgDld = NULL;
+HWND hDlgDld = nullptr;
INT UpdatesCount = 0;
void PopupAction(HWND hWnd, BYTE action)
@@ -139,7 +139,7 @@ void show_popup(HWND hDlg, LPCTSTR pszTitle, LPCTSTR pszText, int iNumber, int A pd.iSeconds = -1;
else
pd.iSeconds = MyOptions.Timeout;
- pd.hNotification = NULL;
+ pd.hNotification = nullptr;
pd.lpActions = pmpd->pa;
pmpd->hDialog = hDlg;
@@ -177,10 +177,10 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM) static void __stdcall CreateDownloadDialog(void*)
{
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
- hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
+ hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop);
else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
- hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
+ hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), nullptr, DlgDownload);
}
}
@@ -191,18 +191,18 @@ static void __stdcall DestroyDownloadDialog(void*) void DlgDownloadProc()
{
- CallFunctionAsync(CreateDownloadDialog, 0);
+ CallFunctionAsync(CreateDownloadDialog, nullptr);
if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occurred while downloading the update.");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONSTOP);
+ MessageBox(nullptr, Text, Title, MB_ICONSTOP);
}
- CallFunctionAsync(DestroyDownloadDialog, 0);
+ CallFunctionAsync(DestroyDownloadDialog, nullptr);
}
INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -327,7 +327,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
ShowWindow(hDlg, SW_HIDE);
wchar_t tszBuff[2048] = { 0 }, tszFileDest[MAX_PATH] = { 0 }, tszFilePathDest[MAX_PATH] = { 0 }, tszFilePathBack[MAX_PATH] = { 0 }, tszFileName[MAX_PATH] = { 0 };
- wchar_t* tszExt = NULL;
+ wchar_t* tszExt = nullptr;
char szKey[64] = { 0 };
vector<int> arFileType;
vector<tString> arFilePath;
@@ -350,30 +350,30 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam switch (todo[i].FileType) {
case 1:
mir_snwprintf(tszFileDest, L"%s\\Pack", tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ CreateDirectory(tszFileDest, nullptr);
break;
case 2:
mir_snwprintf(tszFileDest, L"%s\\Plugins", tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ CreateDirectory(tszFileDest, nullptr);
break;
case 3:
mir_snwprintf(tszFileDest, L"%s\\Icons", tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ CreateDirectory(tszFileDest, nullptr);
break;
case 4:
mir_snwprintf(tszFileDest, L"%s\\Others", tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ CreateDirectory(tszFileDest, nullptr);
break;
case 5:
mir_snwprintf(tszFileDest, L"%s\\Others", tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ CreateDirectory(tszFileDest, nullptr);
break;
default:
mir_wstrncpy(tszFileDest, tszRoot, _countof(tszFileDest));
break;
}
mir_snwprintf(tszBuff, L"%s\\Backups", tszRoot);
- CreateDirectory(tszBuff, NULL);
+ CreateDirectory(tszBuff, nullptr);
mir_wstrncpy(tszFileName, todo[i].File.tszDiskPath, _countof(tszFileName));
mir_snwprintf(todo[i].File.tszDiskPath, L"%s\\%s", tszFileDest, tszFileName);
UpdatesCount++;
@@ -421,14 +421,14 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam Title = TranslateT("Pack Updater");
Text = tszBuff;
if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
- rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
+ rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop);
else
- rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
+ rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
if (rc == IDYES) {
for (int i = 0; i < UpdatesCount; i++) {
- wchar_t* tszUtilRootPlug = NULL;
- wchar_t* tszUtilRootIco = NULL;
- wchar_t* tszUtilRoot = NULL;
+ wchar_t* tszUtilRootPlug = nullptr;
+ wchar_t* tszUtilRootIco = nullptr;
+ wchar_t* tszUtilRoot = nullptr;
wchar_t tszCurrentDir[MAX_PATH];
switch (arFileType[i]) {
@@ -445,9 +445,9 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam wchar_t *p = wcsrchr(tszCurrentDir, '\\');
if (p) *p = 0;
}
- CreateProcess(arFilePath[i].c_str(), L"", NULL, NULL, FALSE, NULL, NULL, tszCurrentDir, &si, &pi);
+ CreateProcess(arFilePath[i].c_str(), L"", nullptr, nullptr, FALSE, NULL, nullptr, tszCurrentDir, &si, &pi);
i = UpdatesCount;
- CallFunctionAsync(ExitMe, 0);
+ CallFunctionAsync(ExitMe, nullptr);
break;
case 2:
tszUtilRootPlug = Utils_ReplaceVarsW(L"%miranda_path%\\Plugins");
@@ -460,7 +460,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRootPlug);
if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
+ CallFunctionAsync(RestartMe, nullptr);
break;
case 3:
tszUtilRootIco = Utils_ReplaceVarsW(L"%miranda_path%\\Icons");
@@ -473,7 +473,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRootIco);
if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
+ CallFunctionAsync(RestartMe, nullptr);
break;
case 4:
tszUtilRoot = Utils_ReplaceVarsW(L"%miranda_path%");
@@ -486,7 +486,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRoot);
if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
+ CallFunctionAsync(RestartMe, nullptr);
break;
case 5:
tszUtilRoot = Utils_ReplaceVarsW(L"%miranda_path%");
@@ -510,10 +510,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam Text = tszBuff;
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
}
}
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index 2fc1bb3868..421244f4af 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -290,7 +290,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) for (i = 0; i < POPUPS; i++) {
if ((BST_UNCHECKED == IsDlgButtonChecked(hdlg, (i + 40071))) || (!IsWindowEnabled(GetDlgItem(hdlg, (i + 40071)))))
continue;
- show_popup(0, Title, Text, i, 0);
+ show_popup(nullptr, Title, Text, i, 0);
}
break;
@@ -358,7 +358,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) //Colors
db_set_b(NULL, MODNAME, "DefColors", MyOptions.DefColors);
//Timeout
- MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE);
+ MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
db_set_dw(NULL, MODNAME, "Timeout", MyOptions.Timeout);
//Left mouse click
db_set_b(NULL, MODNAME, "LeftClickAction", MyOptions.LeftClickAction);
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 860c37fb83..ca83b8ae11 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -19,9 +19,9 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
-HANDLE hPackUpdaterFolder = NULL;
+HANDLE hPackUpdaterFolder = nullptr;
wchar_t tszRoot[MAX_PATH] = { 0 };
int hLangpack;
@@ -100,7 +100,7 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
if (hCheckThread)
- hCheckThread = NULL;
+ hCheckThread = nullptr;
NetlibUnInit();
return 0;
}
\ No newline at end of file diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 9a8ce67da2..036a782d3c 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -26,13 +26,13 @@ BYTE Reminder, AutoUpdate; BYTE UpdateOnStartup, UpdateOnPeriod, OnlyOnceADay, PeriodMeasure;
INT Period;
wchar_t tszDialogMsg[2048] = { 0 };
-FILEINFO* pFileInfo = NULL;
-FILEURL* pFileUrl = NULL;
-HANDLE hCheckThread = NULL;
-HNETLIBUSER hNetlibUser = NULL;
+FILEINFO* pFileInfo = nullptr;
+FILEURL* pFileUrl = nullptr;
+HANDLE hCheckThread = nullptr;
+HNETLIBUSER hNetlibUser = nullptr;
MYOPTIONS MyOptions = { 0 };
aPopups PopupsList[POPUPS];
-LPCTSTR Title = { 0 }, Text = { 0 };
+LPCTSTR Title = {}, Text = {};
IconItem iconList[] =
{
@@ -55,13 +55,13 @@ BOOL NetlibInit() nlu.szSettingsModule = MODNAME;
hNetlibUser = Netlib_RegisterUser(&nlu);
- return hNetlibUser != NULL;
+ return hNetlibUser != nullptr;
}
void NetlibUnInit()
{
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
}
void InitPopupList()
@@ -130,9 +130,9 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) if (pReply) {
if (200 == pReply->resultCode && pReply->dataLength > 0) {
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
DWORD dwBytes;
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -184,7 +184,7 @@ static void CheckUpdates(void *) vector<FILEINFO> UpdateFiles;
if (!Exists(tszRoot))
- CreateDirectory(tszRoot, NULL);
+ CreateDirectory(tszRoot, nullptr);
Files.clear();
Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
@@ -196,11 +196,11 @@ static void CheckUpdates(void *) Text = TranslateT("URL for checking updates not found.");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONSTOP);
- hCheckThread = NULL;
+ MessageBox(nullptr, Text, Title, MB_ICONSTOP);
+ hCheckThread = nullptr;
return;
}
// Download version info
@@ -214,7 +214,7 @@ static void CheckUpdates(void *) DlgDownloadProc();
mir_free(pFileUrl);
if (!DlgDld) {
- hCheckThread = NULL;
+ hCheckThread = nullptr;
return;
}
@@ -251,10 +251,10 @@ static void CheckUpdates(void *) Text = TranslateT("Name of Update's file is not supported.");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
mir_wstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, _countof(Files[CurrentFile].File.tszDiskPath));
@@ -279,9 +279,9 @@ static void CheckUpdates(void *) VARSW tszProgFiles(L"%ProgramFiles%");
if (Files[CurrentFile].FileType != 1 && !IsUserAnAdmin() && (wcsstr(tszRoot, tszSysRoot) || wcsstr(tszRoot, tszProgFiles))) {
- MessageBox(NULL, TranslateT("Update is not possible!\nYou have no Administrator's rights.\nPlease run Miranda NG with Administrator's rights."), Title, MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Update is not possible!\nYou have no Administrator's rights.\nPlease run Miranda NG with Administrator's rights."), Title, MB_ICONINFORMATION);
DeleteFile(tszTmpIni);
- hCheckThread = NULL;
+ hCheckThread = nullptr;
return;
} // user have not admin's rights
@@ -333,7 +333,7 @@ static void CheckUpdates(void *) upd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)&UpdateFiles);
DeleteFile(tszTmpIni);
if (upd_ret == IDCANCEL) {
- hCheckThread = NULL;
+ hCheckThread = nullptr;
return;
}
@@ -342,10 +342,10 @@ static void CheckUpdates(void *) Text = TranslateT("No updates found.");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
if (!FileCount) {
@@ -353,36 +353,36 @@ static void CheckUpdates(void *) Text = TranslateT("No files for update.");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
- hCheckThread = NULL;
+ hCheckThread = nullptr;
}
void DoCheck(int iFlag)
{
- if (hCheckThread != NULL) {
+ if (hCheckThread != nullptr) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
- show_popup(0, Title, Text, Number, 0);
+ show_popup(nullptr, Title, Text, Number, 0);
}
else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
else if (iFlag) {
- hCheckThread = mir_forkthread(CheckUpdates, 0);
- db_set_dw(NULL, MODNAME, "LastUpdate", time(NULL));
+ hCheckThread = mir_forkthread(CheckUpdates, nullptr);
+ db_set_dw(NULL, MODNAME, "LastUpdate", time(nullptr));
}
}
BOOL AllowUpdateOnStartup()
{
if (OnlyOnceADay) {
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
if ((now - was) < 86400)
@@ -427,6 +427,6 @@ void InitTimer() li.LowPart = (DWORD)(qwDueTime & 0xFFFFFFFF);
li.HighPart = (LONG)(qwDueTime >> 32);
- SetWaitableTimer(Timer, &li, interval, TimerAPCProc, NULL, 0);
+ SetWaitableTimer(Timer, &li, interval, TimerAPCProc, nullptr, 0);
}
}
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index 4bbb0bcea7..97d93e3d98 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -66,7 +66,7 @@ Options::~Options() {
for (int i = 0; i < PasteToWeb::pages; ++i) {
delete webOptions[i];
- webOptions[i] = NULL;
+ webOptions[i] = nullptr;
}
}
@@ -139,7 +139,7 @@ public: {
for (int i = 0; i < PasteToWeb::pages; ++i) {
delete webOptions[i];
- webOptions[i] = NULL;
+ webOptions[i] = nullptr;
}
}
@@ -228,7 +228,7 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam HWND btnhwnd = GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN);
int btSize = Button_GetTextLength(btnhwnd);
if (btSize > 20) {
- SetWindowPos(btnhwnd, NULL, 0, 0, 115, 34, SWP_NOZORDER | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOREDRAW);
+ SetWindowPos(btnhwnd, nullptr, 0, 0, 115, 34, SWP_NOZORDER | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOREDRAW);
}
for (int i = 0; i < PasteToWeb::pages; ++i) {
@@ -613,7 +613,7 @@ unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int if (selCpIdx < 0) {
wchar_t text[128];
ComboBox_GetText(hwndCB, text, 128);
- wchar_t * stopOn = NULL;
+ wchar_t * stopOn = nullptr;
long cp = wcstol(text, &stopOn, 10);
if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) {
MessageBox(GetParent(hwndCB), TranslateT("You've entered invalid codepage. Select codepage from combo box or enter correct number."), TranslateT("Invalid codepage"), MB_OK | MB_ICONERROR);
@@ -780,7 +780,7 @@ void Options::Load() webOptions[i]->formats.clear();
int k = 0;
wchar_t *id = forms.pwszVal;
- wchar_t *name = NULL;
+ wchar_t *name = nullptr;
while (forms.pwszVal[k]) {
if (forms.pwszVal[k] == L'=') {
forms.pwszVal[k] = 0;
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 7f9dec64c7..96de6b8a51 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -28,7 +28,7 @@ HANDLE hPrebuildContactMenu; HGENMENU hContactMenu;
HGENMENU hWebPageMenus[PasteToWeb::pages];
HANDLE hOptionsInit;
-HANDLE hWindowEvent = NULL;
+HANDLE hWindowEvent = nullptr;
HINSTANCE hInst;
#define FROM_CLIPBOARD 10
@@ -78,7 +78,7 @@ std::wstring GetFile() stzFilePath[1] = 0;
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
@@ -111,9 +111,9 @@ void PasteIt(MCONTACT hContact, int mode) }
else return;
- if (pasteToWeb->szFileLink[0] == 0 && pasteToWeb->error != NULL)
+ if (pasteToWeb->szFileLink[0] == 0 && pasteToWeb->error != nullptr)
{
- MessageBox(NULL, pasteToWeb->error, TranslateT("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, pasteToWeb->error, TranslateT("Error"), MB_OK | MB_ICONERROR);
}
else if (hContact != NULL && pasteToWeb->szFileLink[0] != 0)
{
@@ -129,7 +129,7 @@ void PasteIt(MCONTACT hContact, int mode) 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(pasteToWeb->szFileLink) + 1;
dbei.pBlob = (PBYTE)pasteToWeb->szFileLink;
db_event_add(hContact, &dbei);
@@ -232,7 +232,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) RECT rc;
GetWindowRect(hwndBtn, &rc);
SetForegroundWindow(cbc->hwndFrom);
- int selected = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0);
+ int selected = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, nullptr);
if (selected != 0)
{
if (selected >= DEF_PAGES_START)
@@ -328,7 +328,7 @@ void DefWebPageChanged() {
for (int i = 0; i < PasteToWeb::pages; i++) {
int flags = (Options::instance->defWeb == i) ? CMIF_CHECKED : 0;
- Menu_ModifyItem(hWebPageMenus[i], NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(hWebPageMenus[i], nullptr, INVALID_HANDLE_VALUE, flags);
}
}
@@ -343,7 +343,7 @@ void InitTabsrmmButton() btn.pwszTooltip = TranslateT("Paste It");
Srmm_AddButton(&btn);
- if (hTabsrmmButtonPressed != NULL)
+ if (hTabsrmmButtonPressed != nullptr)
UnhookEvent(hTabsrmmButtonPressed);
hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
@@ -406,7 +406,7 @@ extern "C" int __declspec(dllexport) Load(void) Options::instance->Load();
hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
hOptionsInit = HookEvent(ME_OPT_INITIALISE, Options::InitOptions);
- hTabsrmmButtonPressed = NULL;
+ hTabsrmmButtonPressed = nullptr;
CreateServiceFunction(MS_PASTEIT_CONTACTMENU, ContactMenuService);
contactWindows = new std::map<MCONTACT, HWND>();
return 0;
@@ -417,22 +417,22 @@ extern "C" int __declspec(dllexport) Unload(void) UnhookEvent(hModulesLoaded);
UnhookEvent(hPrebuildContactMenu);
UnhookEvent(hOptionsInit);
- if (hWindowEvent != NULL)
+ if (hWindowEvent != nullptr)
UnhookEvent(hWindowEvent);
Netlib_CloseHandle(g_hNetlibUser);
- if (hTabsrmmButtonPressed != NULL)
+ if (hTabsrmmButtonPressed != nullptr)
UnhookEvent(hTabsrmmButtonPressed);
for (int i = 0; i < PasteToWeb::pages; ++i)
- if (pasteToWebs[i] != NULL) {
+ if (pasteToWebs[i] != nullptr) {
delete pasteToWebs[i];
- pasteToWebs[i] = NULL;
+ pasteToWebs[i] = nullptr;
}
- if (Options::instance != NULL) {
+ if (Options::instance != nullptr) {
delete Options::instance;
- Options::instance = NULL;
+ Options::instance = nullptr;
}
delete contactWindows;
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index 1307a2fabd..09786c738a 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -121,11 +121,11 @@ void RecodeDlg(HWND hwndDlg) }
else
{
- cbLen = MultiByteToWideChar(cp, 0, fromFileData->content, fromFileData->contentLen, NULL, 0);
+ cbLen = MultiByteToWideChar(cp, 0, fromFileData->content, fromFileData->contentLen, nullptr, 0);
}
fromFileData->contentW = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen + 1));
- if (fromFileData->contentW != NULL)
+ if (fromFileData->contentW != nullptr)
{
if (cp == 1200)
{
@@ -263,13 +263,13 @@ INT_PTR CALLBACK DlgProcFromFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l void PasteToWeb::FromClipboard()
{
szFileLink[0] = 0;
- error = NULL;
+ error = nullptr;
std::wstring str;
BOOL isFile = 0;
- if (OpenClipboard(NULL))
+ if (OpenClipboard(nullptr))
{
HANDLE obj = GetClipboardData(CF_UNICODETEXT);
- if (obj != NULL)
+ if (obj != nullptr)
{
LPCWSTR wStr = (LPCWSTR)GlobalLock(obj);
str.append(wStr, wStr + mir_wstrlen(wStr));
@@ -278,7 +278,7 @@ void PasteToWeb::FromClipboard() // to fix this I check if CF_TEXT contains more characters,
// if this is true, this mean that CF_UNICODETEXT is invalid.
obj = GetClipboardData(CF_TEXT);
- if (obj != NULL)
+ if (obj != nullptr)
{
LPCSTR cStr = (LPCSTR)GlobalLock(obj);
if (mir_strlen(cStr) > str.length())
@@ -294,7 +294,7 @@ void PasteToWeb::FromClipboard() else
{
obj = GetClipboardData(CF_TEXT);
- if (obj != NULL)
+ if (obj != nullptr)
{
LPCSTR cStr = (LPCSTR)GlobalLock(obj);
LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP);
@@ -305,7 +305,7 @@ void PasteToWeb::FromClipboard() else
{
obj = GetClipboardData(CF_HDROP);
- if (obj != NULL)
+ if (obj != nullptr)
{
LPDROPFILES df = (LPDROPFILES)GlobalLock(obj);
isFile = 1;
@@ -356,13 +356,13 @@ void PasteToWeb::FromClipboard() FromClipboardData data;
data.content = str;
data.page = pageIndex;
- if (Options::instance->confDlg && DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FROM_CLIPBOARD), 0, DlgProcFromClipboard, (LPARAM)&data) != IDC_BTN_OK)
+ if (Options::instance->confDlg && DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FROM_CLIPBOARD), nullptr, DlgProcFromClipboard, (LPARAM)&data) != IDC_BTN_OK)
return;
SendToServer(str, L"", data.format);
}
}
- else if (error == NULL)
+ else if (error == nullptr)
{
error = TranslateT("Cannot get data from clipboard");
}
@@ -370,10 +370,10 @@ void PasteToWeb::FromClipboard() void PasteToWeb::FromFile(std::wstring file)
{
- error = NULL;
+ error = nullptr;
szFileLink[0] = 0;
- HANDLE hFile = CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- FromFileData fromFileData = { 0 };
+ HANDLE hFile = CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
+ FromFileData fromFileData = {};
fromFileData.fileName = &file;
if (hFile != INVALID_HANDLE_VALUE)
{
@@ -385,7 +385,7 @@ void PasteToWeb::FromFile(std::wstring file) if (fileSize.QuadPart > 512000LL)
{
mir_snwprintf(bufErr, TranslateT("File size is %d KB, do you really want to paste such a large file?"), fileSize.LowPart / 1024);
- if (MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES)
+ if (MessageBox(nullptr, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES)
{
CloseHandle(hFile);
return;
@@ -394,10 +394,10 @@ void PasteToWeb::FromFile(std::wstring file) DWORD readed;
fromFileData.contentLen = fileSize.LowPart;
fromFileData.content = (char*)mir_alloc(fromFileData.contentLen);
- if (!ReadFile(hFile, fromFileData.content, fromFileData.contentLen, &readed, NULL))
+ if (!ReadFile(hFile, fromFileData.content, fromFileData.contentLen, &readed, nullptr))
{
mir_free(fromFileData.content);
- fromFileData.content = NULL;
+ fromFileData.content = nullptr;
fromFileData.contentLen = 0;
mir_snwprintf(bufErr, TranslateT("Cannot read file '%s'"), file.c_str());
error = bufErr;
@@ -417,7 +417,7 @@ void PasteToWeb::FromFile(std::wstring file) error = bufErr;
}
- if (fromFileData.content != NULL)
+ if (fromFileData.content != nullptr)
{
int cbLen = 0;
bool isDefTranslation = true;
@@ -425,7 +425,7 @@ void PasteToWeb::FromFile(std::wstring file) {
isDefTranslation = false;
fromFileData.codepage = CP_UTF8;
- cbLen = MultiByteToWideChar(fromFileData.codepage, MB_ERR_INVALID_CHARS, fromFileData.content, fromFileData.contentLen, NULL, 0);
+ cbLen = MultiByteToWideChar(fromFileData.codepage, MB_ERR_INVALID_CHARS, fromFileData.content, fromFileData.contentLen, nullptr, 0);
if (cbLen == 0)
{
int errorN = GetLastError();
@@ -446,14 +446,14 @@ void PasteToWeb::FromFile(std::wstring file) }
else
{
- cbLen = MultiByteToWideChar(fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, NULL, 0);
+ cbLen = MultiByteToWideChar(fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, nullptr, 0);
}
}
if (cbLen > 0)
{
fromFileData.contentW = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen + 1));
- if (fromFileData.contentW != NULL)
+ if (fromFileData.contentW != nullptr)
{
if (fromFileData.codepage == 1200)
{
@@ -473,7 +473,7 @@ void PasteToWeb::FromFile(std::wstring file) fromFileData.contentW[cbLen] = 0;
fromFileData.page = pageIndex;
- if (!Options::instance->confDlg || DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FROM_FILE), 0, DlgProcFromFile, (LPARAM)&fromFileData) == IDC_BTN_OK)
+ if (!Options::instance->confDlg || DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FROM_FILE), nullptr, DlgProcFromFile, (LPARAM)&fromFileData) == IDC_BTN_OK)
{
std::wstring fileName;
std::wstring::size_type pos1 = file.find_last_of(L'\\');
@@ -502,13 +502,13 @@ extern HNETLIBUSER g_hNetlibUser; wchar_t* PasteToWeb::SendToWeb(char* url, std::map<std::string, std::string>& headers, std::wstring content)
{
- wchar_t* resCont = NULL;
- int cbLen = WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, NULL, 0, NULL, NULL);
+ wchar_t* resCont = nullptr;
+ int cbLen = WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, nullptr, 0, nullptr, nullptr);
char* contentBytes = (char*)mir_alloc(cbLen);
- if (contentBytes == NULL)
+ if (contentBytes == nullptr)
return resCont;
- WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, nullptr, nullptr);
--cbLen;
int nHeaders = 0;
@@ -543,14 +543,14 @@ wchar_t* PasteToWeb::SendToWeb(char* url, std::map<std::string, std::string>& he nlhr.headersCount = nHeaders;
NETLIBHTTPREQUEST* nlhrReply = Netlib_HttpTransaction(g_hNetlibUser, &nlhr);
- if (nlhrReply != NULL)
+ if (nlhrReply != nullptr)
{
if (nlhrReply->resultCode == 200)
{
- int resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, NULL, 0);
+ int resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, nullptr, 0);
++resLen;
resCont = (wchar_t*)mir_alloc(resLen * sizeof(wchar_t));
- if (resCont != NULL)
+ if (resCont != nullptr)
{
resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, resCont, resLen);
resCont[resLen] = 0;
diff --git a/plugins/PasteIt/src/PasteToWeb1.cpp b/plugins/PasteIt/src/PasteToWeb1.cpp index a7de2c10fc..b725c12f52 100644 --- a/plugins/PasteIt/src/PasteToWeb1.cpp +++ b/plugins/PasteIt/src/PasteToWeb1.cpp @@ -300,7 +300,7 @@ void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wst }
wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_post.php", headers, content);
- if (resCont != NULL)
+ if (resCont != nullptr)
{
if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
@@ -332,12 +332,12 @@ std::wstring PasteToWeb1::GetUserKey(std::wstring& user, std::wstring& password) content += L"&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd";
wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_login.php", headers, content);
std::wstring toRet;
- if (resCont != NULL)
+ if (resCont != nullptr)
{
if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
mir_snwprintf(bufErr, TranslateT("Error during getting user key from web page: %s"), resCont + 17);
- MessageBox(NULL, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR);
}
else
toRet = resCont;
diff --git a/plugins/PasteIt/src/PasteToWeb2.cpp b/plugins/PasteIt/src/PasteToWeb2.cpp index a5843149a3..17b3ca116f 100644 --- a/plugins/PasteIt/src/PasteToWeb2.cpp +++ b/plugins/PasteIt/src/PasteToWeb2.cpp @@ -103,27 +103,27 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content);
error = TranslateT("Error during sending text to web page");
- if (resCont != NULL)
+ if (resCont != nullptr)
{
- HXML hXml = xmlParseString(resCont, NULL, L"methodResponse");
- if (hXml != NULL)
+ HXML hXml = xmlParseString(resCont, nullptr, L"methodResponse");
+ if (hXml != nullptr)
{
HXML node = xmlGetChildByPath(hXml, L"params/param/value/array/data/value/int", 0);
- if (node != NULL && !mir_wstrcmp(xmlGetText(node), L"1"))
+ if (node != nullptr && !mir_wstrcmp(xmlGetText(node), L"1"))
{
node = xmlGetChildByPath(hXml, L"params/param/value/array/data", 0);
- if (node != NULL)
+ if (node != nullptr)
{
node = xmlGetNthChild(node, L"value", 1);
- if (node != NULL)
+ if (node != nullptr)
{
node = xmlGetChildByPath(node, L"string", 0);
- if (node != NULL)
+ if (node != nullptr)
{
char* s = mir_u2a_cp(xmlGetText(node), CP_ACP);
mir_strncpy(szFileLink, s, _countof(szFileLink));
mir_free(s);
- error = NULL;
+ error = nullptr;
}
}
}
@@ -143,22 +143,22 @@ std::list<PasteFormat> PasteToWeb2::GetFormats() std::wstring content = L"<?xml version=\"1.0\"?>\r\n<methodCall><methodName>types</methodName></methodCall>";
wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content);
- if (resCont != NULL)
+ if (resCont != nullptr)
{
- HXML hXml = xmlParseString(resCont, NULL, L"methodResponse");
- if (hXml != NULL)
+ HXML hXml = xmlParseString(resCont, nullptr, L"methodResponse");
+ if (hXml != nullptr)
{
HXML node = xmlGetChildByPath(hXml, L"params/param/value/array/data/value/int", 0);
- if (node != NULL && !mir_wstrcmp(xmlGetText(node), L"1"))
+ if (node != nullptr && !mir_wstrcmp(xmlGetText(node), L"1"))
{
node = xmlGetChildByPath(hXml, L"params/param/value/array/data", 0);
- if (node != NULL)
+ if (node != nullptr)
{
node = xmlGetNthChild(node, L"value", 1);
- if (node != NULL)
+ if (node != nullptr)
{
node = xmlGetChildByPath(node, L"string", 0);
- if (node != NULL)
+ if (node != nullptr)
{
std::wstring str = xmlGetText(node);
std::wstring::size_type pos = str.find(L'\n');
diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp index 93bf4febd4..26e7379845 100644 --- a/plugins/Ping/src/icmp.cpp +++ b/plugins/Ping/src/icmp.cpp @@ -1,11 +1,11 @@ #include "stdafx.h"
char data[] = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHH";
-ICMP *ICMP::instance = 0;
+ICMP *ICMP::instance = nullptr;
#define BUFFER_SIZE (16 * (sizeof(ICMP_ECHO_REPLY) + sizeof(data)))
-ICMP::ICMP() : timeout(2000), functions_loaded(false), hIP(0)
+ICMP::ICMP() : timeout(2000), functions_loaded(false), hIP(nullptr)
{
WSAData wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
@@ -40,7 +40,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply) if (address == INADDR_NONE)
{
rec = gethostbyname(host);
- if (rec != NULL)
+ if (rec != nullptr)
address = *(unsigned long *)(*rec->h_addr_list);
else
return false;
@@ -50,7 +50,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply) ipoi.Tos = 0;
ipoi.Flags = 0;
ipoi.OptionsSize = 0;
- ipoi.OptionsData = 0;
+ ipoi.OptionsData = nullptr;
reply.Status = 0;
@@ -58,14 +58,14 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply) if (hIP == INVALID_HANDLE_VALUE)
return false;
- DWORD rep_cnt = IcmpSendEcho2(hIP, 0, 0, 0, address, data, sizeof(data), 0, buff, BUFFER_SIZE, timeout);
+ DWORD rep_cnt = IcmpSendEcho2(hIP, nullptr, nullptr, nullptr, address, data, sizeof(data), nullptr, buff, BUFFER_SIZE, timeout);
if (rep_cnt == 0)
{
DWORD code = GetLastError();
if (code != 11010)
{
char winmsg[512], msg[1024];
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, code, 0, winmsg, 512, 0);
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, code, 0, winmsg, 512, nullptr);
mir_snprintf(msg, "Ping error (%d): %s", code, winmsg);
PUShowMessage(msg, SM_NOTIFY);
return false;
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index 6d1a2a9767..20782c2c17 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -10,8 +10,8 @@ INT_PTR Log(WPARAM wParam, LPARAM) { GetLocalTime(&systime);
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, tbuf, 512);
- GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, dbuf, 512);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, nullptr, tbuf, 512);
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, nullptr, dbuf, 512);
wchar_t *line = (wchar_t *)wParam;
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index 974469725f..f8ee4ec831 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -91,9 +91,9 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ofn.lpstrTitle = TranslateT("Open log file");
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
+ ofn.lpstrInitialDir = nullptr;
ofn.Flags = OFN_PATHMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE) {
diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 7dd24e6a26..c703feba7a 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -4,8 +4,8 @@ CLIST_INTERFACE *pcli; HINSTANCE hInst;
int hLangpack = 0;
-HNETLIBUSER hNetlibUser = 0;
-HANDLE hFillListEvent = 0;
+HNETLIBUSER hNetlibUser = nullptr;
+HANDLE hFillListEvent = nullptr;
bool use_raw_ping = true;
@@ -131,7 +131,7 @@ extern "C" __declspec(dllexport) int Load(void) db_set_b(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping);
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0);
- hWakeEvent = CreateEvent(NULL, FALSE, FALSE, L"Local\\ThreadWaitEvent");
+ hWakeEvent = CreateEvent(nullptr, FALSE, FALSE, L"Local\\ThreadWaitEvent");
// create services before loading options - so we can have the 'getlogfilename' service!
CreatePluginServices();
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index 1b95e95649..554c740c61 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -37,24 +37,24 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar return TRUE;
}
- InvalidateRect(hwnd, 0, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
}
return TRUE;
case WM_SHOWWINDOW:
if (wParam == TRUE && lParam == 0) {
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (wd->hwnd_chk_grid == 0) {
- wd->hwnd_chk_grid = CreateWindow(L"BUTTON", TranslateT("Show grid lines"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, 0, hInst, 0);
+ if (wd->hwnd_chk_grid == nullptr) {
+ wd->hwnd_chk_grid = CreateWindow(L"BUTTON", TranslateT("Show grid lines"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
SendMessage(wd->hwnd_chk_grid, BM_SETCHECK, wd->show_grid ? BST_CHECKED : BST_UNCHECKED, 0);
}
- if (wd->hwnd_chk_stat == 0) {
- wd->hwnd_chk_stat = CreateWindow(L"BUTTON", TranslateT("Show stats"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, 0, hInst, 0);
+ if (wd->hwnd_chk_stat == nullptr) {
+ wd->hwnd_chk_stat = CreateWindow(L"BUTTON", TranslateT("Show stats"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
SendMessage(wd->hwnd_chk_stat, BM_SETCHECK, wd->show_stat ? BST_CHECKED : BST_UNCHECKED, 0);
}
KillTimer(hwnd, ID_REPAINT_TIMER);
#ifdef min
- SetTimer(hwnd, ID_REPAINT_TIMER, min(options.ping_period * 1000, 5000), 0);
+ SetTimer(hwnd, ID_REPAINT_TIMER, min(options.ping_period * 1000, 5000), nullptr);
#else
SetTimer(hwnd, ID_REPAINT_TIMER, std::min(options.ping_period * 1000, 5000), 0);
#endif
@@ -71,7 +71,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar else if ((HWND)lParam == wd->hwnd_chk_stat) {
wd->show_stat = (SendMessage(wd->hwnd_chk_stat, BM_GETCHECK, 0, 0) == BST_CHECKED);
}
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
return TRUE;
case WM_TIMER:
@@ -85,7 +85,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HDC hdc;
RECT r;
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (wd && (hdc = BeginPaint(hwnd, &ps)) != 0)
+ if (wd && (hdc = BeginPaint(hwnd, &ps)) != nullptr)
{
GetClientRect(hwnd, &r);
FillRect(hdc, &r, GetSysColorBrush(COLOR_WINDOW));
@@ -144,7 +144,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (time / MARK_PERIOD != last_time / MARK_PERIOD)
{ // new minute
- MoveToEx(hdc, bar.left, r.bottom, 0);
+ MoveToEx(hdc, bar.left, r.bottom, nullptr);
LineTo(hdc, bar.left, r.top);
}
@@ -160,7 +160,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // draw horizontal lines to mark every 100ms
for (int li = 0; li < graph_height; li += MARK_TIME)
{
- MoveToEx(hdc, r.left, r.bottom - (int)(li * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(li * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(li * unit_height + 0.5f));
}
}
@@ -169,13 +169,13 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (wd->show_stat)
{
SelectObject(hdc, hPen2);
- MoveToEx(hdc, r.left, r.bottom - (int)(avg * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(avg * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(avg * unit_height + 0.5f));
if (max_value != avg)
{
- MoveToEx(hdc, r.left, r.bottom - (int)(max_value * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(max_value * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(max_value * unit_height + 0.5f));
- MoveToEx(hdc, r.left, r.bottom - (int)(min_value * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(min_value * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(min_value * unit_height + 0.5f));
}
}
@@ -220,10 +220,10 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
RECT r;
GetClientRect(hwnd, &r);
- if (wd->hwnd_chk_grid != 0) SetWindowPos(wd->hwnd_chk_grid, 0, r.right - 150, r.top + 10, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
- if (wd->hwnd_chk_stat != 0) SetWindowPos(wd->hwnd_chk_stat, 0, r.right - 150, r.top + 30, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
+ if (wd->hwnd_chk_grid != nullptr) SetWindowPos(wd->hwnd_chk_grid, nullptr, r.right - 150, r.top + 10, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
+ if (wd->hwnd_chk_stat != nullptr) SetWindowPos(wd->hwnd_chk_stat, nullptr, r.right - 150, r.top + 30, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
}
- InvalidateRect(hwnd, 0, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_CLOSE:
{
@@ -269,9 +269,9 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = hIconResponding;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = _A2W(PLUG) L"GraphWindow";
RegisterClass(&wndclass);
@@ -282,15 +282,15 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { mir_wstrncat(title, (wchar_t *)lParam, _countof(title) - mir_wstrlen(title));
}
- HWND parent = 0;
+ HWND parent = nullptr;
hGraphWnd = CreateWindowEx(0, _A2W(PLUG) L"GraphWindow", title,
(WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN) & ~CS_VREDRAW & ~CS_HREDRAW,
- 0, 0, 800, 600, parent, NULL, hInst, NULL);
+ 0, 0, 800, 600, parent, nullptr, hInst, nullptr);
WindowData *wd = new WindowData;
wd->item_id = (DWORD)wParam; // wParam is destination id
- wd->hwnd_chk_grid = 0;
- wd->hwnd_chk_stat = 0;
+ wd->hwnd_chk_grid = nullptr;
+ wd->hwnd_chk_stat = nullptr;
wd->show_grid = db_get_b(0, PLUG, "ShowGridLines", 0) ? true : false;
wd->show_stat = db_get_b(0, PLUG, "ShowStats", 1) ? true : false;
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 06c5b8963e..1cc8632675 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -5,23 +5,23 @@ int upCount, total = 0; size_t list_size = 0;
HANDLE mainThread;
-HANDLE hWakeEvent = 0;
+HANDLE hWakeEvent = nullptr;
// thread protected variables
mir_cs thread_finished_cs, list_changed_cs, data_list_cs;
bool thread_finished = false, list_changed = false;
PINGLIST data_list;
-HANDLE status_update_thread = 0;
+HANDLE status_update_thread = nullptr;
-HWND hpwnd = 0, list_hwnd, hwnd_clist = 0;
+HWND hpwnd = nullptr, list_hwnd, hwnd_clist = nullptr;
int frame_id = -1;
-HBRUSH tbrush = 0;
+HBRUSH tbrush = nullptr;
FontIDW font_id;
ColourIDW bk_col_id;
-HFONT hFont = 0;
+HFONT hFont = nullptr;
COLORREF bk_col = RGB(255, 255, 255);
////////////////
@@ -138,7 +138,7 @@ void __cdecl sttCheckStatusThreadProc(void*) if (i->item_id == pa.item_id)
i->status = PS_TESTING;
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
CallService(PLUG "/Ping", 0, (LPARAM)&pa);
@@ -153,7 +153,7 @@ void __cdecl sttCheckStatusThreadProc(void*) i->responding = pa.responding;
i->round_trip_time = pa.round_trip_time;
history_entry.first = i->round_trip_time;
- history_entry.second = time(0);
+ history_entry.second = time(nullptr);
history_map[i->item_id].push_back(history_entry);
// maintain history (-1 represents no response)
while (history_map[i->item_id].size() >= MAX_HISTORY)
@@ -214,7 +214,7 @@ void __cdecl sttCheckStatusThreadProc(void*) }
}
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
}
@@ -233,7 +233,7 @@ void start_ping_thread() {
if (status_update_thread)
CloseHandle(status_update_thread);
- status_update_thread = mir_forkthread(sttCheckStatusThreadProc, 0);
+ status_update_thread = mir_forkthread(sttCheckStatusThreadProc, nullptr);
}
void stop_ping_thread()
@@ -244,7 +244,7 @@ void stop_ping_thread() WaitForSingleObject(status_update_thread, 2000);
TerminateThread(status_update_thread, 0);
CloseHandle(status_update_thread);
- status_update_thread = 0;
+ status_update_thread = nullptr;
}
bool FrameIsFloating()
@@ -280,7 +280,7 @@ int FillList(WPARAM, LPARAM) }
SendMessage(list_hwnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
SetEvent(hWakeEvent);
@@ -341,7 +341,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_DRAWITEM:
dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == list_hwnd) {
- HBRUSH ttbrush = 0;
+ HBRUSH ttbrush = nullptr;
COLORREF tcol;
if (dis->itemID != -1) {
PINGADDRESS itemData;
@@ -382,7 +382,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetBkMode(dis->hDC, TRANSPARENT);
HICON hIcon = (itemData.status != PS_DISABLED ? (itemData.status == PS_TESTING ? hIconTesting : (itemData.status == PS_RESPONDING ? hIconResponding : hIconNotResponding)) : hIconDisabled);
dis->rcItem.left += options.indent;
- DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top + ((options.row_height - 16) >> 1), hIcon, 0, 0, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top + ((options.row_height - 16) >> 1), hIcon, 0, 0, 0, nullptr, DI_NORMAL);
GetTextExtentPoint32(dis->hDC, itemData.pszLabel, (int)mir_wstrlen(itemData.pszLabel), &textSize);
TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, itemData.pszLabel, (int)mir_wstrlen(itemData.pszLabel));
@@ -423,7 +423,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar {
context_point = lParam;
context_point_valid = true;
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)),
submenu = GetSubMenu(menu, 0);
@@ -461,13 +461,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar TranslateMenu(submenu);
GetCursorPos(&pt);
- BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(menu);
if (ret)
SendMessage(hwnd, WM_COMMAND, ret, 0);
context_point_valid = false;
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
return TRUE;
@@ -480,7 +480,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar list_hwnd = CreateWindow(L"LISTBOX", L"",
//(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT| LBS_STANDARD | WS_CLIPCHILDREN | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY)
(WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY)
- & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst, 0);
+ & ~WS_BORDER, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
if (db_get_b(NULL, "CList", "Transparent", 0)) {
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
@@ -508,7 +508,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if ((HWND)wParam != hwnd)
if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT))
if (transparentFocus)
- SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
+ SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
else {
if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT)) {
@@ -528,7 +528,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
transparentFocus = 1;
- SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
+ SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -648,7 +648,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar WORD x = LOWORD(context_point), y = HIWORD(context_point);
GetWindowRect(list_hwnd, &r);
DWORD item = SendMessage(list_hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(x - r.left, y - r.top));
- PINGADDRESS *temp = 0;
+ PINGADDRESS *temp = nullptr;
if (HIWORD(item) == 0) {
int count = LOWORD(item);
{
@@ -698,7 +698,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar DWORD item_id = pItemData->item_id;
int wake = CallService(PLUG "/DblClick", (WPARAM)item_id, 0);
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
if (wake) SetEvent(hWakeEvent);
if (options.logging) {
@@ -728,10 +728,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar #else
height = std::min(winheight - winheight % itemheight, itemheight * count);
#endif
- SetWindowPos(list_hwnd, 0, rect.left, rect.top, rect.right - rect.left, height, SWP_NOZORDER);
- InvalidateRect(list_hwnd, 0, FALSE);
+ SetWindowPos(list_hwnd, nullptr, rect.left, rect.top, rect.right - rect.left, height, SWP_NOZORDER);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
return DefWindowProc(hwnd, msg, wParam, lParam);
case WM_DESTROY:
@@ -779,8 +779,8 @@ int ReloadFont(WPARAM, LPARAM) int RefreshWindow(WPARAM, LPARAM)
{
- InvalidateRect(list_hwnd, 0, TRUE);
- InvalidateRect(hpwnd, 0, TRUE);
+ InvalidateRect(list_hwnd, nullptr, TRUE);
+ InvalidateRect(hpwnd, nullptr, TRUE);
return 0;
}
@@ -802,7 +802,7 @@ void UpdateFrame() height += (r_frame.bottom - r_frame.top) - (r_frame_client.bottom - r_frame_client.top);
}
- SetWindowPos(hpwnd, 0, r_clist.left, r_clist.top - height, (r_clist.right - r_clist.left), height, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hpwnd, nullptr, r_clist.left, r_clist.top - height, (r_clist.right - r_clist.left), height, SWP_NOZORDER | SWP_NOACTIVATE);
}
// Subclass procedure
@@ -816,7 +816,7 @@ LRESULT APIENTRY ClistSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l || GetWindowLongPtr(hwnd_clist, GWL_STYLE) != GetWindowLongPtr(hpwnd, GWL_STYLE)) {
SetWindowLongPtr(hpwnd, GWL_STYLE, GetWindowLongPtr(hwnd_clist, GWL_STYLE));
SetWindowLongPtr(hpwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd_clist, GWL_EXSTYLE));
- SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+ SetWindowPos(hpwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
}
}
@@ -833,7 +833,7 @@ void AttachToClist(bool attach) if (attach) {
SetWindowLongPtr(hpwnd, GWL_STYLE, GetWindowLongPtr(hwnd_clist, GWL_STYLE));
SetWindowLongPtr(hpwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd_clist, GWL_EXSTYLE));
- SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+ SetWindowPos(hpwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
// subclass clist to trap move/size
mir_subclassWindow(hwnd_clist, ClistSubclassProc);
@@ -842,7 +842,7 @@ void AttachToClist(bool attach) else {
SetWindowLongPtr(hpwnd, GWL_STYLE, (WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE | WS_CLIPCHILDREN));
SetWindowLongPtr(hpwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
- SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+ SetWindowPos(hpwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
}
}
@@ -858,14 +858,14 @@ void InitList() wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = hIconResponding;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = _A2W(PLUG) L"WindowClass";
RegisterClass(&wndclass);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- hpwnd = CreateWindow(_A2W(PLUG) L"WindowClass", L"Ping", (WS_BORDER | WS_CHILD | WS_CLIPCHILDREN), 0, 0, 0, 0, hwnd_clist, NULL, hInst, NULL);
+ hpwnd = CreateWindow(_A2W(PLUG) L"WindowClass", L"Ping", (WS_BORDER | WS_CHILD | WS_CLIPCHILDREN), 0, 0, 0, 0, hwnd_clist, nullptr, hInst, nullptr);
CLISTFrame frame = { 0 };
frame.name = PLUG;
@@ -881,7 +881,7 @@ void InitList() else {
hpwnd = CreateWindowEx(WS_EX_TOOLWINDOW, _A2W(PLUG) L"WindowClass", L"Ping",
(WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_CLIPCHILDREN),
- 0, 0, 400, 300, hwnd_clist, NULL, hInst, NULL);
+ 0, 0, 400, 300, hwnd_clist, nullptr, hInst, nullptr);
Utils_RestoreWindowPosition(hpwnd, 0, PLUG, "main_window");
diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp index bc7de84224..c5b2c0c2e8 100644 --- a/plugins/Ping/src/rawping.cpp +++ b/plugins/Ping/src/rawping.cpp @@ -87,7 +87,7 @@ extern int raw_ping(char *host, int timeout) else {
// Not in dotted quad form, so try and look it up
hostent* hp = gethostbyname(host);
- if (hp != 0) {
+ if (hp != nullptr) {
// Found an address for that host, so save it
memcpy(&(dest.sin_addr), hp->h_addr, hp->h_length);
//dest.sin_family = hp->h_addrtype;
@@ -198,7 +198,7 @@ extern int raw_ping(char *host, int timeout) if (reply->type == PT_ICMP_SOURCE_QUENCH) {
char buff[1024];
mir_snprintf(buff, Translate("Host %s requests that you reduce the amount of traffic you are sending."), host);
- MessageBoxA(0, buff, Translate(PLUG " Warning"), MB_OK | MB_ICONWARNING);
+ MessageBoxA(nullptr, buff, Translate(PLUG " Warning"), MB_OK | MB_ICONWARNING);
}
if (use_hi_res) {
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 8bdaa385a2..cf900a3ffa 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -46,12 +46,12 @@ void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags) ppd->iSeconds = 10;
ppd->PluginWindowProc = NullWindowProc;
- ppd->PluginData = NULL;
+ ppd->PluginData = nullptr;
QueueUserAPC(sttMainThreadCallback, mainThread, (ULONG_PTR)ppd);
}
else{
- MessageBox(NULL, line2, _A2W(PLUG) L" Message", MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, line2, _A2W(PLUG) L" Message", MB_OK | MB_ICONINFORMATION);
return;
}
}
@@ -206,7 +206,7 @@ INT_PTR DblClick(WPARAM wParam, LPARAM) { for (pinglist_it i = pl.begin(); i != pl.end(); ++i) {
if (i->item_id == (DWORD)wParam) {
if (mir_wstrlen(i->pszCommand)) {
- ShellExecute(0, L"open", i->pszCommand, i->pszParams, 0, SW_SHOW);
+ ShellExecute(nullptr, L"open", i->pszCommand, i->pszParams, nullptr, SW_SHOW);
}
else {
return CallService(PLUG "/ToggleEnabled", wParam, 0);
diff --git a/plugins/PluginUpdater/pu_stub/pu_stub.cpp b/plugins/PluginUpdater/pu_stub/pu_stub.cpp index e7d346533d..2a42d51c4c 100644 --- a/plugins/PluginUpdater/pu_stub/pu_stub.cpp +++ b/plugins/PluginUpdater/pu_stub/pu_stub.cpp @@ -38,19 +38,19 @@ int CreateDirectoryTreeW(const WCHAR* szDir) return 0;
WCHAR *pszLastBackslash = wcsrchr(szTestDir, '\\');
- if (pszLastBackslash == NULL)
+ if (pszLastBackslash == nullptr)
return 0;
*pszLastBackslash = '\0';
CreateDirectoryTreeW(szTestDir);
*pszLastBackslash = '\\';
- return (CreateDirectoryW(szTestDir, NULL) == 0) ? GetLastError() : 0;
+ return (CreateDirectoryW(szTestDir, nullptr) == 0) ? GetLastError() : 0;
}
void CreatePathToFileW(WCHAR* wszFilePath)
{
WCHAR* pszLastBackslash = wcsrchr(wszFilePath, '\\');
- if (pszLastBackslash == NULL)
+ if (pszLastBackslash == nullptr)
return;
*pszLastBackslash = '\0';
@@ -70,7 +70,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int) swprintf_s(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%s", lpCmdLine);
#endif
log(L"Opening pipe %s...", tszPipeName);
- HANDLE hPipe = CreateFile(tszPipeName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hPipe = CreateFile(tszPipeName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hPipe == INVALID_HANDLE_VALUE) {
dwError = GetLastError();
log(L"Failed to open a pipe: error %d", dwError);
@@ -81,7 +81,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int) BYTE szReadBuffer[1024] = { 0 };
DWORD dwBytes;
- while (ReadFile(hPipe, szReadBuffer, sizeof(szReadBuffer), &dwBytes, NULL)) {
+ while (ReadFile(hPipe, szReadBuffer, sizeof(szReadBuffer), &dwBytes, nullptr)) {
DWORD dwAction = *(DWORD*)szReadBuffer;
wchar_t *ptszFile1 = (wchar_t*)(szReadBuffer + sizeof(DWORD));
wchar_t *ptszFile2 = ptszFile1 + wcslen(ptszFile1) + 1;
@@ -117,7 +117,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int) dwError = ERROR_UNKNOWN_FEATURE;
}
- WriteFile(hPipe, &dwError, sizeof(DWORD), &dwBytes, NULL);
+ WriteFile(hPipe, &dwError, sizeof(DWORD), &dwBytes, nullptr);
}
dwError = GetLastError();
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 5ac1a40eb1..12c4853002 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -63,7 +63,7 @@ static void ApplyDownloads(void *param) VARSW tszMirandaPath(L"%miranda_path%");
- HNETLIBCONN nlc = NULL;
+ HNETLIBCONN nlc = nullptr;
for (int i=0; i < todo.getCount(); ++i) {
ListView_EnsureVisible(hwndList, i, FALSE);
if (todo[i].bEnabled) {
@@ -88,14 +88,14 @@ static void ApplyDownloads(void *param) int rc = MessageBox(hDlg, TranslateT("Download complete. Do you want to go to plugins option page?"), TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION);
if (rc == IDYES)
- CallFunctionAsync(OpenPluginOptions, 0);
+ CallFunctionAsync(OpenPluginOptions, nullptr);
PostMessage(hDlg, WM_CLOSE, 0, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
-static WNDPROC oldWndProc = NULL;
+static WNDPROC oldWndProc = nullptr;
static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -164,12 +164,12 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) OSVERSIONINFO osver = { sizeof(osver) };
if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6) {
wchar_t szPath[MAX_PATH];
- GetModuleFileName(NULL, szPath, _countof(szPath));
+ GetModuleFileName(nullptr, szPath, _countof(szPath));
wchar_t *ext = wcsrchr(szPath, '.');
- if (ext != NULL)
+ if (ext != nullptr)
*ext = '\0';
wcscat(szPath, L".test");
- HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
// Running Windows Vista or later (major version >= 6).
Button_SetElevationRequiredState(GetDlgItem(hDlg, IDOK), !IsProcessElevated());
@@ -229,8 +229,8 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) lvi.mask = LVIF_PARAM | LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE;
int groupId = 4;
- if (wcschr(todo[i].tszOldName, L'\\') != NULL)
- groupId = (wcsstr(todo[i].tszOldName, L"Plugins") != NULL) ? 1 : ((wcsstr(todo[i].tszOldName, L"Languages") != NULL) ? 3 : 2);
+ if (wcschr(todo[i].tszOldName, L'\\') != nullptr)
+ groupId = (wcsstr(todo[i].tszOldName, L"Plugins") != nullptr) ? 1 : ((wcsstr(todo[i].tszOldName, L"Languages") != nullptr) ? 3 : 2);
lvi.iItem = i;
lvi.lParam = (LPARAM)&todo[i];
@@ -330,7 +330,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_DESTROY:
Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ListWindow");
Window_FreeIcon_IcoLib(hDlg);
- hwndDialog = NULL;
+ hwndDialog = nullptr;
delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
break;
@@ -364,7 +364,7 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t* mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
- for (tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = wcschr(tp, '\\'))
+ for (tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != nullptr; tp = wcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
// Load list of checked Plugins from database
@@ -388,7 +388,7 @@ static void GetList(void *) ptrW updateUrl( GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
- hListThread = NULL;
+ hListThread = nullptr;
return;
}
@@ -414,7 +414,7 @@ static void GetList(void *) }
else CallFunctionAsync(LaunchListDialog, UpdateFiles);
- hListThread = NULL;
+ hListThread = nullptr;
}
static void DoGetList()
@@ -427,12 +427,12 @@ static void DoGetList() SetFocus(hwndDialog);
}
else
- hListThread = mir_forkthread(GetList, 0);
+ hListThread = mir_forkthread(GetList, nullptr);
}
void UninitListNew()
{
- if (hwndDialog != NULL)
+ if (hwndDialog != nullptr)
DestroyWindow(hwndDialog);
}
@@ -445,20 +445,20 @@ static INT_PTR ShowListCommand(WPARAM,LPARAM) void UnloadListNew()
{
if (hListThread)
- hListThread = NULL;
+ hListThread = nullptr;
}
static INT_PTR ParseUriService(WPARAM, LPARAM lParam)
{
wchar_t *arg = (wchar_t *)lParam;
- if (arg == NULL)
+ if (arg == nullptr)
return 1;
wchar_t uri[1024];
wcsncpy_s(uri, arg, _TRUNCATE);
wchar_t *p = wcschr(uri, ':');
- if (p == NULL)
+ if (p == nullptr)
return 1;
wchar_t pluginPath[MAX_PATH];
@@ -472,12 +472,12 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam) ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
- hListThread = NULL;
+ hListThread = nullptr;
return 1;
}
ServListEntry *hash = hashes.find((ServListEntry*)&pluginPath);
- if (hash == NULL)
+ if (hash == nullptr)
return 0;
VARSW dirName(L"%miranda_path%");
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 71f7a3c1e7..d228d9a239 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -67,7 +67,7 @@ static void ApplyUpdates(void *param) SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
- HNETLIBCONN nlc = NULL;
+ HNETLIBCONN nlc = nullptr;
for (int i=0; i < todo.getCount(); i++) {
ListView_EnsureVisible(hwndList, i, FALSE);
if (!todo[i].bEnabled) {
@@ -139,7 +139,7 @@ static void ApplyUpdates(void *param) if (opts.bChangePlatform) {
wchar_t mirandaPath[MAX_PATH];
- GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
+ GetModuleFileName(nullptr, mirandaPath, _countof(mirandaPath));
db_set_ws(NULL, MODNAME, "OldBin2", mirandaPath);
db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
@@ -186,7 +186,7 @@ static void ResizeVert(HWND hDlg, int yy) RECT r = { 0, 0, 244, yy };
MapDialogRect(hDlg, &r);
r.bottom += GetSystemMetrics(SM_CYSMCAPTION);
- SetWindowPos(hDlg, 0, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER);
+ SetWindowPos(hDlg, nullptr, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER);
}
static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -208,12 +208,12 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6)
{
wchar_t szPath[MAX_PATH];
- GetModuleFileName(NULL, szPath, _countof(szPath));
+ GetModuleFileName(nullptr, szPath, _countof(szPath));
wchar_t *ext = wcsrchr(szPath, '.');
- if (ext != NULL)
+ if (ext != nullptr)
*ext = '\0';
wcscat(szPath, L".test");
- HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
// Running Windows Vista or later (major version >= 6).
Button_SetElevationRequiredState(GetDlgItem(hDlg, IDOK), !IsProcessElevated());
@@ -270,9 +270,9 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM for (int i = 0; i < todo.getCount(); ++i) {
LVITEM lvI = {0};
lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_GROUPID | LVIF_NORECOMPUTE;
- lvI.iGroupId = (wcsstr(todo[i].tszOldName, L"Plugins") != NULL) ? 1 :
- ((wcsstr(todo[i].tszOldName, L"Languages") != NULL) ? 3 :
- ((wcsstr(todo[i].tszOldName, L"Icons") != NULL) ? 4 : 2));
+ lvI.iGroupId = (wcsstr(todo[i].tszOldName, L"Plugins") != nullptr) ? 1 :
+ ((wcsstr(todo[i].tszOldName, L"Languages") != nullptr) ? 3 :
+ ((wcsstr(todo[i].tszOldName, L"Icons") != nullptr) ? 4 : 2));
lvI.iSubItem = 0;
lvI.lParam = (LPARAM)&todo[i];
lvI.pszText = todo[i].tszOldName;
@@ -381,13 +381,13 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM case WM_DESTROY:
Window_FreeIcon_IcoLib(hDlg);
Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
- hwndDialog = NULL;
+ hwndDialog = nullptr;
delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
#if MIRANDA_VER >= 0x0A00
- db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(NULL));
+ db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(nullptr));
#endif
- mir_forkthread(InitTimer, 0);
+ mir_forkthread(InitTimer, nullptr);
break;
}
@@ -421,7 +421,7 @@ static void DlgUpdateSilent(void *param) SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
- HNETLIBCONN nlc = NULL;
+ HNETLIBCONN nlc = nullptr;
// Count all updates that have been enabled
int count = 0;
for (int i = 0; i < UpdateFiles.getCount(); i++) {
@@ -505,7 +505,7 @@ static void DlgUpdateSilent(void *param) wchar_t tszText[200];
mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
- if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
+ if (MessageBox(nullptr, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
#if MIRANDA_VER >= 0x0A00
CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
#else
@@ -563,12 +563,12 @@ static renameTable[] = #if MIRANDA_VER >= 0x0A00
{ L"dbx_mmap_sa.dll", L"Plugins\\dbx_mmap.dll" },
{ L"dbx_tree.dll", L"Plugins\\dbx_mmap.dll" },
- { L"rc4.dll", NULL },
- { L"athena.dll", NULL },
- { L"skypekit.exe", NULL },
- { L"mir_app.dll", NULL },
- { L"mir_core.dll", NULL },
- { L"zlib.dll", NULL },
+ { L"rc4.dll", nullptr },
+ { L"athena.dll", nullptr },
+ { L"skypekit.exe", nullptr },
+ { L"mir_app.dll", nullptr },
+ { L"mir_core.dll", nullptr },
+ { L"zlib.dll", nullptr },
#endif
{ L"proto_newsaggr.dll", L"Icons\\proto_newsaggregator.dll" },
@@ -577,26 +577,26 @@ static renameTable[] = { L"langpack_*.txt", L"Languages\\*" },
- { L"pcre16.dll", NULL },
- { L"clist_classic.dll", NULL },
- { L"chat.dll", NULL },
- { L"srmm.dll", NULL },
- { L"stdchat.dll", NULL },
- { L"stdurl.dll", NULL },
- { L"extraicons.dll", NULL },
- { L"firstrun.dll", NULL },
- { L"flashavatars.dll", NULL },
- { L"gender.dll", NULL },
- { L"gtalkext.dll", NULL },
- { L"langman.dll", NULL },
- { L"metacontacts.dll", NULL },
- { L"modernopt.dll", NULL },
- { L"msvcp100.dll", NULL },
- { L"msvcr100.dll", NULL },
- { L"xfire.dll", NULL },
- { L"yahoo.dll", NULL },
- { L"yahoogroups.dll", NULL },
- { L"WART-*.exe", NULL },
+ { L"pcre16.dll", nullptr },
+ { L"clist_classic.dll", nullptr },
+ { L"chat.dll", nullptr },
+ { L"srmm.dll", nullptr },
+ { L"stdchat.dll", nullptr },
+ { L"stdurl.dll", nullptr },
+ { L"extraicons.dll", nullptr },
+ { L"firstrun.dll", nullptr },
+ { L"flashavatars.dll", nullptr },
+ { L"gender.dll", nullptr },
+ { L"gtalkext.dll", nullptr },
+ { L"langman.dll", nullptr },
+ { L"metacontacts.dll", nullptr },
+ { L"modernopt.dll", nullptr },
+ { L"msvcp100.dll", nullptr },
+ { L"msvcr100.dll", nullptr },
+ { L"xfire.dll", nullptr },
+ { L"yahoo.dll", nullptr },
+ { L"yahoogroups.dll", nullptr },
+ { L"WART-*.exe", nullptr },
};
// Checks if file needs to be renamed and copies it in pNewName
@@ -606,7 +606,7 @@ static bool CheckFileRename(const wchar_t *ptszOldName, wchar_t *pNewName) for (int i = 0; i < _countof(renameTable); i++) {
if (wildcmpiw(ptszOldName, renameTable[i].oldName)) {
wchar_t *ptszDest = renameTable[i].newName;
- if (ptszDest == NULL)
+ if (ptszDest == nullptr)
*pNewName = 0;
else {
wcsncpy_s(pNewName, MAX_PATH, ptszDest, _TRUNCATE);
@@ -627,7 +627,7 @@ static bool isValidExtension(const wchar_t *ptszFileName) {
const wchar_t *pExt = wcsrchr(ptszFileName, '.');
- return (pExt != NULL) && (!_wcsicmp(pExt, L".dll") || !_wcsicmp(pExt, L".exe") || !_wcsicmp(pExt, L".txt"));
+ return (pExt != nullptr) && (!_wcsicmp(pExt, L".dll") || !_wcsicmp(pExt, L".exe") || !_wcsicmp(pExt, L".txt"));
}
// We only scan subfolders "Plugins", "Icons", "Languages", "Libs", "Core"
@@ -687,7 +687,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t wchar_t *pName = tszNewName;
ServListEntry *item = hashes.find((ServListEntry*)&pName);
// Not in list? Check for trailing 'W' or 'w'
- if (item == NULL) {
+ if (item == nullptr) {
wchar_t *p = wcsrchr(tszNewName, '.');
if (p[-1] != 'w' && p[-1] != 'W') {
Netlib_LogfW(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
@@ -697,7 +697,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t // remove trailing w or W and try again
int iPos = int(p - tszNewName) - 1;
strdelw(p - 1, 1);
- if ((item = hashes.find((ServListEntry*)&pName)) == NULL) {
+ if ((item = hashes.find((ServListEntry*)&pName)) == nullptr) {
Netlib_LogfW(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
continue;
}
@@ -761,7 +761,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, p);
mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszBuf);
- for (p = wcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = wcschr(p, '\\'))
+ for (p = wcschr(FileInfo->File.tszDownloadURL, '\\'); p != nullptr; p = wcschr(p, '\\'))
*p++ = '/';
// remember whether the user has decided not to update this component with this particular new version
@@ -812,10 +812,10 @@ static void CheckUpdates(void *) else CallFunctionAsync(LaunchDialog, UpdateFiles);
}
- mir_forkthread(InitTimer, (success ? 0 : (void*)2));
+ mir_forkthread(InitTimer, (success ? nullptr : (void*)2));
hashes.destroy();
- hCheckThread = NULL;
+ hCheckThread = nullptr;
}
static void DoCheck(bool bSilent = true)
@@ -830,9 +830,9 @@ static void DoCheck(bool bSilent = true) else {
opts.bSilent = bSilent;
#if MIRANDA_VER >= 0x0A00
- db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(NULL));
+ db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(nullptr));
#endif
- hCheckThread = mir_forkthread(CheckUpdates, 0);
+ hCheckThread = mir_forkthread(CheckUpdates, nullptr);
}
}
@@ -840,7 +840,7 @@ void UninitCheck() {
CancelWaitableTimer(hTimer);
CloseHandle(hTimer);
- if (hwndDialog != NULL)
+ if (hwndDialog != nullptr)
DestroyWindow(hwndDialog);
}
@@ -860,14 +860,14 @@ void InitCheck() void UnloadCheck()
{
if (hCheckThread)
- hCheckThread = NULL;
+ hCheckThread = nullptr;
}
void CheckUpdateOnStartup()
{
if (opts.bUpdateOnStartup) {
if (opts.bOnlyOnceADay) {
- time_t now = time(NULL),
+ time_t now = time(nullptr),
was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
if ((now - was) < 86400)
@@ -914,7 +914,7 @@ void InitTimer(void *type) switch ((INT_PTR)type) {
case 0: // default, plan next check relative to last check
{
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
@@ -939,13 +939,13 @@ void InitTimer(void *type) li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
li.QuadPart += interval * 10000LL;
- SetWaitableTimer(hTimer, &li, 0, TimerAPCProc, NULL, 0);
+ SetWaitableTimer(hTimer, &li, 0, TimerAPCProc, nullptr, 0);
// Wait in an alertable state for the timer to go off.
SleepEx(INFINITE, TRUE);
}
void CreateTimer() {
- hTimer = CreateWaitableTimer(NULL, FALSE, NULL);
- mir_forkthread(InitTimer, 0);
+ hTimer = CreateWaitableTimer(nullptr, FALSE, nullptr);
+ mir_forkthread(InitTimer, nullptr);
}
\ No newline at end of file diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index f048d10a5a..fa215c6a3b 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -33,13 +33,13 @@ int OnFoldersChanged(WPARAM, LPARAM) void EmptyFolder()
{
SHFILEOPSTRUCT file_op = {
- NULL,
+ nullptr,
FO_DELETE,
g_tszRoot,
L"",
FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION,
false,
- 0,
+ nullptr,
L"" };
SHFileOperation(&file_op);
}
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 819cf521e3..c8057276b7 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -73,7 +73,7 @@ static void _stdcall RestartPrompt(void *) wchar_t tszText[200];
mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
- if (MessageBox(0, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
+ if (MessageBox(nullptr, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
}
@@ -85,7 +85,7 @@ static LRESULT CALLBACK PopupDlgProcRestart(HWND hPopup, UINT uMsg, WPARAM wPara break;
case WM_COMMAND:
PUDeletePopup(hPopup);
- CallFunctionAsync(RestartPrompt, 0);
+ CallFunctionAsync(RestartPrompt, nullptr);
break;
}
@@ -141,5 +141,5 @@ void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number) }
if (Number == POPUP_TYPE_ERROR)
- MessageBox(0, ptszText, ptszTitle, MB_ICONINFORMATION);
+ MessageBox(nullptr, ptszText, ptszTitle, MB_ICONINFORMATION);
}
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 536e018471..8d5d4d2830 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -45,7 +45,7 @@ static int GetUpdateMode() // Missing or unknown mode, determine correct from version of running core
char coreVersion[512];
Miranda_GetVersionText(coreVersion, _countof(coreVersion));
- UpdateMode = (strstr(coreVersion, "alpha") == NULL) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
+ UpdateMode = (strstr(coreVersion, "alpha") == nullptr) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
}
return UpdateMode;
@@ -479,7 +479,7 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM //Colors
db_set_b(NULL, MODNAME, "DefColors", PopupOptions.DefColors);
//Timeout
- PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE);
+ PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
db_set_dw(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
//Left mouse click
db_set_b(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index fdc39c3695..863a93ac7b 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
wchar_t g_tszRoot[MAX_PATH] = {0}, g_tszTempPath[MAX_PATH];
int hLangpack;
DWORD g_mirandaVersion;
diff --git a/plugins/PluginUpdater/src/Services.cpp b/plugins/PluginUpdater/src/Services.cpp index 698fac6021..ab8c744c9f 100644 --- a/plugins/PluginUpdater/src/Services.cpp +++ b/plugins/PluginUpdater/src/Services.cpp @@ -23,7 +23,7 @@ static INT_PTR srvParseHashes(WPARAM wParam, LPARAM lParam) {
LPCTSTR ptszUrl = (LPCTSTR)wParam;
LPTSTR ptszBaseUrl = (LPTSTR)lParam;
- if (ptszUrl == NULL || ptszBaseUrl == NULL)
+ if (ptszUrl == nullptr || ptszBaseUrl == nullptr)
return NULL;
SERVLIST *pList = new SERVLIST(50, CompareHashes);
@@ -48,13 +48,13 @@ static INT_PTR srvFreeHashes(WPARAM, LPARAM lParam) static INT_PTR srvGetHashCount(WPARAM, LPARAM lParam)
{
SERVLIST *pList = (SERVLIST*)lParam;
- return (pList == NULL) ? 0 : pList->getCount();
+ return (pList == nullptr) ? 0 : pList->getCount();
}
static INT_PTR srvGetNthHash(WPARAM wParam, LPARAM lParam)
{
SERVLIST *pList = (SERVLIST*)lParam;
- return (pList == NULL) ? 0 : INT_PTR(&(*pList)[wParam]);
+ return (pList == nullptr) ? 0 : INT_PTR(&(*pList)[wParam]);
}
void InitServices()
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index ba52be0285..aea147a0f1 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -19,8 +19,8 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HNETLIBUSER hNetlibUser = NULL;
-HANDLE hPipe = NULL;
+HNETLIBUSER hNetlibUser = nullptr;
+HANDLE hPipe = nullptr;
/////////////////////////////////////////////////////////////////////////////////////
void LoadOptions()
@@ -72,7 +72,7 @@ void InitNetlib() void UnloadNetlib()
{
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
}
ULONG crc32_table[256];
@@ -143,7 +143,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) #else
vars[0].value.w = L"32";
#endif
- vars[1].key.w = vars[1].value.w = 0;
+ vars[1].key.w = vars[1].value.w = nullptr;
#else
vars[0].lptzKey = L"platform";
#ifdef _WIN64
@@ -172,7 +172,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) return false;
}
- if(!unzip(pFileUrl.tszDiskPath, g_tszTempPath, NULL,true)) {
+ if(!unzip(pFileUrl.tszDiskPath, g_tszTempPath, nullptr,true)) {
Netlib_LogfW(hNetlibUser,L"Unzipping list of available updates from %s failed",baseUrl);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
Skin_PlaySound("updatefailed");
@@ -192,7 +192,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) bool bDoNotSwitchToStable = false;
char str[200];
- while(fgets(str, _countof(str), fp) != NULL) {
+ while(fgets(str, _countof(str), fp) != nullptr) {
rtrim(str);
// Do not allow the user to switch back to stable
if (!strcmp(str, "DoNotSwitchToStable")) {
@@ -201,13 +201,13 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) else if (str[0] != ';') { // ';' marks a comment
Netlib_Logf(hNetlibUser, "Update: %s", str);
char *p = strchr(str, ' ');
- if (p != NULL) {
+ if (p != nullptr) {
*p++ = 0;
_strlwr(p);
int dwCrc32;
char *p1 = strchr(p, ' ');
- if (p1 == NULL)
+ if (p1 == nullptr)
dwCrc32 = 0;
else {
*p1++ = 0;
@@ -280,21 +280,21 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) }
}
- HANDLE hFile = CreateFile(pFileURL->tszDiskPath, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(pFileURL->tszDiskPath, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwBytes;
// write the downloaded file directly
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
CloseHandle(hFile);
}
else {
// try to write it via PU stub
wchar_t tszTempFile[MAX_PATH];
mir_snwprintf(tszTempFile, L"%s\\pulocal.tmp", g_tszTempPath);
- hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwBytes;
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
CloseHandle(hFile);
SafeMoveFile(tszTempFile, pFileURL->tszDiskPath);
}
@@ -307,7 +307,7 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) }
else {
Netlib_LogfW(hNetlibUser,L"Downloading file %s failed, host is propably temporary down.",pFileURL->tszDownloadURL);
- nlc = NULL;
+ nlc = nullptr;
}
}
if(!ret)
@@ -322,7 +322,7 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) void __stdcall OpenPluginOptions(void*)
{
#if MIRANDA_VER >= 0x0A00
- Options_Open(NULL, L"Plugins");
+ Options_Open(nullptr, L"Plugins");
#endif
}
@@ -357,7 +357,7 @@ BOOL IsRunAsAdmin() {
BOOL fIsRunAsAdmin = FALSE;
DWORD dwError = ERROR_SUCCESS;
- PSID pAdministratorsGroup = NULL;
+ PSID pAdministratorsGroup = nullptr;
// Allocate and initialize a SID of the administrators group.
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
@@ -375,7 +375,7 @@ BOOL IsRunAsAdmin() // Determine whether the SID of administrators group is bEnabled in
// the primary access token of the process.
- if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))
+ if (!CheckTokenMembership(nullptr, pAdministratorsGroup, &fIsRunAsAdmin))
{
dwError = GetLastError();
goto Cleanup;
@@ -386,7 +386,7 @@ Cleanup: if (pAdministratorsGroup)
{
FreeSid(pAdministratorsGroup);
- pAdministratorsGroup = NULL;
+ pAdministratorsGroup = nullptr;
}
// Throw the error if something failed in the function.
@@ -442,7 +442,7 @@ BOOL IsProcessElevated() {
BOOL fIsElevated = FALSE;
DWORD dwError = ERROR_SUCCESS;
- HANDLE hToken = NULL;
+ HANDLE hToken = nullptr;
// Open the primary access token of the process with TOKEN_QUERY.
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
@@ -471,7 +471,7 @@ Cleanup: if (hToken)
{
CloseHandle(hToken);
- hToken = NULL;
+ hToken = nullptr;
}
// Throw the error if something failed in the function.
@@ -487,12 +487,12 @@ bool PrepareEscalation() {
// First try to create a file near Miranda32.exe
wchar_t szPath[MAX_PATH];
- GetModuleFileName(NULL, szPath, _countof(szPath));
+ GetModuleFileName(nullptr, szPath, _countof(szPath));
wchar_t *ext = wcsrchr(szPath, '.');
- if (ext != NULL)
+ if (ext != nullptr)
*ext = '\0';
wcscat(szPath, L".test");
- HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
// we are admins or UAC is disable, cool
CloseHandle(hFile);
@@ -507,14 +507,14 @@ bool PrepareEscalation() // Elevate the process. Create a pipe for a stub first
wchar_t tszPipeName[MAX_PATH];
mir_snwprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%d", GetCurrentProcessId());
- hPipe = CreateNamedPipe(tszPipeName, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);
+ hPipe = CreateNamedPipe(tszPipeName, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, nullptr);
if (hPipe == INVALID_HANDLE_VALUE) {
- hPipe = NULL;
+ hPipe = nullptr;
}
else {
wchar_t cmdLine[100], *p;
- GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
- if ((p = wcsrchr(szPath, '\\')) != 0)
+ GetModuleFileName(nullptr, szPath, ARRAYSIZE(szPath));
+ if ((p = wcsrchr(szPath, '\\')) != nullptr)
wcscpy(p+1, L"pu_stub.exe");
mir_snwprintf(cmdLine, L"%d", GetCurrentProcessId());
@@ -523,11 +523,11 @@ bool PrepareEscalation() sei.lpVerb = L"runas";
sei.lpFile = szPath;
sei.lpParameters = cmdLine;
- sei.hwnd = NULL;
+ sei.hwnd = nullptr;
sei.nShow = SW_NORMAL;
if (ShellExecuteEx(&sei)) {
- if (hPipe != NULL)
- ConnectNamedPipe(hPipe, NULL);
+ if (hPipe != nullptr)
+ ConnectNamedPipe(hPipe, nullptr);
return true;
}
@@ -562,11 +562,11 @@ int TransactPipe(int opcode, const wchar_t *p1, const wchar_t *p2) else *dst++ = 0;
DWORD dwBytes = 0, dwError;
- if ( WriteFile(hPipe, buf, (DWORD)((BYTE*)dst - buf), &dwBytes, NULL) == 0)
+ if ( WriteFile(hPipe, buf, (DWORD)((BYTE*)dst - buf), &dwBytes, nullptr) == 0)
return 0;
dwError = 0;
- if ( ReadFile(hPipe, &dwError, sizeof(DWORD), &dwBytes, NULL) == 0) return 0;
+ if ( ReadFile(hPipe, &dwError, sizeof(DWORD), &dwBytes, nullptr) == 0) return 0;
if (dwBytes != sizeof(DWORD)) return 0;
return dwError == ERROR_SUCCESS;
@@ -574,7 +574,7 @@ int TransactPipe(int opcode, const wchar_t *p1, const wchar_t *p2) int SafeCopyFile(const wchar_t *pSrc, const wchar_t *pDst)
{
- if (hPipe == NULL)
+ if (hPipe == nullptr)
return CopyFile(pSrc, pDst, FALSE);
return TransactPipe(1, pSrc, pDst);
@@ -582,7 +582,7 @@ int SafeCopyFile(const wchar_t *pSrc, const wchar_t *pDst) int SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst)
{
- if (hPipe == NULL) {
+ if (hPipe == nullptr) {
DeleteFile(pDst);
if ( MoveFile(pSrc, pDst) == 0) // use copy on error
CopyFile(pSrc, pDst, FALSE);
@@ -594,28 +594,28 @@ int SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst) int SafeDeleteFile(const wchar_t *pFile)
{
- if (hPipe == NULL)
+ if (hPipe == nullptr)
return DeleteFile(pFile);
- return TransactPipe(3, pFile, NULL);
+ return TransactPipe(3, pFile, nullptr);
}
int SafeCreateDirectory(const wchar_t *pFolder)
{
- if (hPipe == NULL)
+ if (hPipe == nullptr)
return CreateDirectoryTreeW(pFolder);
- return TransactPipe(4, pFolder, NULL);
+ return TransactPipe(4, pFolder, nullptr);
}
int SafeCreateFilePath(wchar_t *pFolder)
{
- if (hPipe == NULL) {
+ if (hPipe == nullptr) {
CreatePathToFileW(pFolder);
return 0;
}
- return TransactPipe(5, pFolder, NULL);
+ return TransactPipe(5, pFolder, nullptr);
}
void BackupFile(wchar_t *ptszSrcFileName, wchar_t *ptszBackFileName)
diff --git a/plugins/PluginUpdater/src/checksum.cpp b/plugins/PluginUpdater/src/checksum.cpp index 67f2493611..889696c4b0 100644 --- a/plugins/PluginUpdater/src/checksum.cpp +++ b/plugins/PluginUpdater/src/checksum.cpp @@ -25,12 +25,12 @@ struct MFileMapping MFileMapping(const wchar_t* ptszFileName)
{
- ptr = NULL;
- hMap = NULL;
+ ptr = nullptr;
+ hMap = nullptr;
- hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE)
- hMap = CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 0, NULL);
+ hMap = CreateFileMapping(hFile, nullptr, PAGE_WRITECOPY, 0, 0, nullptr);
if (hMap)
ptr = (PBYTE)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0, 0);
}
@@ -79,7 +79,7 @@ int CalculateModuleHash(const wchar_t *filename, char *szDest) if (map.hFile == INVALID_HANDLE_VALUE)
return RESULT_NOTFOUND;
- if (map.ptr == NULL)
+ if (map.ptr == nullptr)
return RESULT_READERROR;
// check minimum and maximum size
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 7698e056a0..95aa1bf009 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -44,7 +44,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath unz_file_info64 file_info;
char filename[MAX_PATH], buf[8192];
- int err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, sizeof(buf), NULL, 0);
+ int err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, sizeof(buf), nullptr, 0);
if (err != UNZ_OK)
return false;
@@ -58,7 +58,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath wchar_t tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
wchar_t *ptszNewName = mir_utf8decodeW(filename);
- if (ptszNewName == NULL)
+ if (ptszNewName == nullptr)
ptszNewName = mir_a2u(filename);
if (!(file_info.external_fa & FILE_ATTRIBUTE_DIRECTORY)) {
@@ -68,7 +68,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath return false;
}
- if (ptszBackPath != NULL) {
+ if (ptszBackPath != nullptr) {
PrepareFileName(tszDestFile, _countof(tszDestFile), ptszDestPath, ptszNewName);
PrepareFileName(tszBackFile, _countof(tszBackFile), ptszBackPath, ptszNewName);
BackupFile(tszDestFile, tszBackFile);
@@ -78,7 +78,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath SafeCreateFilePath(tszDestFile);
wchar_t *ptszFile2unzip;
- if (hPipe == NULL) // direct mode
+ if (hPipe == nullptr) // direct mode
ptszFile2unzip = tszDestFile;
else {
wchar_t tszTempPath[MAX_PATH];
@@ -87,7 +87,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath ptszFile2unzip = tszBackFile;
}
- HANDLE hFile = CreateFile(ptszFile2unzip, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, file_info.external_fa, 0);
+ HANDLE hFile = CreateFile(ptszFile2unzip, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, file_info.external_fa, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
mir_free(ptszNewName);
return false;
diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 5b8cbac17c..3e8c257cc4 100644 --- a/plugins/Popup/src/avatars_gif.cpp +++ b/plugins/Popup/src/avatars_gif.cpp @@ -30,8 +30,8 @@ GifAvatar::GifAvatar(MCONTACT hContact) : PopupAvatar() bIsValid = true;
GDIPlus_GetGIFSize(av->szFilename, &this->width, &this->height);
- hBitmap = NULL;
- frameDelays = NULL;
+ hBitmap = nullptr;
+ frameDelays = nullptr;
frameCount = 0;
frameSize.cx = frameSize.cy = 0;
@@ -44,7 +44,7 @@ GifAvatar::~GifAvatar() {
if (frameDelays) {
mir_free(frameDelays);
- frameDelays = NULL;
+ frameDelays = nullptr;
}
if (hBitmap) DeleteObject(hBitmap);
}
@@ -65,7 +65,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op cachedHeight = h;
if (frameDelays) {
mir_free(frameDelays);
- frameDelays = NULL;
+ frameDelays = nullptr;
}
if (hBitmap) DeleteObject(hBitmap);
GDIPlus_ExtractAnimatedGIF(av->szFilename, w, h, hBitmap, frameDelays, frameCount, frameSize);
@@ -113,7 +113,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op bmp->restoreAlpha(x, y, w, h);
}
DeleteObject(rgn);
- SelectClipRgn(bmp->getDC(), NULL);
+ SelectClipRgn(bmp->getDC(), nullptr);
DeleteDC(hdcTmp);
activeFrame = (activeFrame + 1) % frameCount;
diff --git a/plugins/Popup/src/avatars_simple.cpp b/plugins/Popup/src/avatars_simple.cpp index b887bb27fd..21ce9e0463 100644 --- a/plugins/Popup/src/avatars_simple.cpp +++ b/plugins/Popup/src/avatars_simple.cpp @@ -60,7 +60,7 @@ SimpleAvatar::SimpleAvatar(HANDLE h, bool bUseBitmap) }
width = height = 0;
- av = NULL;
+ av = nullptr;
avNeedFree = false;
}
@@ -119,6 +119,6 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS bmp->restoreAlpha(x, y, w, h);
}
DeleteObject(rgn);
- SelectClipRgn(bmp->getDC(), NULL);
+ SelectClipRgn(bmp->getDC(), nullptr);
DeleteDC(hdcTmp);
}
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index a652e68980..4ca3ef3bf2 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -38,30 +38,30 @@ typedef long pu_koef; 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(const wchar_t *fn)
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
loadFromFile(fn);
}
@@ -153,7 +153,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) }
delete[] bitsSave;
- bitsSave = 0;
+ bitsSave = nullptr;
}
void MyBitmap::DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h)
@@ -586,7 +586,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) }
else {
this->saveAlpha(x, y, w, h);
- DrawIconEx(this->getDC(), x, y, hic, w, h, 0, NULL, DI_NORMAL);
+ DrawIconEx(this->getDC(), x, y, hic, w, h, 0, nullptr, DI_NORMAL);
this->restoreAlpha(x, y, w, h);
}
@@ -660,7 +660,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque) }
}
- HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
+ HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
delete[] pRgnData;
return hRgn;
}
@@ -736,9 +736,9 @@ bool MyBitmap::loadFromFile(const wchar_t *fn) return false;
BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm);
- SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, NULL);
+ SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr);
- HDC dcTmp = CreateCompatibleDC(0);
+ HDC dcTmp = CreateCompatibleDC(nullptr);
GetBitmapDimensionEx(hBmpLoaded, &sz);
HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded);
@@ -775,8 +775,8 @@ void MyBitmap::allocate(int w, int h) bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
- 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);
GdiFlush();
@@ -789,9 +789,9 @@ void MyBitmap::freemem() 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/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 4f11e52471..aaf022f2ec 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-PopupFonts fonts = { 0 };
+PopupFonts fonts = {};
void InitFonts()
{
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index 4746c4d4a9..860e777962 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -27,7 +27,7 @@ static mir_cs csPopupHistory; static LIST<POPUPDATA2> arPopupHistory(SETTING_HISTORYSIZE_DEFAULT);
static int popupHistoryBuffer = 0;
-static HWND hwndHistory = NULL;
+static HWND hwndHistory = nullptr;
#define UM_RESIZELIST (WM_USER+100)
#define UM_SELECTLAST (WM_USER+101)
@@ -82,7 +82,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) ppd->lpzText = mir_strdup(ppd->lpzText);
}
ppd->lpzSkin = mir_strdup(ppd->lpzSkin);
- ppd->dwTimestamp = time(NULL);
+ ppd->dwTimestamp = time(nullptr);
{
mir_cslock lck(csPopupHistory);
if (arPopupHistory.getCount() >= popupHistoryBuffer) {
@@ -98,7 +98,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) void PopupHistoryShow()
{
if (!PopupOptions.EnableHistory) {
- MessageBox(NULL, TranslateT("Popup History is disabled"), TranslateT("Popup History message"), MB_OK);
+ MessageBox(nullptr, TranslateT("Popup History is disabled"), TranslateT("Popup History message"), MB_OK);
return;
}
@@ -109,7 +109,7 @@ void PopupHistoryShow() SetActiveWindow(hwndHistory);
}
else {
- hwndHistory = CreateDialog(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryDlgProc);
+ hwndHistory = CreateDialog(hInst, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryDlgProc);
SetWindowText(hwndHistory, TranslateT("Popup History"));
}
}
@@ -120,7 +120,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara static int loadItem = -1;
static enum { LOG_NONE, LOG_DEFAULT, LOG_HPP } logType = LOG_NONE;
- static HWND hwndLog = NULL;
+ static HWND hwndLog = nullptr;
switch (msg) {
case WM_INITDIALOG:
@@ -176,7 +176,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieEvent.eventData = &ieData;
ieEvent.count = 1;
ieEvent.codepage = 0;
- ieEvent.pszProto = NULL;
+ ieEvent.pszProto = nullptr;
for (int i = 0; i < arPopupHistory.getCount(); ++i) {
POPUPDATA2* ppd = arPopupHistory[i];
@@ -188,18 +188,18 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
ieData.pszNickW = ppd->lptzTitle;
ieData.pszTextW = ppd->lptzText;
- ieData.pszText2W = NULL;
+ ieData.pszText2W = nullptr;
}
else {
ieData.dwFlags |= 0;
ieData.pszNick = ppd->lpzTitle;
ieData.pszText = ppd->lpzText;
- ieData.pszText2 = NULL;
+ ieData.pszText2 = nullptr;
}
ieData.bIsMe = FALSE;
ieData.time = ppd->dwTimestamp;
ieData.dwData = 0;
- ieData.next = NULL;
+ ieData.next = nullptr;
CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent);
}
}
@@ -301,7 +301,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara rcLst.right -= 10;
rcLst.bottom -= 10;
if (logType == LOG_HPP) {
- SetWindowPos(hwndLog, NULL,
+ SetWindowPos(hwndLog, nullptr,
rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top,
SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW);
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
}
else if (logType == LOG_DEFAULT) {
- SetWindowPos(hwndLog, NULL,
+ SetWindowPos(hwndLog, nullptr,
rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top,
SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW);
if (rcLst.right - rcLst.left != oldWidth) {
@@ -343,8 +343,8 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ListBox_SetItemData(hwndLog, i, 0);
ListBox_SetItemHeight(hwndLog, i, 50);
}
- ScrollWindow(hwndLog, 0, 100000, NULL, NULL);
- InvalidateRect(hwndLog, NULL, TRUE);
+ ScrollWindow(hwndLog, 0, 100000, nullptr, nullptr);
+ InvalidateRect(hwndLog, nullptr, TRUE);
}
return TRUE;
@@ -362,7 +362,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieEvent.eventData = &ieData;
ieEvent.count = 1;
ieEvent.codepage = 0;
- ieEvent.pszProto = NULL;
+ ieEvent.pszProto = nullptr;
ieData.cbSize = sizeof(ieData);
ieData.dwFlags = 0;
@@ -372,18 +372,18 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
ieData.pszNickW = ppd->lptzTitle;
ieData.pszTextW = ppd->lptzText;
- ieData.pszText2W = NULL;
+ ieData.pszText2W = nullptr;
}
else {
ieData.dwFlags |= 0;
ieData.pszNick = ppd->lpzTitle;
ieData.pszText = ppd->lpzText;
- ieData.pszText2 = NULL;
+ ieData.pszText2 = nullptr;
}
ieData.bIsMe = FALSE;
ieData.time = ppd->dwTimestamp;
ieData.dwData = 0;
- ieData.next = NULL;
+ ieData.next = nullptr;
CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent);
}
else if (logType == LOG_DEFAULT) {
@@ -399,7 +399,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara case WM_CLOSE:
Utils_SaveWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_");
DestroyWindow(hwnd);
- hwndHistory = NULL;
+ hwndHistory = nullptr;
return TRUE;
case WM_DESTROY:
diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 207b4991a2..fec8b0663d 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -73,7 +73,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
- return NULL;
+ return nullptr;
}
HANDLE GetIconHandle(int iconId)
@@ -82,5 +82,5 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 9fdd80632a..7471eddb29 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -40,11 +40,11 @@ int hLangpack = 0; CLIST_INTERFACE *pcli;
//===== Global variables ================================================================
-HMODULE hUserDll = 0;
-HMODULE hMsimgDll = 0;
-HMODULE hKernelDll = 0;
-HMODULE hGdiDll = 0;
-HMODULE hDwmapiDll = 0;
+HMODULE hUserDll = nullptr;
+HMODULE hMsimgDll = nullptr;
+HMODULE hKernelDll = nullptr;
+HMODULE hGdiDll = nullptr;
+HMODULE hDwmapiDll = nullptr;
GLOBAL_WND_CLASSES g_wndClass = { 0 };
@@ -114,16 +114,16 @@ static int IconsChanged(WPARAM, LPARAM) ? GetIconHandle(IDI_POPUP)
: GetIconHandle(IDI_NOPOPUP);
- Menu_ModifyItem(hMenuItem, NULL, hIcon);
- Menu_ModifyItem(hMenuRoot, NULL, hIcon);
+ Menu_ModifyItem(hMenuItem, nullptr, hIcon);
+ Menu_ModifyItem(hMenuRoot, nullptr, hIcon);
- Menu_ModifyItem(hMenuItemHistory, NULL, GetIconHandle(IDI_HISTORY));
+ Menu_ModifyItem(hMenuItemHistory, nullptr, GetIconHandle(IDI_HISTORY));
return 0;
}
static int TTBLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.pszService = MENUCOMMAND_SVC;
ttb.lParamUp = 1;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
@@ -157,7 +157,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP));
}
- Menu_ModifyItem(hMenuRoot, NULL, hIcon);
+ Menu_ModifyItem(hMenuRoot, nullptr, hIcon);
if (hTTButton)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopupOptions.ModuleIsEnabled) ? TTBST_PUSHED : 0);
@@ -238,7 +238,7 @@ static int ModulesLoaded(WPARAM, LPARAM) htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT);
htuTitle = MText.Register("Popup Plus/Title", MTEXT_FANCY_DEFAULT);
}
- else htuTitle = htuText = NULL;
+ else htuTitle = htuText = nullptr;
// check if OptionLoaded
if (!OptionLoaded)
@@ -331,14 +331,14 @@ MIRAPI int Load(void) // Transparent and animation routines
hDwmapiDll = LoadLibrary(L"dwmapi.dll");
- MyDwmEnableBlurBehindWindow = 0;
+ MyDwmEnableBlurBehindWindow = nullptr;
if (hDwmapiDll)
MyDwmEnableBlurBehindWindow = (HRESULT(WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow");
PopupHistoryLoad();
LoadPopupThread();
if (!LoadPopupWnd2()) {
- MessageBox(0, TranslateT("Error: I could not register the Popup Window class.\r\nThe plugin will not operate."), MODULNAME_LONG, MB_ICONSTOP | MB_OK);
+ MessageBox(nullptr, TranslateT("Error: I could not register the Popup Window class.\r\nThe plugin will not operate."), MODULNAME_LONG, MB_ICONSTOP | MB_OK);
return 0; // We couldn't register our Window Class, don't hook any event: the plugin will act as if it was disabled.
}
RegisterOptPrevBox();
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 1c9759e201..09bd94e332 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -42,7 +42,7 @@ void LoadNotifications() POPUPNOTIFICATION notification = { 0 };
notification.cbSize = sizeof(notification);
notification.actionCount = 0;
- notification.lpActions = 0;
+ notification.lpActions = nullptr;
mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName));
@@ -158,12 +158,12 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
char *szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzLAction);
mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
- mir_free(szTmp); szTmp = NULL;
+ mir_free(szTmp); szTmp = nullptr;
mir_snprintf(setting, "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzRAction);
mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
- mir_free(szTmp); szTmp = NULL;
+ mir_free(szTmp); szTmp = nullptr;
}
}
@@ -218,7 +218,7 @@ HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ) if (p->typ == typ && (!group || (mir_wstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_wstrcmp(p->pszDescription, name) == 0)))
return p;
}
- return NULL;
+ return nullptr;
}
void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen)
@@ -264,7 +264,7 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, return false;
POPUPTREEDATA *ptd = (POPUPTREEDATA *)hNotification;
- char *lpzAction = NULL;
+ char *lpzAction = nullptr;
switch (message) {
case WM_LBUTTONUP:
case WM_COMMAND:
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 1de7bcbb81..41f1d8ced4 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-HWND hwndBox = NULL;
+HWND hwndBox = nullptr;
LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -89,16 +89,16 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM hwndBox = CreateWindowEx(
WS_EX_TOOLWINDOW | WS_EX_TOPMOST, // dwStyleEx
BOXPREVIEW_WNDCLASS, // Class name
- NULL, // Title
+ nullptr, // Title
DS_SETFONT | DS_FIXEDSYS | WS_POPUP, // dwStyle
CW_USEDEFAULT, // x
CW_USEDEFAULT, // y
CW_USEDEFAULT, // Width
CW_USEDEFAULT, // Height
HWND_DESKTOP, // Parent
- NULL, // menu handle
+ nullptr, // menu handle
hInst, // Instance
- (LPVOID)0);
+ (LPVOID)nullptr);
ShowWindow(hwndBox, SW_HIDE);
}
// Group: History
@@ -364,7 +364,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (idCtrl) {
case IDC_MAXPOPUPS:
{
- int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int maxPop = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (maxPop > 0) {
PopupOptions.MaxPopups = maxPop;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -373,7 +373,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_HISTORYSIZE:
{
- int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int histSize = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (histSize > 0 && histSize <= SETTING_HISTORYSIZE_MAX) {
PopupOptions.HistorySize = histSize;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -382,7 +382,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_AVT_RADIUS:
{
- int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int avtRadius = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (avtRadius <= SETTING_AVTSIZE_MAX / 2) {
PopupOptions.avatarRadius = avtRadius;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -391,7 +391,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_FADEIN:
{
- int fadeIn = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int fadeIn = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (fadeIn >= SETTING_FADEINTIME_MIN && fadeIn <= SETTING_FADEINTIME_MAX) {
PopupOptions.FadeIn = fadeIn;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -400,7 +400,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_FADEOUT:
{
- int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int fadeOut = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (fadeOut >= SETTING_FADEOUTTIME_MIN && fadeOut <= SETTING_FADEOUTTIME_MAX) {
PopupOptions.FadeOut = fadeOut;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -415,7 +415,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (idCtrl) {
case IDC_MAXPOPUPS:
{
- int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int maxPop = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (maxPop <= 0)
PopupOptions.MaxPopups = 20;
if (maxPop != PopupOptions.MaxPopups) {
@@ -427,7 +427,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_HISTORYSIZE:
{
- int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int histSize = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (histSize <= 0)
PopupOptions.HistorySize = SETTING_HISTORYSIZE_DEFAULT;
else if (histSize > SETTING_HISTORYSIZE_MAX)
@@ -441,7 +441,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_AVT_RADIUS:
{
- int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int avtRadius = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (avtRadius > SETTING_AVTSIZE_MAX / 2)
PopupOptions.avatarRadius = SETTING_AVTSIZE_MAX / 2;
if (avtRadius != PopupOptions.avatarRadius) {
@@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_FADEIN:
{
- int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int fade = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (fade < SETTING_FADEINTIME_MIN)
PopupOptions.FadeIn = SETTING_FADEINTIME_MIN;
else if (fade > SETTING_FADEINTIME_MAX)
@@ -467,7 +467,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_FADEOUT:
{
- int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ int fade = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE);
if (fade < SETTING_FADEOUTTIME_MIN)
PopupOptions.FadeOut = SETTING_FADEOUTTIME_MIN;
else if (fade > SETTING_FADEOUTTIME_MAX)
@@ -557,20 +557,20 @@ LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr(hwndBox, GWLP_USERDATA, 0);
RECT rc; GetWindowRect(hwnd, &rc);
- SetWindowPos(hwndBox, NULL,
+ SetWindowPos(hwndBox, nullptr,
(rc.left + rc.right - newVal) / 2, rc.bottom + 2, newVal, newVal,
SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
HRGN rgn = CreateRoundRectRgn(0, 0, newVal, newVal, 2 * PopupOptions.avatarRadius, 2 * PopupOptions.avatarRadius);
SetWindowRgn(hwndBox, rgn, TRUE);
- InvalidateRect(hwndBox, NULL, FALSE);
+ InvalidateRect(hwndBox, nullptr, FALSE);
oldVal = newVal;
}
}
break;
case WM_MOUSELEAVE:
- SetWindowRgn(hwndBox, NULL, TRUE);
+ SetWindowRgn(hwndBox, nullptr, TRUE);
ShowWindow(hwndBox, SW_HIDE);
oldVal = -1;
break;
@@ -608,10 +608,10 @@ LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1);
RECT rc; GetWindowRect(hwnd, &rc);
- SetWindowPos(hwndBox, NULL,
+ SetWindowPos(hwndBox, nullptr,
(rc.left + rc.right - 170) / 2, rc.bottom + 2, 170, 50,
SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
- SetWindowRgn(hwndBox, NULL, TRUE);
+ SetWindowRgn(hwndBox, nullptr, TRUE);
}
SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA);
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 9a58419986..18905ee3aa 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l // element typ1 (Notification)
if (ptd->typ == 1) {
- LPTSTR psztAction = NULL;
+ LPTSTR psztAction = nullptr;
// Timeout
SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE);
SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1));
@@ -268,15 +268,15 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < ptd->notification.actionCount; ++i) {
psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateW(psztAction)), ptd->notification.lpActions[i].lpzTitle);
- mir_free(psztAction); psztAction = NULL;
+ mir_free(psztAction); psztAction = nullptr;
}
// combo right action (EXTRA)
hCtrl = GetDlgItem(hwnd, IDC_RACTION);
- psztAction = NULL;
+ psztAction = nullptr;
for (i = 0; i < ptd->notification.actionCount; ++i) {
psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateW(psztAction)), ptd->notification.lpActions[i].lpzTitle);
- mir_free(psztAction); psztAction = NULL;
+ mir_free(psztAction); psztAction = nullptr;
}
// enable all controls
for (i = 0; i < _countof(ctrlsAll); ++i){
@@ -348,7 +348,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ppd.iSeconds = ptd->timeoutValue;
ppd.colorBack = ptd->colorBack;
ppd.colorText = ptd->colorText;
- POPUPTREEDATA *ptdPrev = NULL;
+ POPUPTREEDATA *ptdPrev = nullptr;
if (ptd->typ == 1) {
// we work with a copy for preview
ptdPrev = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA));
@@ -365,7 +365,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ppd.lchIcon = ptd->pupClass.hIcon;
CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY);
- mir_free(ptdPrev); ptdPrev = NULL;
+ mir_free(ptdPrev); ptdPrev = nullptr;
}
break;
@@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case EN_CHANGE: // Edit controls
switch (idCtrl) {
case IDC_TIMEOUT:
- int seconds = GetDlgItemInt(hwnd, idCtrl, NULL, TRUE);
+ int seconds = GetDlgItemInt(hwnd, idCtrl, nullptr, TRUE);
if (seconds >= SETTING_LIFETIME_INFINITE && seconds <= SETTING_LIFETIME_MAX && seconds != ptd->timeoutValue) {
ptd->timeoutValue = seconds;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -418,7 +418,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case EN_KILLFOCUS: // Edit controls lost fokus
switch (idCtrl) {
case IDC_TIMEOUT:
- int seconds = GetDlgItemInt(hwnd, idCtrl, NULL, TRUE);
+ int seconds = GetDlgItemInt(hwnd, idCtrl, nullptr, TRUE);
if (seconds > SETTING_LIFETIME_MAX)
ptd->timeoutValue = SETTING_LIFETIME_MAX;
else if (seconds < SETTING_LIFETIME_INFINITE)
diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 3434287acf..ae183f15b8 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -81,7 +81,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) DWORD hitFlags;
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwnd, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL) break;
+ if (hItem == nullptr) break;
if (!(hitFlags&CLCHT_ONITEMEXTRA)) break;
int iImage = SendDlgItemMessage(hwnd, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 32af64f767..677e1bc459 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -129,7 +129,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG
- static OPTTREE_OPTION *statusOptions = NULL;
+ static OPTTREE_OPTION *statusOptions = nullptr;
static int statusOptionsCount = 0;
if (statusOptions) {
int index;
@@ -310,7 +310,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_CUSTOMPOS:
{
RECT rcButton, rcBox;
- HWND hwndBox = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POSITION), NULL, PositionBoxDlgProc);
+ HWND hwndBox = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POSITION), nullptr, PositionBoxDlgProc);
GetWindowRect((HWND)lParam, &rcButton);
GetWindowRect(hwndBox, &rcBox);
MoveWindow(hwndBox,
@@ -384,7 +384,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // lParam = Handle to the control
case IDC_SECONDS:
{
- int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
+ int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE);
if (seconds >= SETTING_LIFETIME_MIN &&
seconds <= SETTING_LIFETIME_MAX &&
seconds != PopupOptions.Seconds) {
@@ -395,7 +395,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_MINIMUMWIDTH:
{
- int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, NULL, FALSE);
+ int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, nullptr, FALSE);
if (temp >= SETTING_MINIMUMWIDTH_MIN &&
temp <= SETTING_MAXIMUMWIDTH_MAX &&
temp != PopupOptions.MinimumWidth) {
@@ -406,7 +406,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_MAXIMUMWIDTH:
{
- int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, NULL, FALSE);
+ int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, nullptr, FALSE);
if (temp >= SETTING_MINIMUMWIDTH_MIN &&
temp <= SETTING_MAXIMUMWIDTH_MAX &&
temp != PopupOptions.MaximumWidth) {
@@ -423,7 +423,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // lParam = Handle to the control
case IDC_SECONDS:
{
- int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
+ int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE);
if (seconds > SETTING_LIFETIME_MAX)
PopupOptions.Seconds = SETTING_LIFETIME_MAX;
else if (seconds < SETTING_LIFETIME_MIN)
@@ -437,7 +437,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_MINIMUMWIDTH:
{
- int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
+ int temp = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE);
if (temp < SETTING_MINIMUMWIDTH_MIN)
PopupOptions.MinimumWidth = SETTING_MINIMUMWIDTH_MIN;
else if (temp > SETTING_MAXIMUMWIDTH_MAX)
@@ -456,7 +456,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case IDC_MAXIMUMWIDTH:
{
- int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
+ int temp = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE);
if (temp >= SETTING_MAXIMUMWIDTH_MAX)
PopupOptions.MaximumWidth = SETTING_MAXIMUMWIDTH_MAX;
else if (temp < SETTING_MINIMUMWIDTH_MIN)
@@ -570,7 +570,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM mir_free(statusOptions[i].pszSettingName);
}
delete[] statusOptions;
- statusOptions = NULL;
+ statusOptions = nullptr;
statusOptionsCount = 0;
bDlgInit = false;
}
@@ -614,7 +614,7 @@ void Check_ReorderPopups(HWND hwnd) { INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
LOGFONT lf;
- static HFONT hFontTitle = 0;
+ static HFONT hFontTitle = nullptr;
switch (msg) {
case WM_INITDIALOG:
@@ -645,11 +645,11 @@ INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND:
if ((LOWORD(wParam)) == IDOK) {
- PopupOptions.gapTop = GetDlgItemInt(hwndDlg, IDC_TXT_TOP, NULL, FALSE);
- PopupOptions.gapBottom = GetDlgItemInt(hwndDlg, IDC_TXT_BOTTOM, NULL, FALSE);
- PopupOptions.gapLeft = GetDlgItemInt(hwndDlg, IDC_TXT_LEFT, NULL, FALSE);
- PopupOptions.gapRight = GetDlgItemInt(hwndDlg, IDC_TXT_RIGHT, NULL, FALSE);
- PopupOptions.spacing = GetDlgItemInt(hwndDlg, IDC_TXT_SPACING, NULL, FALSE);
+ PopupOptions.gapTop = GetDlgItemInt(hwndDlg, IDC_TXT_TOP, nullptr, FALSE);
+ PopupOptions.gapBottom = GetDlgItemInt(hwndDlg, IDC_TXT_BOTTOM, nullptr, FALSE);
+ PopupOptions.gapLeft = GetDlgItemInt(hwndDlg, IDC_TXT_LEFT, nullptr, FALSE);
+ PopupOptions.gapRight = GetDlgItemInt(hwndDlg, IDC_TXT_RIGHT, nullptr, FALSE);
+ PopupOptions.spacing = GetDlgItemInt(hwndDlg, IDC_TXT_SPACING, nullptr, FALSE);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
else if ((LOWORD(wParam)) == IDCANCEL)
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 249ea08e7d..925a7d2b5a 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
static volatile bool gPreviewOk = false;
-static PopupWnd2 *wndPreview = NULL;
+static PopupWnd2 *wndPreview = nullptr;
INT_PTR CALLBACK BoxPreviewWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -38,10 +38,10 @@ void RegisterOptPrevBox() wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hInstance = hInst;
- wcl.hIcon = NULL;
- wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcl.hbrBackground = NULL; // (HBRUSH)GetStockObject(LTGRAY_BRUSH);
- wcl.lpszMenuName = NULL;
+ wcl.hIcon = nullptr;
+ wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wcl.hbrBackground = nullptr; // (HBRUSH)GetStockObject(LTGRAY_BRUSH);
+ wcl.lpszMenuName = nullptr;
wcl.lpszClassName = BOXPREVIEW_WNDCLASS;
wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
g_wndClass.cPopupPreviewBoxWndclass = RegisterClassEx(&wcl);
@@ -89,7 +89,7 @@ static void updatePreviewImage(HWND hwndBox) wndPreview->update();
gPreviewOk = true;
- InvalidateRect(hwndBox, NULL, TRUE);
+ InvalidateRect(hwndBox, nullptr, TRUE);
}
static void DrawPreview(HWND hwnd, HDC hdc)
@@ -101,8 +101,8 @@ static void DrawPreview(HWND hwnd, HDC hdc) bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
- HBITMAP hBmpBrush = CreateDIBSection(0, &bi, DIB_RGB_COLORS, 0, 0, 0);
- HDC dcBmp = CreateCompatibleDC(0);
+ HBITMAP hBmpBrush = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, nullptr, nullptr, 0);
+ HDC dcBmp = CreateCompatibleDC(nullptr);
HBITMAP hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmpBrush);
HBRUSH hbr = CreateSolidBrush(RGB(0xcc, 0xcc, 0xcc));
@@ -121,7 +121,7 @@ static void DrawPreview(HWND hwnd, HDC hdc) GetClientRect(hwnd, &rc);
hbr = CreatePatternBrush(hBmpBrush);
- SetBrushOrgEx(hdc, 1, 1, 0);
+ SetBrushOrgEx(hdc, 1, 1, nullptr);
FillRect(hdc, &rc, hbr);
DeleteObject(hbr);
DeleteObject(hBmpBrush);
@@ -155,7 +155,7 @@ LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch (msg) {
case WM_PAINT:
- if (GetUpdateRect(hwnd, 0, FALSE))
+ if (GetUpdateRect(hwnd, nullptr, FALSE))
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
@@ -174,7 +174,7 @@ LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP }
int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions) {
- const PopupSkin *skin = 0;
+ const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
for (int i = 1; i <= 10; i++) {
if (!skin->getFlagName(i))
@@ -265,7 +265,7 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn mir_free(options[i].pszSettingName);
}
mir_free(options);
- options = NULL;
+ options = nullptr;
*OptionsCount = 0;
}
// add "Global options"
@@ -306,8 +306,8 @@ void LoadOption_Skins() { INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG
- static HANDLE hhkFontsReload = 0;
- static OPTTREE_OPTION *skinOptions = NULL;
+ static HANDLE hhkFontsReload = nullptr;
+ static OPTTREE_OPTION *skinOptions = nullptr;
static int skinOptionsCount = 0;
if (skinOptions) {
@@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR OptTree_ProcessMessage(hwndDlg, msg, wParam, lParam, &index, IDC_SKIN_LIST_OPT, skinOptions, skinOptionsCount);
if (index != -1) {
if (mir_wstrcmp(skinOptions[index].pszSettingName, L"Skin options") == 0) {
- const PopupSkin *skin = 0;
+ const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
skin->setFlag(skinOptions[index].Data, skinOptions[index].bState ? true : false);
}
@@ -385,7 +385,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND:
{
- HWND hCtrl = NULL;
+ HWND hCtrl = nullptr;
UINT idCtrl = LOWORD(wParam);
switch (HIWORD(wParam)) {
case BN_KILLFOCUS: // Button controls
@@ -421,7 +421,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR PopupOptions.SkinPack = mir_wstrdup(szNewSkin);
}
- const PopupSkin *skin = 0;
+ const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
// update Skin Option List from reload SkinPack
bDlgInit = false;
@@ -446,7 +446,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR LB_GETITEMDATA,
(WPARAM)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL, 0, 0),
0));
- const PopupSkin *skin = 0;
+ const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
mir_free(PopupOptions.SkinPack);
PopupOptions.SkinPack = mir_wstrdup(skin->getName());
@@ -479,7 +479,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // skin pack
db_set_ws(NULL, MODULNAME, "SkinPack", PopupOptions.SkinPack);
// skin options
- const PopupSkin *skin = 0;
+ const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack))
skin->saveOpts();
skins.freeAllButActive();
@@ -499,7 +499,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_DESTROY:
if (wndPreview) {
delete wndPreview;
- wndPreview = NULL;
+ wndPreview = nullptr;
gPreviewOk = false;
}
if (hhkFontsReload) UnhookEvent(hhkFontsReload);
@@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mir_free(skinOptions[i].pszSettingName);
}
mir_free(skinOptions);
- skinOptions = NULL;
+ skinOptions = nullptr;
skinOptionsCount = 0;
}
return TRUE;
@@ -578,9 +578,9 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) DeleteObject(hbr);
HPEN hpen = (HPEN)SelectObject(mydc, CreatePen(PS_DOT, 1, RGB(0, 0, 0)));
- MoveToEx(mydc, 0, 100, NULL);
+ MoveToEx(mydc, 0, 100, nullptr);
LineTo(mydc, 201, 100);
- MoveToEx(mydc, 100, 0, NULL);
+ MoveToEx(mydc, 100, 0, nullptr);
LineTo(mydc, 100, 201);
DeleteObject(SelectObject(mydc, hpen));
@@ -597,7 +597,7 @@ INT_PTR CALLBACK BoxPreviewWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP {
switch (msg) {
case WM_PAINT:
- if (GetUpdateRect(hwnd, 0, FALSE)) {
+ if (GetUpdateRect(hwnd, nullptr, FALSE)) {
PAINTSTRUCT ps;
HDC mydc = BeginPaint(hwnd, &ps);
BoxPreview_OnPaint(hwnd, mydc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index a9abe4ca0e..1b5b4a8743 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -45,7 +45,7 @@ void OptTree_Translate(HWND hwndTree) while (hItem) {
OptTree_TranslateItem(hwndTree, hItem);
- HTREEITEM hItemTmp = 0;
+ HTREEITEM hItemTmp = nullptr;
if (hItemTmp = TreeView_GetChild(hwndTree, hItem)) {
hItem = hItemTmp;
}
@@ -90,7 +90,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wcha tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
- return NULL;
+ return nullptr;
}
HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconIndex)
@@ -100,7 +100,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd wchar_t *sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL, result = NULL;
+ HTREEITEM hSection = nullptr, result = nullptr;
mir_wstrcpy(itemName, name);
sectionName = itemName;
@@ -118,7 +118,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName);
if (!sectionName || !hItem) {
if (!hItem) {
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;// TVI_SORT;
@@ -175,7 +175,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res wchar_t *sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL;
+ HTREEITEM hSection = nullptr;
mir_wstrcpy(itemName, options[indx].pszOptionName);
sectionName = itemName;
@@ -193,7 +193,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName);
if (!sectionName || !hItem) {
if (!hItem) {
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;// TVI_SORT;
@@ -225,7 +225,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res OptTree_Translate(hwndTree);
ShowWindow(hwndTree, SW_SHOW);
- TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, 0, NULL));
+ TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, nullptr, nullptr));
break;
}
diff --git a/plugins/Popup/src/popup_gdiplus.cpp b/plugins/Popup/src/popup_gdiplus.cpp index 4c788a0679..b6fd4039a1 100644 --- a/plugins/Popup/src/popup_gdiplus.cpp +++ b/plugins/Popup/src/popup_gdiplus.cpp @@ -41,7 +41,7 @@ void LoadGDIPlus() gbGdiPlusLoaded = false;
__try {
if (g_gdiplusToken == 0)
- Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL);
+ Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, nullptr);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
@@ -74,7 +74,7 @@ using namespace Gdiplus; HBITMAP SkinEngine_CreateDIB32(int cx, int cy)
{
if (cx < 0 || cy < 0) {
- return NULL;
+ return nullptr;
}
BITMAPINFO RGB32BitsBITMAPINFO;
@@ -88,8 +88,8 @@ HBITMAP SkinEngine_CreateDIB32(int cx, int cy) UINT *ptPixels;
- HBITMAP DirectBitmap = CreateDIBSection(NULL, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0);
- if ((DirectBitmap == NULL || ptPixels == NULL) && cx != 0 && cy != 0) {
+ HBITMAP DirectBitmap = CreateDIBSection(nullptr, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0);
+ if ((DirectBitmap == nullptr || ptPixels == nullptr) && cx != 0 && cy != 0) {
;
}
else {
@@ -163,7 +163,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP clipHeight = (int)(xscale*imHeight + .5);
HBITMAP hBitmap = SkinEngine_CreateDIB32(clipWidth*nFrameCount, height);
- HDC hdc = CreateCompatibleDC(NULL);
+ HDC hdc = CreateCompatibleDC(nullptr);
HBITMAP oldBmp = (HBITMAP)SelectObject(hdc, hBitmap);
Graphics graphics(hdc);
ImageAttributes attr;
@@ -175,7 +175,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP for (int i = 1; i < nFrameCount + 1; i++) {
GUID pageGuid = FrameDimensionTime;
RectF rect((float)(i - 1)*clipWidth, (float)0, (float)clipWidth, (float)clipHeight);
- graphics.DrawImage(&image, rect, (float)0, (float)0, (float)imWidth, (float)imHeight, UnitPixel, &attr, NULL, NULL);
+ graphics.DrawImage(&image, rect, (float)0, (float)0, (float)imWidth, (float)imHeight, UnitPixel, &attr, nullptr, nullptr);
image.SelectActiveFrame(&pageGuid, i);
long lPause = ((long*)pPropertyItem->value)[i - 1] * 10;
delays[i - 1] = (int)lPause;
@@ -183,7 +183,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP SelectObject(hdc, oldBmp);
DeleteDC(hdc);
mir_free(pPropertyItem);
- pPropertyItem = NULL;
+ pPropertyItem = nullptr;
delete[]pDimensionIDs;
pBitmap = hBitmap;
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 54dc146040..54531432b6 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // globals
static int gIdleRequests = 0;
static bool gTerminating = false;
-static HWND gHwndManager = 0;
+static HWND gHwndManager = nullptr;
static int gLockCount = 0;
static volatile int nPopups = 0;
-static HANDLE hThread = 0;
+static HANDLE hThread = nullptr;
static LIST<PopupWnd2> popupList(3);
@@ -133,7 +133,7 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) void RepositionPopups()
{
- PopupWnd2 *prev = 0;
+ PopupWnd2 *prev = nullptr;
if (PopupOptions.ReorderPopups) {
for (int i = 0; i < popupList.getCount(); ++i) {
UpdatePopupPosition(prev, popupList[i]);
@@ -144,7 +144,7 @@ void RepositionPopups() static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- PopupWnd2 *wnd = NULL;
+ PopupWnd2 *wnd = nullptr;
if (message == UTM_ADD_WINDOW || message == UTM_UPDATE_WINDOW || message == UTM_REMOVE_WINDOW || message == UTM_REQUEST_REMOVE)
if (!(wnd = (PopupWnd2 *)lParam))
return 0;
@@ -161,7 +161,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA case UTM_ADD_WINDOW:
if (gTerminating)
break;
- UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount() - 1] : 0, wnd);
+ UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount() - 1] : nullptr, wnd);
popupList.insert(wnd);
++nPopups;
wnd->callMethodAsync(&PopupWnd2::m_show, 0);
@@ -222,10 +222,10 @@ static unsigned __stdcall PopupThread(void *) 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 = L"PopupThreadManagerWnd";
wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
g_wndClass.cPopupThreadManagerWnd = RegisterClassEx(&wcl);
@@ -236,16 +236,16 @@ static unsigned __stdcall PopupThread(void *) MSGERROR(msg);
}
- gHwndManager = CreateWindow(L"PopupThreadManagerWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
- SetWindowPos(gHwndManager, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
+ gHwndManager = CreateWindow(L"PopupThreadManagerWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr);
+ SetWindowPos(gHwndManager, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
MSG msg;
- while (GetMessage(&msg, NULL, 0, 0)) {
+ while (GetMessage(&msg, nullptr, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- DestroyWindow(gHwndManager); gHwndManager = NULL;
+ DestroyWindow(gHwndManager); gHwndManager = nullptr;
return 0;
}
@@ -261,7 +261,7 @@ static int sttAvatarChanged(WPARAM wParam, LPARAM) void LoadPopupThread()
{
unsigned threadId;
- hThread = mir_forkthreadex(PopupThread, NULL, &threadId);
+ hThread = mir_forkthreadex(PopupThread, nullptr, &threadId);
HookEvent(ME_AV_AVATARCHANGED, sttAvatarChanged);
}
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 3aa148af28..a3d5c3c425 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AVATAR_TIMER 1608
#define CURSOR_TIMER 1609
-HWND ghwndMenuHost = NULL;
+HWND ghwndMenuHost = nullptr;
void WindowThread(void *arg);
@@ -52,7 +52,7 @@ bool LoadPopupWnd2() wcl.cbSize = sizeof(wcl);
wcl.lpfnWndProc = PopupWnd2::WindowProc;
wcl.hInstance = hInst;
- wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcl.lpszClassName = POPUP_WNDCLASS;
wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
@@ -62,12 +62,12 @@ bool LoadPopupWnd2() res = false;
wchar_t msg[1024];
mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
- MessageBox(NULL, msg, MODULNAME_LONG, MB_ICONSTOP | MB_OK);
+ MessageBox(nullptr, msg, MODULNAME_LONG, MB_ICONSTOP | MB_OK);
}
WNDCLASSEX wclw = { 0 };
wclw.cbSize = sizeof(wclw);
- if (!GetClassInfoEx(NULL, L"EDIT", &wclw))
+ if (!GetClassInfoEx(nullptr, L"EDIT", &wclw))
MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class."));
wclw.hInstance = hInst;
wclw.lpszClassName = L"PopupEditBox";
@@ -90,10 +90,10 @@ bool LoadPopupWnd2() 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 = L"PopupMenuHostWnd";
wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
g_wndClass.cPopupMenuHostWnd = RegisterClassEx(&wcl);
@@ -105,8 +105,8 @@ bool LoadPopupWnd2() MSGERROR(msg);
}
- ghwndMenuHost = CreateWindow(L"PopupMenuHostWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
- SetWindowPos(ghwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
+ ghwndMenuHost = CreateWindow(L"PopupMenuHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr);
+ SetWindowPos(ghwndMenuHost, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
INITCOMMONCONTROLSEX iccex;
iccex.dwICC = ICC_WIN95_CLASSES;
@@ -138,7 +138,7 @@ PopupWnd2::PopupWnd2(POPUPDATA2 *ppd, POPUPOPTIONS *theCustomOptions, bool rende PopupWnd2::~PopupWnd2()
{
m_signature = 0;
- setIcon(NULL);
+ setIcon(nullptr);
mir_free(m_lpzSkin);
mir_free(m_lptzTitle);
@@ -167,14 +167,14 @@ void PopupWnd2::create() WS_EX_TRANSPARENT | // prevents unwanted clicks
WS_EX_TOOLWINDOW | WS_EX_TOPMOST, // dwStyleEx
POPUP_WNDCLASS, // Class name
- NULL, // Title
+ nullptr, // Title
DS_SETFONT | DS_FIXEDSYS | WS_POPUP, // dwStyle
CW_USEDEFAULT, // x
CW_USEDEFAULT, // y
CW_USEDEFAULT, // Width
CW_USEDEFAULT, // Height
HWND_DESKTOP, // Parent
- NULL, // menu handle
+ nullptr, // menu handle
hInst, // Instance
(LPVOID)this);
@@ -188,10 +188,10 @@ void PopupWnd2::create() SetClassLongPtr(m_hwnd, GCL_STYLE, style);
// tooltips
- m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- m_hwnd, NULL, hInst, NULL);
+ m_hwnd, nullptr, hInst, nullptr);
SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
m_bWindowCreated = true;
@@ -213,7 +213,7 @@ void PopupWnd2::updateLayered(BYTE opacity) blend.SourceConstantAlpha = opacity; // m_options->UseTransparency ? opacity : 255;
blend.AlphaFormat = AC_SRC_ALPHA;
- UpdateLayeredWindow(m_hwnd, NULL, &ptDst, &m_sz,
+ UpdateLayeredWindow(m_hwnd, nullptr, &ptDst, &m_sz,
m_bmpAnimate ? m_bmpAnimate->getDC() : m_bmp->getDC(),
&ptSrc, 0xffffffff, &blend, ULW_ALPHA);
@@ -243,7 +243,7 @@ void PopupWnd2::update() // destroy content bitmap so animate() can reallocate it if needed
if (m_bmp) {
delete m_bmp;
- m_bmp = NULL;
+ m_bmp = nullptr;
}
// measure popup
@@ -285,7 +285,7 @@ void PopupWnd2::animate() if (m_bmpBase) {
if (m_bmp) delete m_bmp;
m_bmp = m_bmpBase;
- m_bmpBase = NULL;
+ m_bmpBase = nullptr;
}
// update layered window if supported
@@ -323,7 +323,7 @@ void PopupWnd2::animate() void PopupWnd2::show()
{
if ((m_options->UseEffect || (m_options->UseAnimations && !m_customPopup)) && m_options->FadeIn) {
- IPopupPlusEffect *effect = NULL;
+ IPopupPlusEffect *effect = nullptr;
m_bSlide = m_bFade = false;
DWORD dwTime, dwTime0 = GetTickCount();
DWORD dwTime1 = dwTime0 + m_options->FadeIn;
@@ -354,10 +354,10 @@ void PopupWnd2::show() m_ptPosition0.x -= m_sz.cx + 2 * 5;
else
m_ptPosition0.x += m_sz.cx + 2 * 5;
- SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
+ SetWindowPos(m_hwnd, nullptr, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
}
else {
- SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
+ SetWindowPos(m_hwnd, nullptr, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
}
while ((dwTime = GetTickCount()) < dwTime1) {
if (m_bFade) {
@@ -383,7 +383,7 @@ void PopupWnd2::show() }
}
if (m_bSlide)
- SetWindowPos(m_hwnd, 0,
+ SetWindowPos(m_hwnd, nullptr,
(int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeIn,
(int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeIn,
0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
@@ -395,7 +395,7 @@ void PopupWnd2::show() effect->endEffect();
effect->destroy();
delete m_bmpAnimate;
- m_bmpAnimate = NULL;
+ m_bmpAnimate = nullptr;
}
}
@@ -403,14 +403,14 @@ void PopupWnd2::show() updateLayered((m_options->UseTransparency && !(m_bIsHovered && m_options->OpaqueOnHover)) ? m_options->Alpha : 255);
// updateLayered(m_options->UseTransparency ? m_options->Alpha : 255);
- SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
+ SetWindowPos(m_hwnd, nullptr, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
}
void PopupWnd2::hide()
{
if ((m_options->UseEffect || (m_options->UseAnimations && !m_customPopup)) && m_options->FadeOut) {
m_bDestroy = true;
- IPopupPlusEffect *effect = NULL;
+ IPopupPlusEffect *effect = nullptr;
m_bFade = m_bSlide = false;
DWORD dwTime, dwTime0 = GetTickCount();
DWORD dwTime1 = dwTime0 + m_options->FadeOut;
@@ -438,7 +438,7 @@ void PopupWnd2::hide() m_ptPosition1.x -= m_sz.cx + 2 * 5;
else
m_ptPosition1.x += m_sz.cx + 2 * 5;
- SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
+ SetWindowPos(m_hwnd, nullptr, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
}
while ((dwTime = GetTickCount()) < dwTime1) {
if (m_bFade) {
@@ -464,7 +464,7 @@ void PopupWnd2::hide() }
}
if (m_bSlide)
- SetWindowPos(m_hwnd, 0,
+ SetWindowPos(m_hwnd, nullptr,
(int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeOut,
(int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeOut,
0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
@@ -476,11 +476,11 @@ void PopupWnd2::hide() effect->endEffect();
effect->destroy();
delete m_bmpAnimate;
- m_bmpAnimate = NULL;
+ m_bmpAnimate = nullptr;
}
}
- SetWindowPos(m_hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
+ SetWindowPos(m_hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
DestroyWindow(m_hwnd);
// hwnd = 0;
}
@@ -641,7 +641,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count, int additional) {
m_actionCount = 0;
if (m_actions) delete[] m_actions;
- m_actions = NULL;
+ m_actions = nullptr;
int i;
@@ -697,7 +697,7 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) m_PluginWindowProc = ppd->PluginWindowProc;
if (m_options->DisplayTime)
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", m_time, _countof(m_time));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", m_time, _countof(m_time));
else m_time[0] = 0;
fixDefaults();
@@ -721,8 +721,8 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) replaceStrW(m_lptzText, ppd->lptzText);
}
else {
- replaceStrW(m_lptzTitle, NULL);
- replaceStrW(m_lptzText, NULL);
+ replaceStrW(m_lptzTitle, nullptr);
+ replaceStrW(m_lptzText, nullptr);
}
setIcon(ppd->lchIcon);
@@ -739,7 +739,7 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) if (ppd->dwTimestamp)
TimeZone_ToStringT(ppd->dwTimestamp, L"t", m_time, _countof(m_time));
else
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", m_time, _countof(m_time));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", m_time, _countof(m_time));
}
else m_time[0] = 0;
@@ -756,7 +756,7 @@ void PopupWnd2::buildMText() if (m_mtText) MText.Destroy(m_mtText);
if (m_mtTitle)MText.Destroy(m_mtTitle);
- m_mtText = m_mtTitle = NULL;
+ m_mtText = m_mtTitle = nullptr;
if (m_lptzText && m_lptzTitle) {
m_textType = TT_MTEXT;
@@ -788,7 +788,7 @@ void PopupWnd2::updateTimer() {
KillTimer(m_hwnd, POPUP_TIMER);
if (m_iTimeout > 0)
- SetTimer(m_hwnd, POPUP_TIMER, 1000, 0);
+ SetTimer(m_hwnd, POPUP_TIMER, 1000, nullptr);
}
LRESULT CALLBACK NullWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -815,7 +815,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg) dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(hContact);
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.cbBlob = (int)mir_strlen(msg) + 1;
dbei.pBlob = (PBYTE)msg;
db_event_add(hContact, &dbei);
@@ -824,7 +824,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg) LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
ReplyEditData *dat = (ReplyEditData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- WNDPROC oldWndProc = dat ? dat->oldWndProc : NULL;
+ WNDPROC oldWndProc = dat ? dat->oldWndProc : nullptr;
switch (message) {
case WM_KEYDOWN:
@@ -880,14 +880,14 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara if (!m_customPopup)
PopupThreadAddWindow(this);
if (m_iTimeout > 0)
- SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, 0);
+ SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, nullptr);
if (m_avatar->activeFrameDelay() > 0)
- SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), 0);
+ SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), nullptr);
// prevent unwanted clicks, but allow wanted :)
GetCursorPos(&m_ptPrevCursor);
- SetTimer(m_hwnd, CURSOR_TIMER, 500, NULL);
+ SetTimer(m_hwnd, CURSOR_TIMER, 500, nullptr);
break;
case UM_POPUPSHOW:
@@ -900,7 +900,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara m_avatar->invalidate();
update();
if (m_avatar->activeFrameDelay() > 0)
- SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), 0);
+ SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), nullptr);
break;
case UM_POPUPACTION:
@@ -919,9 +919,9 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara {
HWND hwndEditBox = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT",
- NULL,
+ nullptr,
WS_BORDER | WS_POPUP | WS_VISIBLE | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN,
- rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInst, NULL);
+ rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, hInst, nullptr);
ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData));
dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC);
@@ -950,7 +950,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara ADDCONTACTSTRUCT acs = { 0 };
acs.hContact = m_hContact;
acs.handleType = HANDLE_CONTACT;
- acs.szProto = 0;
+ acs.szProto = nullptr;
CallServiceSync(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs);
if (!(PopupOptions.actions&ACT_DEF_KEEPWND))
PUDeletePopup(m_hwnd);
@@ -959,7 +959,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case ACT_DEF_PIN:
if (m_bIsPinned)
- SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, NULL);
+ SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, nullptr);
else
KillTimer(m_hwnd, POPUP_TIMER);
@@ -1106,7 +1106,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara animate();
if ((newDelay <= 0) || (newDelay != m_avatarFrameDelay)) KillTimer(m_hwnd, AVATAR_TIMER);
if (newDelay > 0) {
- SetTimer(m_hwnd, AVATAR_TIMER, newDelay, 0);
+ SetTimer(m_hwnd, AVATAR_TIMER, newDelay, nullptr);
m_avatarFrameDelay = newDelay;
}
}
@@ -1147,7 +1147,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break;
case WM_PAINT:
- if (GetUpdateRect(m_hwnd, 0, FALSE)) {
+ if (GetUpdateRect(m_hwnd, nullptr, FALSE)) {
PAINTSTRUCT ps;
HDC mydc = BeginPaint(m_hwnd, &ps);
BitBlt(mydc, 0, 0, m_sz.cx, m_sz.cy, m_bmp->getDC(), 0, 0, SRCCOPY);
@@ -1212,7 +1212,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara }
SendMessage(m_hwnd, UM_FREEPLUGINDATA, 0, 0);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
- m_hwnd = 0;
+ m_hwnd = nullptr;
DestroyWindow(m_hwndToolTip);
@@ -1243,7 +1243,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara LRESULT CALLBACK PopupWnd2::WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- PopupWnd2 *wnd = 0;
+ PopupWnd2 *wnd = nullptr;
if (message == WM_CREATE) {
LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam;
wnd = (PopupWnd2 *)cs->lpCreateParams;
@@ -1259,7 +1259,7 @@ void WindowThread(void *arg) {
Thread_SetName("POPUP: WindowThread");
- CoInitialize(NULL); // we may need OLE in this thread for smiley substitution
+ CoInitialize(nullptr); // we may need OLE in this thread for smiley substitution
PopupWnd2 *wnd = (PopupWnd2 *)arg;
wnd->buildMText();
@@ -1267,7 +1267,7 @@ void WindowThread(void *arg) PostMessage(wnd->getHwnd(), UM_INITPOPUP, 0, 0);
MSG msg;
- while (GetMessage(&msg, NULL, 0, 0)) {
+ while (GetMessage(&msg, nullptr, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -1287,7 +1287,7 @@ LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM HMENU hMenu = Menu_BuildContactMenu(hContact);
HWND hwndSave = GetForegroundWindow();
SetForegroundWindow(hwnd);
- TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, nullptr);
SetForegroundWindow(hwndSave);
DestroyMenu(hMenu);
PostMessage((HWND)wParam, UM_MENUDONE, 0, 0);
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 767fa11096..d4dcd4418e 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -122,7 +122,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) return -1;
// Check if contact handle is valid.
- char *proto = NULL;
+ char *proto = nullptr;
if (ppd->lchContact)
proto = GetContactProto(ppd->lchContact);
@@ -157,7 +157,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (lParam & APF_CUSTOM_POPUP)
ppd->flags |= PU2_CUSTOM_POPUP;
- PopupWnd2 *wnd = new PopupWnd2(ppd, NULL, false);
+ PopupWnd2 *wnd = new PopupWnd2(ppd, nullptr, false);
if (lParam & APF_RETURN_HWND) {
while (!wnd->m_bWindowCreated) Sleep(1);
return (INT_PTR)wnd->getHwnd();
@@ -414,7 +414,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
{
POPUPTREEDATA *ptd = (POPUPTREEDATA*)lParam;
- if (ptd == NULL)
+ if (ptd == nullptr)
return 1;
for (int i = 0; i < gTreeData.getCount(); i++)
@@ -439,14 +439,14 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) pc = (POPUPCLASS*)wParam;
else {
LPTSTR group = mir_a2u(pdc->pszClassName);
- POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2);
+ POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, nullptr, 2);
if (ptd)
pc = &ptd->pupClass;
else
- pc = NULL;
+ pc = nullptr;
mir_free(group);
}
- if (pc == NULL)
+ if (pc == nullptr)
return 1;
POPUPDATA2 ppd2 = { sizeof(ppd2) };
@@ -484,7 +484,7 @@ INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam) PopupOptions.SkinPack = mir_a2u((char*)lParam);
}
- const PopupSkin *skin = 0;
+ const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
mir_free(PopupOptions.SkinPack);
PopupOptions.SkinPack = mir_wstrdup(skin->getName());
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 9fb5e34439..157c9aa981 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -31,9 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. PopupSkin::PopupSkin(LPCTSTR aName)
{
for (int i = 0; i < 32; i++)
- m_flag_names[i] = NULL;
- m_elements = 0;
- m_name = aName ? mir_wstrdup(aName) : NULL;
+ m_flag_names[i] = nullptr;
+ m_elements = nullptr;
+ m_name = aName ? mir_wstrdup(aName) : nullptr;
}
PopupSkin::~PopupSkin()
@@ -173,7 +173,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options if (!m_elements)
return;
- SKINELEMENT *head = NULL;
+ SKINELEMENT *head = nullptr;
int STYLE_SZ_CLOCK = 0;
if (!this->useInternalClock())
@@ -240,7 +240,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options {
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
- DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
+ DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
}
@@ -283,7 +283,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options {
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
- DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
+ DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
}
@@ -417,7 +417,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW if (!m_elements) return;
HDC hdc = bmp->getDC();
- SKINELEMENT *head = NULL;
+ SKINELEMENT *head = nullptr;
int STYLE_SZ_CLOCK = 0;
if (!this->useInternalClock())
@@ -502,7 +502,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW {
RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
- DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
+ DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
}
break;
case PopupWnd2::TT_MTEXT:
@@ -550,7 +550,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
- DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
+ DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
SelectObject(hdc, hFntSave);
}
break;
@@ -718,7 +718,7 @@ bool PopupSkin::onMouseMove(PopupWnd2 *wnd, int x, int y) const }
}
- SetCursor(LoadCursor(NULL, hovered ? IDC_HAND : IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, hovered ? IDC_HAND : IDC_ARROW));
return res;
}
@@ -734,7 +734,7 @@ bool PopupSkin::onMouseLeave(PopupWnd2 *wnd) const }
}
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
return res;
}
@@ -778,7 +778,7 @@ bool PopupSkin::load(LPCTSTR dir) for (int i = 0; i < 32; i++) {
if (m_flag_names[i]) {
mir_free(m_flag_names[i]);
- m_flag_names[i] = NULL;
+ m_flag_names[i] = nullptr;
}
}
m_flags = 0;
@@ -826,7 +826,7 @@ void PopupSkin::loadSkin(std::wistream &f) SKINELEMENT *head = new SKINELEMENT;
m_elements = head;
head->type = ST_NOTHING;
- head->next = NULL;
+ head->next = nullptr;
while (!f.eof()) {
wchar_t buf[1024];
@@ -871,7 +871,7 @@ void PopupSkin::loadSkin(std::wistream &f) if (head->next && ((head->next->type & ST_TYPEMASK) == ST_CLOCK))
m_internalClock = false;
head = head->next;
- head->next = NULL;
+ head->next = nullptr;
}
else if (!mir_wstrcmp(buf, L"options")) {
loadOptions(f);
@@ -911,10 +911,10 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) SKINELEMENT *element = new SKINELEMENT;
element->proportional = 0;
element->type = ST_NOTHING | ST_BADPOS;
- element->next = NULL;
+ element->next = nullptr;
element->flag_mask = 0;
element->flags = 0;
- element->myBmp = NULL;
+ element->myBmp = nullptr;
while (!f.eof()) {
wchar_t buf[1024];
@@ -937,12 +937,12 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) else if (!mir_wstrcmp(buf, L"text")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_TEXT;
element->textColor = (COLORREF)0xffffffff;
- element->hfn = 0;
+ element->hfn = nullptr;
}
else if (!mir_wstrcmp(buf, L"title")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_TITLE;
element->textColor = (COLORREF)0xffffffff;
- element->hfn = 0;
+ element->hfn = nullptr;
}
else if (!mir_wstrcmp(buf, L"avatar")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_AVATAR;
@@ -950,7 +950,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) else if (!mir_wstrcmp(buf, L"clock")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_CLOCK;
element->textColor = (COLORREF)0xffffffff;
- element->hfn = 0;
+ element->hfn = nullptr;
}
}
else if (!mir_wstrcmp(buf, L"source")) {
@@ -1057,7 +1057,7 @@ Skins skins; Skins::Skins()
{
- m_skins = 0;
+ m_skins = nullptr;
}
Skins::~Skins()
@@ -1089,12 +1089,12 @@ bool Skins::load() m_skins->name = mir_wstrdup(L"* Popup Classic");
m_skins->dir = new wchar_t[1024];
mir_wstrcpy(m_skins->dir, L"res:classic.popupskin");
- m_skins->skin = 0;
+ m_skins->skin = nullptr;
wchar_t dir[1024] = { '\0' };
if (ServiceExists(MS_FOLDERS_GET_PATH)) {
- if (FoldersGetCustomPathT(folderId, dir, _countof(dir), NULL) != 0)
+ if (FoldersGetCustomPathT(folderId, dir, _countof(dir), nullptr) != 0)
return false;
}
else {
@@ -1120,7 +1120,7 @@ bool Skins::load() m_skins->name = mir_wstrdup(ffd.cFileName);
m_skins->dir = new wchar_t[1024];
GetCurrentDirectory(1024, m_skins->dir);
- m_skins->skin = 0;
+ m_skins->skin = nullptr;
SetCurrentDirectory(L"..");
}
@@ -1137,7 +1137,7 @@ bool Skins::load() const PopupSkin *Skins::getSkin(LPCTSTR name)
{
- SKINLIST *any = 0;
+ SKINLIST *any = nullptr;
for (SKINLIST *p = m_skins; p; p = p->next) {
if (!mir_wstrcmp(p->name, L"* Popup Classic") || !any)
any = p;
@@ -1150,13 +1150,13 @@ const PopupSkin *Skins::getSkin(LPCTSTR name) if (any && any->skin)
return any->skin;
if (!any)
- return 0;
+ return nullptr;
any->skin = new PopupSkin(any->name);
any->skin->load(any->dir);
if (!any->skin->isCompatible())
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("The skin you are trying to load is designed\r\nfor newer version of Popup plus. And will not\r\ndisplay properly.\r\n\r\nPlease choose another skin."),
MODULNAME_LONG, MB_ICONSTOP | MB_OK);
@@ -1181,6 +1181,6 @@ void Skins::freeAllButActive() for (SKINLIST *p = m_skins; p; p = p->next)
if (mir_wstrcmpi(p->name, PopupOptions.SkinPack)) {
delete p->skin;
- p->skin = NULL;
+ p->skin = nullptr;
}
}
diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index a13216a0f7..ba45fa7c30 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. on current active mode for user.
*************************************************************************************/
-static MWindowList hDialogsList = NULL;
+static MWindowList hDialogsList = nullptr;
static void SrmmMenu_UpdateIcon(MCONTACT hContact)
{
@@ -88,7 +88,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM hContact, LPARAM lParam) CheckMenuItem(hMenu, 1 + mode, MF_BYCOMMAND | MF_CHECKED);
- mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), NULL);
+ mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), nullptr);
if (mode) {
db_set_b(hContact, MODULNAME, "ShowMode", mode - 1);
SrmmMenu_UpdateIcon(hContact);
diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp index 9bc378596b..4b221431e1 100644 --- a/plugins/ProfileManager/src/pmanagerEx.cpp +++ b/plugins/ProfileManager/src/pmanagerEx.cpp @@ -49,8 +49,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) static INT_PTR ChangePM(WPARAM, LPARAM)
{
wchar_t fn[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), fn, _countof(fn));
- ShellExecute(0, L"open", fn, L"/ForceShowPM", L"", 1);
+ GetModuleFileName(GetModuleHandle(nullptr), fn, _countof(fn));
+ ShellExecute(nullptr, L"open", fn, L"/ForceShowPM", L"", 1);
CallService("CloseAction", 0, 0);
return 0;
}
@@ -58,22 +58,22 @@ static INT_PTR ChangePM(WPARAM, LPARAM) static INT_PTR LoadPM(WPARAM, LPARAM)
{
wchar_t fn[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), fn, _countof(fn));
- ShellExecute(0, L"open", fn, L"/ForceShowPM", L"", 1);
+ GetModuleFileName(GetModuleHandle(nullptr), fn, _countof(fn));
+ ShellExecute(nullptr, L"open", fn, L"/ForceShowPM", L"", 1);
return 0;
}
static INT_PTR CheckDb(WPARAM, LPARAM)
{
- if (MessageBox(0, TranslateT("Miranda NG will exit and Database checker will start.\n\nAre you sure you want to do this?"), TranslateT("Check database"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Miranda NG will exit and Database checker will start.\n\nAre you sure you want to do this?"), TranslateT("Check database"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
wchar_t mirandaPath[MAX_PATH], cmdLine[100];
PROCESS_INFORMATION pi;
STARTUPINFO si = { 0 };
si.cb = sizeof(si);
- GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
+ GetModuleFileName(nullptr, mirandaPath, _countof(mirandaPath));
mir_snwprintf(cmdLine, L"\"%s\" /restart:%d /svc:dbchecker", mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
- CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ CreateProcess(mirandaPath, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi);
}
return 0;
}
@@ -120,7 +120,7 @@ extern "C" __declspec(dllexport) int Load(void) mi.hIcolibItem = iconList[i].hIcolib;
mi.uid = uids[i];
if (i == 3)
- mi.root = NULL;
+ mi.root = nullptr;
Menu_AddMainMenuItem(&mi);
}
diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp index 1e534e6c6a..d018d6a20a 100644 --- a/plugins/QuickContacts/src/options.cpp +++ b/plugins/QuickContacts/src/options.cpp @@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////////////////
-HANDLE hOptHook = NULL;
+HANDLE hOptHook = nullptr;
Options opts;
@@ -76,16 +76,16 @@ void DeInitOptions() // Options page
static OptPageControl controls[] = {
- { NULL, CONTROL_CHECKBOX, IDC_LASTSENTTO, "EnableLastSentTo", (BYTE)TRUE },
- { NULL, CONTROL_RADIO, IDC_GLOBAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_GLOBAL },
- { NULL, CONTROL_RADIO, IDC_LOCAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_LOCAL },
- { NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "ShowOffline%s", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_HIDE_OFFLINE, "HideOfflineFromOfflineProto", (BYTE)TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_APPEND_GROUP, "AppendGroupName", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_GROUP_COLUMN, "GroupColumn", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_GROUP_LEFT, "GroupColumnLeft", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_SUBCONTACTS, "HideSubcontacts", (BYTE)TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_KEEP_OFFLINE, "KeepSubcontactsFromOffline", (BYTE)TRUE }
+ { nullptr, CONTROL_CHECKBOX, IDC_LASTSENTTO, "EnableLastSentTo", (BYTE)TRUE },
+ { nullptr, CONTROL_RADIO, IDC_GLOBAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_GLOBAL },
+ { nullptr, CONTROL_RADIO, IDC_LOCAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_LOCAL },
+ { nullptr, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "ShowOffline%s", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_HIDE_OFFLINE, "HideOfflineFromOfflineProto", (BYTE)TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_APPEND_GROUP, "AppendGroupName", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_GROUP_COLUMN, "GroupColumn", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_GROUP_LEFT, "GroupColumnLeft", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_SUBCONTACTS, "HideSubcontacts", (BYTE)TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_KEEP_OFFLINE, "KeepSubcontactsFromOffline", (BYTE)TRUE }
};
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index b4e00128f5..75034af9ca 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -41,12 +41,12 @@ HINSTANCE hInst; HIMAGELIST hIml;
int hLangpack = 0;
-HANDLE hModulesLoaded = NULL;
-HANDLE hEventAdded = NULL;
-HANDLE hHotkeyPressed = NULL;
+HANDLE hModulesLoaded = nullptr;
+HANDLE hEventAdded = nullptr;
+HANDLE hHotkeyPressed = nullptr;
long main_dialog_open = 0;
-HWND hwndMain = NULL;
+HWND hwndMain = nullptr;
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
int EventAdded(WPARAM wparam, LPARAM lparam);
@@ -128,7 +128,7 @@ int ModulesLoaded(WPARAM, LPARAM) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_ALT, 'Q');
Hotkey_Register(&hkd);
- hkd.pszService = NULL;
+ hkd.pszService = nullptr;
hkd.lParam = HOTKEY_FILE;
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'F');
@@ -304,12 +304,12 @@ void SortArray(void) }
-int GetStatus(MCONTACT hContact, char *proto = NULL)
+int GetStatus(MCONTACT hContact, char *proto = nullptr)
{
- if (proto == NULL)
+ if (proto == nullptr)
proto = GetContactProto(hContact);
- if (proto == NULL)
+ if (proto == nullptr)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
@@ -340,7 +340,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *pszProto = GetContactProto(hContact);
- if(pszProto == NULL)
+ if(pszProto == nullptr)
continue;
// Get meta
@@ -398,7 +398,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) DBVARIANT dbv;
if (db_get_ws(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
- if (dbv.ptszVal != NULL)
+ if (dbv.ptszVal != nullptr)
mir_wstrncpy(contact->szgroup, dbv.ptszVal, _countof(contact->szgroup));
db_free(&dbv);
@@ -410,7 +410,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) mir_wstrncpy(contact->szname, tmp, _countof(contact->szname));
PROTOACCOUNT *acc = Proto_GetAccount(pszProto);
- if (acc != NULL)
+ if (acc != nullptr)
mir_wstrncpy(contact->proto, acc->tszAccountName, _countof(contact->proto));
contact->hcontact = hContact;
@@ -455,7 +455,7 @@ void EnableButtons(HWND hwndDlg, MCONTACT hContact) INT_PTR caps = 0;
char *pszProto = GetContactProto(hContact);
- if (pszProto != NULL)
+ if (pszProto != nullptr)
caps = CallProtoService(pszProto, PS_GETCAPS, PFLAGNUM_1, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), caps & PF1_IMSEND ? TRUE : FALSE);
@@ -476,7 +476,7 @@ int CheckText(HWND hdlg, wchar_t *sztext, BOOL only_enable = FALSE) {
EnableButtons(hwndMain, NULL);
- if(sztext == NULL || sztext[0] == '\0')
+ if(sztext == nullptr || sztext[0] == '\0')
return 0;
size_t len = mir_wstrlen(sztext);
@@ -709,7 +709,7 @@ static void FillButton(HWND hwndDlg, int dlgItem, wchar_t *name, wchar_t *key, H wchar_t tmp[256];
wchar_t *full = tmp;
- if (key == NULL)
+ if (key == nullptr)
full = TranslateW(name);
else
mir_snwprintf(tmp, L"%s (%s)", TranslateW(name), key);
@@ -725,7 +725,7 @@ static void FillCheckbox(HWND hwndDlg, int dlgItem, wchar_t *name, wchar_t *key) wchar_t tmp[256];
wchar_t *full = tmp;
- if (key == NULL)
+ if (key == nullptr)
full = TranslateW(name);
else
mir_snwprintf(tmp, L"%s (%s)", TranslateW(name), key);
@@ -746,12 +746,12 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CreateWindow(L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE,
rc.left - 20, rc.top + (rc.bottom - rc.top - 16) / 2, 16, 16, hwndDlg, (HMENU) IDC_ICO,
- hInst, NULL);
+ hInst, nullptr);
if (!hasNewHotkeyModule)
hAcct = LoadAccelerators(hInst, MAKEINTRESOURCE(ACCEL_TABLE));
- hHook = SetWindowsHookEx(WH_MSGFILTER, HookProc, 0, GetCurrentThreadId());
+ hHook = SetWindowsHookEx(WH_MSGFILTER, HookProc, nullptr, GetCurrentThreadId());
// Combo
SendDlgItemMessage(hwndDlg, IDC_USERNAME, EM_LIMITTEXT, (WPARAM)119, 0);
@@ -759,7 +759,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA // Buttons
FillCheckbox(hwndDlg, IDC_SHOW_ALL_CONTACTS, LPGENW("Show all contacts"), hasNewHotkeyModule ? NULL : L"Ctrl+A");
- FillButton(hwndDlg, IDC_MESSAGE, LPGENW("Send message"), NULL, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ FillButton(hwndDlg, IDC_MESSAGE, LPGENW("Send message"), nullptr, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
FillButton(hwndDlg, IDC_FILE, LPGENW("Send file"), hasNewHotkeyModule ? NULL : L"Ctrl+F", Skin_LoadIcon(SKINICON_EVENT_FILE));
FillButton(hwndDlg, IDC_URL, LPGENW("Send URL"), hasNewHotkeyModule ? NULL : L"Ctrl+U", Skin_LoadIcon(SKINICON_EVENT_URL));
FillButton(hwndDlg, IDC_USERINFO, LPGENW("Open user info"), hasNewHotkeyModule ? NULL : L"Ctrl+I", Skin_LoadIcon(SKINICON_OTHER_USERDETAILS));
@@ -934,7 +934,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MENU), &rc);
HMENU hMenu = Menu_BuildContactMenu(hContact);
- int ret = TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ int ret = TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
if(ret)
@@ -984,7 +984,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_DESTROY:
UnhookWindowsHookEx(hHook);
- hwndMain = NULL;
+ hwndMain = nullptr;
FreeContacts();
InterlockedExchange(&main_dialog_open, 0);
break;
@@ -1122,7 +1122,7 @@ INT_PTR ShowDialog(WPARAM, LPARAM) {
InterlockedExchange(&main_dialog_open, 1);
- hwndMain = CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, MainDlgProc);
+ hwndMain = CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc);
}
// Show it
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 015c19f6e0..ba4cccf945 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ListData* ButtonsList[100]; -SortedList* QuickList = NULL; +SortedList* QuickList = nullptr; typedef void(*ItemDestuctor)(void*); @@ -29,7 +29,7 @@ int sstSortButtons(const void * vmtbi1, const void * vmtbi2) { ButtonData * mtbi1 = (ButtonData *)*((ButtonData **)vmtbi1); ButtonData * mtbi2 = (ButtonData *)*((ButtonData **)vmtbi2); - if (mtbi1 == NULL || mtbi2 == NULL) return (mtbi1 - mtbi2); + if (mtbi1 == nullptr || mtbi2 == nullptr) return (mtbi1 - mtbi2); return mtbi1->dwPos - mtbi2->dwPos; } @@ -37,7 +37,7 @@ int sstQuickSortButtons(const void * vmtbi1, const void * vmtbi2) { QuickData * mtbi1 = (QuickData *)*((QuickData **)vmtbi1); QuickData * mtbi2 = (QuickData *)*((QuickData **)vmtbi2); - if (mtbi1 == NULL || mtbi2 == NULL) return (mtbi1 - mtbi2); + if (mtbi1 == nullptr || mtbi2 == nullptr) return (mtbi1 - mtbi2); return mtbi1->dwPos - mtbi2->dwPos; } @@ -46,7 +46,7 @@ int sstOpSortButtons(const void * vmtbi1, const void * vmtbi2) { ButtonData * mtbi1 = (ButtonData *)*((ButtonData **)vmtbi1); ButtonData * mtbi2 = (ButtonData *)*((ButtonData **)vmtbi2); - if (mtbi1 == NULL || mtbi2 == NULL) return (mtbi1 - mtbi2); + if (mtbi1 == nullptr || mtbi2 == nullptr) return (mtbi1 - mtbi2); return mtbi1->dwOPPos - mtbi2->dwOPPos; } @@ -81,7 +81,7 @@ void li_SortList(SortedList *pList, FSortFunc pSortFunct) FSortFunc pOldSort = pList->sortFunc; int i; if (!pSortFunct) pSortFunct = pOldSort; - pList->sortFunc = NULL; + pList->sortFunc = nullptr; for (i = 0; i < pList->realCount - 1; i++) if (pOldSort(pList->items[i], pList->items[i + 1]) < 0) { void * temp = pList->items[i]; @@ -100,8 +100,8 @@ void li_ZeroQuickList(SortedList *pList) QuickData * qd = (QuickData *)pList->items[i]; qd->dwPos = 0; qd->bIsService = 0; - qd->ptszValue = NULL; - qd->ptszValueName = NULL; + qd->ptszValue = nullptr; + qd->ptszValueName = nullptr; List_Remove(pList, i); i--; } @@ -140,10 +140,10 @@ void DestroyButton(int listnum) li_ListDestruct((SortedList*)ld->sl, listdestructor); mir_free(ld); - ButtonsList[i] = NULL; + ButtonsList[i] = nullptr; while (ButtonsList[i + 1]) { ButtonsList[i] = ButtonsList[i + 1]; - ButtonsList[i + 1] = NULL; + ButtonsList[i + 1] = nullptr; i++; } } @@ -227,7 +227,7 @@ static HANDLE AddIcon(char* szIcoName) wchar_t tszPath[MAX_PATH]; GetModuleFileName(hinstance, tszPath, _countof(tszPath)); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_PATH_UNICODE; sid.section.a = "Quick Messages"; sid.description.a = szIcoName; @@ -266,8 +266,8 @@ void InitButtonsList() int i, j, k = 0; QuickList = List_Create(0, 1); for (i = 0; i < g_iButtonsCount; i++) { - wchar_t* pszBName = NULL; - ListData* ld = NULL; + wchar_t* pszBName = nullptr; + ListData* ld = nullptr; if (!(pszBName = getMenuEntry(i, 0, 3))) { g_iButtonsCount = i; db_set_b(NULL, PLGNAME, "ButtonsCount", (BYTE)g_iButtonsCount); @@ -283,8 +283,8 @@ void InitButtonsList() ld->dwOPFlags = 0; ld->bIsServName = ld->bIsOpServName = getEntryByte(i, 0, 3); for (j = 0;; j++) { - wchar_t* pszEntry = NULL; - ButtonData *bd = NULL; + wchar_t* pszEntry = nullptr; + ButtonData *bd = nullptr; if (!(pszEntry = getMenuEntry(i, j, 0))) break; @@ -330,7 +330,7 @@ void DestructButtonsList() wchar_t* getMenuEntry(int buttonnum, int entrynum, BYTE mode) { - wchar_t* buffer = NULL; + wchar_t* buffer = nullptr; char szMEntry[256]; DBVARIANT dbv; @@ -384,13 +384,13 @@ int RegisterCustomButton(WPARAM, LPARAM) wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, wchar_t* ptszClip, int QVSize, int TextSize, int ClipSize) { int i = 0, iOffset = 0; - wchar_t* tempPointer = NULL; + wchar_t* tempPointer = nullptr; wchar_t* ptszQValue = wcsdup(ptszQValIn); wchar_t* tempQValue = ptszQValue; wchar_t varstr = '%'; - wchar_t* p = NULL; + wchar_t* p = nullptr; int NameLenght = 0; - wchar_t* ptszName = NULL; + wchar_t* ptszName = nullptr; if (!wcschr(ptszQValue, varstr)) return ptszQValue; @@ -404,7 +404,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, if (ptszQValue[i] != '%') goto move_next; NameLenght = 0; - ptszName = NULL; + ptszName = nullptr; switch (ptszQValue[i + 1]) { case 't': @@ -493,7 +493,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, break; case 'F': ptszName = Contact_GetInfo(CNF_FIRSTNAME, hContact); - if (ptszName == NULL) + if (ptszName == nullptr) break; NameLenght = (int)mir_wstrlen(ptszName); p = (wchar_t *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(wchar_t)); @@ -519,7 +519,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, break; case 'L': ptszName = Contact_GetInfo(CNF_LASTNAME, hContact); - if (ptszName == NULL) + if (ptszName == nullptr) break; NameLenght = (int)mir_wstrlen(ptszName); diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index c889776178..f16c798875 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -55,7 +55,7 @@ int PreShutdown(WPARAM, LPARAM) static int InputMenuPopup(WPARAM, LPARAM lParam)
{
- HMENU hSubMenu = NULL;
+ HMENU hSubMenu = nullptr;
int i = 0;
MessageWindowPopupData *mwpd = (MessageWindowPopupData *)lParam;
if (mwpd->uFlags == MSG_WINDOWPOPUP_LOG || !g_bQuickMenu || !QuickList->realCount)
@@ -65,12 +65,12 @@ static int InputMenuPopup(WPARAM, LPARAM lParam) hSubMenu = CreatePopupMenu();
InsertMenu((HMENU)mwpd->hMenu, 6, MF_STRING | MF_POPUP | MF_BYPOSITION, (UINT_PTR)hSubMenu, TranslateT("Quick Messages"));
- InsertMenu((HMENU)mwpd->hMenu, 7, MF_SEPARATOR | MF_BYPOSITION, 0, 0);
+ InsertMenu((HMENU)mwpd->hMenu, 7, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr);
qsort(QuickList->items, QuickList->realCount, sizeof(QuickData *), sstQuickSortButtons);
for (i = 0; i < QuickList->realCount; i++) {
QuickData *qd = (QuickData*)QuickList->items[i];
if (qd->fEntryType & QMF_EX_SEPARATOR)
- AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hSubMenu, MF_SEPARATOR, 0, nullptr);
else
AppendMenu(hSubMenu, MF_STRING, qd->dwPos + 254, qd->ptszValueName);
}
@@ -87,8 +87,8 @@ static int InputMenuPopup(WPARAM, LPARAM lParam) if (IsClipboardFormatAvailable(CF_TEXT)) {
if (OpenClipboard(mwpd->hwnd)) {
- HANDLE hData = NULL;
- wchar_t* chBuffer = NULL;
+ HANDLE hData = nullptr;
+ wchar_t* chBuffer = nullptr;
int textLength = 0;
hData = GetClipboardData(CF_UNICODETEXT);
@@ -200,7 +200,7 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) if (!g_iButtonsCount)
break;
- HMENU hMenu = CreatePopupMenu(), hSubMenu = NULL;
+ HMENU hMenu = CreatePopupMenu(), hSubMenu = nullptr;
for (int menunum = 0; menunum < sl->realCount; menunum++) {
ButtonData *bd = (ButtonData *)sl->items[menunum];
@@ -208,23 +208,23 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) continue;
BOOL bSetPopupMark = FALSE;
- if (bd->pszValue == 0 && bd->fEntryType == 0) {
+ if (bd->pszValue == nullptr && bd->fEntryType == 0) {
hSubMenu = CreatePopupMenu();
bSetPopupMark = TRUE;
}
if (bd->pszValue && bd->fEntryType == 0)
- hSubMenu = NULL;
+ hSubMenu = nullptr;
if (bd->fEntryType & QMF_EX_SEPARATOR)
- AppendMenu((HMENU)((hSubMenu && !bSetPopupMark) ? hSubMenu : hMenu), MF_SEPARATOR, 0, NULL);
+ AppendMenu((HMENU)((hSubMenu && !bSetPopupMark) ? hSubMenu : hMenu), MF_SEPARATOR, 0, nullptr);
else
AppendMenu((HMENU)((hSubMenu && !bSetPopupMark) ? hSubMenu : hMenu),
MF_STRING | (bSetPopupMark ? MF_POPUP : 0),
(bSetPopupMark ? (UINT_PTR)hSubMenu : (menunum + 1)), bd->pszName);
}
- int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
+ int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, nullptr);
if (res == 0)
break;
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index e26d36c13a..a9799aa64d 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -22,12 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. int g_iOPButtonsCount;
BOOL bNeedRestart = FALSE;
BOOL drag = FALSE, bOptionsInit = TRUE;
-HTREEITEM hDragItem = NULL;
-HWND hButtonsList = NULL;
-HWND hMenuTree = NULL;
-HWND hwndEdit = NULL;
+HTREEITEM hDragItem = nullptr;
+HWND hButtonsList = nullptr;
+HWND hMenuTree = nullptr;
+HWND hwndEdit = nullptr;
-HWND g_opHdlg = NULL, g_varhelpDlg = NULL;
+HWND g_opHdlg = nullptr, g_varhelpDlg = nullptr;
INT_PTR CALLBACK HelpDlgProc(HWND hdlg, UINT msg, WPARAM, LPARAM lparam)
{
@@ -54,7 +54,7 @@ INT_PTR CALLBACK HelpDlgProc(HWND hdlg, UINT msg, WPARAM, LPARAM lparam) SendDlgItemMessage(hdlg, IDC_VARCLNAME, WM_SETFONT, (WPARAM)hFont, 0);
GetWindowRect(g_opHdlg, &rc);
- SetWindowPos(hdlg, 0, rc.left, rc.top, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
+ SetWindowPos(hdlg, nullptr, rc.left, rc.top, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
}
break;
@@ -65,7 +65,7 @@ INT_PTR CALLBACK HelpDlgProc(HWND hdlg, UINT msg, WPARAM, LPARAM lparam) case WM_CLOSE:
case WM_DESTROY:
DestroyWindow(g_varhelpDlg);
- g_varhelpDlg = NULL;
+ g_varhelpDlg = nullptr;
break;
default:
@@ -110,7 +110,7 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA void SetMenuEntryProperties(HWND hdlg)
{
TVITEM tvi;
- HTREEITEM hItem = NULL;
+ HTREEITEM hItem = nullptr;
int pos = 0;
if (TreeView_GetCount(hButtonsList) && (tvi.hItem = TreeView_GetSelection(hButtonsList))) {
@@ -130,7 +130,7 @@ void SetMenuEntryProperties(HWND hdlg) }
}
- tvi.hItem = NULL;
+ tvi.hItem = nullptr;
if (TreeView_GetCount(hMenuTree) && (tvi.hItem = TreeView_GetSelection(hMenuTree))) {
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
TreeView_GetItem(hMenuTree, &tvi);
@@ -163,7 +163,7 @@ void SetMenuEntryProperties(HWND hdlg) if (bd->pszOpValue) {
mir_free(bd->pszOpValue);
- bd->pszOpValue = NULL;
+ bd->pszOpValue = nullptr;
}
tvi.hItem = hItem;
continue;
@@ -172,7 +172,7 @@ void SetMenuEntryProperties(HWND hdlg) if (bd->fEntryOpType&QMF_EX_SEPARATOR) {
if (bd->pszOpValue) {
mir_free(bd->pszOpValue);
- bd->pszOpValue = NULL;
+ bd->pszOpValue = nullptr;
}
}
else {
@@ -199,7 +199,7 @@ void SaveMenuTree() BOOL bDeleted = FALSE;
char szMEntry[256] = { '\0' };
wchar_t strbuf[256];
- HTREEITEM hti = NULL;
+ HTREEITEM hti = nullptr;
TVITEM tvi;
g_iButtonsCount = TreeView_GetCount(hButtonsList);
@@ -216,7 +216,7 @@ void SaveMenuTree() BalanceButtons(iBtd, g_iButtonsCount);
while (ButtonsList[iBl]) {
- SortedList * sl = NULL;
+ SortedList * sl = nullptr;
ListData* ld = ButtonsList[iBl];
if (!ld->sl) break;
@@ -233,7 +233,7 @@ void SaveMenuTree() if (ld->ptszQValue)
mir_free(ld->ptszQValue);
- ld->ptszQValue = (ld->ptszOPQValue) ? ld->ptszOPQValue : NULL;
+ ld->ptszQValue = (ld->ptszOPQValue) ? ld->ptszOPQValue : nullptr;
}
if (ld->ptszButtonName)
@@ -253,7 +253,7 @@ void SaveMenuTree() }
if (((ld->dwOPFlags & QMF_NEW) || (ld->dwOPFlags & QMF_RENAMED) || bDeleted)) {
- BBButton bb = { 0 };
+ BBButton bb = {};
bb.pszModuleName = PLGNAME;
bb.dwButtonID = iBl;
bb.pwszTooltip = ld->ptszButtonName;
@@ -289,13 +289,13 @@ void SaveMenuTree() if (bd->pszName != bd->pszOpName) {
if (bd->pszName)
mir_free(bd->pszName);
- bd->pszName = bd->pszOpName ? bd->pszOpName : NULL;
+ bd->pszName = bd->pszOpName ? bd->pszOpName : nullptr;
}
if (bd->pszValue != bd->pszOpValue) {
if (bd->pszValue)
mir_free(bd->pszValue);
- bd->pszValue = bd->pszOpValue ? bd->pszOpValue : NULL;
+ bd->pszValue = bd->pszOpValue ? bd->pszOpValue : nullptr;
}
if (bd->bInQMenu) {
QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData));
@@ -322,7 +322,7 @@ void RestoreModuleData() int iBl = 0, i = 0;
while (ButtonsList[iBl]) {
- SortedList * sl = NULL;
+ SortedList * sl = nullptr;
ListData* ld = ButtonsList[iBl];
if (!(sl = ld->sl)) break;
@@ -336,7 +336,7 @@ void RestoreModuleData() if (ld->ptszOPQValue)
mir_free(ld->ptszOPQValue);
- ld->ptszOPQValue = (ld->ptszQValue) ? ld->ptszQValue : NULL;
+ ld->ptszOPQValue = (ld->ptszQValue) ? ld->ptszQValue : nullptr;
}
ld->bIsOpServName = ld->bIsServName;
@@ -360,13 +360,13 @@ void RestoreModuleData() if (bd->pszName != bd->pszOpName) {
if (bd->pszOpName)
mir_free(bd->pszOpName);
- bd->pszOpName = bd->pszName ? bd->pszName : NULL;
+ bd->pszOpName = bd->pszName ? bd->pszName : nullptr;
}
if (bd->pszValue != bd->pszOpValue) {
if (bd->pszOpValue)
mir_free(bd->pszOpValue);
- bd->pszOpValue = bd->pszValue ? bd->pszValue : NULL;
+ bd->pszOpValue = bd->pszValue ? bd->pszValue : nullptr;
}
}
iBl++;
@@ -377,8 +377,8 @@ static int BuildMenuTree(HWND hToolBarTree, SortedList * sl) {
TVINSERTSTRUCT tvis;
int i;
- HTREEITEM hParent = NULL;
- tvis.hParent = NULL;
+ HTREEITEM hParent = nullptr;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT;
@@ -397,7 +397,7 @@ static int BuildMenuTree(HWND hToolBarTree, SortedList * sl) tvis.item.pszText = bd->pszOpName;
if (bd->fEntryOpType == 0)
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
hParent = TreeView_InsertItem(hToolBarTree, &tvis);
if (tvis.hParent) TreeView_Expand(hMenuTree, tvis.hParent, TVE_EXPAND);
@@ -412,7 +412,7 @@ static int BuildButtonsList(HWND hToolBarTree) {
TVINSERTSTRUCT tvis;
int i = 0;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT;
@@ -563,8 +563,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case WM_LBUTTONUP:
if (drag) {
TVHITTESTINFO hti;
- HTREEITEM htiAfter = NULL;
- ButtonData* bd = NULL;
+ HTREEITEM htiAfter = nullptr;
+ ButtonData* bd = nullptr;
TVITEM tvi;
RECT rc;
BYTE height;
@@ -572,7 +572,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) TreeView_SetInsertMark(hMenuTree, NULL, 0);
ReleaseCapture();
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
hti.pt.x = (SHORT)LOWORD(lparam);
hti.pt.y = (SHORT)HIWORD(lparam);
@@ -658,17 +658,17 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) BYTE height = (BYTE)(rc.bottom - rc.top);
if (hti.pt.y - (height / 3) < rc.top) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
TreeView_SetInsertMark(hMenuTree, hti.hItem, 0);
}
else
if (hti.pt.y + (height / 3) > rc.bottom) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
TreeView_SetInsertMark(hMenuTree, hti.hItem, 1);
}
else {
TreeView_SetInsertMark(hMenuTree, NULL, 0);
- SetCursor(LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(183)));
+ SetCursor(LoadCursor(GetModuleHandle(nullptr), MAKEINTRESOURCE(183)));
}
}
}
@@ -683,7 +683,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case WM_DESTROY:
if (g_varhelpDlg)
DestroyWindow(g_varhelpDlg);
- g_varhelpDlg = NULL;
+ g_varhelpDlg = nullptr;
break;
case WM_NOTIFY:
@@ -724,7 +724,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case TVN_ENDLABELEDIT:
{
TVITEM tvi;
- ButtonData* bd = NULL;
+ ButtonData* bd = nullptr;
wchar_t strbuf[256];
wchar_t szLabel[256];
@@ -735,7 +735,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) TreeView_GetItem(hMenuTree, &tvi);
GetWindowText(hwndEdit, szLabel, _countof(szLabel));
- hwndEdit = NULL;
+ hwndEdit = nullptr;
if (!mir_wstrlen(szLabel)) break;
if (bd = (ButtonData*)tvi.lParam) {
if (!mir_wstrcmp(szLabel, L"---")) {
@@ -778,7 +778,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case TVN_SELCHANGING:
{
HTREEITEM hti = TreeView_GetSelection(hMenuTree);
- if (hti == NULL)
+ if (hti == nullptr)
break;
TVITEM tvi;
@@ -806,7 +806,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case TVN_SELCHANGED:
{
HTREEITEM hti = TreeView_GetSelection(hMenuTree);
- if (hti == NULL)
+ if (hti == nullptr)
break;
TVITEM tvi;
@@ -864,7 +864,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) TreeView_GetItem(hButtonsList, &tvi);
GetWindowText(hwndEdit, szLabel, _countof(szLabel));
- hwndEdit = NULL;
+ hwndEdit = nullptr;
if (!mir_wstrlen(szLabel)) break;
tvi.pszText = szLabel;
@@ -882,7 +882,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case TVN_SELCHANGED:
{
HTREEITEM hti = TreeView_GetSelection(hButtonsList);
- if (hti == NULL || !TreeView_GetCount(hButtonsList)) {
+ if (hti == nullptr || !TreeView_GetCount(hButtonsList)) {
EnableWindow(GetDlgItem(hdlg, IDC_MENUVALUE), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_ISSERVNAME), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_INQMENU), FALSE);
@@ -920,20 +920,20 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) switch (LOWORD(wparam)) {
case IDC_VARHELP:
if (!g_varhelpDlg)
- g_varhelpDlg = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_HELPDIALOG), 0, HelpDlgProc);
+ g_varhelpDlg = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_HELPDIALOG), nullptr, HelpDlgProc);
else
//ShowWindow(g_varhelpDlg,SW_SHOWDEFAULT);
- SetWindowPos(g_varhelpDlg, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
+ SetWindowPos(g_varhelpDlg, nullptr, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
break;
case IDC_BLISTADD:
{
TVINSERTSTRUCT tvis;
- ListData* ld = NULL;
+ ListData* ld = nullptr;
wchar_t namebuff[MAX_PATH] = { '\0' };
int count = TreeView_GetCount(hButtonsList);
if (count > 10) break;
if (g_iOPButtonsCount == 99) {
- MessageBox(NULL, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"), MB_OK);
+ MessageBox(nullptr, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"), MB_OK);
break;
}
@@ -943,10 +943,10 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) ld->sl = List_Create(0, 1);
ld->dwOPFlags = QMF_NEW;
ld->bIsOpServName = 0;
- ld->ptszButtonName = NULL;
- ld->ptszOPQValue = NULL;
- ld->ptszQValue = NULL;
- tvis.hParent = NULL;
+ ld->ptszButtonName = nullptr;
+ ld->ptszOPQValue = nullptr;
+ ld->ptszQValue = nullptr;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, _countof(namebuff));
@@ -989,8 +989,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) {
TVINSERTSTRUCT tvis;
TVITEM tvi;
- ButtonData *bd = NULL;
- SortedList *sl = NULL;
+ ButtonData *bd = nullptr;
+ SortedList *sl = nullptr;
wchar_t namebuff[MAX_PATH] = { '\0' };
if (!TreeView_GetCount(hButtonsList)) break;
@@ -1006,8 +1006,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) bd->pszOpValue = mir_wstrdup(bd->pszOpName);
bd->fEntryOpType = !mir_wstrcmp(namebuff, L"---") ? QMF_EX_SEPARATOR : 0;
bd->dwOPFlags = QMF_NEW;
- bd->pszName = NULL;
- bd->pszValue = NULL;
+ bd->pszName = nullptr;
+ bd->pszValue = nullptr;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -1018,7 +1018,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) List_InsertPtr(sl, bd);
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT;
tvis.item.pszText = bd->pszOpName;
@@ -1030,8 +1030,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) {
TVITEM tvi;
TVINSERTSTRUCT tvis;
- HTREEITEM hti = NULL;
- ButtonData *bd = NULL;
+ HTREEITEM hti = nullptr;
+ ButtonData *bd = nullptr;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
if (!(tvi.hItem = TreeView_GetSelection(hMenuTree)))
break;
@@ -1050,7 +1050,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
TreeView_GetItem(hMenuTree, &tvi);
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.item = tvi;
TreeView_InsertItem(hMenuTree, &tvis);
tvi.hItem = TreeView_GetNextSibling(hMenuTree, tvi.hItem);
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 73a8172070..5335379dd1 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -78,15 +78,15 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) if (value == nullptr)
replyList.insert(mir_wstrdup(L""));
else
- replyList.insert(variables_parsedup(value, 0, wParam));
+ replyList.insert(variables_parsedup(value, nullptr, wParam));
if (!mir_wstrcmp(value, L"---"))
- AppendMenu((HMENU)hMenu, MF_SEPARATOR, i + 1, NULL);
+ AppendMenu((HMENU)hMenu, MF_SEPARATOR, i + 1, nullptr);
else
AppendMenu((HMENU)hMenu, MF_STRING, i + 1, replyList[i]);
}
- int index = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
+ int index = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, nullptr);
if (index > 0) {
if (mir_wstrcmp(replyList[index - 1], L"")) {
CallService(MS_MSG_SENDMESSAGEW, cbcd->hContact, (LPARAM)replyList[index - 1]);
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index 157e6a3e85..29477c53a7 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -91,7 +91,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if (HIWORD(wParam) == BN_CLICKED) {
switch (LOWORD(wParam)) {
case IDC_VARIABLES:
- variables_showhelp(hwndDlg, IDC_REPLIES, VHF_SIMPLEDLG, NULL, NULL);
+ variables_showhelp(hwndDlg, IDC_REPLIES, VHF_SIMPLEDLG, nullptr, nullptr);
break;
case IDC_IMMEDIATELY:
diff --git a/plugins/QuickReplies/src/quickreplies.cpp b/plugins/QuickReplies/src/quickreplies.cpp index 69707049fa..cf424fa336 100644 --- a/plugins/QuickReplies/src/quickreplies.cpp +++ b/plugins/QuickReplies/src/quickreplies.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInstance = NULL;
+HINSTANCE hInstance = nullptr;
int hLangpack;
PLUGININFOEX pluginInfoEx = {
diff --git a/plugins/Quotes/src/ComHelper.cpp b/plugins/Quotes/src/ComHelper.cpp index 6228ae9526..0dc689133f 100644 --- a/plugins/Quotes/src/ComHelper.cpp +++ b/plugins/Quotes/src/ComHelper.cpp @@ -11,7 +11,7 @@ tstring ComException2Msg(_com_error& e, const tstring& rsAdditionalInfo) IErrorInfo* p = e.ErrorInfo();
CComPtr<IErrorInfo> pErrorInfo(p);
- if (NULL != p)
+ if (nullptr != p)
p->Release();
if (pErrorInfo)
@@ -24,5 +24,5 @@ void ShowComError(_com_error& e, const tstring& rsAdditionalInfo) {
tstring sErrorMsg = ComException2Msg(e, rsAdditionalInfo);
LogIt(sErrorMsg);
- Quotes_MessageBox(NULL, sErrorMsg.c_str(), MB_OK | MB_ICONERROR);
+ Quotes_MessageBox(nullptr, sErrorMsg.c_str(), MB_OK | MB_ICONERROR);
}
diff --git a/plugins/Quotes/src/CommonOptionDlg.cpp b/plugins/Quotes/src/CommonOptionDlg.cpp index d2edc48c16..4429ff1aa3 100644 --- a/plugins/Quotes/src/CommonOptionDlg.cpp +++ b/plugins/Quotes/src/CommonOptionDlg.cpp @@ -17,7 +17,7 @@ CAdvProviderSettings* get_adv_settings(const IQuotesProvider* pProvider, bool bC return pAdvSet.get();
}
- return NULL;
+ return nullptr;
}
void remove_adv_settings(const IQuotesProvider *pProvider)
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index faf1d09a3d..f2917ad03c 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -18,12 +18,12 @@ static CQuotesProviderGoogle* get_google_provider() }
assert(!"We should never get here!");
- return NULL;
+ return nullptr;
}
-CQuotesProviderGoogle::CQuoteSection get_quotes(const CQuotesProviderGoogle* pProvider = NULL)
+CQuotesProviderGoogle::CQuoteSection get_quotes(const CQuotesProviderGoogle* pProvider = nullptr)
{
- if (NULL == pProvider)
+ if (nullptr == pProvider)
pProvider = get_google_provider();
if (pProvider) {
@@ -242,7 +242,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM case NM_CLICK:
if (IDC_SYSLINK_PROVIDER == wp) {
PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
- ::ShellExecute(hDlg, L"open", pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecute(hDlg, L"open", pNMLink->item.szUrl, nullptr, nullptr, SW_SHOWNORMAL);
}
break;
}
@@ -255,11 +255,11 @@ INT_PTR QuotesMenu_CurrencyConverter(WPARAM, LPARAM) {
MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, true);
HWND hWnd = WindowList_Find(hWL, NULL);
- if (NULL != hWnd) {
+ if (nullptr != hWnd) {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CURRENCY_CONVERTER), NULL, CurrencyConverterDlgProc, 0);
+ else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CURRENCY_CONVERTER), nullptr, CurrencyConverterDlgProc, 0);
return 0;
}
diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp index dffcb18c5d..19e8088286 100644 --- a/plugins/Quotes/src/DBUtils.cpp +++ b/plugins/Quotes/src/DBUtils.cpp @@ -4,11 +4,11 @@ std::string Quotes_DBGetStringA(MCONTACT hContact, const char* szModule, const c {
std::string sResult;
char* pszSymbol = db_get_sa(hContact, szModule, szSetting);
- if (NULL != pszSymbol) {
+ if (nullptr != pszSymbol) {
sResult = pszSymbol;
mir_free(pszSymbol);
}
- else if (NULL != pszDefValue)
+ else if (nullptr != pszDefValue)
sResult = pszDefValue;
return sResult;
@@ -18,11 +18,11 @@ std::wstring Quotes_DBGetStringW(MCONTACT hContact, const char* szModule, const {
std::wstring sResult;
wchar_t* pszSymbol = db_get_wsa(hContact, szModule, szSetting);
- if (NULL != pszSymbol) {
+ if (nullptr != pszSymbol) {
sResult = pszSymbol;
mir_free(pszSymbol);
}
- else if (NULL != pszDefValue)
+ else if (nullptr != pszDefValue)
sResult = pszDefValue;
return sResult;
diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp index ce5b7ded1c..5fdff8d004 100644 --- a/plugins/Quotes/src/ExtraImages.cpp +++ b/plugins/Quotes/src/ExtraImages.cpp @@ -24,7 +24,7 @@ bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex) hIcolib = Quotes_GetIconHandle(IDI_ICON_NOTCHANGED);
break;
default:
- hIcolib = NULL;
+ hIcolib = nullptr;
}
return ExtraIcon_SetIcon(hExtraIcon, hContact, hIcolib) == 0;
}
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 32ffb684a8..0a56404ca4 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -4,16 +4,16 @@ #include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInstance = NULL;
+HINSTANCE g_hInstance = nullptr;
HANDLE g_hEventWorkThreadStop;
//int g_nStatus = ID_STATUS_OFFLINE;
bool g_bAutoUpdate = true;
-HGENMENU g_hMenuEditSettings = NULL;
-HGENMENU g_hMenuOpenLogFile = NULL;
+HGENMENU g_hMenuEditSettings = nullptr;
+HGENMENU g_hMenuOpenLogFile = nullptr;
#ifdef CHART_IMPLEMENT
-HGENMENU g_hMenuChart = NULL;
+HGENMENU g_hMenuChart = nullptr;
#endif
-HGENMENU g_hMenuRefresh = NULL, g_hMenuRoot = NULL;
+HGENMENU g_hMenuRefresh = nullptr, g_hMenuRoot = nullptr;
#define DB_STR_AUTO_UPDATE "AutoUpdate"
@@ -137,7 +137,7 @@ void InitMenu() SET_UID(mi, 0x19a16fa2, 0xf370, 0x4201, 0x92, 0x9, 0x25, 0xde, 0x4e, 0x55, 0xf9, 0x1a);
mi.name.w = LPGENW("Open Log File...");
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.pszService = "Quotes/OpenLogFile";
g_hMenuOpenLogFile = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME);
Menu_ConfigureItem(g_hMenuOpenLogFile, MCI_OPT_EXECPARAM, 1);
@@ -146,7 +146,7 @@ void InitMenu() #ifdef CHART_IMPLEMENT
SET_UID(mi, 0x65da7256, 0x43a2, 0x4857, 0xac, 0x52, 0x1c, 0xb7, 0xff, 0xd7, 0x96, 0xfa);
mi.name.w = LPGENW("Chart...");
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.pszService = "Quotes/Chart";
g_hMenuChart = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME);
CreateServiceFunction(mi.pszService, QuotesMenu_Chart);
@@ -154,7 +154,7 @@ void InitMenu() SET_UID(mi, 0xac5fc17, 0x5640, 0x4f81, 0xa3, 0x44, 0x8c, 0xb6, 0x9a, 0x5c, 0x98, 0xf);
mi.name.w = LPGENW("Edit Settings...");
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.pszService = "Quotes/EditSettings";
g_hMenuEditSettings = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME);
#ifdef CHART_IMPLEMENT
@@ -167,7 +167,7 @@ void InitMenu() int Quotes_OnToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.name = LPGEN("Enable/Disable Quotes Auto Update");
ttb.pszService = g_pszAutoUpdateCmd;
ttb.pszTooltipUp = LPGEN("Quotes Auto Update Enabled");
@@ -202,7 +202,7 @@ int QuotesEventFunc_OnModulesLoaded(WPARAM, LPARAM) {
CHTTPSession::Init();
- g_hEventWorkThreadStop = ::CreateEvent(NULL, TRUE, FALSE, NULL);
+ g_hEventWorkThreadStop = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
HookEvent(ME_USERINFO_INITIALISE, QuotesEventFunc_OnUserInfoInit);
HookEvent(ME_CLIST_DOUBLECLICKED, Quotes_OnContactDoubleClick);
diff --git a/plugins/Quotes/src/HTMLParserMS.cpp b/plugins/Quotes/src/HTMLParserMS.cpp index c79c32ed5d..c2f8962063 100644 --- a/plugins/Quotes/src/HTMLParserMS.cpp +++ b/plugins/Quotes/src/HTMLParserMS.cpp @@ -153,13 +153,13 @@ private: CHTMLParserMS::CHTMLParserMS() : m_bCallUninit(false)
{
try {
- CheckError(::CoInitialize(NULL));
+ CheckError(::CoInitialize(nullptr));
m_bCallUninit = true;
_com_util::CheckError(
::CoCreateInstance(CLSID_HTMLDocument,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2,
(LPVOID*)&m_pDoc)
@@ -217,14 +217,14 @@ bool CHTMLParserMS::IsInstalled() bool bResult = true;
bool bCallUninit = false;
try {
- CheckError(::CoInitialize(NULL));
+ CheckError(::CoInitialize(nullptr));
bCallUninit = true;
CComPtr<IHTMLDocument2> pDoc;
_com_util::CheckError(
::CoCreateInstance(CLSID_HTMLDocument,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2,
reinterpret_cast<LPVOID*>(&pDoc))
diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index 7c9ea5a880..0dbfac3441 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -30,17 +30,17 @@ public: static bool Init()
{
- assert(NULL == g_hNetLib);
+ assert(nullptr == g_hNetLib);
NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = QUOTES_PROTOCOL_NAME;
nlu.szDescriptiveName.w = TranslateT("Quotes HTTP connections");
g_hNetLib = Netlib_RegisterUser(&nlu);
- return (NULL != g_hNetLib);
+ return (nullptr != g_hNetLib);
}
- static bool IsValid() { return NULL != g_hNetLib; }
+ static bool IsValid() { return nullptr != g_hNetLib; }
virtual bool OpenURL(const tstring& rsURL)
{
@@ -80,7 +80,7 @@ public: // nlhr.headers[5].szValue = cookie;
bool bResult = false;
- NETLIBHTTPREQUEST* pReply = NULL;
+ NETLIBHTTPREQUEST* pReply = nullptr;
{
mir_cslock lck(m_mx);
pReply = Netlib_HttpTransaction(g_hNetLib, &nlhr);
@@ -94,7 +94,7 @@ public: char* pResult = &*(apBuffer.begin());
int nIndex = find_header(pReply, "Content-Type");
- if ((-1 != nIndex) && (NULL != strstr(_strlwr(pReply->headers[nIndex].szValue), "utf-8"))) {
+ if ((-1 != nIndex) && (nullptr != strstr(_strlwr(pReply->headers[nIndex].szValue), "utf-8"))) {
wchar_t* p = mir_utf8decodeW(pResult);
rsResponce = p;
mir_free(p);
@@ -123,7 +123,7 @@ private: mutable mir_cs m_mx;
};
-HNETLIBUSER CImplMI::g_hNetLib = NULL;
+HNETLIBUSER CImplMI::g_hNetLib = nullptr;
CHTTPSession::CHTTPSession()
: m_pImpl(new CImplMI)
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp index d2ea08eee0..60a7880328 100644 --- a/plugins/Quotes/src/IconLib.cpp +++ b/plugins/Quotes/src/IconLib.cpp @@ -27,7 +27,7 @@ HICON Quotes_LoadIconEx(int iconId, bool bBig /*= false*/) if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, bBig);
- return NULL;
+ return nullptr;
}
HANDLE Quotes_GetIconHandle(int iconId)
@@ -36,5 +36,5 @@ HANDLE Quotes_GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index 468558b7be..89fbeec022 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -173,7 +173,7 @@ bool show_open_file_dialog(bool bOpen, tstring& rsFile) ofn.lStructSize = sizeof(OPENFILENAME);
- ofn.hwndOwner = NULL;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFilter = prepare_filter(szFilter, MAX_PATH);
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
ofn.lpstrDefExt = L"xml";
@@ -203,7 +203,7 @@ INT_PTR Quotes_Export(WPARAM wp, LPARAM lp) {
tstring sFileName;
const char* pszFile = reinterpret_cast<const char*>(lp);
- if (NULL == pszFile) {
+ if (nullptr == pszFile) {
if (false == show_open_file_dialog(false, sFileName))
return -1;
}
@@ -626,7 +626,7 @@ INT_PTR Quotes_Import(WPARAM wp, LPARAM lp) tstring sFileName;
const char* pszFile = reinterpret_cast<const char*>(lp);
- if (NULL == pszFile) {
+ if (nullptr == pszFile) {
if (false == show_open_file_dialog(true, sFileName))
return -1;
}
diff --git a/plugins/Quotes/src/Locale.cpp b/plugins/Quotes/src/Locale.cpp index ae79f71eb6..43493fb127 100644 --- a/plugins/Quotes/src/Locale.cpp +++ b/plugins/Quotes/src/Locale.cpp @@ -8,10 +8,10 @@ const std::locale GetSystemLocale() tstring get_int_registry_value(LPCTSTR pszValueName)
{
tstring sResult;
- HKEY hKey = NULL;
+ HKEY hKey = nullptr;
LONG lResult = ::RegOpenKeyEx(HKEY_CURRENT_USER,
L"Control Panel\\International", 0, KEY_QUERY_VALUE, &hKey);
- if ((ERROR_SUCCESS == lResult) && (NULL != hKey)) {
+ if ((ERROR_SUCCESS == lResult) && (nullptr != hKey)) {
DWORD dwType = 0;
DWORD dwSize = 0;
lResult = ::RegQueryValueEx(hKey, pszValueName, nullptr, &dwType, nullptr, &dwSize);
@@ -23,7 +23,7 @@ tstring get_int_registry_value(LPCTSTR pszValueName) }
}
- if (NULL != hKey) {
+ if (nullptr != hKey) {
lResult = ::RegCloseKey(hKey);
assert(ERROR_SUCCESS == lResult);
}
diff --git a/plugins/Quotes/src/ModuleInfo.cpp b/plugins/Quotes/src/ModuleInfo.cpp index a362bf9133..7a72063270 100644 --- a/plugins/Quotes/src/ModuleInfo.cpp +++ b/plugins/Quotes/src/ModuleInfo.cpp @@ -20,7 +20,7 @@ CModuleInfo& CModuleInfo::GetInstance() MWindowList CModuleInfo::GetWindowList(const std::string& rsKey, bool bAllocateIfNonExist /*= true*/)
{
- MWindowList hResult = NULL;
+ MWindowList hResult = nullptr;
THandles::const_iterator i = m_ahWindowLists.find(rsKey);
if (i != m_ahWindowLists.end()) {
hResult = i->second;
@@ -84,12 +84,12 @@ bool CModuleInfo::Verify() return false;
if (!GetXMLEnginePtr()) {
- Quotes_MessageBox(NULL, TranslateT("Miranda could not load Quotes plugin. XML parser is missing."), MB_OK | MB_ICONERROR);
+ Quotes_MessageBox(nullptr, TranslateT("Miranda could not load Quotes plugin. XML parser is missing."), MB_OK | MB_ICONERROR);
return false;
}
if (!g_pHTMLEngine && (false == CHTMLParserMS::IsInstalled())) {
- Quotes_MessageBox(NULL,
+ Quotes_MessageBox(nullptr,
TranslateT("Miranda could not load Quotes plugin. Microsoft HTML parser is missing."),
MB_YESNO | MB_ICONQUESTION);
return false;
diff --git a/plugins/Quotes/src/OptionDukasCopy.cpp b/plugins/Quotes/src/OptionDukasCopy.cpp index 12c53f1753..d8ff58068c 100644 --- a/plugins/Quotes/src/OptionDukasCopy.cpp +++ b/plugins/Quotes/src/OptionDukasCopy.cpp @@ -42,7 +42,7 @@ bool add_quote_to_tree(const CQuotesProviderDukasCopy::CQuote& q, HWND hwndTree, ::PostMessage(hDlg, TREE_VIEW_CHECK_STATE_CHANGE, MAKEWPARAM(0, TCBS_CHECKED), reinterpret_cast<LPARAM>(hti));
}
- return (NULL != hti && bChecked);
+ return (nullptr != hti && bChecked);
}
void add_section_to_tree(const CQuotesProviderDukasCopy::CQuoteSection& qs,
@@ -220,7 +220,7 @@ CQuotesProviderDukasCopy* get_dukas_copy_provider() }
assert(!"We should never get here!");
- return NULL;
+ return nullptr;
}
INT_PTR CALLBACK EconomicRatesDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index 14e2cd8ae7..4a9922e76b 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -15,7 +15,7 @@ MCONTACT g_hContact; inline bool IsMyContact(MCONTACT hContact)
{
CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
- return (NULL != pProvider);
+ return (nullptr != pProvider);
}
inline MCONTACT get_contact(HWND hWnd)
@@ -82,7 +82,7 @@ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WP case NM_CLICK:
if (IDC_SYSLINK_PROVIDER == wParam) {
PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
- ::ShellExecute(hdlg, L"open", pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecute(hdlg, L"open", pNMLink->item.szUrl, nullptr, nullptr, SW_SHOWNORMAL);
}
break;
}
@@ -143,7 +143,7 @@ INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM) tstring sLogFileName;
if ((true == get_log_file(hContact, sLogFileName)) && (false == sLogFileName.empty()))
- ::ShellExecute(NULL, L"open", sLogFileName.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecute(nullptr, L"open", sLogFileName.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
return 0;
}
@@ -216,12 +216,12 @@ int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, true);
assert(hWL);
HWND hWnd = WindowList_Find(hWL, hContact);
- if (NULL != hWnd) {
+ if (nullptr != hWnd) {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
else if (true == IsMyContact(hContact))
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), NULL, QuoteInfoDlgProc1, LPARAM(hContact));
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), nullptr, QuoteInfoDlgProc1, LPARAM(hContact));
return 1;
}
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index f90f90e462..86f2cedecf 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -138,8 +138,8 @@ CQuotesProviderBase::CXMLFileInfo init_xml_info(LPCTSTR pszFileName, bool& rbSuc }
CQuotesProviderBase::CQuotesProviderBase()
- : m_hEventSettingsChanged(::CreateEvent(NULL, FALSE, FALSE, NULL)),
- m_hEventRefreshContact(::CreateEvent(NULL, FALSE, FALSE, NULL)),
+ : m_hEventSettingsChanged(::CreateEvent(nullptr, FALSE, FALSE, nullptr)),
+ m_hEventRefreshContact(::CreateEvent(nullptr, FALSE, FALSE, nullptr)),
m_bRefreshInProgress(false)
{
}
@@ -152,7 +152,7 @@ CQuotesProviderBase::~CQuotesProviderBase() bool CQuotesProviderBase::Init()
{
- bool bSucceded = m_pXMLInfo != NULL;
+ bool bSucceded = m_pXMLInfo != nullptr;
if (!m_pXMLInfo) {
CQuotesProviderVisitorDbSettings visitor;
Accept(visitor);
@@ -510,7 +510,7 @@ bool show_popup(const IQuotesProvider* pProvider, const tstring& sTitle = visitor.GetResult();
mir_wstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME);
{
- ptrW ss(variables_parsedup((wchar_t*)rsFormat.c_str(), 0, hContact));
+ ptrW ss(variables_parsedup((wchar_t*)rsFormat.c_str(), nullptr, hContact));
tstring sText = format_rate(pProvider, hContact, tstring(ss));
mir_wstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE);
}
@@ -547,7 +547,7 @@ bool show_popup(const IQuotesProvider* pProvider, void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/)
{
- time_t nTime = ::time(NULL);
+ time_t nTime = ::time(nullptr);
if (false == rsSymbol.empty())
db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsSymbol.c_str());
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 94d39e5d46..d63ac57a46 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -183,7 +183,7 @@ static CQuotesProviderGoogle* get_google_provider() }
assert(!"We should never get here!");
- return NULL;
+ return nullptr;
}
CQuotesProviderGoogle::CQuoteSection get_quotes()
diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index 09d4546573..dcda584269 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -178,7 +178,7 @@ bool get_dif_value(const IHTMLNode::THTMLNodePtr& pNode, CGoogleInfo& rInfo, int ++i;
}
- double* pValue = NULL;
+ double* pValue = nullptr;
switch (nItem) {
case CGoogleInfo::giPercentChangeAfterHours:
pValue = &rInfo.m_dPercentChangeAfterHours;
diff --git a/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp b/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp index c1cd208545..51f4fab953 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp @@ -1,30 +1,30 @@ #include "StdAfx.h"
CQuotesProviderVisitorDbSettings::CQuotesProviderVisitorDbSettings()
- : m_pszDbRefreshRateType(NULL),
- m_pszDbRefreshRateValue(NULL),
- m_pszDbDisplayNameFormat(NULL),
- m_pszDefDisplayFormat(NULL),
- m_pszDefLogFileFormat(NULL),
- m_pszDefHistoryFormat(NULL),
- m_pszXMLIniFileName(NULL),
- m_pszDbStatusMsgFormat(NULL),
- m_pszDefStatusMsgFormat(NULL),
- m_pszDbLogMode(NULL),
- m_pszDbHistoryFormat(NULL),
- m_pszDbHistoryCondition(NULL),
- m_pszDbLogFile(NULL),
- m_pszDbLogFormat(NULL),
- m_pszDbLogCondition(NULL),
- m_pszDbPopupFormat(NULL),
- m_pszDefPopupFormat(NULL),
- m_pszDbPopupCondition(NULL),
- m_pszDbPopupColourMode(NULL),
- m_pszDbPopupBkColour(NULL),
- m_pszDbPopupTextColour(NULL),
- m_pszDbPopupDelayMode(NULL),
- m_pszDbPopupDelayTimeout(NULL),
- m_pszDbPopupHistoryFlag(NULL),
+ : m_pszDbRefreshRateType(nullptr),
+ m_pszDbRefreshRateValue(nullptr),
+ m_pszDbDisplayNameFormat(nullptr),
+ m_pszDefDisplayFormat(nullptr),
+ m_pszDefLogFileFormat(nullptr),
+ m_pszDefHistoryFormat(nullptr),
+ m_pszXMLIniFileName(nullptr),
+ m_pszDbStatusMsgFormat(nullptr),
+ m_pszDefStatusMsgFormat(nullptr),
+ m_pszDbLogMode(nullptr),
+ m_pszDbHistoryFormat(nullptr),
+ m_pszDbHistoryCondition(nullptr),
+ m_pszDbLogFile(nullptr),
+ m_pszDbLogFormat(nullptr),
+ m_pszDbLogCondition(nullptr),
+ m_pszDbPopupFormat(nullptr),
+ m_pszDefPopupFormat(nullptr),
+ m_pszDbPopupCondition(nullptr),
+ m_pszDbPopupColourMode(nullptr),
+ m_pszDbPopupBkColour(nullptr),
+ m_pszDbPopupTextColour(nullptr),
+ m_pszDbPopupDelayMode(nullptr),
+ m_pszDbPopupDelayTimeout(nullptr),
+ m_pszDbPopupHistoryFlag(nullptr),
m_pszDbTendencyFormat(nullptr),
m_pszDefTendencyFormat(L"%r>%p")
{
diff --git a/plugins/Quotes/src/QuotesProviders.cpp b/plugins/Quotes/src/QuotesProviders.cpp index 3a316df3d3..b097901502 100644 --- a/plugins/Quotes/src/QuotesProviders.cpp +++ b/plugins/Quotes/src/QuotesProviders.cpp @@ -66,7 +66,7 @@ void CQuotesProviders::InitProviders() CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(MCONTACT hContact)const
{
char* szProto = GetContactProto(hContact);
- if (NULL == szProto || 0 != ::_stricmp(szProto, QUOTES_PROTOCOL_NAME))
+ if (nullptr == szProto || 0 != ::_stricmp(szProto, QUOTES_PROTOCOL_NAME))
return TQuotesProviderPtr();
tstring sProvider = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_PROVIDER);
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 3a4d3daa52..e9595d65d6 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -122,7 +122,7 @@ void select_log_file(HWND hDlg) struct CSettingWindowParam
{
- CSettingWindowParam(MCONTACT hContact) : m_hContact(hContact), m_pPopupSettings(NULL) {}
+ CSettingWindowParam(MCONTACT hContact) : m_hContact(hContact), m_pPopupSettings(nullptr) {}
~CSettingWindowParam() { delete m_pPopupSettings; }
MCONTACT m_hContact;
@@ -466,11 +466,11 @@ void ShowSettingsDlg(MCONTACT hContact) MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS, true);
assert(hWL);
HWND hWnd = WindowList_Find(hWL, hContact);
- if (NULL != hWnd) {
+ if (nullptr != hWnd) {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), NULL, EditSettingsPerContactDlgProc, LPARAM(hContact));
+ else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), nullptr, EditSettingsPerContactDlgProc, LPARAM(hContact));
}
//////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Quotes/src/XMLEngineMI.cpp b/plugins/Quotes/src/XMLEngineMI.cpp index ed63a63784..413ed619dd 100644 --- a/plugins/Quotes/src/XMLEngineMI.cpp +++ b/plugins/Quotes/src/XMLEngineMI.cpp @@ -72,12 +72,12 @@ public: virtual tstring GetAttributeValue(const tstring& rsAttrName)
{
LPCTSTR pszValue = xmlGetAttrValue(m_hXML, rsAttrName.c_str());
- return ((NULL != pszValue) ? tstring(pszValue) : tstring());
+ return ((nullptr != pszValue) ? tstring(pszValue) : tstring());
}
virtual void Write(tostream& o)const
{
- ptrW ss(xmlToString(m_hXML, NULL));
+ ptrW ss(xmlToString(m_hXML, nullptr));
if (ss != NULL)
o << (char*)T2Utf(ss);
}
@@ -111,7 +111,7 @@ IXMLNode::TXMLNodePtr CXMLEngineMI::LoadFile(const tstring& rsFileName)const int nLen = (int)cBytes;
ptrW ss(mir_utf8decodeW(pBuffer));
if (ss) {
- HXML h = xmlParseString(ss, &nLen, NULL);
+ HXML h = xmlParseString(ss, &nLen, nullptr);
if (h)
pResult = IXMLNode::TXMLNodePtr(new CXMLNodeMI(h, true));
}
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index a461029377..03d440448b 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -37,7 +37,7 @@ HINSTANCE g_hInst;
-static HANDLE hExtraIcon = NULL;
+static HANDLE hExtraIcon = nullptr;
int hLangpack;
PLUGININFOEX pluginInfo =
@@ -77,14 +77,14 @@ static void setExtraIcon(MCONTACT hContact, int bRate = -1, BOOL clear = TRUE) if (bRate < 0)
bRate = db_get_b(hContact, "CList", "Rate", 0);
- const char *icon = NULL;
+ const char *icon = nullptr;
switch (bRate) {
case 1: icon = "rate_low"; break;
case 2: icon = "rate_medium"; break;
case 3: icon = "rate_high"; break;
}
- if (icon != NULL || clear)
+ if (icon != nullptr || clear)
ExtraIcon_SetIconByName(hExtraIcon, hContact, icon);
}
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index f89b112c78..0ed7142472 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -7,7 +7,7 @@ using namespace std; static const basic_string <char>::size_type npos = -1;
char *szProto;
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
int hLangpack = 0;
CHAT_MANAGER *pci;
@@ -63,7 +63,7 @@ void LoadDBSettings() DBVARIANT dbv;
dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = NULL;
+ dbv.pszVal = nullptr;
if (db_get(NULL, MODULENAME, dbLastUC_DateTimeFormat, &dbv) == 0 && dbv.pszVal[0] != 0) {
LastUCOpt.DateTimeFormat = dbv.pszVal;
db_free(&dbv);
@@ -74,7 +74,7 @@ void LoadDBSettings() void ShowListMainDlgProc_AdjustListPos(HWND hDlg, LASTUC_DLG_DATA *DlgDat)
{
HWND hList = GetDlgItem(hDlg, IDC_CONTACTS_LIST);
- if (hList == NULL)
+ if (hList == nullptr)
return;
RECT rc;
@@ -126,11 +126,11 @@ BOOL ShowListMainDlgProc_OpenContactMenu(HWND hDlg, HWND hList, int item, LASTUC ListView_GetItem(hList, &lvi);
if (lvi.lParam != NULL) {
HMENU hCMenu = Menu_BuildContactMenu(lvi.lParam);
- if (hCMenu != NULL) {
+ if (hCMenu != nullptr) {
POINT p;
GetCursorPos(&p);
DlgDat->hContact = (MCONTACT)lvi.lParam;
- BOOL ret = TrackPopupMenu(hCMenu, 0, p.x, p.y, 0, hDlg, NULL);
+ BOOL ret = TrackPopupMenu(hCMenu, 0, p.x, p.y, 0, hDlg, nullptr);
DestroyMenu(hCMenu);
if (ret)
return TRUE;
@@ -154,16 +154,16 @@ void wSetData(char **Data, const char *Value) void wfree(char **Data)
{
if (*Data && mir_strlen(*Data) > 0) mir_free(*Data);
- *Data = NULL;
+ *Data = nullptr;
}
-HWND hwndContactTree = NULL;
+HWND hwndContactTree = nullptr;
INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
LASTUC_DLG_DATA *DlgDat = (LASTUC_DLG_DATA *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
HWND hList = GetDlgItem(hDlg, IDC_CONTACTS_LIST);
- if (hList == NULL)
+ if (hList == nullptr)
return FALSE;
switch (msg) {
@@ -208,7 +208,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM // add conacts to listview
HIMAGELIST hImgList = Clist_GetImageList();
- if (hImgList != NULL)
+ if (hImgList != nullptr)
ListView_SetImageList(hList, hImgList, LVSIL_SMALL);
LVITEM lvi = { 0 };
@@ -221,7 +221,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM string strtimformat;
DBVARIANT dbv;
dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = NULL;
+ dbv.pszVal = nullptr;
if (db_get(NULL, MODULENAME, dbLastUC_DateTimeFormat, &dbv) == 0) {
strtimformat = dbv.pszVal;
db_free(&dbv);
@@ -231,12 +231,12 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM for (auto curContact = DlgDat->Contacts->begin(); curContact != DlgDat->Contacts->end(); curContact++) {
if (curContact->second != NULL && db_get_b(curContact->second, MODULENAME, dbLastUC_IgnoreContact, 0) == 0) {
wchar_t *cname = (wchar_t*)pcli->pfnGetContactDisplayName(curContact->second, 0);
- if (cname == NULL)
+ if (cname == nullptr)
continue;
if (LastUCOpt.HideOffline == 1) {
szProto = GetContactProto(curContact->second);
- if (szProto != NULL && db_get_w(curContact->second, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
+ if (szProto != nullptr && db_get_w(curContact->second, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
continue;
}
@@ -416,13 +416,13 @@ INT_PTR OnMenuCommandShowList(WPARAM, LPARAM) contacts->insert(cpair(curTime, curContact));
}
- HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LASTUC_DIALOG), NULL, ShowListMainDlgProc, (LPARAM)contacts);
- if (hWndMain == NULL)
+ HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LASTUC_DIALOG), nullptr, ShowListMainDlgProc, (LPARAM)contacts);
+ if (hWndMain == nullptr)
return -1;
ShowWindow(hWndMain, SW_SHOW);
- if (hTopToolbarButtonShowList != NULL)
+ if (hTopToolbarButtonShowList != nullptr)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTopToolbarButtonShowList, 0);
return 0;
}
@@ -439,7 +439,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) int Create_TopToolbarShowList(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconHandleUp = icon.hIcolib;
ttb.pszService = msLastUC_ShowList;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
@@ -468,7 +468,7 @@ int Create_MenuitemShowList(void) static void SaveLastUsedTimeStamp(MCONTACT hContact)
{
- __time64_t ct = _time64(NULL);
+ __time64_t ct = _time64(nullptr);
db_set_dw(hContact, MODULENAME, dbLastUC_LastUsedTimeLo, (DWORD)ct);
db_set_dw(hContact, MODULENAME, dbLastUC_LastUsedTimeHi, (DWORD)(ct >> 32));
}
@@ -561,7 +561,7 @@ extern "C" __declspec(dllexport) int Load(void) pcli = Clist_GetInterface();
pci = Chat_GetInterface();
- CoInitialize(NULL);
+ CoInitialize(nullptr);
Icon_Register(hInst, "Recent Contacts", &icon, 1);
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index 63952a3f27..0e20c8282b 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -104,11 +104,11 @@ extern "C" int __declspec(dllexport) Load() // Get ini file name
gMirandaDir[0] = '\0';
- GetModuleFileNameA(GetModuleHandle(NULL),gMirandaDir,sizeof(gMirandaDir));
+ GetModuleFileNameA(GetModuleHandle(nullptr),gMirandaDir,sizeof(gMirandaDir));
// Remove last name
strTmp = strrchr(gMirandaDir,'\\');
- if(strTmp != NULL)
+ if(strTmp != nullptr)
*strTmp = '\0';
// Set vars
@@ -144,11 +144,11 @@ extern "C" int __declspec(dllexport) Unload(void) INT_PTR RemoveAllService(WPARAM, LPARAM)
{
if (gIniFile[0] == '\0') {
- MessageBox(NULL, TranslateT("Configuration file could not be found!"), TranslateW(MSGBOX_TITLE), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Configuration file could not be found!"), TranslateW(MSGBOX_TITLE), MB_OK | MB_ICONERROR);
return -1;
}
- if (MessageBox(NULL, TranslateW(NOTICE_TEXT), TranslateW(MSGBOX_TITLE), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateW(NOTICE_TEXT), TranslateW(MSGBOX_TITLE), MB_YESNO) == IDYES) {
SetProtocolsOffline();
RemoveUsers();
RemoveSettings();
@@ -156,7 +156,7 @@ INT_PTR RemoveAllService(WPARAM, LPARAM) RemoveDirectories();
DisablePlugins();
- MessageBox(NULL, TranslateT("Settings are deleted now."), TranslateW(MSGBOX_TITLE), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Settings are deleted now."), TranslateW(MSGBOX_TITLE), MB_OK | MB_ICONINFORMATION);
}
return 0;
@@ -175,7 +175,7 @@ void SetProtocolsOffline() if (!accounts[i]->bIsEnabled)
continue;
- if (accounts[i]->szModuleName == NULL || accounts[i]->szModuleName[0] == '\0')
+ if (accounts[i]->szModuleName == nullptr || accounts[i]->szModuleName[0] == '\0')
continue;
CallProtoService(accounts[i]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
@@ -216,7 +216,7 @@ void RemoveUsers() }
// Now delete groups
- DeleteSettingEx("CListGroups", NULL);
+ DeleteSettingEx("CListGroups", nullptr);
}
}
@@ -226,7 +226,7 @@ void RemoveProtocolSettings(const char * protocolName) // Remove protocol module settings
if ( GetSettingBool("GlobalSettings", "RemoveWholeProtocolModule", FALSE) ) {
- DeleteSettingEx(protocolName, NULL);
+ DeleteSettingEx(protocolName, nullptr);
}
else if ( GetSettings("ProtocolSettings", buffer, sizeof(buffer)) ) {
char *name;
@@ -235,7 +235,7 @@ void RemoveProtocolSettings(const char * protocolName) name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -262,7 +262,7 @@ void RemoveProtocolSettings(const char * protocolName) name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -274,7 +274,7 @@ void RemoveProtocolSettings(const char * protocolName) // Delete it
if (name[0] != '\0') {
mir_snprintf(moduleName, "%s%s", protocolName, name);
- DeleteSettingEx(moduleName, NULL);
+ DeleteSettingEx(moduleName, nullptr);
}
// Get next one
@@ -299,7 +299,7 @@ void RemoveSettings() if (!accounts[i]->bIsEnabled)
continue;
- if (accounts[i]->szModuleName == NULL || accounts[i]->szModuleName[0] == '\0')
+ if (accounts[i]->szModuleName == nullptr || accounts[i]->szModuleName[0] == '\0')
continue;
RemoveProtocolSettings(accounts[i]->szModuleName);
@@ -313,7 +313,7 @@ void RemoveSettings() name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -341,7 +341,7 @@ void RemoveSettings() name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -371,7 +371,7 @@ void ExecuteServices() name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -408,7 +408,7 @@ void RemoveDirectories() if (!accounts[i]->bIsEnabled)
continue;
- if (accounts[i]->szModuleName == NULL || accounts[i]->szModuleName[0] == '\0')
+ if (accounts[i]->szModuleName == nullptr || accounts[i]->szModuleName[0] == '\0')
continue;
mir_snprintf(dir, "%s%s", gMirandaDir, accounts[i]->szModuleName);
@@ -424,7 +424,7 @@ void RemoveDirectories() name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -456,7 +456,7 @@ void DisablePlugins() name = buffer;
while(name[0] != '\0') {
value = strchr(name, '=');
- if (value == NULL)
+ if (value == nullptr)
value = &name[mir_strlen(name)];
// Has " ?
@@ -520,7 +520,7 @@ void DeleteFileOrFolder(const char *name) strncpy(tmp, name, sizeof(tmp)-1);
strTmp = strrchr(tmp,'\\');
- if(strTmp != NULL) {
+ if(strTmp != nullptr) {
strTmp++;
*strTmp = '\0';
}
@@ -590,7 +590,7 @@ int EnumProc(const char *szName, LPARAM lParam) DeleteModuleStruct *dms = (DeleteModuleStruct *) lParam;
size_t len = mir_strlen(szName);
- if (dms->filter != NULL && dms->lenFilterMinusOne > 0) {
+ if (dms->filter != nullptr && dms->lenFilterMinusOne > 0) {
if (len >= dms->lenFilterMinusOne) {
if (dms->filter[0] == '*') {
if (mir_strcmp(&dms->filter[1], &szName[len - dms->lenFilterMinusOne]) != 0)
@@ -621,7 +621,7 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) {
size_t lenModule;
- if (szModule == NULL)
+ if (szModule == nullptr)
return;
lenModule = mir_strlen(szModule);
@@ -644,8 +644,8 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) }
}
else {
- size_t lenSetting = szSetting == NULL ? 0 : mir_strlen(szSetting);
- if (szSetting == NULL || szSetting[0] == '*' || szSetting[lenSetting-1] == '*') {
+ size_t lenSetting = szSetting == nullptr ? 0 : mir_strlen(szSetting);
+ if (szSetting == nullptr || szSetting[0] == '*' || szSetting[lenSetting-1] == '*') {
DeleteModuleStruct dms;
memset(&dms, 0, sizeof(dms));
dms.filter = szSetting;
@@ -672,14 +672,14 @@ void DeleteSetting(const char *setting) char *szModule;
char *szSetting;
- if (setting == NULL || setting[0] == '\0') {
+ if (setting == nullptr || setting[0] == '\0') {
return;
}
// Split setting
szModule = strdup(setting);
szSetting = strrchr(szModule, '/');
- if (szSetting != NULL) {
+ if (szSetting != nullptr) {
*szSetting = '\0';
szSetting ++;
}
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index b224343cd0..330c089f08 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -102,7 +102,7 @@ int ReadMsgSMS(WPARAM, LPARAM lParam) if (db_event_get(cle->hDbEvent, &dbei) == 0)
if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION)
if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) {
- if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMS, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) {
+ if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMS, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) {
db_event_markRead(cle->hContact, cle->hDbEvent);
return 0;
}
@@ -123,7 +123,7 @@ int ReadAckSMS(WPARAM, LPARAM lParam) if (db_event_get(cle->hDbEvent, &dbei) == 0)
if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION)
if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) {
- if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMSCONFIRMATION, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) {
+ if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMSCONFIRMATION, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) {
db_event_delete(cle->hContact, cle->hDbEvent);
return 0;
}
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 7f36b72935..78c7f5851c 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -32,7 +32,7 @@ LPSTR GetModuleName(MCONTACT hContact) if (hContact) {
lpszRet = GetContactProto(hContact);
- if (lpszRet == NULL)
+ if (lpszRet == nullptr)
lpszRet = PROTOCOL_NAMEA;
}
else lpszRet = PROTOCOL_NAMEA;
@@ -243,7 +243,7 @@ BOOL GetXMLFieldEx(LPSTR lpszXML, size_t dwXMLSize, LPSTR *plpszData, size_t *pd {
BOOL bRet = FALSE;
int thisLevel = 0;
- LPSTR lpszFindTag = (LPSTR)tag1, lpszTagEnd = lpszXML, lpszDataStart = NULL;
+ LPSTR lpszFindTag = (LPSTR)tag1, lpszTagEnd = lpszXML, lpszDataStart = nullptr;
va_list va;
va_start(va, tag1);
@@ -272,7 +272,7 @@ BOOL GetXMLFieldEx(LPSTR lpszXML, size_t dwXMLSize, LPSTR *plpszData, size_t *pd if (++thisLevel == 1)
if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszFindTag, -1, lpszTagStart, ((lpszTagEnd + 1) - lpszTagStart)) == CSTR_EQUAL) {
lpszFindTag = va_arg(va, LPSTR);
- if (lpszFindTag == NULL) lpszDataStart = (lpszTagEnd + 2);
+ if (lpszFindTag == nullptr) lpszDataStart = (lpszTagEnd + 2);
thisLevel = 0;
}
}
@@ -286,7 +286,7 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML, size_t dwXMLSize, LPSTR lpszBuff, size_t d {
BOOL bRet = FALSE;
int thisLevel = 0;
- LPSTR lpszFindTag = (LPSTR)tag1, lpszTagStart, lpszTagEnd = lpszXML, lpszDataStart = NULL;
+ LPSTR lpszFindTag = (LPSTR)tag1, lpszTagStart, lpszTagEnd = lpszXML, lpszDataStart = nullptr;
va_list va;
@@ -313,7 +313,7 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML, size_t dwXMLSize, LPSTR lpszBuff, size_t d if (++thisLevel == 1)
if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszFindTag, -1, lpszTagStart, ((lpszTagEnd + 1) - lpszTagStart)) == CSTR_EQUAL) {
lpszFindTag = va_arg(va, LPSTR);
- if (lpszFindTag == NULL) lpszDataStart = (lpszTagEnd + 2);
+ if (lpszFindTag == nullptr) lpszDataStart = (lpszTagEnd + 2);
thisLevel = 0;
}
}
@@ -359,7 +359,7 @@ DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplaceItemsC while (dwFoundedCount) {
// looking for first to replace
for (i = 0; i < dwReplaceItemsCount; i++)
- if (plpszFound[i] && (plpszFound[i] < plpszFound[dwFirstFoundedIndex] || plpszFound[dwFirstFoundedIndex] == NULL))
+ if (plpszFound[i] && (plpszFound[i] < plpszFound[dwFirstFoundedIndex] || plpszFound[dwFirstFoundedIndex] == nullptr))
dwFirstFoundedIndex = i;
// in founded
diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index 839b2dc395..c62edf3376 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -67,7 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) break;
case DLL_PROCESS_DETACH:
HeapDestroy(ssSMSSettings.hHeap);
- ssSMSSettings.hHeap = NULL;
+ ssSMSSettings.hHeap = nullptr;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
@@ -119,17 +119,17 @@ void VersionConversions() {
WCHAR wsztm[MAX_PATH];
- if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),NULL))
+ if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),nullptr))
DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0'));
else
DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
- if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),NULL))
+ if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),nullptr))
DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0'));
else
DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
- if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),NULL))
+ if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),nullptr))
DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0'));
else
DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK);
diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp index 54fc700a62..6998611134 100644 --- a/plugins/SMS/src/options.cpp +++ b/plugins/SMS/src/options.cpp @@ -37,7 +37,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
- if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),NULL)==FALSE)
+ if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),nullptr)==FALSE)
mir_snwprintf(tszSign, TranslateT("From %s:\r\n\r\n"), pcli->pfnGetContactDisplayName(0, 0));
SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign);
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index c576e2cdd3..40d2ed7933 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -58,14 +58,14 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) dwMessageXMLEncodedSize = MultiByteToWideChar(CP_UTF8, 0, lpszData, (int)dwDataSize, lpwszMessageXMLEncoded, (int)dwBuffLen);
DecodeXML(lpwszMessageXMLEncoded, dwMessageXMLEncodedSize, lpwszMessageXMLDecoded, dwBuffLen, &dwMessageXMLDecodedSize);
lpszMessageUTF = (LPSTR)lpwszMessageXMLEncoded;
- WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLDecoded, (int)dwMessageXMLDecodedSize, lpszMessageUTF, (int)dwBuffLen, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLDecoded, (int)dwMessageXMLDecodedSize, lpszMessageUTF, (int)dwBuffLen, nullptr, nullptr);
dwPhoneSize = CopyNumberA(szPhone, lpszPhone, dwPhoneSize);
dwPhoneSize = MultiByteToWideChar(CP_UTF8, 0, szPhone, (int)dwPhoneSize, tszPhone, MAX_PHONE_LEN);
MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize);
dbei.szModule = GetModuleName(hContact);
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.flags = DBEF_UTF;
dbei.eventType = ICQEVENTTYPE_SMS;
dbei.cbBlob = (mir_snprintf((LPSTR)dbei.pBlob, ((dwBuffLen + dwPhoneSize)), "SMS From: +%s\r\n%s", szPhone, lpszMessageUTF) + sizeof(DWORD));
@@ -93,7 +93,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = {};
dbei.szModule = GetModuleName(hContact);
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.flags = DBEF_UTF;
dbei.eventType = ICQEVENTTYPE_SMSCONFIRMATION;
if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) {
@@ -133,7 +133,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) char szNetwork[MAX_PATH];
KillTimer(hWndDlg, wParam);
- GetXMLFieldExBuff(lpszXML, dwXMLSize, szNetwork, sizeof(szNetwork), NULL, "sms_response", "network", NULL);
+ GetXMLFieldExBuff(lpszXML, dwXMLSize, szNetwork, sizeof(szNetwork), nullptr, "sms_response", "network", NULL);
if (ack->result == ACKRESULT_FAILED || CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "no", 2) == CSTR_EQUAL) {
char szBuff[1024];
@@ -154,7 +154,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) lpszErrorDescription = lpszXML;
else {
lpszErrorDescription = szBuff;
- GetXMLFieldExBuff(lpszXML, dwXMLSize, szBuff, sizeof(szBuff), NULL, "sms_response", "error", "params", "param", NULL);
+ GetXMLFieldExBuff(lpszXML, dwXMLSize, szBuff, sizeof(szBuff), nullptr, "sms_response", "error", "params", "param", NULL);
}
mir_snwprintf(tszErrorMessage, TranslateT("SMS message didn't send by %S to %s because: %S"), szNetwork, tszPhone, lpszErrorDescription);
@@ -181,14 +181,14 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) if (DB_SMS_GetByte(NULL, "ShowACK", SMS_DEFAULT_SHOWACK)) {
HWND hwndAccepted = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSACCEPT), hWndDlg, SMSAcceptedDlgProc);
if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) {
- GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), NULL, "sms_response", "source", NULL);
- GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), NULL, "sms_response", "message_id", NULL);
+ GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), nullptr, "sms_response", "source", NULL);
+ GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), nullptr, "sms_response", "message_id", NULL);
}
else {
SetDlgItemText(hwndAccepted, IDC_ST_SOURCE, TranslateT("From:"));
SetDlgItemText(hwndAccepted, IDC_ST_MESSAGEID, TranslateT("To:"));
- GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), NULL, "sms_response", "from", NULL);
- GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), NULL, "sms_response", "to", NULL);
+ GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), nullptr, "sms_response", "from", NULL);
+ GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), nullptr, "sms_response", "to", NULL);
}
SetDlgItemTextA(hwndAccepted, IDC_NETWORK, szNetwork);
SetDlgItemTextA(hwndAccepted, IDC_SOURCE, szSource);
@@ -226,7 +226,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) {
Skin_PlaySound("RecvSMSMsg");
if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) {
- if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMS, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob))
+ if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMS, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob))
db_event_markRead(hContact, hDbEvent);
}
else {
@@ -247,12 +247,12 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) else if (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) {
Skin_PlaySound("RecvSMSConfirmation");
if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) {
- if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMSCONFIRMATION, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob))
+ if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMSCONFIRMATION, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob))
db_event_delete(hContact, hDbEvent);
}
else {
UINT iIcon;
- if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, NULL, NULL, 0, NULL, &iIcon)) {
+ if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, nullptr, nullptr, 0, nullptr, &iIcon)) {
memcpy(pszServiceFunctionName, SMS_READ_ACK, sizeof(SMS_READ_ACK));
mir_snwprintf(szToolTip, TranslateT("SMS Confirmation from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 4734d8cf0e..5e2d194e05 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -53,7 +53,7 @@ void RecvSMSWindowDestroy() RECV_SMS_WINDOW_DATA *prswdWindowData;
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, NULL, (LPVOID*)&prswdWindowData) == NO_ERROR) {// öèêë
+ while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, nullptr, (LPVOID*)&prswdWindowData) == NO_ERROR) {// öèêë
RecvSMSWindowRemove(prswdWindowData->hWnd);
}
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
@@ -77,7 +77,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA LOGFONT lf;
HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont);
- LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, NULL);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, nullptr);
hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
@@ -87,16 +87,16 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA // def pos
if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv"))
- SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER);
+ SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER);
- InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE);
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) {
COLORREF colour;
- LoadMsgDlgFont(MSGFONTID_YOURMSG, NULL, &colour);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG, nullptr, &colour);
SetTextColor((HDC)wParam, colour);
SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
return (INT_PTR)prswdWindowData->hBkgBrush;
@@ -114,15 +114,15 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA {
int cx = rcWin.right - rcWin.left - 10;
int cy = rcWin.bottom - rcWin.top - 10;
- SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), 0, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), 0, cx - 87, cy - 60, 80, 25, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), nullptr, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), nullptr, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), nullptr, cx - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDOK), nullptr, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), nullptr, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
}
- RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+ RedrawWindow(hWndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
break;
case WM_COMMAND:
@@ -160,22 +160,22 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA //The function gets void and return the window HWND
HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, size_t dwPhoneSize, LPSTR lpszMessage, size_t dwMessageSize)
{
- HWND hRet = NULL;
+ HWND hRet = nullptr;
if ((dwPhoneSize + dwMessageSize) <= MIN_SMS_DBEVENT_LEN)
- return NULL;
+ return nullptr;
LPWSTR lpwszMessage;
lpwszMessage = (LPWSTR)MEMALLOC(((dwMessageSize + MAX_PATH) * sizeof(WCHAR)));
if (!lpwszMessage)
- return NULL;
+ return nullptr;
RECV_SMS_WINDOW_DATA *prswdWindowData;
prswdWindowData = (RECV_SMS_WINDOW_DATA*)MEMALLOC(sizeof(RECV_SMS_WINDOW_DATA));
if (prswdWindowData) {
prswdWindowData->hContact = hContact;
- prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), NULL, RecvSmsDlgProc, (LPARAM)prswdWindowData);
+ prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), nullptr, RecvSmsDlgProc, (LPARAM)prswdWindowData);
if (prswdWindowData->hWnd) {
HICON hIcon;
WCHAR wszTitle[MAX_PATH] = { 0 }, wszPhoneLocal[MAX_PHONE_LEN] = { 0 };
@@ -193,19 +193,19 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s break;
case ICQEVENTTYPE_SMSCONFIRMATION:
lpwszTitlepart = TranslateT("Received SMS Confirmation");
- GetDataFromMessage(lpszMessage, dwMessageSize, NULL, NULL, 0, NULL, &iIcon);
+ GetDataFromMessage(lpszMessage, dwMessageSize, nullptr, nullptr, 0, nullptr, &iIcon);
hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(iIcon), IMAGE_ICON, 0, 0, LR_SHARED);
break;
default:
lpwszTitlepart = L"Unknown event type";
- hIcon = 0;
+ hIcon = nullptr;
}
wszPhoneLocal[0] = '+';
if (dwPhoneSize)
dwPhoneSize = CopyNumberW((wszPhoneLocal + 1), lpwszPhone, dwPhoneSize);
else {
- GetDataFromMessage(lpszMessage, dwMessageSize, NULL, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, NULL);
+ GetDataFromMessage(lpszMessage, dwMessageSize, nullptr, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, nullptr);
dwPhoneSize++;
}
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp index c0ab45f149..01cd0ac02c 100644 --- a/plugins/SMS/src/send.cpp +++ b/plugins/SMS/src/send.cpp @@ -49,7 +49,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP lpszMessageUTF = (LPSTR)MEMALLOC(dwMessageUTFBuffSize);
if (lpszMessageUTF)
{
- dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL));
+ dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, nullptr, nullptr));
pdbei = (DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO) + dwBuffSize));
if (pdbei)
{
@@ -57,10 +57,10 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP LPSTR lpszBuff = (LPSTR)(pdbei + 1);
HANDLE hProcess;
- WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, nullptr, nullptr);
dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize);
- pdbei->timestamp = time(NULL);
+ pdbei->timestamp = time(nullptr);
pdbei->flags = (DBEF_SENT | DBEF_UTF);
pdbei->eventType = ICQEVENTTYPE_SMS;
pdbei->cbBlob = (mir_snprintf(lpszBuff, dwBuffSize, "SMS To: +%s\r\n%s", szPhone, lpszMessageUTF) + 4);
@@ -69,7 +69,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP char *szProto = ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName;
if (ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) {
- WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, nullptr, nullptr);
hProcess = (HANDLE)CallProtoService(szProto, MS_ICQ_SENDSMS, (WPARAM)szPhone, (LPARAM)lpszMessageUTF);
SendSMSWindowHProcessSet(hWndDlg, hProcess);
}
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index c1fb06c02d..bb501bf051 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -65,7 +65,7 @@ void SendSMSWindowDestroy() SEND_SMS_WINDOW_DATA *psswdWindowData;
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
- while (ListMTItemGetFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR)
+ while (ListMTItemGetFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR)
SendSMSWindowRemove(psswdWindowData->hWnd);
ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
@@ -103,7 +103,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA LOGFONT lf;
HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont);
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, nullptr);
hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
@@ -111,7 +111,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA psswdWindowData->hBkgBrush = CreateSolidBrush(colour);
}
{
- HWND hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, TEXT(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
+ HWND hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, TEXT(""), WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandle(nullptr), nullptr);
TOOLINFO ti;
memset(&ti, 0, sizeof(ti));
ti.cbSize = sizeof(ti);
@@ -136,7 +136,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA RECT rcWin, rcList;
GetWindowRect(hWndDlg, &rcWin);
GetWindowRect(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &rcList);
- SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 10, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 10, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
}
SendSMSWindowUpdateAccountList(hWndDlg);
@@ -159,9 +159,9 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA }
if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), PROTOCOL_NAMEA, "send")) {// def pos
- SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER);
+ SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER);
}
- InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE);
return TRUE;
case WM_GETMINMAXINFO:
if (psswdWindowData->bMultiple) {
@@ -188,22 +188,22 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA }
cx -= 10; /* XXX: fix window sizes for aero. */
cy -= 10;
- SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 132, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_ACCOUNTS), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDRESS), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_ADDRESS), 0, cx - (cx * 35) / 100 - 68, 5, 50, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_MULTIPLE), 0, cx - ((cx * 35) / 100 + 35) / 2 - 11, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_SAVENUMBER), 0, cx - (cx * 35) / 100 - 58, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_HISTORY), 0, 0, 0, 20, 20, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_COUNT), 0, cx - 61, 52, 50, 15, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_CHARS), 0, cx - 106, 52, 40, 15, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDNUMBER), 0, cx, 5, 170, 20, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), 0, cx, 25, 170, cy - 90, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, 0, 0, cx - 14, cy - 132, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ACCOUNTS), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDRESS), nullptr, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_ADDRESS), nullptr, cx - (cx * 35) / 100 - 68, 5, 50, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MULTIPLE), nullptr, cx - ((cx * 35) / 100 + 35) / 2 - 11, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_SAVENUMBER), nullptr, cx - (cx * 35) / 100 - 58, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_HISTORY), nullptr, 0, 0, 20, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_COUNT), nullptr, cx - 61, 52, 50, 15, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_CHARS), nullptr, cx - 106, 52, 40, 15, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDNUMBER), nullptr, cx, 5, 170, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), nullptr, cx, 25, 170, cy - 90, SWP_NOZORDER);
//SetWindowPos(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),0,cx,cy - 110 + 25,170,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
- RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDOK), nullptr, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), nullptr, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
+ RedrawWindow(hWndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
}
break;
case WM_TIMER:
@@ -234,7 +234,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) {
COLORREF colour;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &colour);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &colour);
SetTextColor((HDC)wParam, colour);
SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
return((INT_PTR)psswdWindowData->hBkgBrush);
@@ -263,7 +263,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), TRUE);
if (psswdWindowData->hMyContact == NULL) EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), TRUE);
SetFocus(GetDlgItem(hWndDlg, IDC_MESSAGE));
- psswdWindowData->hItemSend = NULL;
+ psswdWindowData->hItemSend = nullptr;
}
break;
case TIMEDOUT_RETRY:
@@ -291,7 +291,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA MEMFREE(lpwszMessage);
}
}
- SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL);
+ SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr);
break;
}
break;
@@ -305,7 +305,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA {
wchar_t tszPhone[MAX_PHONE_LEN];
if (IsPhoneW(tszPhone, GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)))) {
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.hInsertAfter = TVI_SORT;
tvis.item.pszText = tszPhone;
@@ -362,7 +362,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), FALSE);
SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0);
StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lpwszMessage, dwMessageSize);
- SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL);
+ SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr);
MEMFREE(lpwszMessage);
}
@@ -495,7 +495,7 @@ INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hWndDlg);
GetWindowRect(hWndDlg, &rc);
GetWindowRect(GetParent(hWndDlg), &rcParent);
- SetWindowPos(hWndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hWndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND);
}
return TRUE;
@@ -524,7 +524,7 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA RECT rc, rcParent;
GetWindowRect(hWndDlg, &rc);
GetWindowRect(GetParent(hWndDlg), &rcParent);
- SetWindowPos(hWndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hWndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
return TRUE;
@@ -546,12 +546,12 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA //The function gets void and return the window HWND
HWND SendSMSWindowAdd(MCONTACT hContact)
{
- HWND hRet = NULL;
+ HWND hRet = nullptr;
SEND_SMS_WINDOW_DATA *psswdWindowData = (SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA));
if (!psswdWindowData)
- return NULL;
+ return nullptr;
psswdWindowData->hMyContact = hContact;
- psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), NULL, SendSmsDlgProc, (LPARAM)psswdWindowData);
+ psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), nullptr, SendSmsDlgProc, (LPARAM)psswdWindowData);
if (psswdWindowData->hWnd) {
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem, psswdWindowData);
@@ -616,14 +616,14 @@ void SendSMSWindowHContactSet(HWND hWndDlg, MCONTACT hContact) //the same process
HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess)
{
- HWND hRet = NULL;
+ HWND hRet = nullptr;
SEND_SMS_WINDOW_DATA *psswdWindowData;
LIST_MT_ITERATOR lmtiIterator;
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator);
do {// öèêë
- if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR)
+ if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR)
if (psswdWindowData->hProcess == hProcess) {
hRet = psswdWindowData->hWnd;
break;
@@ -675,16 +675,16 @@ void SendSMSWindowMultipleSet(HWND hWndDlg, BOOL bMultiple) EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE);
SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single"));
- if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right - rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, nullptr, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right - rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
}
else {
if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg, psswdWindowData->hMyContact);
EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE);
SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>"));
- SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
- if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, nullptr, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
}
}
@@ -750,7 +750,7 @@ void SendSMSWindowHItemSendSet(HWND hWndDlg, HTREEITEM hItemSend) //
HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg)
{
- HTREEITEM hRet = NULL;
+ HTREEITEM hRet = nullptr;
SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
if (psswdWindowData) hRet = psswdWindowData->hItemSend;
@@ -811,7 +811,7 @@ HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg, HTREEITEM hItem) }
}
}
- return(NULL);
+ return(nullptr);
}
//This function get the HANDLE of an user. if there is already a SMS send window for this contact
@@ -819,14 +819,14 @@ HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg, HTREEITEM hItem) //The function gets the HANDLE of a contact and return HWND
HWND SendSMSWindowIsOtherInstanceHContact(MCONTACT hContact)
{
- HWND hRet = NULL;
+ HWND hRet = nullptr;
SEND_SMS_WINDOW_DATA *psswdWindowData;
LIST_MT_ITERATOR lmtiIterator;
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator);
do {// öèêë
- if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR)
+ if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR)
if (psswdWindowData->hMyContact == hContact) {
hRet = psswdWindowData->hWnd;
break;
@@ -861,7 +861,7 @@ void SendSMSWindowNext(HWND hWndDlg) dwPhoneSize = mir_wstrlen(tszPhone);
SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize);
StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lptszMessage, dwMessageSize);
- SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL);
+ SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr);
MEMFREE(lptszMessage);
}
@@ -934,7 +934,7 @@ void SendSMSWindowsUpdateAllAccountLists() ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator);
do {// öèêë
- if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR) {
+ if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) {
SendSMSWindowUpdateAccountList(psswdWindowData->hWnd);
}
} while (ListMTIteratorMoveNext(&lmtiIterator));
@@ -1004,7 +1004,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR char szBuff[MAX_PATH];
wchar_t tszPhone[MAX_PHONE_LEN], tszPhoneRaw[MAX_PHONE_LEN];
size_t i, dwPhoneSize;
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
if (phParent) tvis.hParent = (*phParent);
tvis.item.mask = (TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE);
@@ -1015,7 +1015,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR tszPhone[0] = '+';
dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize);
if (IsPhoneW(tszPhone, dwPhoneSize)) {
- if (tvis.hParent == NULL) {
+ if (tvis.hParent == nullptr) {
tvis.item.pszText = pcli->pfnGetContactDisplayName(hContact, 0);
tvis.hParent = TreeView_InsertItem(hWndList, &tvis);
}
@@ -1030,7 +1030,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR tszPhone[0] = '+';
dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize);
if (IsPhoneW(tszPhone, dwPhoneSize)) {
- if (tvis.hParent == NULL) {
+ if (tvis.hParent == nullptr) {
tvis.item.pszText = pcli->pfnGetContactDisplayName(hContact, 0);
tvis.hParent = TreeView_InsertItem(hWndList, &tvis);
}
@@ -1052,7 +1052,7 @@ void SendSMSWindowFillTreeView(HWND hWnd) TreeView_DeleteAllItems(hWndTreeView);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HTREEITEM hParent = NULL;
+ HTREEITEM hParent = nullptr;
LPSTR lpszProto = GetContactProto(hContact);
if (lpszProto) {
AddContactPhonesToTreeViewParam(hContact, lpszProto, "Phone", hWndTreeView, &hParent);
@@ -1075,7 +1075,7 @@ size_t GetSMSMessageLenMax(HWND hWndDlg) LPTSTR lptszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(wchar_t)));
if (lptszMessage) {
dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize + 2);
- if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, NULL, 0, NULL, NULL))
+ if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, nullptr, 0, nullptr, nullptr))
dwLenght = 70;
MEMFREE(lptszMessage);
}
diff --git a/plugins/Scriver/src/chat_options.cpp b/plugins/Scriver/src/chat_options.cpp index ee3b0647df..7ddb5ac90c 100644 --- a/plugins/Scriver/src/chat_options.cpp +++ b/plugins/Scriver/src/chat_options.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define UM_CHECKSTATECHANGE (WM_USER+100)
-static HWND hPathTip = 0;
+static HWND hPathTip = nullptr;
struct branch_t
{
@@ -164,7 +164,7 @@ static void CheckHeading(HWND hwndTree, HTREEITEM hHeading) {
BOOL bChecked = TRUE;
- if (hHeading == 0)
+ if (hHeading == nullptr)
return;
TVITEM tvi;
@@ -189,7 +189,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) BOOL bChecked = TRUE;
TVITEM tvi;
- if (hHeading == 0)
+ if (hHeading == nullptr)
return;
tvi.mask = TVIF_HANDLE | TVIF_STATE;
@@ -236,8 +236,8 @@ static void InitSetting(wchar_t **ppPointer, char *pszSetting, wchar_t *pszDefau INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static HTREEITEM hListHeading1 = 0;
- static HTREEITEM hListHeading4 = 0;
+ static HTREEITEM hListHeading1 = nullptr;
+ static HTREEITEM hListHeading4 = nullptr;
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -345,8 +345,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static HTREEITEM hListHeading2 = 0;
- static HTREEITEM hListHeading3 = 0;
+ static HTREEITEM hListHeading2 = nullptr;
+ static HTREEITEM hListHeading3 = nullptr;
switch (uMsg) {
case WM_INITDIALOG:
@@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM LPMALLOC psMalloc;
if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
wchar_t tszDirectory[MAX_PATH], tszTemp[MAX_PATH];
- BROWSEINFO bi = { 0 };
+ BROWSEINFO bi = {};
bi.hwndOwner = hwndDlg;
bi.pszDisplayName = tszDirectory;
bi.lpszTitle = TranslateT("Select folder");
@@ -620,7 +620,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (hPathTip) {
KillTimer(hwndDlg, 0);
DestroyWindow(hPathTip);
- hPathTip = 0;
+ hPathTip = nullptr;
}
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index 7b22f4e8ad..f53118c989 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -164,11 +164,11 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) int logBottom = (m_hwndIeview != nullptr) ? toolbarTopY / 2 : toolbarTopY;
HDWP hdwp = BeginDeferWindowPos(5);
- hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, 0, bNick ? w - m_pParent->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_nickList.GetHwnd(), 0, w - m_pParent->iSplitterX + 2, 0, m_pParent->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_splitterX.GetHwnd(), 0, w - m_pParent->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), 0, 0, h - m_pParent->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), 0, 1, h - m_pParent->iSplitterY + SPLITTER_HEIGHT, w - 2, m_pParent->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), nullptr, 1, 0, bNick ? w - m_pParent->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_nickList.GetHwnd(), nullptr, w - m_pParent->iSplitterX + 2, 0, m_pParent->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitterX.GetHwnd(), nullptr, w - m_pParent->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), nullptr, 0, h - m_pParent->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), nullptr, 1, h - m_pParent->iSplitterY + SPLITTER_HEIGHT, w - 2, m_pParent->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
SetButtonsPos(m_hwnd, m_hContact, bToolbar);
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 2047c534d0..3a38cc1f97 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -147,10 +147,10 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA }
}
HDWP hdwp = BeginDeferWindowPos(4);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_NAME), 0, 16, 0, dlgWidth - avatarWidth - 2 - 32, dlgHeight / 2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_STATUS), 0, 16, dlgHeight / 2, dlgWidth - avatarWidth - 2 - 32, dlgHeight / 2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_AVATAR), 0, dlgWidth - avatarWidth - 2, (dlgHeight - avatarHeight) / 2, avatarWidth, (dlgHeight + avatarHeight - 2) / 2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_XSTATUSICON), 0, dlgWidth - avatarWidth - 2 - 16, dlgHeight / 4 - 8, 16, 16, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_NAME), nullptr, 16, 0, dlgWidth - avatarWidth - 2 - 32, dlgHeight / 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_STATUS), nullptr, 16, dlgHeight / 2, dlgWidth - avatarWidth - 2 - 32, dlgHeight / 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_AVATAR), nullptr, dlgWidth - avatarWidth - 2, (dlgHeight - avatarHeight) / 2, avatarWidth, (dlgHeight + avatarHeight - 2) / 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_XSTATUSICON), nullptr, dlgWidth - avatarWidth - 2 - 16, dlgHeight / 4 - 8, 16, 16, SWP_NOZORDER);
rc.left = dlgWidth - avatarWidth - 2 - 16;
rc.top = dlgHeight / 4 - 8;
rc.bottom = rc.top + 20;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index b8c23fd8ad..6d1bd4afe1 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -439,7 +439,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton) pf2.dwMask = PFM_RTLPARA;
m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
- MessageSendQueueItem msi = { 0 };
+ MessageSendQueueItem msi = {};
if (pf2.wEffects & PFE_RTLPARA)
msi.flags |= PREF_RTL;
@@ -877,11 +877,11 @@ void CSrmmWindow::MessageDialogResize(int w, int h) int logH = h - hSplitterPos - toolbarHeight - infobarInnerHeight;
HDWP hdwp = BeginDeferWindowPos(5);
- hdwp = DeferWindowPos(hdwp, m_hwndInfo, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, logY, w - 2, logH, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), 0, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_AVATAR), 0, w - avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_splitter.GetHwnd(), 0, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_hwndInfo, nullptr, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), nullptr, 1, logY, w - 2, logH, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), nullptr, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_AVATAR), nullptr, w - avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitter.GetHwnd(), nullptr, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
SetButtonsPos(m_hwnd, m_hContact, bToolbar);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 26ee901ae6..d7c0f1ac32 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -617,7 +617,7 @@ int OnLoadModule(void) {
hMsftEdit = LoadLibrary(L"Msftedit.dll");
if (hMsftEdit == nullptr) {
- if (IDYES != MessageBox(0,
+ if (IDYES != MessageBox(nullptr,
TranslateT("Miranda could not load the built-in message module, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."),
TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION))
return 1;
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index a1f6d0cf0f..dad688b38a 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -310,7 +310,7 @@ static void SetContainerWindowStyle(ParentWindowData *dat) RECT rc;
GetWindowRect(dat->hwnd, &rc);
- SetWindowPos(dat->hwnd, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
+ SetWindowPos(dat->hwnd, nullptr, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING);
}
@@ -668,7 +668,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara MCONTACT hSContact = savePerContact ? dat->hContact : 0;
dat->bTopmost = db_get_b(hSContact, SRMM_MODULE, SRMSGSET_TOPMOST, SRMSGDEFSET_TOPMOST);
if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMM_MODULE, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE))
- SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
+ SetWindowPos(hwndDlg, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
if (!savePerContact && db_get_b(0, SRMM_MODULE, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)&dat->windowWasCascaded);
@@ -826,7 +826,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara HMENU hUserMenu = (HMENU)SendMessage(pDlg->GetHwnd(), DM_GETCONTEXTMENU, 0, 0);
if (hUserMenu != nullptr) {
InsertMenu(hSubMenu, 0, MF_POPUP | MF_BYPOSITION, (UINT_PTR)hUserMenu, TranslateT("User menu"));
- InsertMenu(hSubMenu, 1, MF_SEPARATOR | MF_BYPOSITION, 0, 0);
+ InsertMenu(hSubMenu, 1, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr);
}
BOOL menuResult = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, x, y, 0, hwndDlg, nullptr);
switch (menuResult) {
@@ -1256,7 +1256,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
RECT rc;
GetWindowRect(hwndDlg, &rc);
- SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
+ SetWindowPos(hwndDlg, nullptr, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING);
RedrawWindow(hwndDlg, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
break;
@@ -1268,7 +1268,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara GetWindowRect((HWND)wParam, &rcNew);
if (abs(rcThis.left - rcNew.left) < 3 && abs(rcThis.top - rcNew.top) < 3) {
int offset = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME);
- SetWindowPos((HWND)wParam, 0, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos((HWND)wParam, nullptr, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
*(int *)lParam = 1;
}
}
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 31fe1d8792..0c46b53bdd 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -5,13 +5,13 @@ HINSTANCE g_hInst, g_hIconInst; char TEMP[MAX_PATH];
int TEMP_SIZE = 0;
-HANDLE g_hEvent[2], g_hCLIcon, g_hFolders = 0;
+HANDLE g_hEvent[2], g_hCLIcon, g_hFolders = nullptr;
HGENMENU g_hMenu[15];
int iService = 0;
int iHook = 0;
-HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1 + IEC_CNT*MODE_CNT] = { 0 };
+HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1 + IEC_CNT*MODE_CNT] = {};
HANDLE g_IEC[1 + IEC_CNT*MODE_CNT];
int iBmpDepth;
@@ -25,7 +25,7 @@ mir_cs localQueueMutex; LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *szSetting)
{
char *val = db_get_sa(hContact, szModule, szSetting);
- if (!val) return NULL;
+ if (!val) return nullptr;
size_t len = mir_strlen(val) + 64;
char *buf = (LPSTR)mir_alloc(len);
strncpy(buf, val, len); mir_free(val);
@@ -86,7 +86,7 @@ void CopyToClipboard(HWND hwnd, LPSTR msg) mir_strcpy(lpstrCopy, msg);
GlobalUnlock(hglbCopy);
- if(OpenClipboard(NULL)) {
+ if(OpenClipboard(nullptr)) {
EmptyClipboard();
SetClipboardData(CF_TEXT, hglbCopy);
CloseClipboard();
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index 67b80e507b..183f93f62f 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -56,7 +56,7 @@ BYTE isContactSecured(MCONTACT hContact) break;
case MODE_RSA:
- if (p->cntx != 0) res |= SECURED;
+ if (p->cntx != nullptr) res |= SECURED;
break;
}
return res;
@@ -70,7 +70,7 @@ bool isClientMiranda(pUinKey ptr, BOOL emptyMirverAsMiranda) bool isMiranda = true;
LPSTR mirver = db_get_sa(ptr->hContact, ptr->proto->name, "MirVer");
if (mirver) {
- isMiranda = (emptyMirverAsMiranda && !*mirver) || (strstr(mirver, "Miranda") != NULL);
+ isMiranda = (emptyMirverAsMiranda && !*mirver) || (strstr(mirver, "Miranda") != nullptr);
mir_free(mirver);
}
return isMiranda;
@@ -91,7 +91,7 @@ bool isProtoSmallPackets(MCONTACT hContact) if (!p || !p->proto || !p->proto->inspecting)
return false;
- return strstr(p->proto->name, "IRC") != NULL || strstr(p->proto->name, "WinPopup") != NULL || strstr(p->proto->name, "VyChat") != NULL;
+ return strstr(p->proto->name, "IRC") != nullptr || strstr(p->proto->name, "WinPopup") != nullptr || strstr(p->proto->name, "VyChat") != nullptr;
}
bool isContactInvisible(MCONTACT hContact)
@@ -199,7 +199,7 @@ bool isSecureIM(pUinKey ptr, BOOL emptyMirverAsSecureIM) bool isSecureIM = false;
LPSTR mirver = db_get_sa(ptr->hContact, ptr->proto->name, "MirVer");
if (mirver) {
- isSecureIM = (emptyMirverAsSecureIM && !*mirver) || (strstr(mirver, "SecureIM") != NULL) || (strstr(mirver, "secureim") != NULL);
+ isSecureIM = (emptyMirverAsSecureIM && !*mirver) || (strstr(mirver, "SecureIM") != nullptr) || (strstr(mirver, "secureim") != nullptr);
mir_free(mirver);
}
return isSecureIM;
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index 162b6090ab..afa18459e0 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -131,10 +131,10 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) CCSDATA *pccsd = (CCSDATA *)lParam;
PROTORECVEVENT *ppre = (PROTORECVEVENT *)pccsd->lParam;
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = cpp_decodeU(ptr->cntx, szEncMsg);
- if (szOldMsg == NULL) {
+ if (szOldMsg == nullptr) {
ptr->decoded = false;
switch (cpp_get_error(ptr->cntx)) {
case CPP_ERROR_BAD_LEN:
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index 3d7a74ac46..d0ad9953a5 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -38,7 +38,7 @@ static ICON_CACHE& getCacheItem(int mode, int type) ICON_CACHE *p = new ICON_CACHE;
p->icon = icon;
p->mode = (type << 8) | mode;
- p->hCLIcon = NULL;
+ p->hCLIcon = nullptr;
arIcoList.insert(p);
return *p;
@@ -55,7 +55,7 @@ HANDLE mode2clicon(int mode, int type) return INVALID_HANDLE_VALUE;
ICON_CACHE &p = getCacheItem(mode, type);
- if (p.hCLIcon == NULL)
+ if (p.hCLIcon == nullptr)
p.hCLIcon = ExtraIcon_AddIcon(p.icon);
return p.hCLIcon;
@@ -107,7 +107,7 @@ void ShowStatusIconNotify(MCONTACT hContact) void RefreshContactListIcons(void)
{
for (int i = 0; i < arIcoList.getCount(); i++)
- arIcoList[i].hCLIcon = 0;
+ arIcoList[i].hCLIcon = nullptr;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
if (isSecureProtocol(hContact))
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 3eeabe0721..bb97d160f0 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -6,7 +6,7 @@ LIST<UinKey> arClist(100, NumericKeySortT); void loadSupportedProtocols()
{
LPSTR szNames = db_get_sa(0, MODULENAME, "protos");
- if (szNames && strchr(szNames, ':') == NULL) {
+ if (szNames && strchr(szNames, ':') == nullptr) {
LPSTR tmp = (LPSTR)mir_alloc(2048); int j = 0;
for (int i = 0; szNames[i]; i++) {
if (szNames[i] == ';')
@@ -70,16 +70,16 @@ pSupPro getSupPro(MCONTACT hContact) if (Proto_IsProtoOnContact(hContact, arProto[j]->name))
return arProto[j];
- return NULL;
+ return nullptr;
}
// add contact in the list of secureIM users
pUinKey addContact(MCONTACT hContact)
{
- if (hContact == NULL) return NULL;
+ if (hContact == NULL) return nullptr;
pSupPro proto = getSupPro(hContact);
- if (proto == NULL) return NULL;
+ if (proto == nullptr) return nullptr;
pUinKey p = (pUinKey)mir_calloc(sizeof(UinKey));
p->header = HEADER;
@@ -107,7 +107,7 @@ void delContact(MCONTACT hContact) if (p) {
arClist.remove(p);
- cpp_delete_context(p->cntx); p->cntx = 0;
+ cpp_delete_context(p->cntx); p->cntx = nullptr;
mir_free(p->tmp);
mir_free(p->msgSplitted);
mir_free(p);
@@ -129,7 +129,7 @@ void freeContactList() {
for (int j = 0; j < arClist.getCount(); j++) {
pUinKey p = arClist[j];
- cpp_delete_context(p->cntx); p->cntx = 0;
+ cpp_delete_context(p->cntx); p->cntx = nullptr;
mir_free(p->tmp);
mir_free(p->msgSplitted);
mir_free(p);
@@ -157,7 +157,7 @@ pUinKey getUinCtx(HANDLE cntx) if (arClist[j]->cntx == cntx)
return arClist[j];
- return NULL;
+ return nullptr;
}
// add message to user queue for send later
@@ -169,7 +169,7 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg) mir_cslock lck(localQueueMutex);
- if (ptr->msgQueue == NULL) {
+ if (ptr->msgQueue == nullptr) {
// create new
ptr->msgQueue = (pWM)mir_alloc(sizeof(struct waitingMessage));
ptrMessage = ptr->msgQueue;
@@ -185,7 +185,7 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg) }
ptrMessage->wParam = wParam;
- ptrMessage->nextMessage = NULL;
+ ptrMessage->nextMessage = nullptr;
ptrMessage->Message = mir_strdup(szMsg);
}
@@ -210,7 +210,7 @@ void getContactUinA(MCONTACT hContact, LPSTR szUIN) DBVARIANT dbv_uniqueid;
LPSTR uID = (LPSTR)CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = 0; // Billy_Bons
+ if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = nullptr; // Billy_Bons
if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
if (dbv_uniqueid.type == DBVT_WORD)
sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name); //!!!!!!!!!!!
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp index dfda8a284a..8f60119b0b 100644 --- a/plugins/SecureIM/src/crypt_misc.cpp +++ b/plugins/SecureIM/src/crypt_misc.cpp @@ -17,7 +17,7 @@ static void sttWaitForExchange(LPVOID param) // if keyexchange failed or timeout
if (ptr->waitForExchange == 1 || ptr->waitForExchange == 3) { // ïðîòóõëî - îòïðàâëÿåì íåçàøèôðîâàííî, åñëè íàäî
- if (ptr->msgQueue && msgbox1(0, sim104, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (ptr->msgQueue && msgbox1(nullptr, sim104, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES) {
mir_cslock lck(localQueueMutex);
ptr->sendQueue = true;
pWM ptrMessage = ptr->msgQueue;
@@ -31,7 +31,7 @@ static void sttWaitForExchange(LPVOID param) ptrMessage = ptrMessage->nextMessage;
mir_free(tmp);
}
- ptr->msgQueue = NULL;
+ ptr->msgQueue = nullptr;
ptr->sendQueue = false;
}
ptr->waitForExchange = 0;
@@ -51,7 +51,7 @@ static void sttWaitForExchange(LPVOID param) ptrMessage = ptrMessage->nextMessage;
mir_free(tmp);
}
- ptr->msgQueue = NULL;
+ ptr->msgQueue = nullptr;
ptr->waitForExchange = 0;
}
else if (ptr->waitForExchange == 0) { // î÷èñòèòü î÷åðåäü
@@ -64,7 +64,7 @@ static void sttWaitForExchange(LPVOID param) ptrMessage = ptrMessage->nextMessage;
mir_free(tmp);
}
- ptr->msgQueue = NULL;
+ ptr->msgQueue = nullptr;
}
}
diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index 9ed7a92671..495bc324e2 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -5,7 +5,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText) DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_SENT | DBEF_READ;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)mir_strlen(szText) + 1;
dbei.pBlob = (PBYTE)szText;
diff --git a/plugins/SecureIM/src/images.cpp b/plugins/SecureIM/src/images.cpp index ea171fd482..60a1af63d1 100644 --- a/plugins/SecureIM/src/images.cpp +++ b/plugins/SecureIM/src/images.cpp @@ -9,7 +9,7 @@ void HalfBitmap32Alpha(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -39,7 +39,7 @@ void MakeBmpTransparent(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -64,7 +64,7 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -106,8 +106,8 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) dwLen = bmp.bmWidth * bmp.bmHeight * 4;
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
// Create bitmap
BITMAPINFO RGB32BitsBITMAPINFO;
@@ -118,21 +118,21 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- HBITMAP hDirectBitmap = CreateDIBSection(NULL,
+ HBITMAP hDirectBitmap = CreateDIBSection(nullptr,
(BITMAPINFO *)&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
(void **)&ptPixels,
- NULL, 0);
+ nullptr, 0);
// Copy data
if (bmp.bmBitsPixel != 32) {
HDC hdcOrig, hdcDest;
HBITMAP oldOrig, oldDest;
- hdcOrig = CreateCompatibleDC(NULL);
+ hdcOrig = CreateCompatibleDC(nullptr);
oldOrig = (HBITMAP)SelectObject(hdcOrig, hBitmap);
- hdcDest = CreateCompatibleDC(NULL);
+ hdcDest = CreateCompatibleDC(nullptr);
oldDest = (HBITMAP)SelectObject(hdcDest, hDirectBitmap);
BitBlt(hdcDest, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOrig, 0, 0, SRCCOPY);
@@ -168,11 +168,11 @@ HBITMAP CreateBitmap32(int cx, int cy) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- HBITMAP DirectBitmap = CreateDIBSection(NULL,
+ HBITMAP DirectBitmap = CreateDIBSection(nullptr,
(BITMAPINFO *)&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
(void **)&ptPixels,
- NULL, 0);
+ nullptr, 0);
return DirectBitmap;
}
@@ -197,7 +197,7 @@ BOOL MakeBitmap32(HBITMAP *hBitmap) BOOL MakeGrayscale(HBITMAP *hBitmap)
{
- BYTE *p = NULL;
+ BYTE *p = nullptr;
BYTE *p1;
DWORD dwLen;
int width, height, x, y;
@@ -209,7 +209,7 @@ BOOL MakeGrayscale(HBITMAP *hBitmap) dwLen = width * height * 4;
p = (BYTE *)malloc(dwLen);
- if (p == NULL) {
+ if (p == nullptr) {
return FALSE;
}
@@ -241,11 +241,11 @@ HICON MakeHalfAlphaIcon(HICON SourceIcon) ICONINFO TargetIconInfo;
if (!GetIconInfo(TempIcon, &TargetIconInfo))
- return NULL;
+ return nullptr;
BITMAP TargetBitmapInfo;
if (!GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo))
- return NULL;
+ return nullptr;
MakeBitmap32(&TargetIconInfo.hbmColor);
HalfBitmap32Alpha(TargetIconInfo.hbmColor);
@@ -264,7 +264,7 @@ HICON MakeGrayscaleIcon(HICON SourceIcon) ICONINFO TargetIconInfo;
BITMAP TargetBitmapInfo;
if (!GetIconInfo(TempIcon, &TargetIconInfo) || GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo) == 0)
- return NULL;
+ return nullptr;
MakeGrayscale(&TargetIconInfo.hbmColor);
@@ -286,19 +286,19 @@ HICON BindOverlayIcon(HICON SourceIcon, HICON OverlayIcon) TempIcon = CopyIcon(SourceIcon);
if (!GetIconInfo(TempIcon, &TargetIconInfo))
- return NULL;
+ return nullptr;
MakeBitmap32(&TargetIconInfo.hbmColor);
CorrectBitmap32Alpha(TargetIconInfo.hbmColor, FALSE);
GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo);
if (!GetIconInfo(OverlayIcon, &OverlayIconInfo) || !GetObject(OverlayIconInfo.hbmColor, sizeof(BITMAP), &OverlayBitmapInfo))
- return NULL;
+ return nullptr;
- TargetDC = CreateCompatibleDC(NULL);
+ TargetDC = CreateCompatibleDC(nullptr);
OldTargetBitmap = (HBITMAP)SelectObject(TargetDC, TargetIconInfo.hbmColor);
- OverlayDC = CreateCompatibleDC(NULL);
+ OverlayDC = CreateCompatibleDC(nullptr);
OldOverlayBitmap = (HBITMAP)SelectObject(OverlayDC, OverlayIconInfo.hbmColor);
AlphaBlend(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight,
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp index ceb5a545cd..756a235b4c 100644 --- a/plugins/SecureIM/src/loadicons.cpp +++ b/plugins/SecureIM/src/loadicons.cpp @@ -45,11 +45,11 @@ static icons[] = HINSTANCE LoadIconsPack(const char* szIconsPack)
{
HINSTANCE hNewIconInst = LoadLibrary(szIconsPack);
- if (hNewIconInst != NULL) {
+ if (hNewIconInst != nullptr) {
for (int i = ID_FIRSTICON; i <= ID_LASTICON; i++)
- if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == NULL) {
+ if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == nullptr) {
FreeLibrary(hNewIconInst);
- hNewIconInst = NULL;
+ hNewIconInst = nullptr;
break;
}
}
@@ -73,22 +73,22 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) void InitIcons(void)
{
- HINSTANCE hNewIconInst = NULL;
+ HINSTANCE hNewIconInst = nullptr;
if (g_hFolders) {
char pathname[MAX_PATH];
FoldersGetCustomPath(g_hFolders, pathname, MAX_PATH, "icons\\");
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
hNewIconInst = LoadIconsPack(pathname);
}
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
hNewIconInst = LoadIconsPack("icons\\secureim_icons.dll");
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
hNewIconInst = LoadIconsPack("plugins\\secureim_icons.dll");
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
g_hIconInst = g_hInst;
else
g_hIconInst = hNewIconInst;
@@ -96,7 +96,7 @@ void InitIcons(void) char tszPath[MAX_PATH];
GetModuleFileName(g_hIconInst, tszPath, _countof(tszPath));
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.a = "SecureIM";
sid.defaultFile.a = tszPath;
diff --git a/plugins/SecureIM/src/loadlib.cpp b/plugins/SecureIM/src/loadlib.cpp index 640f464ce4..c1c5cc483e 100644 --- a/plugins/SecureIM/src/loadlib.cpp +++ b/plugins/SecureIM/src/loadlib.cpp @@ -6,9 +6,9 @@ HMODULE h; BOOL loadlib(void)
{
h = LoadLibrary("plugins/cryptopp.dll");
- if (h == NULL) {
+ if (h == nullptr) {
h = LoadLibrary("cryptopp.dll");
- if (h == NULL) return 0;
+ if (h == nullptr) return 0;
}
cpp.cc = (_cpp_create_context)GetProcAddress(h, "cpp_create_context");
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 22a5ef4749..a56200fff4 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -107,7 +107,7 @@ static int onModulesLoaded(WPARAM, LPARAM) }
if (!rsa_4096)
- mir_forkthread(sttGenerateRSA, NULL);
+ mir_forkthread(sttGenerateRSA, nullptr);
mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10));
@@ -236,7 +236,7 @@ static int onModulesLoaded(WPARAM, LPARAM) g_hMenu[0] = MyAddMenuItem(sim301, 110000, "5A8C2F35-4699-43A4-A820-516DEB83FCA1", g_hICO[ICO_CM_EST], MODULENAME"/SIM_EST", CMIF_NOTOFFLINE);
g_hMenu[1] = MyAddMenuItem(sim302, 110001, "0B092254-DA91-42D6-A89D-365981BB3D91", g_hICO[ICO_CM_DIS], MODULENAME"/SIM_DIS", CMIF_NOTOFFLINE);
- g_hMenu[2] = MyAddMenuItem(sim312[0], 110002, "635576BB-A927-4F64-B205-DD464F57CC99", NULL, NULL);
+ g_hMenu[2] = MyAddMenuItem(sim312[0], 110002, "635576BB-A927-4F64-B205-DD464F57CC99", nullptr, nullptr);
g_hMenu[3] = MyAddSubItem(g_hMenu[2], sim232[0], 110003, 110002, MODULENAME"/SIM_ST_DIS");
g_hMenu[4] = MyAddSubItem(g_hMenu[2], sim232[1], 110004, 110002, MODULENAME"/SIM_ST_ENA");
g_hMenu[5] = MyAddSubItem(g_hMenu[2], sim232[2], 110005, 110002, MODULENAME"/SIM_ST_TRY");
@@ -251,7 +251,7 @@ static int onModulesLoaded(WPARAM, LPARAM) g_hMenu[9] = MyAddMenuItem(sim309, 110009, "5C60AD6F-6B1B-4758-BB68-C008168BF32B", mode2icon(MODE_GPG, 2), MODULENAME"/GPG_DEL", 0);
}
- g_hMenu[10] = MyAddMenuItem(sim311[0], 110010, "D56DD118-863B-4069-9A6A-C0057BA99CC6", NULL, NULL);
+ g_hMenu[10] = MyAddMenuItem(sim311[0], 110010, "D56DD118-863B-4069-9A6A-C0057BA99CC6", nullptr, nullptr);
g_hMenu[11] = MyAddSubItem(g_hMenu[10], sim231[0], 110011, 110010, MODULENAME"/MODE_NAT");
g_hMenu[12] = MyAddSubItem(g_hMenu[10], sim231[1], 110012, 110010, MODULENAME"/MODE_PGP");
g_hMenu[13] = MyAddSubItem(g_hMenu[10], sim231[2], 110013, 110010, MODULENAME"/MODE_GPG");
@@ -324,7 +324,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) // load crypo++ dll
if (!loadlib()) {
- msgbox1(0, sim107, MODULENAME, MB_OK | MB_ICONSTOP);
+ msgbox1(nullptr, sim107, MODULENAME, MB_OK | MB_ICONSTOP);
return 1;
}
diff --git a/plugins/SecureIM/src/mmi.cpp b/plugins/SecureIM/src/mmi.cpp index 5f2c5a8896..30b1030e32 100644 --- a/plugins/SecureIM/src/mmi.cpp +++ b/plugins/SecureIM/src/mmi.cpp @@ -57,7 +57,7 @@ char* m_aastrcat(LPCSTR strA, LPCSTR strB) return str;
}
-LPSTR m_string = NULL;
+LPSTR m_string = nullptr;
// ANSIz + ANSIz = ANSIz
char* m_ustrcat(LPCSTR strA, LPCSTR strB)
@@ -68,7 +68,7 @@ char* m_ustrcat(LPCSTR strA, LPCSTR strB) return m_string;
}
-LPSTR m_hex = NULL;
+LPSTR m_hex = nullptr;
LPSTR to_hex(PBYTE bin, int len)
{
@@ -90,7 +90,7 @@ void __fastcall safe_free(void** p) {
if (*p) {
mir_free(*p);
- *p = NULL;
+ *p = nullptr;
}
}
@@ -98,7 +98,7 @@ void __fastcall safe_delete(void** p) {
if (*p) {
delete(*p);
- *p = NULL;
+ *p = nullptr;
}
}
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 7ca3e45258..79095679a5 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -10,7 +10,7 @@ BOOL hasKey(pUinKey ptr) BOOL ret = 0;
if (ptr->mode == MODE_NATIVE) {
LPSTR str = db_get_sa(ptr->hContact, MODULENAME, "PSK");
- ret = (str != NULL); SAFE_FREE(str);
+ ret = (str != nullptr); SAFE_FREE(str);
}
else if (ptr->mode == MODE_RSAAES) {
DBVARIANT dbv;
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR ListView_SetImageList(hLV, hSmall, LVSIL_SMALL);
ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL);
{
- static const char *szColHdr[] = { sim203, sim204, sim230, sim205, "", sim234, 0 };
+ static const char *szColHdr[] = { sim203, sim204, sim230, sim205, "", sim234, nullptr };
static int iColWidth[] = { 150, 110, 60, 55, 35, 330 };
LVCOLUMN lvc;
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -280,7 +280,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR if (ptr) {
LPSTR buffer = (LPSTR)alloca(PSKSIZE + 1);
getContactName(ptr->hContact, buffer);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PSK), NULL, DlgProcSetPSK, (LPARAM)buffer);
+ int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PSK), nullptr, DlgProcSetPSK, (LPARAM)buffer);
if (res == IDOK) {
setListViewPSK(hLV, idx, 1);
db_set_s(ptr->hContact, MODULENAME, "tPSK", buffer);
@@ -429,7 +429,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR ptr = (pUinKey)getListViewParam(hLV, lpLV->iItem);
if (ptr) {
POINT p; GetCursorPos(&p);
- HMENU hMenu = NULL;
+ HMENU hMenu = nullptr;
if (ptr->tmode == MODE_NATIVE || ptr->tmode == MODE_RSAAES) {
switch (lpLV->iSubItem) {
case 2: // mode
@@ -463,7 +463,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR CheckMenuItem(hMenu, ID_SIM_NATIVE + ptr->tmode, MF_CHECKED);
if (!bPGP) EnableMenuItem(hMenu, ID_SIM_PGP, MF_GRAYED);
if (!bGPG) EnableMenuItem(hMenu, ID_SIM_GPG, MF_GRAYED);
- TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_LEFTALIGN | TPM_TOPALIGN, p.x, p.y, 0, hDlg, 0);
+ TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_LEFTALIGN | TPM_TOPALIGN, p.x, p.y, 0, hDlg, nullptr);
DestroyMenu(hMenu);
}
}
@@ -511,7 +511,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -525,7 +525,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM case IDC_RSA_EXP:
{
LPSTR pub = (LPSTR)alloca(RSASIZE);
- mir_exp->rsa_export_keypair(CPP_MODE_RSA, NULL, pub, NULL);
+ mir_exp->rsa_export_keypair(CPP_MODE_RSA, nullptr, pub, nullptr);
if (!SaveExportRSAKeyDlg(hDlg, pub, 0))
msgbox(hDlg, sim114, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
}
@@ -534,10 +534,10 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM case IDC_RSA_EXPPRIV:
{
LPSTR passphrase = (LPSTR)alloca(RSASIZE);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, DlgProcSetPassphrase, (LPARAM)passphrase);
+ int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
if (res == IDOK) {
LPSTR priv = (LPSTR)alloca(RSASIZE);
- mir_exp->rsa_export_keypair(CPP_MODE_RSA, priv, NULL, passphrase);
+ mir_exp->rsa_export_keypair(CPP_MODE_RSA, priv, nullptr, passphrase);
if (!SaveExportRSAKeyDlg(hDlg, priv, 1))
msgbox(hDlg, sim112, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
}
@@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM return TRUE;
LPSTR passphrase = (LPSTR)alloca(RSASIZE);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, DlgProcSetPassphrase, (LPARAM)passphrase);
+ int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
if (res == IDOK) {
if (!mir_exp->rsa_import_keypair(CPP_MODE_RSA, priv, passphrase))
msgbox(hDlg, sim113, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
@@ -644,7 +644,7 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l ListView_SetImageList(hLV, hSmall, LVSIL_SMALL);
ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL);
{
- static const char *szColHdr[] = { sim203, sim204, sim215, 0 };
+ static const char *szColHdr[] = { sim203, sim204, sim215, nullptr };
static int iColWidth[] = { 160, 150, 80 };
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
@@ -667,7 +667,7 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -770,7 +770,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l ListView_SetImageList(hLV, hSmall, LVSIL_SMALL);
ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL);
{
- static const char *szColHdr[] = { sim203, sim204, sim215, sim227, 0 };
+ static const char *szColHdr[] = { sim203, sim204, sim215, sim227, nullptr };
static int iColWidth[] = { 140, 120, 120, 40 };
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
@@ -794,7 +794,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -1025,7 +1025,7 @@ void RefreshProtoDlg(HWND hDlg) EnableWindow(GetDlgItem(hDlg, IDC_SPLITON), false);
EnableWindow(GetDlgItem(hDlg, IDC_SPLITOFF), false);
- BYTE sha[64]; int len; mir_exp->rsa_get_keyhash(CPP_MODE_RSA, NULL, NULL, (PBYTE)&sha, &len);
+ BYTE sha[64]; int len; mir_exp->rsa_get_keyhash(CPP_MODE_RSA, nullptr, nullptr, (PBYTE)&sha, &len);
LPSTR txt = mir_strdup(to_hex(sha, len));
SetDlgItemText(hDlg, IDC_RSA_SHA, txt);
mir_free(txt);
@@ -1067,7 +1067,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) LPSTR szKeyID = db_get_sa(hContact, MODULENAME, "pgp_abbr");
lvi.iItem++;
- lvi.iImage = (szKeyID != 0);
+ lvi.iImage = (szKeyID != nullptr);
lvi.lParam = (LPARAM)ptr;
getContactName(hContact, tmp);
@@ -1130,7 +1130,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) LPSTR szKeyID = db_get_sa(hContact, MODULENAME, "gpg");
lvi.iItem++;
- lvi.iImage = (szKeyID != 0);
+ lvi.iImage = (szKeyID != nullptr);
lvi.lParam = (LPARAM)ptr;
getContactName(hContact, tmp);
@@ -1340,14 +1340,14 @@ void ApplyGPGSettings(HWND hDlg) GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgLog", tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
- else gpg_set_log(0);
+ else gpg_set_log(nullptr);
BOOL bgpgTmpFlag = (IsDlgButtonChecked(hDlg, IDC_TMPPATHON_CBOX) == BST_CHECKED);
db_set_b(0, MODULENAME, "gpgTmpFlag", bgpgTmpFlag);
GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgTmp", tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
- else gpg_set_tmp(0);
+ else gpg_set_tmp(nullptr);
HWND hLV = GetDlgItem(hDlg, IDC_GPG_USERLIST);
int i = ListView_GetNextItem(hLV, (UINT)-1, LVNI_ALL);
@@ -1438,7 +1438,7 @@ void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1);
LV_SetItemTextA(hLV, iItem, 4, str);
- LPSTR sha = NULL;
+ LPSTR sha = nullptr;
if (iStatus) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
@@ -1587,7 +1587,7 @@ LPCSTR publ_end = "-----END PGP PUBLIC KEY BLOCK-----"; LPSTR LoadKeys(LPCSTR file, BOOL priv)
{
FILE *f = fopen(file, "r");
- if (!f) return NULL;
+ if (!f) return nullptr;
fseek(f, 0, SEEK_END);
int flen = ftell(f);
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index db0cf190a2..a4f1d8a946 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -38,7 +38,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) int msg_id, part_num, part_all;
sscanf(szMsg, "%4X%2X%2X", &msg_id, &part_num, &part_all);
//
- pPM ppm = NULL, pm = ptr->msgPart;
+ pPM ppm = nullptr, pm = ptr->msgPart;
if (!ptr->msgPart) {
pm = ptr->msgPart = new partitionMessage;
memset(pm, 0, sizeof(partitionMessage));
@@ -65,7 +65,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) int len = 0, i;
for (i = 0; i < part_all; i++) {
- if (pm->message[i] == NULL) break;
+ if (pm->message[i] == nullptr) break;
len += (int)mir_strlen(pm->message[i]);
}
if (i == part_all) { // combine message
@@ -87,7 +87,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) Sent_NetLog("combine: not all parts");
// not combined yet
- return NULL;
+ return nullptr;
}
// îòïðàâëÿåò ñîîáùåíèå, åñëè íàäî òî ðàçáèâàåò íà ÷àñòè
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index c78bc618df..548c92bce8 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -11,7 +11,7 @@ int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam) if (stat == ID_STATUS_OFFLINE) { // go offline
if (ptr->mode == MODE_NATIVE && cpp_keyx(ptr->cntx)) { // have active context
- cpp_delete_context(ptr->cntx); ptr->cntx = 0; // reset context
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr; // reset context
showPopupDC(hContact); // show popup "Disabled"
ShowStatusIconNotify(hContact); // change icon in CL
}
@@ -96,16 +96,16 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM) // Native/RSAAES
if (!isSecured) // create secureim connection
- Menu_ModifyItem(g_hMenu[0], NULL, mode2icon(ptr->mode | SECURED, 2), 0);
+ Menu_ModifyItem(g_hMenu[0], nullptr, mode2icon(ptr->mode | SECURED, 2), 0);
else // disable secureim connection
- Menu_ModifyItem(g_hMenu[1], NULL, mode2icon(ptr->mode, 2), 0);
+ Menu_ModifyItem(g_hMenu[1], nullptr, mode2icon(ptr->mode, 2), 0);
// set status menu
if (bSCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
Menu_ModifyItem(g_hMenu[2], sim312[ptr->status], g_hICO[ICO_ST_DIS + ptr->status], 0);
for (int i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++)
- Menu_ModifyItem(g_hMenu[3 + i], NULL, (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL, 0);
+ Menu_ModifyItem(g_hMenu[3 + i], nullptr, (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : nullptr, 0);
}
}
else if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
@@ -126,7 +126,7 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM) for (int i = 0; i < MODE_CNT; i++) {
if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP) continue;
if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG) continue;
- Menu_ModifyItem(g_hMenu[11 + i], NULL, (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL, 0);
+ Menu_ModifyItem(g_hMenu[11 + i], nullptr, (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : nullptr, 0);
}
}
}
diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp index 79c12b0b83..b7f879dbbf 100644 --- a/plugins/SecureIM/src/svcs_menu.cpp +++ b/plugins/SecureIM/src/svcs_menu.cpp @@ -61,7 +61,7 @@ INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM) }
{
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -84,7 +84,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) }
else if (bPGPprivkey) {
char KeyPath[MAX_PATH]; KeyPath[0] = '\0';
- if (ShowSelectKeyDlg(0, KeyPath)) {
+ if (ShowSelectKeyDlg(nullptr, KeyPath)) {
char *publ = LoadKeys(KeyPath, false);
if (publ) {
db_unset(wParam, MODULENAME, "pgp");
@@ -102,7 +102,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) Service_PGPdelKey(wParam, lParam);
else {
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -114,7 +114,7 @@ INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM) db_unset(wParam, MODULENAME, "gpg");
{
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -136,7 +136,7 @@ INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) Service_GPGdelKey(wParam, lParam);
else {
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -150,7 +150,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) case MODE_NATIVE:
case MODE_RSAAES:
if (isContactSecured(wParam)&SECURED) {
- msgbox(NULL, sim111, MODULENAME, MB_OK);
+ msgbox(nullptr, sim111, MODULENAME, MB_OK);
return 0;
}
if (lParam != MODE_NATIVE && ptr->status > STATUS_ENABLED)
@@ -162,7 +162,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) if (ptr) {
if (ptr->cntx) {
cpp_delete_context(ptr->cntx);
- ptr->cntx = 0;
+ ptr->cntx = nullptr;
ptr->keyLoaded = 0;
}
ptr->mode = (BYTE)lParam;
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index 00ae0afdf7..9e3a18de80 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -1,7 +1,7 @@ #include "commonheaders.h"
// return SignID
-int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = NULL)
+int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = nullptr)
{
if (szPlainMsg) *szPlainMsg = (LPSTR)szMsg;
for (int i = 0; signs[i].len; i++) {
@@ -23,7 +23,7 @@ static void sttFakeAck(LPVOID param) TFakeAckParams *tParam = (TFakeAckParams*)param;
Sleep(100);
- if (tParam->msg == NULL)
+ if (tParam->msg == nullptr)
SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->id, 0);
else
SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, LPARAM(tParam->msg));
@@ -33,7 +33,7 @@ static void sttFakeAck(LPVOID param) int returnNoError(MCONTACT hContact)
{
- mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, 0));
+ mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, nullptr));
return 777;
}
@@ -43,7 +43,7 @@ int returnError(MCONTACT hContact, LPCSTR err) return 666;
}
-LPSTR szUnrtfMsg = NULL;
+LPSTR szUnrtfMsg = nullptr;
// RecvMsg handler
INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam)
@@ -51,7 +51,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *)lParam;
PROTORECVEVENT *ppre = (PROTORECVEVENT *)ccs->lParam;
pUinKey ptr = getUinKey(ccs->hContact);
- LPSTR szEncMsg = ppre->szMessage, szPlainMsg = NULL;
+ LPSTR szEncMsg = ppre->szMessage, szPlainMsg = nullptr;
Sent_NetLog("onRecvMsg: %s", szEncMsg);
@@ -140,8 +140,8 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (!strstr(szEncMsg, "-----END PGP MESSAGE-----"))
return 1; // no end tag, don't display it ...
- LPSTR szNewMsg = NULL;
- LPSTR szOldMsg = NULL;
+ LPSTR szNewMsg = nullptr;
+ LPSTR szOldMsg = nullptr;
if (!ptr->keyLoaded && bPGPloaded) ptr->keyLoaded = LoadKeyPGP(ptr);
if (!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr);
@@ -284,7 +284,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) case SiG_DEIN: // deinit message
// other user has disabled SecureIM with you
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
showPopupDC(ptr->hContact);
ShowStatusIconNotify(ptr->hContact);
@@ -298,7 +298,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (ptr->mode == MODE_RSAAES) {
ptr->mode = MODE_NATIVE;
cpp_delete_context(ptr->cntx);
- ptr->cntx = 0;
+ ptr->cntx = nullptr;
ptr->keyLoaded = 0;
db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
@@ -481,7 +481,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) if (!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr);
if (!ptr->keyLoaded) return returnError(ccs->hContact, Translate(sim108));
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
ptrA szUtfMsg(miranda_to_utf8((LPCSTR)ccs->lParam, ccs->wParam));
if (ptr->keyLoaded == 1) // PGP
szNewMsg = pgp_encode(ptr->cntx, szUtfMsg);
@@ -606,7 +606,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) return returnError(ccs->hContact, Translate(sim105));
if (ptr->cntx) { // if secure context exists
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
CCSDATA ccsd;
memcpy(&ccsd, (HLOCAL)lParam, sizeof(CCSDATA));
@@ -651,7 +651,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) else {
db_unset(ptr->hContact, MODULENAME, "offlineKey");
db_unset(ptr->hContact, MODULENAME, "offlineKeyTimeout");
- if (msgbox1(0, sim106, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDNO)
+ if (msgbox1(nullptr, sim106, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDNO)
return returnNoError(ccs->hContact);
// exit and send unencrypted message
@@ -689,7 +689,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // disable SecureIM only if it was enabled
if (ptr->cntx) {
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
ccs->wParam |= PREF_METANODB;
Proto_ChainSend(wParam, ccs);
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index e60c19430a..66dbfe4686 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -1,6 +1,6 @@ #include "commonheaders.h"
-pRSA_EXPORT mir_exp = NULL;
+pRSA_EXPORT mir_exp = nullptr;
RSA_IMPORT imp =
{
rsa_inject,
@@ -36,7 +36,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int LPSTR uin = (LPSTR)mir_alloc(KEYSIZE); getContactUinA(ptr->hContact, uin);
LPSTR msg = (LPSTR)mir_alloc(MSGSIZE);
LPSTR sha = mir_strdup(to_hex(sig, sigLen));
- LPSTR sha_old = NULL;
+ LPSTR sha_old = nullptr;
Sent_NetLog("rsa_check_pub: %s %s %s", cnm, uin, sha);
@@ -62,7 +62,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int else {
if (k) mir_snprintf(msg, MSGSIZE, Translate(sim522), cnm, sha, sha_old);
else mir_snprintf(msg, MSGSIZE, Translate(sim520), cnm, sha);
- v = (msgbox(0, msg, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES);
+ v = (msgbox(nullptr, msg, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: manual accepted %d", v);
#endif
@@ -82,7 +82,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int void __cdecl rsa_notify(HANDLE context, int state)
{
pUinKey ptr = getUinCtx(context); if (!ptr) return;
- LPCSTR msg = NULL;
+ LPCSTR msg = nullptr;
Sent_NetLog("rsa_notify: 0x%x", state);
@@ -194,6 +194,6 @@ void resetRSAcntx(pUinKey ptr) void deleteRSAcntx(pUinKey ptr)
{
cpp_delete_context(ptr->cntx);
- ptr->cntx = 0;
+ ptr->cntx = nullptr;
ptr->keyLoaded = 0;
}
diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 411d85a71e..ac3d85b774 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -56,7 +56,7 @@ void UninitFileOutput() void FileWrite(MCONTACT hcontact)
{
FILE *log = _wfopen(ParseString(g_ptszFileName, hcontact), L"a");
- if (log != NULL) {
+ if (log != nullptr) {
fputws(ParseString(g_ptszFileStamp, hcontact), log);
fputs("\r\n", log);
fclose(log);
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 28a959d7d4..176168dd61 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -104,7 +104,7 @@ HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl, POINT pt;
RECT rcinit;
- if (NULL == hwndDlg) /* Wine fix. */
+ if (nullptr == hwndDlg) /* Wine fix. */
return hDwp;
// get current bounding rectangle
GetWindowRect(hwndControl, &rcinit);
@@ -115,7 +115,7 @@ HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl, ScreenToClient(hwndDlg, &pt);
// resize control
- return DeferWindowPos(hDwp, hwndControl, NULL,
+ return DeferWindowPos(hDwp, hwndControl, nullptr,
pt.x + nHorizontalOffset,
pt.y + nVerticalOffset,
rcinit.right - rcinit.left + nWidthOffset,
@@ -132,7 +132,7 @@ HDWP MyHorizCenterWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl, POINT pt;
RECT rcinit;
- if (NULL == hwndDlg) /* Wine fix. */
+ if (nullptr == hwndDlg) /* Wine fix. */
return hDwp;
// get current bounding rectangle
GetWindowRect(hwndControl, &rcinit);
@@ -143,7 +143,7 @@ HDWP MyHorizCenterWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl, ScreenToClient(hwndDlg, &pt);
// resize control
- return DeferWindowPos(hDwp, hwndControl, NULL,
+ return DeferWindowPos(hDwp, hwndControl, nullptr,
(int)((nClientWidth - (rcinit.right - rcinit.left)) / 2),
pt.y + nVerticalOffset,
rcinit.right - rcinit.left,
@@ -223,7 +223,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &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;
@@ -285,8 +285,8 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA void ShowHistory(MCONTACT hContact, BYTE isAlert)
{
HWND hHistoryDlg = WindowList_Find(hWindowList, hContact);
- if (hHistoryDlg == NULL) {
- hHistoryDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryDlgProc, hContact);
+ if (hHistoryDlg == nullptr) {
+ hHistoryDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryDlgProc, hContact);
LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST);
WindowList_Add(hWindowList, hHistoryDlg, hContact);
}
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index ac6672a246..172897d4ef 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CLIST_INTERFACE *pcli;
HINSTANCE hInstance;
-HANDLE ehmissed = NULL, ehuserinfo = NULL, ehmissed_proto = NULL;
+HANDLE ehmissed = nullptr, ehuserinfo = nullptr, ehmissed_proto = nullptr;
HANDLE g_hShutdownEvent;
MWindowList g_pUserInfo;
@@ -89,7 +89,7 @@ extern "C" __declspec(dllexport) int Load(void) pcli = Clist_GetInterface();
g_pUserInfo = WindowList_Create();
- g_hShutdownEvent = CreateEvent(0, TRUE, FALSE, 0);
+ g_hShutdownEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index c8e9777004..4a385b67d6 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-HANDLE hLSUserDet = NULL;
-HGENMENU hmenuitem = NULL;
+HANDLE hLSUserDet = nullptr;
+HGENMENU hmenuitem = nullptr;
void InitHistoryDialog(void);
@@ -50,7 +50,7 @@ int BuildContactMenu(WPARAM hContact, LPARAM) ptszName = ParseString(DEFAULT_MENUSTAMP, hContact);
int flags = 0;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (!mir_wstrcmp(ptszName, TranslateT("<unknown>"))) {
if (IsWatchedProtocol(szProto))
flags |= CMIF_GRAYED;
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index a3ce568a16..bdce23791a 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -70,7 +70,7 @@ INT_PTR CALLBACK MissedDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam htemp = GetDlgItem(hdlg, IDC_CONTACTS);
GetWindowRect(htemp, &rcinit);
- SetWindowPos(htemp, NULL, 0, 0, rcinit.right - rcinit.left, mcs.count*(rcinit.bottom - rcinit.top) / 2, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ SetWindowPos(htemp, nullptr, 0, 0, rcinit.right - rcinit.left, mcs.count*(rcinit.bottom - rcinit.top) / 2, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
GetWindowRect(htemp, &rcresized);
htemp = GetDlgItem(hdlg, IDOK);
@@ -81,7 +81,7 @@ INT_PTR CALLBACK MissedDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam ScreenToClient(hdlg, &pt);
MoveWindow(htemp, pt.x, pt.y + (rcresized.bottom - rcinit.bottom), (rcb.right - rcb.left), (rcb.bottom - rcb.top), FALSE);
GetWindowRect(hdlg, &rcd);
- SetWindowPos(hdlg, NULL, 0, 0, rcd.right - rcd.left, rcd.bottom - rcd.top + (rcresized.bottom - rcinit.bottom), SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ SetWindowPos(hdlg, nullptr, 0, 0, rcd.right - rcd.left, rcd.bottom - rcd.top + (rcresized.bottom - rcinit.bottom), SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
SetDlgItemText(hdlg, IDC_CONTACTS, (LPCTSTR)lparam);
ShowWindow(hdlg, SW_SHOWNOACTIVATE);
@@ -114,7 +114,7 @@ int ShowMissed(void) buf.AppendChar('\n');
}
- CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MISSED), NULL, MissedDlgProc, (LPARAM)buf.c_str());
+ CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MISSED), nullptr, MissedDlgProc, (LPARAM)buf.c_str());
return 0;
}
@@ -168,7 +168,7 @@ int ModeChange_mo(WPARAM, LPARAM lparam) case ID_STATUS_AWAY:
case ID_STATUS_DND:
case ID_STATUS_NA:
- if (ehmissed == NULL) {
+ if (ehmissed == nullptr) {
memset(&mcs, 0, sizeof(mcs));
CheckIfOnline();
ehmissed = HookEvent(ME_CLIST_CONTACTICONCHANGED, Test);
@@ -176,9 +176,9 @@ int ModeChange_mo(WPARAM, LPARAM lparam) break;
default:
- if (ehmissed != NULL) {
+ if (ehmissed != nullptr) {
UnhookEvent(ehmissed);
- ehmissed = NULL;
+ ehmissed = nullptr;
ShowMissed();
ResetMissed();
}
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index bdbd8aa407..5c2f665fbb 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -88,7 +88,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp GetColorsFromDWord(&ppd.colorBack, &ppd.colorText, temp);
SendDlgItemMessage(hdlg, idBack, CPM_SETCOLOUR, 0, ppd.colorBack);
SendDlgItemMessage(hdlg, idText, CPM_SETCOLOUR, 0, ppd.colorText);
- ppd.lchIcon = Skin_LoadProtoIcon(NULL, idBack);
+ ppd.lchIcon = Skin_LoadProtoIcon(nullptr, idBack);
GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, _countof(szstamp));
wcsncpy(ppd.lptzContactName, ParseString(szstamp, NULL), MAX_CONTACTNAME);
@@ -225,7 +225,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM SetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST), GWL_STYLE) | TVS_CHECKBOXES);
{
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -301,12 +301,12 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, _countof(szstamp));
db_set_ws(NULL, S_MOD, "HistoryStamp", szstamp);
- db_set_w(NULL, S_MOD, "HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, NULL, FALSE) + 1));
+ db_set_w(NULL, S_MOD, "HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, nullptr, FALSE) + 1));
BOOL bchecked = IsDlgButtonChecked(hdlg, IDC_MENUITEM);
if (db_get_b(NULL, S_MOD, "MenuItem", 1) != bchecked) {
db_set_b(NULL, S_MOD, "MenuItem", bchecked);
- if (hmenuitem == NULL && bchecked)
+ if (hmenuitem == nullptr && bchecked)
InitMenuitem();
}
@@ -370,7 +370,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM tvItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
- while (hItem != NULL) {
+ while (hItem != nullptr) {
tvItem.hItem = hItem;
TreeView_GetItem(hwndTreeView, &tvItem);
protocol = (char*)tvItem.lParam;
@@ -415,7 +415,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
- while (hItem != NULL) {
+ while (hItem != nullptr) {
tvItem.hItem = hItem;
TreeView_GetItem(hwndTreeView, &tvItem);
mir_free((void *)tvItem.lParam);
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 7582e5ec8a..19d2aebd16 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -24,7 +24,7 @@ LRESULT CALLBACK EditProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) {
switch (msg) {
case WM_SETCURSOR:
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
return 1;
}
return mir_callNextSubclass(hdlg, EditProc, msg, wparam, lparam);
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index e9e043d824..ef90cd1273 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -24,7 +24,7 @@ void FileWrite(MCONTACT); void HistoryWrite(MCONTACT hcontact);
extern HANDLE g_hShutdownEvent;
-char *courProtoName = 0;
+char *courProtoName = nullptr;
void LoadWatchedProtos()
{
@@ -41,7 +41,7 @@ void LoadWatchedProtos() if (szProtos == NULL)
return;
- for (char *p = strtok(szProtos, "\n"); p != NULL; p = strtok(NULL, "\n"))
+ for (char *p = strtok(szProtos, "\n"); p != nullptr; p = strtok(nullptr, "\n"))
arWatchedProtos.insert(mir_strdup(p));
}
@@ -57,14 +57,14 @@ void UnloadWatchedProtos() int IsWatchedProtocol(const char* szProto)
{
- if (szProto == NULL)
+ if (szProto == nullptr)
return 0;
PROTOACCOUNT *pd = Proto_GetAccount(szProto);
- if (pd == NULL || CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
+ if (pd == nullptr || CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
return 0;
- return arWatchedProtos.find((char*)szProto) != NULL;
+ return arWatchedProtos.find((char*)szProto) != nullptr;
}
BOOL isYahoo(char *protoname)
@@ -504,12 +504,12 @@ void myPlaySound(MCONTACT hcontact, WORD newStatus, WORD oldStatus) {
if (CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE)) return;
//oldStatus and hcontact are not used yet
- char *soundname = NULL;
+ char *soundname = nullptr;
if ((newStatus == ID_STATUS_ONLINE) || (newStatus == ID_STATUS_FREECHAT)) soundname = "LastSeenTrackedStatusOnline";
else if (newStatus == ID_STATUS_OFFLINE) soundname = "LastSeenTrackedStatusOffline";
else if (oldStatus == ID_STATUS_OFFLINE) soundname = "LastSeenTrackedStatusFromOffline";
else soundname = "LastSeenTrackedStatusChange";
- if (soundname != NULL)
+ if (soundname != nullptr)
Skin_PlaySound(soundname);
}
@@ -556,7 +556,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) DBWriteTimeTS(cws->value.dVal, hContact);
HWND hwnd = WindowList_Find(g_pUserInfo, hContact);
- if (hwnd != NULL)
+ if (hwnd != nullptr)
SendMessage(hwnd, WM_REFRESH_UI, hContact, 0);
return 0;
}
@@ -586,7 +586,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) mir_snprintf(str, "OffTime-%s", szProto);
DWORD t = db_get_dw(NULL, S_MOD, str, 0);
if (!t)
- t = time(NULL);
+ t = time(nullptr);
DBWriteTimeTS(t, hContact);
}
@@ -613,7 +613,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if (cws->value.wVal == prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0))
return 0;
- DBWriteTimeTS(time(NULL), hContact);
+ DBWriteTimeTS(time(nullptr), hContact);
if (g_bFileActive) FileWrite(hContact);
if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus);
@@ -631,7 +631,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if (CallProtoService(cws->szModule, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
mir_cslock lck(csContacts);
logthread_info *p = arContacts.find((logthread_info*)&hContact);
- if (p == NULL) {
+ if (p == nullptr) {
p = (logthread_info*)mir_calloc(sizeof(logthread_info));
p->hContact = hContact;
mir_strncpy(p->sProtoName, cws->szModule, _countof(p->sProtoName));
@@ -681,7 +681,7 @@ int ModeChange(WPARAM, LPARAM lparam) if (!IsWatchedProtocol(courProtoName) && strncmp(courProtoName, "MetaContacts", 12))
return 0;
- DBWriteTimeTS(time(NULL), NULL);
+ DBWriteTimeTS(time(nullptr), NULL);
// isetting=CallProtoService(ack->szModule,PS_GETSTATUS,0,0);
WORD isetting = (WORD)ack->lParam;
@@ -718,7 +718,7 @@ int ModeChange(WPARAM, LPARAM lparam) if (g_bFileActive)
FileWrite(NULL);
- courProtoName = NULL;
+ courProtoName = nullptr;
return 0;
}
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 6ec66563aa..002d9fa922 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -35,22 +35,22 @@ CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) : m_bDeleteAfterSend(false), m_bAsync(bAsync), m_bSilent(bSilent), - m_pszFile(NULL), - m_pszFileDesc(NULL), - m_URL(NULL), - m_URLthumb(NULL), - m_pszSendTyp(NULL), - m_pszProto(NULL), + m_pszFile(nullptr), + m_pszFileDesc(nullptr), + m_URL(nullptr), + m_URLthumb(nullptr), + m_pszSendTyp(nullptr), + m_pszProto(nullptr), // m_hContact(hContact), // initialized below m_EnableItem(0), m_ChatRoom(0), // m_PFflag(0), m_cbEventMsg(0), - m_szEventMsg(NULL), - m_hSend(0), - m_hOnSend(0), - m_ErrorMsg(NULL), - m_ErrorTitle(NULL) + m_szEventMsg(nullptr), + m_hSend(nullptr), + m_hOnSend(nullptr), + m_ErrorMsg(nullptr), + m_ErrorTitle(nullptr) { SetContact(hContact); } @@ -297,10 +297,10 @@ void CSend::svcSendFileExit() } // Start miranda PSS_FILE based on mir ver (T) - wchar_t* ppFile[2] = { 0, 0 }; + wchar_t* ppFile[2] = { nullptr, nullptr }; wchar_t* pDesc = mir_wstrdup(m_pszFileDesc); ppFile[0] = mir_wstrdup(m_pszFile); - ppFile[1] = NULL; + ppFile[1] = nullptr; m_hSend = (HANDLE)ProtoChainSend(m_hContact, PSS_FILE, (WPARAM)pDesc, (LPARAM)ppFile); mir_free(pDesc); mir_free(ppFile[0]); @@ -378,7 +378,7 @@ void CSend::DB_EventAdd(WORD EventType) dbei.szModule = m_pszProto; dbei.eventType = EventType; dbei.flags = DBEF_SENT; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.flags |= DBEF_UTF; dbei.cbBlob = m_cbEventMsg; dbei.pBlob = (PBYTE)m_szEventMsg; @@ -402,9 +402,9 @@ void CSend::Error(LPCTSTR pszFormat, ...) memset(&m_box, 0, sizeof(MSGBOX)); m_box.cbSize = sizeof(MSGBOX); - m_box.hParent = NULL; + m_box.hParent = nullptr; m_box.hiLogo = GetIcon(ICO_MAIN); - m_box.hiMsg = NULL; + m_box.hiMsg = nullptr; m_box.ptszTitle = m_ErrorTitle; m_box.ptszMsg = m_ErrorMsg; m_box.uType = MB_OK | MB_ICON_ERROR; @@ -419,7 +419,7 @@ void CSend::Exit(unsigned int Result) switch (Result) { case CSEND_DIALOG: Skin_PlaySound("FileDone"); - DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_UResultForm), 0, ResultDialogProc, (LPARAM)this); + DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_UResultForm), nullptr, ResultDialogProc, (LPARAM)this); err = false; break; case ACKRESULT_SUCCESS: @@ -449,11 +449,11 @@ void CSend::Exit(unsigned int Result) if (err) { Skin_PlaySound("FileFailed"); if (m_ErrorMsg) MsgBoxService(NULL, (LPARAM)&m_box); - else MsgErr(NULL, LPGENW("An unknown error has occurred.")); + else MsgErr(nullptr, LPGENW("An unknown error has occurred.")); } } if (m_pszFile && *m_pszFile && m_bDeleteAfterSend && m_EnableItem&SS_DLG_DELETEAFTERSSEND) { - DeleteFile(m_pszFile), m_pszFile = NULL; + DeleteFile(m_pszFile), m_pszFile = nullptr; } if (m_bAsync) delete this;/// deletes derived class since destructor is virtual (which also auto-calls base dtor) @@ -467,7 +467,7 @@ void CSend::Exit(unsigned int Result) const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* endTag) { char* begin = strstr(str, startTag); - if (!begin) return NULL; + if (!begin) return nullptr; begin += mir_strlen(startTag) - 1; for (; *begin != '>' && *begin; ++begin); if (*begin) { @@ -482,7 +482,7 @@ int JSON_ParseData_(const char** jsondata, size_t jsonlen, const char** rawdata) const char* c = *jsondata; const char* jsonend = *jsondata + jsonlen; int len = 0; - *rawdata = NULL; + *rawdata = nullptr; if (c == jsonend) return 0; if (*c == '{') { // scope (object) @@ -560,7 +560,7 @@ int JSON_Get_(const char* json, size_t jsonlen, const char* variable, const char JSON_ParseData_(&c, jsonend - c, value); } } - *value = NULL; + *value = nullptr; return 0; } @@ -645,9 +645,9 @@ static void HTTPFormAppendData(NETLIBHTTPREQUEST* nlhr, size_t* dataMax, char** void CSend::HTTPFormDestroy(NETLIBHTTPREQUEST* nlhr) { - mir_free(nlhr->headers[0].szValue), nlhr->headers[0].szValue = NULL; - mir_free(nlhr->headers), nlhr->headers = NULL; - mir_free(nlhr->pData), nlhr->pData = NULL; + mir_free(nlhr->headers[0].szValue), nlhr->headers[0].szValue = nullptr; + mir_free(nlhr->headers), nlhr->headers = nullptr; + mir_free(nlhr->pData), nlhr->pData = nullptr; } int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* url, HTTPFormData* frm, size_t frmNum) @@ -700,7 +700,7 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* size_t dataMax = 0; for (HTTPFormData* iter = frm, *end = frm + frmNum; iter != end; ++iter) { if (iter->flags&HTTPFF_HEADER) continue; - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, 2 + sizeof(boundary) + 40); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, 2 + sizeof(boundary) + 40); memset(dataPos, '-', 2); dataPos += 2; memcpy(dataPos, boundary, sizeof(boundary)); dataPos += sizeof(boundary); memcpy(dataPos, "\r\nContent-Disposition: form-data; name=\"", 40); dataPos += 40; @@ -713,7 +713,7 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* if (!filename) filename = iter->value_str; else ++filename; valuelen = mir_strlen(filename); - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 13 + valuelen + 17); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 13 + valuelen + 17); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"; filename=\"", 13); dataPos += 13; memcpy(dataPos, filename, valuelen); dataPos += valuelen; @@ -741,9 +741,9 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* if (fp) { fseek(fp, 0, SEEK_END); filesize = ftell(fp); fseek(fp, 0, SEEK_SET); - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, filesize + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, filesize + 2); if (fread(dataPos, 1, filesize, fp) != filesize) { - fclose(fp), fp = NULL; + fclose(fp), fp = nullptr; } } if (!fp) { @@ -758,14 +758,14 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* memcpy(dataPos, "\r\n", 2); dataPos += 2; } else if (iter->flags&HTTPFF_8BIT) { - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 38 + valuelen + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 38 + valuelen + 2); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n", 38); dataPos += 38; memcpy(dataPos, iter->value_str, valuelen); dataPos += valuelen; memcpy(dataPos, "\r\n", 2); dataPos += 2; } else if (iter->flags&HTTPFF_INT) { - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 5 + 17/*max numbers*/ + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 5 + 17/*max numbers*/ + 2); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"\r\n\r\n", 5); dataPos += 5; int ret = snprintf(dataPos, 17, "%Id", iter->value_int); @@ -773,14 +773,14 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* memcpy(dataPos, "\r\n", 2); dataPos += 2; } else { - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 5 + valuelen + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 5 + valuelen + 2); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"\r\n\r\n", 5); dataPos += 5; memcpy(dataPos, iter->value_str, valuelen); dataPos += valuelen; memcpy(dataPos, "\r\n", 2); dataPos += 2; } } - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, 2 + sizeof(boundary) + 4); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, 2 + sizeof(boundary) + 4); memset(dataPos, '-', 2); dataPos += 2; memcpy(dataPos, boundary, sizeof(boundary)); dataPos += sizeof(boundary); memcpy(dataPos, "--\r\n", 4); dataPos += 4; diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp index 760ad268f3..20993010b2 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp +++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp @@ -35,11 +35,11 @@ CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool /*bAsync*/) { m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_DELETEAFTERSSEND; // SS_DLG_AUTOSEND | ; m_pszSendTyp = LPGENW("Email transfer"); - m_pszFileA = NULL; - m_pszFileName = NULL; - m_Email = NULL; - m_FriendlyName = NULL; - m_Subject = NULL; + m_pszFileA = nullptr; + m_pszFileName = nullptr; + m_Email = nullptr; + m_FriendlyName = nullptr; + m_Subject = nullptr; } CSendEmail::~CSendEmail() @@ -86,14 +86,14 @@ void CSendEmail::SendThread() MAPIFUNC lpMAPISendMail; HINSTANCE hMAPILib = ::LoadLibrary(L"MAPI32.DLL"); - if (hMAPILib == NULL) { + if (hMAPILib == nullptr) { //return -1; Error(SS_ERR_INIT, m_pszSendTyp); Exit(ACKRESULT_FAILED); return; } lpMAPISendMail = (MAPIFUNC)GetProcAddress(hMAPILib, "MAPISendMail"); - if (lpMAPISendMail == NULL) { + if (lpMAPISendMail == nullptr) { ::FreeLibrary(hMAPILib); //return -2; Error(SS_ERR_INIT, m_pszSendTyp); @@ -104,10 +104,10 @@ void CSendEmail::SendThread() arrfileDesc[0].ulReserved = 0; arrfileDesc[0].flFlags = 0; - arrfileDesc[0].lpFileType = NULL; + arrfileDesc[0].lpFileType = nullptr; arrfileDesc[0].nPosition = -1; arrfileDesc[0].lpszPathName = m_pszFileA; - arrfileDesc[0].lpszFileName = NULL; + arrfileDesc[0].lpszFileName = nullptr; Msg.nFileCount = 1; Msg.lpFiles = arrfileDesc; @@ -128,7 +128,7 @@ void CSendEmail::SendThread() recip.lpszAddress = m_Email; //email recip.ulEIDSize = 0; - recip.lpEntryID = NULL; + recip.lpEntryID = nullptr; Msg.lpRecips = &recip; try { diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index b3838ef569..ec25d447fa 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -35,7 +35,7 @@ CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) { m_EnableItem = 0; //SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENW("FTPFile transfer"); - m_pszFileName = NULL; + m_pszFileName = nullptr; } CSendFTPFile::~CSendFTPFile() diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index dda77d2764..6426adc9c9 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -INT_PTR(*g_MirCallService)(const char *, WPARAM, LPARAM) = NULL; +INT_PTR(*g_MirCallService)(const char *, WPARAM, LPARAM) = nullptr; ///////////////////////////////////////////////////////////////////////////////////////// @@ -37,9 +37,9 @@ CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/) { m_EnableItem = SS_DLG_DESCRIPTION; //| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENW("HTTPServer transfer"); - m_pszFileName = NULL; - m_fsi_pszSrvPath = NULL; - m_fsi_pszRealPath = NULL; + m_pszFileName = nullptr; + m_fsi_pszSrvPath = nullptr; + m_fsi_pszRealPath = nullptr; } CSendHTTPServer::~CSendHTTPServer() diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp index 728c6e2d3f..a5ca255e53 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp @@ -80,7 +80,7 @@ void CSendHost_ImageShack::SendThread() if (reply) { if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->dataLength) { reply->pData[reply->dataLength - 1] = '\0';/// make sure its null terminated - const char* url = NULL; + const char* url = nullptr; url = GetHTMLContent(reply->pData, "<image_link>", "</image_link>"); if (url && *url) { mir_free(m_URL), m_URL = mir_strdup(url); @@ -101,7 +101,7 @@ void CSendHost_ImageShack::SendThread() } else {/// check error mess from server url = GetHTMLContent(reply->pData, "<error ", "</error>"); - wchar_t* err = NULL; + wchar_t* err = nullptr; if (url) err = mir_a2u(url); if (!err || !*err) {/// fallback to server response mess mir_free(err); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 307b314beb..6710d8e16e 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -34,8 +34,8 @@ CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; HINSTANCE g_hSendSS; MGLOBAL g_myGlobals; -HNETLIBUSER g_hNetlibUser=0;//!< Netlib Register User -FI_INTERFACE *FIP=NULL; +HNETLIBUSER g_hNetlibUser=nullptr;//!< Netlib Register User +FI_INTERFACE *FIP=nullptr; int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP() IconItem ICONS[ICO_END_] = @@ -68,7 +68,7 @@ IconItem ICONS_BTN[ICO_BTN_END_] = { LPGEN("Down arrow"), "downarrow", IDI_DOWNARROW }, }; -static HANDLE m_hFolderScreenshot = 0; +static HANDLE m_hFolderScreenshot = nullptr; wchar_t* GetCustomPath() { wchar_t* pszPath = Utils_ReplaceVarsW(L"%miranda_userdata%\\Screenshots"); @@ -79,24 +79,24 @@ wchar_t* GetCustomPath() pszPath = mir_wstrdup(szPath); } if (!pszPath) { - MessageBox(NULL, L"Can not retrieve screenshot path.", L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); - return 0; + MessageBox(nullptr, L"Can not retrieve screenshot path.", L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); + return nullptr; } int result = CreateDirectoryTreeW(pszPath); if (result) { wchar_t szError[MAX_PATH]; mir_snwprintf(szError, MAX_PATH, TranslateT("Could not create screenshot folder (error code: %d):\n%s\nDo you have write permissions?"), result, pszPath); - MessageBox(NULL, szError, L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); + MessageBox(nullptr, szError, L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); mir_free(pszPath); - return 0; + return nullptr; } return pszPath; } /// services -static HANDLE m_hOpenCaptureDialog = 0; -static HANDLE m_hSendDesktop = 0; -static HANDLE m_hEditBitmap = 0; -static HANDLE m_hSend2ImageShack = 0; +static HANDLE m_hOpenCaptureDialog = nullptr; +static HANDLE m_hSendDesktop = nullptr; +static HANDLE m_hEditBitmap = nullptr; +static HANDLE m_hSend2ImageShack = nullptr; ///////////////////////////////////////////////////////////////////////////////////////// // Callback function of service for contact menu and main menu @@ -107,7 +107,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam) { TfrmMain* frmMain = new TfrmMain(); if (!frmMain) { - MessageBox(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); + MessageBox(nullptr, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return -1; } wchar_t* pszPath = GetCustomPath(); @@ -118,7 +118,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam) frmMain->Init(pszPath, wParam); mir_free(pszPath); if (lParam == 0xFFFF) { - frmMain->SetTargetWindow(NULL); + frmMain->SetTargetWindow(nullptr); } frmMain->Show(); return 0; @@ -137,7 +137,7 @@ INT_PTR service_SendDesktop(WPARAM wParam, LPARAM) { TfrmMain* frmMain = new TfrmMain(); if (!frmMain) { - MessageBox(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); + MessageBox(nullptr, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return -1; } wchar_t* pszPath = GetCustomPath(); @@ -190,8 +190,8 @@ INT_PTR service_EditBitmap(WPARAM, LPARAM) INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) { - char* result = NULL; - CSendHost_ImageShack* cSend = new CSendHost_ImageShack(NULL, lParam, false); + char* result = nullptr; + CSendHost_ImageShack* cSend = new CSendHost_ImageShack(nullptr, lParam, false); cSend->m_bDeleteAfterSend = false; cSend->SetFile((char*)wParam); if (lParam != NULL) { @@ -271,8 +271,8 @@ DLL_EXPORT int Load(void) pcli = Clist_GetInterface(); INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); - if (FIP == NULL || result != S_OK) { - MessageBox(NULL, TranslateT("Image services (AdvaImg plugin) not found.\nSendSS disabled."), TranslateT("SendSS"), MB_OK | MB_ICONERROR | MB_APPLMODAL); + if (FIP == nullptr || result != S_OK) { + MessageBox(nullptr, TranslateT("Image services (AdvaImg plugin) not found.\nSendSS disabled."), TranslateT("SendSS"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return 1; } /// hook events @@ -328,7 +328,7 @@ DLL_EXPORT int Load(void) /// register highlighter window class HBRUSH brush = CreateSolidBrush(0x0000FF00);//owned by class - WNDCLASS wndclass = { CS_HREDRAW | CS_VREDRAW, DefWindowProc, 0, 0, g_hSendSS, NULL, NULL, brush, NULL, L"SendSSHighlighter" }; + WNDCLASS wndclass = { CS_HREDRAW | CS_VREDRAW, DefWindowProc, 0, 0, g_hSendSS, nullptr, nullptr, brush, nullptr, L"SendSSHighlighter" }; g_clsTargetHighlighter = RegisterClass(&wndclass); return 0; } diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index cf2ca571c7..3e620db8d1 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -171,7 +171,7 @@ TfrmAbout::TfrmAbout(HWND Owner) m_hWndOwner = Owner; m_Page = 1; // create window - m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UAboutForm), 0, DlgTfrmAbout, (LPARAM)this); + m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UAboutForm), nullptr, DlgTfrmAbout, (LPARAM)this); //register object _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); } @@ -212,5 +212,5 @@ void TfrmAbout::btnPageClick() mir_free(pszPlug); mir_free(pszVer); SetDlgItemText(m_hWnd, IDC_HEADERBAR, newTitle); - InvalidateRect(GetDlgItem(m_hWnd, IDC_HEADERBAR), NULL, 1); + InvalidateRect(GetDlgItem(m_hWnd, IDC_HEADERBAR), nullptr, 1); } diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 55ed414586..8ccd2683d5 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -270,9 +270,9 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) ChangeWindowMessageFilterEx_t pChangeWindowMessageFilterEx; pChangeWindowMessageFilterEx = (ChangeWindowMessageFilterEx_t)GetProcAddress(GetModuleHandleA("user32"), "ChangeWindowMessageFilterEx"); if (pChangeWindowMessageFilterEx) { /// Win7+, UAC fix - pChangeWindowMessageFilterEx(m_hWnd, WM_DROPFILES, MSGFLT_ALLOW, NULL); - pChangeWindowMessageFilterEx(m_hWnd, WM_COPYDATA, MSGFLT_ALLOW, NULL); - pChangeWindowMessageFilterEx(m_hWnd, 0x0049/*WM_COPYGLOBALDATA*/, MSGFLT_ALLOW, NULL); + pChangeWindowMessageFilterEx(m_hWnd, WM_DROPFILES, MSGFLT_ALLOW, nullptr); + pChangeWindowMessageFilterEx(m_hWnd, WM_COPYDATA, MSGFLT_ALLOW, nullptr); + pChangeWindowMessageFilterEx(m_hWnd, 0x0049/*WM_COPYGLOBALDATA*/, MSGFLT_ALLOW, nullptr); } DragAcceptFiles(m_hWnd, 1); } @@ -403,8 +403,8 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) break; case ID_imgTarget: if (m_opt_tabCapture != 0) break; - m_hLastWin = NULL; - SetTimer(m_hWnd, ID_imgTarget, BUTTON_POLLDELAY, NULL); + m_hLastWin = nullptr; + SetTimer(m_hWnd, ID_imgTarget, BUTTON_POLLDELAY, nullptr); break; case ID_btnAbout: TfrmMain::btnAboutClick(); @@ -450,7 +450,7 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) break; case ID_edtCaption: //cboxDesktopChange m_opt_cboxDesktop = (BYTE)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); - m_hTargetWindow = NULL; + m_hTargetWindow = nullptr; if (m_opt_cboxDesktop > 0) { edtSizeUpdate(m_Monitors[m_opt_cboxDesktop - 1].rcMonitor, GetParent((HWND)lParam), ID_edtSize); } @@ -466,10 +466,10 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) switch (IDControl) { //lParam = Handle to the control case ID_edtQuality: - m_opt_edtQuality = (BYTE)GetDlgItemInt(m_hWnd, ID_edtQuality, NULL, FALSE); + m_opt_edtQuality = (BYTE)GetDlgItemInt(m_hWnd, ID_edtQuality, nullptr, FALSE); break; case ID_edtTimed: - m_opt_edtTimed = (BYTE)GetDlgItemInt(m_hWnd, ID_edtTimed, NULL, FALSE); + m_opt_edtTimed = (BYTE)GetDlgItemInt(m_hWnd, ID_edtTimed, nullptr, FALSE); break; default: break; @@ -519,7 +519,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) static int primarymouse; if (!m_hTargetHighlighter) { primarymouse = GetSystemMetrics(SM_SWAPBUTTON) ? VK_RBUTTON : VK_LBUTTON; - m_hTargetHighlighter = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW, (wchar_t*)g_clsTargetHighlighter, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hSendSS, NULL); + m_hTargetHighlighter = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW, (wchar_t*)g_clsTargetHighlighter, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_hSendSS, nullptr); if (!m_hTargetHighlighter) return; SetLayeredWindowAttributes(m_hTargetHighlighter, 0, 123, LWA_ALPHA); SetSystemCursor(CopyCursor(GetIcon(ICO_TARGET)), OCR_IBEAM);//text cursor @@ -529,8 +529,8 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) } if (!(GetAsyncKeyState(primarymouse) & 0x8000)) { KillTimer(m_hWnd, ID_imgTarget); - SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0); - DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = NULL; + SystemParametersInfo(SPI_SETCURSORS, 0, nullptr, 0); + DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = nullptr; SetTargetWindow(m_hLastWin); Show(); return; @@ -558,7 +558,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) int width = rect.right - rect.left; int height = rect.bottom - rect.top; if (g_iTargetBorder) { - SetWindowPos(m_hTargetHighlighter, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(m_hTargetHighlighter, nullptr, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE); if (width > g_iTargetBorder * 2 && height > g_iTargetBorder * 2) { HRGN hRegnNew = CreateRectRgn(0, 0, width, height); HRGN hRgnHole = CreateRectRgn(g_iTargetBorder, g_iTargetBorder, width - g_iTargetBorder, height - g_iTargetBorder); @@ -566,7 +566,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) DeleteObject(hRgnHole); SetWindowRgn(m_hTargetHighlighter, hRegnNew, FALSE);//cleans up hRegnNew } - else SetWindowRgn(m_hTargetHighlighter, NULL, FALSE); + else SetWindowRgn(m_hTargetHighlighter, nullptr, FALSE); } SetWindowPos(m_hTargetHighlighter, HWND_TOPMOST, rect.left, rect.top, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); } @@ -579,7 +579,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) if (!m_bCapture) { //only start once if (m_Screenshot) { FIP->FI_Unload(m_Screenshot); - m_Screenshot = NULL; + m_Screenshot = nullptr; } m_bCapture = true; switch (m_opt_tabCapture) { @@ -587,7 +587,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) m_Screenshot = CaptureWindow(m_hTargetWindow, m_opt_chkClientArea, m_opt_chkIndirectCapture); break; case 1: - m_Screenshot = CaptureMonitor((m_opt_cboxDesktop > 0) ? m_Monitors[m_opt_cboxDesktop - 1].szDevice : NULL); + m_Screenshot = CaptureMonitor((m_opt_cboxDesktop > 0) ? m_Monitors[m_opt_cboxDesktop - 1].szDevice : nullptr); break; case 2: /// edge case, existing local file break; @@ -620,7 +620,7 @@ void TfrmMain::wmNotify(WPARAM, LPARAM lParam) case TCN_SELCHANGING:{ if (!m_hwndTabPage) break; ShowWindow(m_hwndTabPage, SW_HIDE); - m_hwndTabPage = NULL; + m_hwndTabPage = nullptr; break; } case TCN_SELCHANGE:{ TAB_INFO itab = { TCIF_PARAM }; @@ -662,7 +662,7 @@ void TfrmMain::UMevent(WPARAM, LPARAM lParam) case EVT_CaptureDone: if (!m_Screenshot && m_opt_tabCapture != 2) { wchar_t *err = TranslateT("Couldn't take a screenshot"); - MessageBox(NULL, err, ERROR_TITLE, MB_OK | MB_ICONWARNING); + MessageBox(nullptr, err, ERROR_TITLE, MB_OK | MB_ICONWARNING); Show(); return; } @@ -674,7 +674,7 @@ void TfrmMain::UMevent(WPARAM, LPARAM lParam) if (m_opt_chkOpenAgain) { if (m_Screenshot) { FIP->FI_Unload(m_Screenshot); - m_Screenshot = NULL; + m_Screenshot = nullptr; } Show(); } @@ -696,22 +696,22 @@ TfrmMain::TfrmMain() /* m_opt_XXX */ m_bOnExitSave = TRUE; - m_hWnd = NULL; + m_hWnd = nullptr; m_hContact = NULL; m_bFormAbout = false; - m_hTargetWindow = m_hLastWin = NULL; - m_hTargetHighlighter = NULL; - m_FDestFolder = m_pszFile = NULL; - m_Screenshot = NULL; + m_hTargetWindow = m_hLastWin = nullptr; + m_hTargetHighlighter = nullptr; + m_FDestFolder = m_pszFile = nullptr; + m_Screenshot = nullptr; /* m_AlphaColor */ - m_cSend = NULL; + m_cSend = nullptr; - m_Monitors = NULL; + m_Monitors = nullptr; m_MonitorCount = MonitorInfoEnum(m_Monitors, m_VirtualScreen); /* m_opt_XXX */ LoadOptions(); m_bCapture = false; /* m_hwndTab,m_hwndTabPage */ - m_himlTab = NULL; + m_himlTab = nullptr; } TfrmMain::~TfrmMain() @@ -723,8 +723,8 @@ TfrmMain::~TfrmMain() if (m_Screenshot) FIP->FI_Unload(m_Screenshot); if (m_cSend) delete m_cSend; if (m_hTargetHighlighter) { - DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = NULL; - SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0); + DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = nullptr; + SystemParametersInfo(SPI_SETCURSORS, 0, nullptr, 0); } } @@ -792,7 +792,7 @@ void TfrmMain::Init(wchar_t* DestFolder, MCONTACT Contact) m_hContact = Contact; // create window - m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UMainForm), 0, DlgTfrmMain, (LPARAM)this); + m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UMainForm), nullptr, DlgTfrmMain, (LPARAM)this); //register object _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); @@ -826,11 +826,11 @@ void TfrmMain::btnCaptureClick() TfrmMain::Hide(); if (m_opt_chkTimed) { - SetTimer(m_hWnd, ID_chkTimed, m_opt_edtTimed ? m_opt_edtTimed * 1000 : 500, NULL); /// calls EVT_CaptureDone + SetTimer(m_hWnd, ID_chkTimed, m_opt_edtTimed ? m_opt_edtTimed * 1000 : 500, nullptr); /// calls EVT_CaptureDone return; } if (m_opt_tabCapture == 1) { /// desktop needs always time to update from TfrmMain::Hide() - SetTimer(m_hWnd, ID_chkTimed, 500, NULL); /// calls EVT_CaptureDone + SetTimer(m_hWnd, ID_chkTimed, 500, nullptr); /// calls EVT_CaptureDone return; } if (m_opt_tabCapture != 2) { @@ -889,7 +889,7 @@ void TfrmMain::cboxSendByChange() m_cSend = new CSendHost_Imgur(m_hWnd, m_hContact, true); break; default: //SS_JUSTSAVE - "Just save it " - m_cSend = NULL; + m_cSend = nullptr; break; } if (m_cSend) { @@ -898,12 +898,12 @@ void TfrmMain::cboxSendByChange() } bState = (itemFlag & SS_DLG_DELETEAFTERSSEND); hIcon = GetIconBtn(m_opt_btnDeleteAfterSend ? ICO_BTN_DELON : ICO_BTN_DEL); - SendDlgItemMessage(m_hWnd, ID_chkDeleteAfterSend, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : 0)); + SendDlgItemMessage(m_hWnd, ID_chkDeleteAfterSend, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : nullptr)); Button_Enable(GetDlgItem(m_hWnd, ID_chkDeleteAfterSend), bState); bState = (itemFlag & SS_DLG_DESCRIPTION); hIcon = GetIconBtn(m_opt_btnDesc ? ICO_BTN_DESCON : ICO_BTN_DESC); - SendDlgItemMessage(m_hWnd, ID_chkDesc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : 0)); + SendDlgItemMessage(m_hWnd, ID_chkDesc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : nullptr)); Button_Enable(GetDlgItem(m_hWnd, ID_chkDesc), bState); } @@ -931,7 +931,7 @@ void TfrmMain::btnAboutOnCloseWindow(HWND) void TfrmMain::btnExploreClick() { if (m_FDestFolder) - ShellExecute(NULL, L"explore", m_FDestFolder, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"explore", m_FDestFolder, nullptr, nullptr, SW_SHOW); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1020,7 +1020,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) case 1: // JPG wszFileName.Append(L".jpg"); { - FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL); + FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr); FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32); FIP->FI_Unload(dib32); ret = FIP->FI_SaveU(FIF_JPEG, dib24, wszFileName, 0); @@ -1031,7 +1031,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) case 2: // BMP wszFileName.Append(L".bmp"); { - FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL); + FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr); FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32); FIP->FI_Unload(dib32); ret = FIP->FI_SaveU(FIF_BMP, dib24, wszFileName, 0); @@ -1042,7 +1042,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) case 3: //TIFF (miranda freeimage interface do not support save tiff, we udse GDI+) wszFileName.Append(L".tif"); { - FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL); + FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr); FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32); FIP->FI_Unload(dib32); @@ -1119,17 +1119,17 @@ void TfrmMain::FormClose() do { // wait for editor exit or messages/input res = MsgWaitForMultipleObjects(1, &shex.hProcess, 0, INFINITE, QS_ALLINPUT); - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { res = WAIT_OBJECT_0; - PostMessage(NULL, WM_QUIT, 0, 0); // forward for outer message loops + PostMessage(nullptr, WM_QUIT, 0, 0); // forward for outer message loops break; } // process dialog messages (of unknown dialogs) HWND hwndDlgModeless = GetActiveWindow(); // HWND hwndDlgModeless = msg.hwnd; // for(HWND hTMP; (hTMP=GetAncestor(hwndDlgModeless,GA_PARENT)) && IsChild(hTMP,hwndDlgModeless); hwndDlgModeless=hTMP); - if (hwndDlgModeless != NULL && IsDialogMessage(hwndDlgModeless, &msg)) /* Wine fix. */ + if (hwndDlgModeless != nullptr && IsDialogMessage(hwndDlgModeless, &msg)) /* Wine fix. */ continue; // process messages TranslateMessage(&msg); @@ -1144,7 +1144,7 @@ void TfrmMain::FormClose() if (send && m_cSend && m_pszFile) { if (!m_cSend->Send()) // not sent now, class deletes itself later - m_cSend = NULL; + m_cSend = nullptr; cboxSendByChange(); } else if (!send && bCanDelete) diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index cc58922f8e..7b0b71c5e6 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -60,8 +60,8 @@ static BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen) { - MONITORS tmp = { 0, 0 }; - if (EnumDisplayMonitors(NULL, NULL, MonitorInfoEnumProc, (LPARAM)&tmp)) { + MONITORS tmp = { 0, nullptr }; + if (EnumDisplayMonitors(nullptr, nullptr, MonitorInfoEnumProc, (LPARAM)&tmp)) { myMonitors = tmp.info; memset(&virtualScreen, 0, sizeof(virtualScreen)); for (size_t i = 0; i < tmp.count; ++i) { @@ -74,7 +74,7 @@ size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen) return 0; } -FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = 0); +FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = nullptr); ///////////////////////////////////////////////////////////////////////////////////////// // capture window as FIBITMAP - caller must FIP->FI_Unload(dib) @@ -86,7 +86,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) RECT rect;//cropping rect if (!hCapture || !IsWindow(hCapture)) - return NULL; + return nullptr; hForegroundWin = GetForegroundWindow(); // old foreground window SetForegroundWindow(hCapture); // force target foreground BringWindowToTop(hCapture); // bring it to top as well @@ -95,7 +95,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) HWND hParent = GetAncestor(hCapture, GA_PARENT); if (hParent && !IsChild(hParent, hCapture)) - hParent = NULL; + hParent = nullptr; if (bIndirectCapture) { intptr_t wastopmost = GetWindowLongPtr(hCapture, GWL_EXSTYLE)&WS_EX_TOPMOST; if (!wastopmost) @@ -107,7 +107,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) } else GetWindowRect(hCapture, &rect); - dib = CaptureMonitor(NULL, &rect); + dib = CaptureMonitor(nullptr, &rect); if (!wastopmost) SetWindowPos(hCapture, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } @@ -151,14 +151,14 @@ FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/) /// get screen resolution if (!szDevice) { - hScrDC = CreateDC(L"DISPLAY", NULL, NULL, NULL); + hScrDC = CreateDC(L"DISPLAY", nullptr, nullptr, nullptr); rect.left = GetSystemMetrics(SM_XVIRTUALSCREEN); rect.top = GetSystemMetrics(SM_YVIRTUALSCREEN); rect.right = GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN); rect.bottom = GetSystemMetrics(SM_YVIRTUALSCREEN) + GetSystemMetrics(SM_CYVIRTUALSCREEN); } else { - hScrDC = CreateDC(szDevice, NULL, NULL, NULL); + hScrDC = CreateDC(szDevice, nullptr, nullptr, nullptr); rect.left = rect.top = 0; rect.right = GetDeviceCaps(hScrDC, HORZRES); rect.bottom = GetDeviceCaps(hScrDC, VERTRES); @@ -171,7 +171,7 @@ FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/) } FIBITMAP *dib = CreateDIBFromDC(hScrDC, &rect); - ReleaseDC(NULL, hScrDC); + ReleaseDC(nullptr, hScrDC); return dib; } @@ -204,8 +204,8 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) bool bFixAlpha = true; bool bInvert = false; HBRUSH hBr = CreateSolidBrush(RGB(255, 255, 255));//Create a SolidBrush object for non transparent area - HBITMAP hMask = CreateBitmap(width, height, 1, 1, NULL);// Create monochrome (1 bit) B+W mask bitmap. - HDC hMaskDC = CreateCompatibleDC(0); + HBITMAP hMask = CreateBitmap(width, height, 1, 1, nullptr);// Create monochrome (1 bit) B+W mask bitmap. + HDC hMaskDC = CreateCompatibleDC(nullptr); SelectBitmap(hMaskDC, hMask); HRGN hRgn = CreateRectRgn(0, 0, 0, 0); if (hCapture && GetWindowRgn(hCapture, hRgn) == ERROR) { @@ -254,7 +254,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) DeleteDC(hMemDC); DeleteObject(hBitmap); if (!hDC) - ReleaseDC(NULL, hScrDC); + ReleaseDC(nullptr, hScrDC); #ifdef _DEBUG switch (FIP->FI_GetImageType(dib)) { @@ -349,7 +349,7 @@ void SaveGIF(HBITMAP hBmp, const wchar_t *szFilename) { Gdiplus::GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; - Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr); Gdiplus::Bitmap *pBitmap = Gdiplus::Bitmap::FromHBITMAP(hBmp, (HPALETTE)GetStockObject(DEFAULT_PALETTE)); if (pBitmap) { @@ -357,7 +357,7 @@ void SaveGIF(HBITMAP hBmp, const wchar_t *szFilename) CLSID clsidEncoder; if (GetEncoderClsid(L"image/gif", clsidEncoder)) { LPWSTR pswFile = mir_wstrdup(szFilename); - pBitmap->Save((const WCHAR*)pswFile, &clsidEncoder, NULL); + pBitmap->Save((const WCHAR*)pswFile, &clsidEncoder, nullptr); mir_free(pswFile); } delete pBitmap; @@ -373,7 +373,7 @@ void SaveTIF(HBITMAP hBmp, const wchar_t *szFilename) ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::Status stat; - Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr); Gdiplus::Bitmap *pBitmap = Gdiplus::Bitmap::FromHBITMAP(hBmp, (HPALETTE)GetStockObject(DEFAULT_PALETTE)); if (pBitmap) { diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index 54d20d58ef..71bbf81a27 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -47,7 +47,7 @@ typedef struct TMBCtrl // External theme methods and properties static mir_cs csTips; -static HWND hwndToolTips = NULL; +static HWND hwndToolTips = nullptr; /** * name: DestroyTheme @@ -59,11 +59,11 @@ static void __fastcall DestroyTheme(BTNCTRL *ctl) { if (ctl->hThemeButton) { CloseThemeData(ctl->hThemeButton); - ctl->hThemeButton = NULL; + ctl->hThemeButton = nullptr; } if (ctl->hThemeToolbar) { CloseThemeData(ctl->hThemeToolbar); - ctl->hThemeToolbar = NULL; + ctl->hThemeToolbar = nullptr; } } @@ -124,7 +124,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT OffsetRect(rcText, rcImage.right + 4, 0); if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hIcon, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hIcon, 0, rcImage.left, rcImage.top, rcImage.right - rcImage.left, rcImage.bottom - rcImage.top, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); @@ -141,7 +141,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT rcImage.top = (rcClient->bottom - rcClient->top - rcImage.bottom) / 2; if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcImage.left, rcImage.top, rcImage.right - rcImage.left, rcImage.bottom - rcImage.top, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); @@ -209,7 +209,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien wszText, ccText, DST_PREFIXTEXT, - NULL, + nullptr, &sizeText); if (ctl->cHot) { @@ -222,7 +222,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien L"&", 1, DST_PREFIXTEXT, - NULL, + nullptr, &rcHot); sizeText.right -= (rcHot.right - rcHot.left); @@ -263,7 +263,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) // Draw the flat button if (ctl->dwStyle & MBS_FLAT) { - HBRUSH hbr = NULL; + HBRUSH hbr = nullptr; if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT) hbr = GetSysColorBrush(COLOR_3DLIGHT); @@ -342,7 +342,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) : GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); - DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)szText, 0, rcText.left, rcText.top, rcText.right - rcText.left, rcText.bottom - rcText.top, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); SelectObject(hdcMem, hOldFont); @@ -400,7 +400,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L } if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { DestroyWindow(hwndToolTips); - hwndToolTips = NULL; + hwndToolTips = nullptr; } } DestroyTheme(bct); @@ -421,7 +421,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L } tmp++; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; @@ -430,7 +430,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L if (bct->dwStyle & MBS_PUSHBUTTON) { if (bct->pbState) bct->pbState = 0; else bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } else SetFocus(hwndBtn); @@ -442,7 +442,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_THEMECHANGED: // themed changed, reload theme object LoadTheme(bct); - InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it + InvalidateRect(bct->hwnd, nullptr, TRUE); // repaint it break; case WM_SETFONT: // remember the font so we can use it later @@ -485,18 +485,18 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BM_SETIMAGE: if (wParam == IMAGE_ICON) { bct->hIcon = (HICON)lParam; - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hBitmap = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } else if (wParam == IMAGE_BITMAP) { - bct->hIcon = NULL; + bct->hIcon = nullptr; bct->hBitmap = (HBITMAP)lParam; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } else if (wParam == NULL && lParam == NULL) { - bct->hIcon = NULL; - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hIcon = nullptr; + bct->hBitmap = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; @@ -510,7 +510,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L bct->pbState = 0; bct->stateId = PBS_NORMAL; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BM_GETCHECK: @@ -519,14 +519,14 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BUTTONSETDEFAULT: bct->defbutton = (wParam != 0); - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BUTTONADDTOOLTIP: if (wParam) { mir_cslock lck(csTips); if (!hwndToolTips) - hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); + hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandle(nullptr), nullptr); if (lParam == MBBF_UNICODE) { TOOLINFOW ti; @@ -571,34 +571,34 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_SETFOCUS: // set keybord bFocus and redraw bct->bFocus = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_KILLFOCUS: // kill bFocus and redraw bct->bFocus = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_WINDOWPOSCHANGED: - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_ENABLE: // windows tells us to enable/disable bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_MOUSELEAVE: // faked by the WM_TIMER if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; case WM_LBUTTONDOWN: if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; @@ -615,17 +615,17 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L // Tell your daddy you got clicked, if mouse is still over the button. if ((bct->dwStyle & MBS_PUSHBUTTON) || bPressed) SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn); - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; case WM_MOUSEMOVE: if (bct->stateId == PBS_NORMAL) { bct->stateId = PBS_HOT; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } // Call timer, used to start cheesy TrackMouseEvent faker - SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); + SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, nullptr); break; case WM_TIMER: // use a timer to check if they have did a mouseout @@ -666,7 +666,7 @@ void CtrlButtonLoadModule()/// @fixme : compatibility with UInfoEx is everything wc.cbSize = sizeof(wc); wc.lpszClassName = UINFOBUTTONCLASS; wc.lpfnWndProc = Button_WndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(LPBTNCTRL); wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index b1a46feabb..25017e15a1 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -88,14 +88,14 @@ static HICON MsgLoadIcon(LPMSGBOX pMsgBox) case MB_ICON_WARNING: case MB_ICON_INFO: { - LPCTSTR ico[] = { 0, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION }; - hIcon = LoadIcon(NULL, ico[MB_ICON_INDEX(pMsgBox->uType)]); + LPCTSTR ico[] = { nullptr, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION }; + hIcon = LoadIcon(nullptr, ico[MB_ICON_INDEX(pMsgBox->uType)]); } break; // no icon default: - hIcon = NULL; + hIcon = nullptr; } return hIcon; } @@ -684,7 +684,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); - mb.hiMsg = NULL; + mb.hiMsg = nullptr; mb.ptszTitle = TranslateW(pszTitle); mb.ptszInfoText = TranslateW(pszInfo); mb.ptszMsg = tszMsg; @@ -711,7 +711,7 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); - mb.hiMsg = NULL; + mb.hiMsg = nullptr; mb.ptszTitle = tszTitle; mb.ptszMsg = tszMsg; mb.uType = MB_OK | MB_ICON_ERROR; diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 0d0baffe91..6a365b73dc 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst = NULL;
+HINSTANCE g_hInst = nullptr;
HGENMENU hmSaveCurrentSession;
@@ -130,7 +130,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l case WM_CLOSE:
DestroyWindow(hdlg);
- g_hSDlg = 0;
+ g_hSDlg = nullptr;
break;
case WM_NOTIFY:
@@ -163,7 +163,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l dd = 5;
hClistControl = CreateWindowEx(WS_EX_CLIENTEDGE, CLISTCONTROL_CLASSW, L"",
WS_TABSTOP | WS_VISIBLE | WS_CHILD,
- x, y, dx, dy, hdlg, (HMENU)IDC_CLIST, g_hInst, 0);
+ x, y, dx, dy, hdlg, (HMENU)IDC_CLIST, g_hInst, nullptr);
SetWindowLongPtr(hClistControl, GWL_STYLE,
GetWindowLongPtr(hClistControl, GWL_STYLE) | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE | CLS_GROUPCHECKBOXES);
@@ -177,9 +177,9 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l DestroyWindow(hClistControl);
}
- SetWindowPos(hdlg, NULL, rWnd.left, rWnd.top, x + dx, y + (dx / 3), SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE);
+ SetWindowPos(hdlg, nullptr, rWnd.left, rWnd.top, x + dx, y + (dx / 3), SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE);
- SetWindowPos(hClistControl, 0, x - dd, dd, dx - dd, y + (dx / 12), SWP_NOZORDER/*|SWP_NOSIZE|SWP_SHOWWINDOW*/);
+ SetWindowPos(hClistControl, nullptr, x - dd, dd, dx - dd, y + (dx / 12), SWP_NOZORDER/*|SWP_NOSIZE|SWP_SHOWWINDOW*/);
SendMessage(hClistControl, CLM_AUTOREBUILD, 0, 0);
for (i = 0; session_list[i] > 0; i++) {
@@ -218,7 +218,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l SaveUserSessionName(szUserSessionName);
memcpy(session_list, session_list_temp, sizeof(session_list));
DestroyWindow(hdlg);
- g_hSDlg = 0;
+ g_hSDlg = nullptr;
}
else if (!SaveUserSessionName(szUserSessionName)) {
SaveSessionHandles(0, 1);
@@ -226,18 +226,18 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l if (IsDlgButtonChecked(hdlg, IDC_SANDCCHECK))
CloseCurrentSession(0, 0);
DestroyWindow(hdlg);
- g_hSDlg = 0;
+ g_hSDlg = nullptr;
}
- else MessageBox(NULL, TranslateT("Current session is empty!"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
+ else MessageBox(nullptr, TranslateT("Current session is empty!"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
}
- else MessageBox(NULL, TranslateT("Session name is empty, enter the name and try again"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
+ else MessageBox(nullptr, TranslateT("Session name is empty, enter the name and try again"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
}
break;
case IDCANCEL:
SavePosition(hdlg, "SaveDlg");
DestroyWindow(hdlg);
- g_hSDlg = 0;
+ g_hSDlg = nullptr;
}
break;
@@ -258,7 +258,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) {
int iDelay = db_get_w(NULL, MODNAME, "StartupModeDelay", 1500);
if (g_hghostw == TRUE)
- SetTimer(hdlg, TIMERID_LOAD, iDelay, NULL);
+ SetTimer(hdlg, TIMERID_LOAD, iDelay, nullptr);
else {
if ((ses_count = LoadSessionToCombobox(hdlg, 0, g_ses_limit, "SessionDate", 0)) == g_ses_limit)
EnableWindow(GetDlgItem(hdlg, IDC_SESSDEL), TRUE);
@@ -272,7 +272,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
LoadPosition(hdlg, "LoadDlg");
if (StartUp)
- SetTimer(hdlg, TIMERID_SHOW, iDelay, NULL);
+ SetTimer(hdlg, TIMERID_SHOW, iDelay, nullptr);
else
ShowWindow(g_hDlg, SW_SHOW);
}
@@ -290,14 +290,14 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) LoadSession(0, g_bIncompletedSave ? 256 : 0);
g_hghostw = StartUp = FALSE;
DestroyWindow(hdlg);
- g_hDlg = 0;
+ g_hDlg = nullptr;
}
break;
case WM_CLOSE:
SavePosition(hdlg, "LoadDlg");
DestroyWindow(hdlg);
- g_hDlg = 0;
+ g_hDlg = nullptr;
break;
case WM_COMMAND:
@@ -374,14 +374,14 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) if (!LoadSession(0, ses_count)) {
SavePosition(hdlg, "LoadDlg");
DestroyWindow(hdlg);
- g_hDlg = 0;
+ g_hDlg = nullptr;
}
break;
case IDCANCEL:
SavePosition(hdlg, "LoadDlg");
DestroyWindow(hdlg);
- g_hDlg = 0;
+ g_hDlg = nullptr;
break;
}
break;
@@ -433,7 +433,7 @@ INT_PTR SaveUserSessionHandles(WPARAM, LPARAM) return 1;
}
- g_hSDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_SAVEDIALOG), 0, SaveSessionDlgProc);
+ g_hSDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_SAVEDIALOG), nullptr, SaveSessionDlgProc);
return 0;
}
@@ -448,26 +448,26 @@ INT_PTR OpenSessionsManagerWindow(WPARAM, LPARAM) tszSession(db_get_wsa(NULL, MODNAME, "SessionDate_0")),
tszUserSession(db_get_wsa(NULL, MODNAME, "UserSessionDsc_0"));
if (g_bIncompletedSave || tszSession || tszUserSession) {
- g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
+ g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
return 0;
}
if (g_bOtherWarnings)
- MessageBox(NULL, TranslateT("No sessions to open"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
+ MessageBox(nullptr, TranslateT("No sessions to open"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
return 1;
}
int SaveSessionDate()
{
if (session_list[0] != 0) {
- int TimeSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, NULL, 0);
+ int TimeSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, nullptr, nullptr, nullptr, 0);
wchar_t *szTimeBuf = (wchar_t*)mir_alloc((TimeSize + 1)*sizeof(wchar_t));
- GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, szTimeBuf, TimeSize);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, nullptr, nullptr, szTimeBuf, TimeSize);
- int DateSize = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0);
+ int DateSize = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, nullptr, 0);
wchar_t *szDateBuf = (wchar_t*)mir_alloc((DateSize + 1)*sizeof(wchar_t));
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szDateBuf, DateSize);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, szDateBuf, DateSize);
int lenn = (DateSize + TimeSize + 5);
wchar_t *szSessionTime = (wchar_t*)mir_alloc(lenn*sizeof(wchar_t));
mir_snwprintf(szSessionTime, lenn, L"%s - %s", szTimeBuf, szDateBuf);
@@ -512,7 +512,7 @@ INT_PTR LoadLastSession(WPARAM wparam, LPARAM lparam) if (isLastTRUE)
return LoadSession(wparam, lparam);
if (g_bOtherWarnings)
- MessageBox(NULL, TranslateT("Last Sessions is empty"), TranslateT("Sessions Manager"), MB_OK);
+ MessageBox(nullptr, TranslateT("Last Sessions is empty"), TranslateT("Sessions Manager"), MB_OK);
return 0;
}
@@ -552,22 +552,22 @@ int LoadSession(WPARAM, LPARAM lparam) if (i == 0) {
if (g_bOtherWarnings)
- MessageBox(NULL, TranslateT("No contacts to open"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
+ MessageBox(nullptr, TranslateT("No contacts to open"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
return 1;
}
if (dup == i) {
if (!hidden[i]) {
if (g_bOtherWarnings)
- MessageBox(NULL, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
+ MessageBox(nullptr, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
return 1;
}
if (!g_bWarnOnHidden && g_bOtherWarnings) {
- MessageBox(NULL, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
+ MessageBox(nullptr, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK | MB_ICONWARNING);
return 1;
}
if (g_bWarnOnHidden) {
- if (IDYES == MessageBox(NULL, TranslateT("This Session already opened (but probably hidden).\nDo you want to show hidden contacts?"), TranslateT("Sessions Manager"), MB_YESNO | MB_ICONQUESTION))
+ if (IDYES == MessageBox(nullptr, TranslateT("This Session already opened (but probably hidden).\nDo you want to show hidden contacts?"), TranslateT("Sessions Manager"), MB_YESNO | MB_ICONQUESTION))
for (j = 0; hidden[j] != 0; j++)
Clist_ContactDoubleClicked(session_list_t[hidden[j] - 1]);
}
@@ -660,7 +660,7 @@ int OkToExit(WPARAM, LPARAM) db_set_b(NULL, MODNAME, "lastempty", 0);
}
else if (exitmode == 1 && session_list[0] != 0) {
- DialogBox(g_hInst, MAKEINTRESOURCE(IDD_EXDIALOG), 0, ExitDlgProc);
+ DialogBox(g_hInst, MAKEINTRESOURCE(IDD_EXDIALOG), nullptr, ExitDlgProc);
}
else db_set_b(NULL, MODNAME, "lastempty", 1);
return 0;
@@ -691,7 +691,7 @@ INT_PTR BuildFavMenu(WPARAM, LPARAM) HMENU hMenu = CreatePopupMenu();
FillFavoritesMenu(hMenu, g_ses_count);
- int res = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_NONOTIFY, pt.x, pt.y, 0, GetActiveWindow(), NULL);
+ int res = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_NONOTIFY, pt.x, pt.y, 0, GetActiveWindow(), nullptr);
if (res == 0) return 1;
LoadSession(0, (res - 1) + g_ses_limit);
return 0;
@@ -699,7 +699,7 @@ INT_PTR BuildFavMenu(WPARAM, LPARAM) static int CreateButtons(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
ttb.pszService = MS_SESSIONS_OPENMANAGER;
@@ -729,11 +729,11 @@ static void CALLBACK LaunchSessions() int startup = db_get_b(NULL, MODNAME, "StartupMode", 3);
if (startup == 1 || (startup == 3 && isLastTRUE == TRUE)) {
StartUp = TRUE;
- g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
+ g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
}
else if (startup == 2 && isLastTRUE == TRUE) {
g_hghostw = TRUE;
- g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
+ g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
}
}
@@ -787,7 +787,7 @@ static int PluginInit(WPARAM, LPARAM) SET_UID(mi, 0x73ea91d6, 0xb7e5, 0x4f67, 0x96, 0x96, 0xa, 0x24, 0x21, 0x48, 0x6f, 0x15);
mi.name.a = LPGEN("Close session");
mi.pszService = MS_SESSIONS_CLOSESESSION;
- mi.hIcolibItem = 0;
+ mi.hIcolibItem = nullptr;
Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0xe2c4e4ba, 0x5d08, 0x441b, 0xb5, 0x93, 0xc4, 0xe7, 0x9a, 0xfb, 0xa4, 0x6c);
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index e60515546b..cfc378ff6e 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -22,10 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. HICON hIcon;
HICON hMarked, hNotMarked;
-HWND hComboBox = NULL;
-HWND hComboBoxEdit = NULL;
+HWND hComboBox = nullptr;
+HWND hComboBoxEdit = nullptr;
-HWND hOpClistControl = NULL;
+HWND hOpClistControl = nullptr;
static BOOL bOptionsInit;
int opses_count;
@@ -36,7 +36,7 @@ MCONTACT session_list_t[255] = { 0 }; HWND g_opHdlg;
int width;
-HDC hdc = NULL;
+HDC hdc = nullptr;
RECT lprect;
RECT rc;
POINT pt;
@@ -78,7 +78,7 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_SETCURSOR:
if (!hOpClistControl) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
return TRUE;
}
break;
@@ -100,13 +100,13 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, MarkUserDefSession(opses_count, 1);
hIcon = hMarked;
bChecked = TRUE;
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
}
else {
MarkUserDefSession(opses_count, 0);
hIcon = hNotMarked;
bChecked = FALSE;
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
}
break;
@@ -123,7 +123,7 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, rc.left = rc.right;
rc.right = rc.left + 16;
FillRect(hdc, &rc, (HBRUSH)GetSysColor(COLOR_WINDOW));
- DrawIconEx(hdc, rc.left, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, rc.left, 0, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
ReleaseDC(hwnd, hdc);
break;
@@ -162,7 +162,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l SetDlgItemInt(hdlg, IDC_TRACK, g_ses_limit = db_get_b(NULL, MODNAME, "TrackCount", 10), FALSE);
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, NULL, FALSE));
+ SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE));
SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODNAME, "StartupModeDelay", 1500), FALSE);
@@ -223,7 +223,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l hComboBoxEdit = cbi.hwndItem;
hComboBox = cbi.hwndCombo;
- SetWindowPos(hComboBoxEdit, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+ SetWindowPos(hComboBoxEdit, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
bOptionsInit = FALSE;
}
@@ -241,9 +241,9 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
{
- int iDelay = GetDlgItemInt(hdlg, IDC_STARTDELAY, NULL, FALSE);
+ int iDelay = GetDlgItemInt(hdlg, IDC_STARTDELAY, nullptr, FALSE);
db_set_w(0, MODNAME, "StartupModeDelay", (WORD)iDelay);
- db_set_b(0, MODNAME, "TrackCount", (BYTE)(g_ses_limit = GetDlgItemInt(hdlg, IDC_TRACK, NULL, FALSE)));
+ db_set_b(0, MODNAME, "TrackCount", (BYTE)(g_ses_limit = GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE)));
if (IsDlgButtonChecked(hdlg, IDC_REXSAVE))
db_set_b(NULL, MODNAME, "ShutdownMode", 2);
else if (IsDlgButtonChecked(hdlg, IDC_REXDSAVE))
@@ -303,12 +303,12 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l if (IsMarkedUserDefSession(opses_count)) {
hIcon = hMarked;
bChecked = TRUE;
- RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
+ RedrawWindow(hComboBoxEdit, nullptr, nullptr, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
}
else {
hIcon = hNotMarked;
bChecked = FALSE;
- RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
+ RedrawWindow(hComboBoxEdit, nullptr, nullptr, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
}
OpLoadSessionContacts(0, opses_count);
if (!hOpClistControl)
@@ -336,7 +336,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l SetDlgItemText(hdlg, IDC_EDIT, TranslateT("View"));
hOpClistControl = CreateWindowEx(WS_EX_STATICEDGE, CLISTCONTROL_CLASSW, L"",
WS_TABSTOP | WS_VISIBLE | WS_CHILD,
- 14, 198, 161, 163, hdlg, (HMENU)IDC_EMCLIST, g_hInst, 0);
+ 14, 198, 161, 163, hdlg, (HMENU)IDC_EMCLIST, g_hInst, nullptr);
SetWindowLongPtr(hOpClistControl, GWL_STYLE,
GetWindowLongPtr(hOpClistControl, GWL_STYLE) | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE | CLS_GROUPCHECKBOXES);
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l EnableWindow(GetDlgItem(hdlg, IDC_SAVE), FALSE);
SetDlgItemText(hdlg, IDC_EDIT, TranslateT("Edit"));
DestroyWindow(hOpClistControl);
- hOpClistControl = NULL;
+ hOpClistControl = nullptr;
}
break;
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index c0f2e5ea90..98f731bd2f 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -225,7 +225,7 @@ void SetInSessionOrder(MCONTACT hContact, int mode, int count, unsigned int orde BOOL ResaveSettings(char *szName, int iFirst, int iLimit, wchar_t *szBuffer)
{
for (int i = iFirst; i < iLimit; i++) {
- if (szBuffer == NULL)
+ if (szBuffer == nullptr)
break;
char szNameBuf[256];
@@ -238,7 +238,7 @@ BOOL ResaveSettings(char *szName, int iFirst, int iLimit, wchar_t *szBuffer) BYTE marked = IsMarkedUserDefSession(i);
MarkUserDefSession(i, (BYTE)((i == iFirst) ? IsMarkedUserDefSession(iFirst - 1) : marked));
- if (ptszTemp == NULL) // read failed
+ if (ptszTemp == nullptr) // read failed
return 0;
szBuffer = ptszTemp;
@@ -350,7 +350,7 @@ void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy) rc.top = pt.y;
OffsetRect(&rc, dx, dy);
- SetWindowPos(hwnd, NULL, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(hwnd, nullptr, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
int CheckContactVisibility(MCONTACT hContact)
@@ -398,5 +398,5 @@ void LoadPosition(HWND hWnd, char *wndName) int x = db_get_dw(0, MODNAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2) - 130);
mir_snprintf(buffer, "%sPosY", wndName);
int y = db_get_dw(0, MODNAME, buffer, ((GetSystemMetrics(SM_CYSCREEN)) / 2) - 80);
- SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSIZE);
}
diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index fbb8b79131..c356ef7b94 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -25,7 +25,7 @@ PLUGININFOEX pluginInfoEx = { BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
{
if (fdwReason == DLL_PROCESS_ATTACH) {
- bIsVistaPlus = GetProcAddress( GetModuleHandleA("kernel32.dll"), "GetProductInfo") != NULL;
+ bIsVistaPlus = GetProcAddress( GetModuleHandleA("kernel32.dll"), "GetProductInfo") != nullptr;
GetTempPath(_countof(tszLogPath), tszLogPath);
wcscat_s(tszLogPath, _countof(tszLogPath), L"shlext.log");
@@ -67,7 +67,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) RpcStringFreeA(&szGuid);
#endif
- *ppv = NULL;
+ *ppv = nullptr;
return CLASS_E_CLASSNOTAVAILABLE;
}
@@ -83,8 +83,8 @@ STDAPI DllCanUnloadNow() struct HRegKey
{
- HRegKey(HKEY hRoot, const wchar_t *ptszKey) : m_key(NULL)
- { RegCreateKeyEx(hRoot, ptszKey, 0, 0, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, 0, &m_key, 0);
+ HRegKey(HKEY hRoot, const wchar_t *ptszKey) : m_key(nullptr)
+ { RegCreateKeyEx(hRoot, ptszKey, 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &m_key, nullptr);
}
~HRegKey() { if (m_key) RegCloseKey(m_key); }
@@ -103,11 +103,11 @@ char str4[] = "Apartment"; STDAPI DllRegisterServer()
{
HRegKey k1(HKEY_CLASSES_ROOT, L"miranda.shlext");
- if (k1 == NULL)
+ if (k1 == nullptr)
return E_FAIL;
int str1len = sprintf_s(str1, sizeof(str1), "shlext %d.%d.%d.%d - shell context menu support for Miranda NG", __FILEVERSION_STRING);
- if ( RegSetValueA(k1, NULL, REG_SZ, str1, str1len))
+ if ( RegSetValueA(k1, nullptr, REG_SZ, str1, str1len))
return E_FAIL;
if ( RegSetValueA(k1, "CLSID", REG_SZ, str2, sizeof(str2)))
return E_FAIL;
@@ -115,21 +115,21 @@ STDAPI DllRegisterServer() //////////////////////////////////////////////////////////////////////////////////////
HRegKey kClsid(HKEY_CLASSES_ROOT, L"CLSID\\{72013A26-A94C-11d6-8540-A5E62932711D}");
- if (kClsid == NULL)
+ if (kClsid == nullptr)
return E_FAIL;
- if ( RegSetValueA(kClsid, NULL, REG_SZ, str3, sizeof(str3)))
+ if ( RegSetValueA(kClsid, nullptr, REG_SZ, str3, sizeof(str3)))
return E_FAIL;
if ( RegSetValueA(kClsid, "ProgID", REG_SZ, str3, sizeof(str3)))
return E_FAIL;
HRegKey kInprocServer(kClsid, L"InprocServer32");
- if (kInprocServer == NULL)
+ if (kInprocServer == nullptr)
return E_FAIL;
wchar_t tszFileName[MAX_PATH];
GetModuleFileName(hInst, tszFileName, _countof(tszFileName));
- if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(wchar_t)*(lstrlen(tszFileName)+1)))
+ if ( RegSetValueEx(kInprocServer, nullptr, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(wchar_t)*(lstrlen(tszFileName)+1)))
return E_FAIL;
if ( RegSetValueExA(kInprocServer, "ThreadingModel", 0, REG_SZ, (PBYTE)str4, sizeof(str4)))
return E_FAIL;
@@ -144,7 +144,7 @@ STDAPI DllRegisterServer() //////////////////////////////////////////////////////////////////////////////////////
HRegKey k2(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved");
- if (k2 == NULL)
+ if (k2 == nullptr)
return E_FAIL;
if ( RegSetValueExA(k2, str2, 0, REG_SZ, (PBYTE)str1, str1len))
return E_FAIL;
diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp index a4ee4a20ac..aaa3f77f7f 100644 --- a/plugins/ShellExt/src/options.cpp +++ b/plugins/ShellExt/src/options.cpp @@ -86,7 +86,7 @@ static INT_PTR CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_CLISTGROUPS), BST_CHECKED == IsDlgButtonChecked(hwndDlg, IDC_USEGROUPS));
break;
case IDC_REMOVE:
- if (IDYES == MessageBox(0,
+ if (IDYES == MessageBox(nullptr,
TranslateT("Are you sure? This will remove all the settings stored in your database and all registry entries created for shlext to work with Explorer"),
TranslateT("Disable/Remove shlext"), MB_YESNO | MB_ICONQUESTION)) {
db_unset(0, SHLExt_Name, SHLExt_UseGroups);
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 6aaa1dde2f..94cce6dece 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -34,7 +34,7 @@ int IsCOMRegistered() if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0, KEY_READ, &hRegKey)) {
DWORD lpType = REG_SZ;
- if (!RegQueryValueEx(hRegKey, L"{72013A26-A94C-11d6-8540-A5E62932711D}", NULL, &lpType, 0, 0))
+ if (!RegQueryValueEx(hRegKey, L"{72013A26-A94C-11d6-8540-A5E62932711D}", nullptr, &lpType, nullptr, nullptr))
res += COMREG_APPROVED;
RegCloseKey(hRegKey);
}
@@ -138,10 +138,10 @@ void __cdecl IssueTransferThread(void *param) TAddArgList args;
args.count = 0;
- args.files = NULL;
+ args.files = nullptr;
TSlotIPC *pct = pipch->DataPtr;
BOOL bQuit = false;
- while (pct != NULL) {
+ while (pct != nullptr) {
if (pct->cbSize != sizeof(TSlotIPC))
break;
args.szFile = LPSTR(UINT_PTR(pct) + sizeof(TSlotIPC));
@@ -153,11 +153,11 @@ void __cdecl IssueTransferThread(void *param) pct = pct->Next;
} // while
- if (args.files != NULL) {
+ if (args.files != nullptr) {
args.files = (LPSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPSTR));
- args.files[args.count++] = NULL;
+ args.files[args.count++] = nullptr;
if (!bQuit) {
- args.hEvent = CreateEvent(NULL, true, false, NULL);
+ args.hEvent = CreateEvent(nullptr, true, false, nullptr);
QueueUserAPC(MainThreadIssueTransfer, hMainThread, UINT_PTR(&args));
while (true) {
if (WaitForSingleObjectEx(args.hEvent, INFINITE, true) != WAIT_IO_COMPLETION)
@@ -203,7 +203,7 @@ void ipcGetSkinIcons(THeaderIPC *ipch) DWORD dwCaps = CallService(szTmp, PFLAGNUM_1, 0);
if (dwCaps & PF1_FILESEND) {
TSlotIPC *pct = ipcAlloc(ipch, sizeof(TSlotProtoIcons));
- if (pct != NULL) {
+ if (pct != nullptr) {
// capture all the icons!
spi.hProto = murmur_hash(pa->szModuleName);
for (int j = 0; j <= 10; j++)
@@ -211,7 +211,7 @@ void ipcGetSkinIcons(THeaderIPC *ipch) pct->fType = REQUEST_NEWICONS;
memcpy(LPSTR(pct) + sizeof(TSlotIPC), &spi, sizeof(TSlotProtoIcons));
- if (ipch->NewIconsBegin == NULL)
+ if (ipch->NewIconsBegin == nullptr)
ipch->NewIconsBegin = pct;
}
}
@@ -222,13 +222,13 @@ void ipcGetSkinIcons(THeaderIPC *ipch) // add Miranda icon
TSlotIPC *pct = ipcAlloc(ipch, sizeof(TSlotProtoIcons));
- if (pct != NULL) {
+ if (pct != nullptr) {
memset(&spi.hIcons, 0, sizeof(spi.hIcons));
spi.hProto = 0; // no protocol
spi.hIcons[0] = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
pct->fType = REQUEST_NEWICONS;
memcpy(LPSTR(pct) + sizeof(TSlotIPC), &spi, sizeof(TSlotProtoIcons));
- if (ipch->NewIconsBegin == NULL)
+ if (ipch->NewIconsBegin == nullptr)
ipch->NewIconsBegin = pct;
}
}
@@ -258,7 +258,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) // do they have a running protocol?
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
// does it support file sends?
DWORD dwCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if ((dwCaps & PF1_FILESEND) == 0)
@@ -309,7 +309,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) int cch = lstrlenA(szContact) + 1;
TSlotIPC *pct = ipcAlloc(ipch, cch + 1 + lstrlenA(szGroup) + 1);
- if (pct == NULL)
+ if (pct == nullptr)
break;
// lie about the actual size of the TSlotIPC
@@ -321,7 +321,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) pct->Status = pContacts[i].dwStatus;
pct->hProto = pContacts[i].hProto;
pct->MRU = db_get_b(pct->hContact, SHLExt_Name, SHLExt_MRU, 0);
- if (ipch->ContactsBegin == NULL)
+ if (ipch->ContactsBegin == nullptr)
ipch->ContactsBegin = pct;
szSlot += cch + 1;
if (szGroup != 0) {
@@ -359,13 +359,13 @@ void __stdcall ipcService(ULONG_PTR) // try to open the file mapping object the caller must make sure no other
// running instance is using this file
HANDLE hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, false, IPC_PACKET_NAME);
- if (hMap == 0)
+ if (hMap == nullptr)
return;
// map the file to this process
THeaderIPC *pMMT = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
// if it fails the caller should of had some timeout in wait
- if (pMMT != NULL && pMMT->cbSize == sizeof(THeaderIPC) && pMMT->dwVersion == PLUGIN_MAKE_VERSION(2, 0, 1, 2)) {
+ if (pMMT != nullptr && pMMT->cbSize == sizeof(THeaderIPC) && pMMT->dwVersion == PLUGIN_MAKE_VERSION(2, 0, 1, 2)) {
// toggle the right bits
int *bits = &pMMT->fRequests;
// jump right to a worker thread for file processing?
@@ -382,7 +382,7 @@ void __stdcall ipcService(ULONG_PTR) }
// the request was to clear the MRU entries, we have no return data
if (*bits & REQUEST_CLEARMRU) {
- mir_forkthread(&ClearMRUThread, NULL);
+ mir_forkthread(&ClearMRUThread, nullptr);
goto Reply;
}
// the IPC header may have pointers that need to be translated
@@ -417,12 +417,12 @@ void __stdcall ipcService(ULONG_PTR) if (bGroupMode && BST_CHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseCListSetting, BST_UNCHECKED))
bGroupMode = db_get_b(0, "CList", "UseGroups", true) != 0;
- TSlotIPC *pct = NULL;
+ TSlotIPC *pct = nullptr;
int iSlot = 0;
// return profile if set
if (BST_UNCHECKED == db_get_b(0, SHLExt_Name, SHLExt_ShowNoProfile, BST_UNCHECKED)) {
pct = ipcAlloc(pMMT, 50);
- if (pct != NULL) {
+ if (pct != nullptr) {
// will actually return with .dat if there's space for it, not what the docs say
pct->Status = STATUS_PROFILENAME;
Profile_GetNameA(49, (char*)pct + sizeof(TSlotIPC));
@@ -439,8 +439,8 @@ void __stdcall ipcService(ULONG_PTR) break;
pct = ipcAlloc(pMMT, lstrlenA(dbv.pszVal + 1) + 1);
// first byte has flags, need null term
- if (pct != NULL) {
- if (pMMT->GroupsBegin == NULL)
+ if (pct != nullptr) {
+ if (pMMT->GroupsBegin == nullptr)
pMMT->GroupsBegin = pct;
pct->fType = REQUEST_GROUPS;
pct->hContact = 0;
@@ -457,7 +457,7 @@ void __stdcall ipcService(ULONG_PTR) iSlot++;
}
// if there was no space left, it'll } on null
- if (pct == NULL)
+ if (pct == nullptr)
*bits = (*bits | GROUPS_NOTIMPL) & ~REQUEST_GROUPS;
}
// SHOULD check slot space.
@@ -471,7 +471,7 @@ void __stdcall ipcService(ULONG_PTR) Reply:
// get the handle the caller wants to be signalled on
hSignal = OpenEventA(EVENT_ALL_ACCESS, false, pMMT->SignalEventName);
- if (hSignal != 0) {
+ if (hSignal != nullptr) {
SetEvent(hSignal);
CloseHandle(hSignal);
}
@@ -484,7 +484,7 @@ Reply: void __cdecl ThreadServer(HANDLE hMainThread)
{
char szBuf[100];
- HANDLE hEvent = CreateEventA(NULL, false, false, CreateProcessUID(GetCurrentProcessId(), szBuf, sizeof(szBuf)));
+ HANDLE hEvent = CreateEventA(nullptr, false, false, CreateProcessUID(GetCurrentProcessId(), szBuf, sizeof(szBuf)));
while (true) {
int retVal = WaitForSingleObjectEx(hEvent, INFINITE, true);
if (retVal == WAIT_OBJECT_0)
@@ -499,9 +499,9 @@ void __cdecl ThreadServer(HANDLE hMainThread) void InvokeThreadServer()
{
- HANDLE hMainThread = 0;
+ HANDLE hMainThread = nullptr;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, false, 0);
- if (hMainThread != 0)
+ if (hMainThread != nullptr)
mir_forkthread(&ThreadServer, hMainThread);
}
@@ -516,27 +516,27 @@ HRESULT RemoveCOMRegistryEntries() RegCloseKey(hRootKey);
// delete it
if (RegDeleteKey(HKEY_CLASSES_ROOT, L"miranda.shlext") != ERROR_SUCCESS)
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("Unable to delete registry key for 'shlext COM', this key may already be deleted or you may need admin rights."),
TranslateT("Problem"), MB_ICONERROR);
}
if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, L"\\*\\shellex\\ContextMenuHandlers", 0, KEY_ALL_ACCESS, &hRootKey)) {
if (RegDeleteKey(hRootKey, L"miranda.shlext") != ERROR_SUCCESS)
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("Unable to delete registry key for 'File context menu handlers', this key may already be deleted or you may need admin rights."),
TranslateT("Problem"), MB_ICONERROR);
RegCloseKey(hRootKey);
}
if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, L"Directory\\shellex\\ContextMenuHandlers", 0, KEY_ALL_ACCESS, &hRootKey)) {
if (RegDeleteKey(hRootKey, L"miranda.shlext") != ERROR_SUCCESS)
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("Unable to delete registry key for 'Directory context menu handlers', this key may already be deleted or you may need admin rights."),
TranslateT("Problem"), MB_ICONERROR);
RegCloseKey(hRootKey);
}
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0, KEY_ALL_ACCESS, &hRootKey)) {
if (RegDeleteValue(hRootKey, L"{72013A26-A94C-11d6-8540-A5E62932711D}") != ERROR_SUCCESS) {
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("Unable to delete registry entry for 'Approved context menu handlers', this key may already be deleted or you may need admin rights."),
TranslateT("Problem"), MB_ICONERROR);
}
@@ -576,7 +576,7 @@ void CheckRegisterServer() if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, L"miranda.shlext", 0, KEY_READ, &hRegKey))
RegCloseKey(hRegKey);
else if (bIsVistaPlus) {
- MessageBox(0,
+ MessageBox(nullptr,
TranslateT("Shell context menus requires your permission to register with Windows Explorer (one time only)."),
TranslateT("Miranda NG - Shell context menus (shellext.dll)"), MB_OK | MB_ICONINFORMATION);
// /s = silent
diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index a8d87632f1..443b1c6eda 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -14,9 +14,9 @@ TShellExt::TShellExt() {
hDllHeap = HeapCreate(0, 0, 0);
// create an inmemory DC
- HDC DC = GetDC(0);
+ HDC DC = GetDC(nullptr);
hMemDC = CreateCompatibleDC(DC);
- ReleaseDC(0, DC);
+ ReleaseDC(nullptr, DC);
// keep count on the number of objects
DllObjectCount++;
}
@@ -26,36 +26,36 @@ TShellExt::~TShellExt() // time to go byebye.
// Note MRU menu is associated with a window (indirectly) so windows will free it.
// free icons!
- if (ProtoIcons != NULL) {
+ if (ProtoIcons != nullptr) {
ULONG c = ProtoIconsCount;
while (c > 0) {
c--;
TSlotProtoIcons *p = &ProtoIcons[c];
for (int j = 0; j < 10; j++) {
- if (p->hIcons[j] != 0)
+ if (p->hIcons[j] != nullptr)
DestroyIcon(p->hIcons[j]);
- if (p->hBitmaps[j] != 0)
+ if (p->hBitmaps[j] != nullptr)
DeleteObject(p->hBitmaps[j]);
}
}
free(ProtoIcons);
- ProtoIcons = NULL;
+ ProtoIcons = nullptr;
}
// free IDataObject reference if pointer exists
- if (pDataObject != NULL) {
+ if (pDataObject != nullptr) {
pDataObject->Release();
- pDataObject = NULL;
+ pDataObject = nullptr;
}
// free the heap and any memory allocated on it
HeapDestroy(hDllHeap);
// destroy the DC
- if (hMemDC != 0)
+ if (hMemDC != nullptr)
DeleteDC(hMemDC);
}
HRESULT TShellExt::QueryInterface(REFIID riid, void **ppvObject)
{
- if (ppvObject == NULL)
+ if (ppvObject == nullptr)
return E_POINTER;
if (riid == IID_IContextMenu) {
@@ -75,7 +75,7 @@ HRESULT TShellExt::QueryInterface(REFIID riid, void **ppvObject) logA("TShellExt[%p] retrieved as IID_IUnknown: %d\n", this, RefCount);
}
else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
#ifdef LOG_ENABLED
RPC_CSTR szGuid;
UuidToStringA(&riid, &szGuid);
@@ -116,11 +116,11 @@ HRESULT TShellExt::Initialize(PCIDLIST_ABSOLUTE, IDataObject *pdtobj, HKEY) // it contains a pointer to a function table containing the function pointer
// address of GetData() - the instance data has to be passed explicitly since
// all compiler magic has gone.
- if (pdtobj == NULL)
+ if (pdtobj == nullptr)
return E_INVALIDARG;
// if an instance already exists, free it.
- if (pDataObject != NULL)
+ if (pDataObject != nullptr)
pDataObject->Release();
// store the new one and AddRef() it
@@ -138,20 +138,20 @@ HRESULT TShellExt::GetCommandString(UINT_PTR, UINT, UINT*, LPSTR, UINT) void FreeGroupTreeAndEmptyGroups(HMENU hParentMenu, TGroupNode *pp, TGroupNode *p)
{
- while (p != NULL) {
+ while (p != nullptr) {
TGroupNode *q = p->Right;
- if (p->Left != NULL)
+ if (p->Left != nullptr)
FreeGroupTreeAndEmptyGroups(p->Left->hMenu, p, p->Left);
if (p->dwItems == 0) {
- if (pp != NULL)
+ if (pp != nullptr)
DeleteMenu(pp->hMenu, p->hMenuGroupID, MF_BYCOMMAND);
else
DeleteMenu(hParentMenu, p->hMenuGroupID, MF_BYCOMMAND);
}
else
// make sure this node's parent know's it exists
- if (pp != NULL)
+ if (pp != nullptr)
pp->dwItems++;
free(p);
@@ -166,7 +166,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum // get the heap object
HANDLE hDllHeap = lParam->Self->hDllHeap;
TMenuDrawInfo *psd = (TMenuDrawInfo*)HeapAlloc(hDllHeap, 0, sizeof(TMenuDrawInfo));
- if (pct != NULL) {
+ if (pct != nullptr) {
psd->cch = pct->cbStrSection - 1; // no null;
psd->szText = (char*)HeapAlloc(hDllHeap, 0, pct->cbStrSection);
lstrcpyA(psd->szText, (char*)pct + sizeof(TSlotIPC));
@@ -175,7 +175,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum // find the protocol icon array to use && which status
UINT c = lParam->Self->ProtoIconsCount;
TSlotProtoIcons *pp = lParam->Self->ProtoIcons;
- psd->hStatusIcon = 0;
+ psd->hStatusIcon = nullptr;
while (c > 0) {
c--;
if (pp[c].hProto == pct->hProto && pp[c].pid == lParam->pid) {
@@ -186,7 +186,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum } // while
psd->pid = lParam->pid;
}
- else if (pg != NULL) {
+ else if (pg != nullptr) {
// store the given ID
pg->hMenuGroupID = mii.wID;
// steal the pointer from the group node it should be on the heap
@@ -195,7 +195,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum psd->fTypes = dtGroup;
} // if
psd->wID = mii.wID;
- psd->szProfile = NULL;
+ psd->szProfile = nullptr;
// store
mii.dwItemData = UINT_PTR(psd);
@@ -206,13 +206,13 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum else {
// normal menu
mii.fType = MFT_STRING;
- if (pct != NULL)
+ if (pct != nullptr)
mii.dwTypeData = LPSTR(pct) + sizeof(TSlotIPC);
else
mii.dwTypeData = pg->szGroup;
// For Vista + let the system draw the theme && icons, pct = contact associated data
- if (bIsVistaPlus && pct != NULL && psd != NULL) {
+ if (bIsVistaPlus && pct != nullptr && psd != nullptr) {
mii.fMask = MIIM_BITMAP | MIIM_FTYPE | MIIM_ID | MIIM_DATA | MIIM_STRING;
// BuildSkinIcons() built an array of bitmaps which we can use here
mii.hbmpItem = psd->hStatusBitmap;
@@ -263,7 +263,7 @@ void BuildContactTree(TGroupNode *group, TEnumData *lParam) // go thru all the contacts
TSlotIPC *pct = lParam->ipch->ContactsBegin;
- while (pct != NULL && pct->cbSize == sizeof(TSlotIPC) && pct->fType == REQUEST_CONTACTS) {
+ while (pct != nullptr && pct->cbSize == sizeof(TSlotIPC) && pct->fType == REQUEST_CONTACTS) {
if (pct->hGroup != 0) {
// at the } of the slot header is the contact's display name
// && after a double NULL char there is the group string, which has the full path of the group
@@ -276,10 +276,10 @@ void BuildContactTree(TGroupNode *group, TEnumData *lParam) // restore the root
TGroupNode *pg = group;
int Depth = 0;
- while (sz != NULL) {
+ while (sz != nullptr) {
UINT Hash = murmur_hash(sz);
// find this node within
- while (pg != NULL) {
+ while (pg != nullptr) {
// does this node have the right hash and the right depth?
if (Hash == pg->Hash && Depth == pg->Depth)
break;
@@ -287,9 +287,9 @@ void BuildContactTree(TGroupNode *group, TEnumData *lParam) // the path syntax doesn't know if a group is a group at the same level
// or a nested one, which means the search node can be anywhere
TGroupNode *px = pg->Left;
- if (px != NULL) {
+ if (px != nullptr) {
// keep searching this level
- while (px != NULL) {
+ while (px != nullptr) {
if (Hash == px->Hash && Depth == px->Depth) {
// found the node we're looking for at the next level to pg, px is now pq for next time
pg = px;
@@ -303,11 +303,11 @@ void BuildContactTree(TGroupNode *group, TEnumData *lParam) grouploop:
Depth++;
// process next token
- sz = strtok(NULL, "\\");
+ sz = strtok(nullptr, "\\");
}
// tokenisation finished, if pg != NULL the group is found
- if (pg != NULL) {
- DecideMenuItemInfo(pct, NULL, mii, lParam);
+ if (pg != nullptr) {
+ DecideMenuItemInfo(pct, nullptr, mii, lParam);
BuildMRU(pct, mii, lParam);
InsertMenuItemA(pg->hMenu, 0xFFFFFFFF, true, &mii);
pg->dwItems++;
@@ -324,12 +324,12 @@ static void BuildMenuGroupTree(TGroupNode *p, TEnumData *lParam, HMENU hLastMenu mii.fMask = MIIM_ID | MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
// go thru each group and create a menu for it adding submenus too.
- while (p != NULL) {
+ while (p != nullptr) {
mii.hSubMenu = CreatePopupMenu();
- if (p->Left != NULL)
+ if (p->Left != nullptr)
BuildMenuGroupTree(p->Left, lParam, mii.hSubMenu);
p->hMenu = mii.hSubMenu;
- DecideMenuItemInfo(NULL, p, mii, lParam);
+ DecideMenuItemInfo(nullptr, p, mii, lParam);
InsertMenuItemA(hLastMenu, 0xFFFFFFFF, true, &mii);
p = p->Right;
}
@@ -344,9 +344,9 @@ static void BuildMenus(TEnumData *lParam) HMENU hBaseMenu = lParam->Self->hRootMenu;
// build an in memory tree of the groups
- TGroupNodeList j = { 0, 0 };
+ TGroupNodeList j = { nullptr, nullptr };
TSlotIPC *pg = lParam->ipch->GroupsBegin;
- while (pg != NULL) {
+ while (pg != nullptr) {
if (pg->cbSize != sizeof(TSlotIPC) || pg->fType != REQUEST_GROUPS)
break;
@@ -354,11 +354,11 @@ static void BuildMenus(TEnumData *lParam) TGroupNode *p = j.First; // start at root again
// get the group
Token = strtok(LPSTR(pg) + sizeof(TSlotIPC), "\\");
- while (Token != NULL) {
+ while (Token != nullptr) {
UINT Hash = murmur_hash(Token);
// if the (sub)group doesn't exist, create it.
TGroupNode *q = FindGroupNode(p, Hash, Depth);
- if (q == NULL) {
+ if (q == nullptr) {
q = AllocGroupNode(&j, p, Depth);
q->Depth = Depth;
// this is the hash of this group node, but it can be anywhere
@@ -376,7 +376,7 @@ static void BuildMenus(TEnumData *lParam) }
p = q;
Depth++;
- Token = strtok(NULL, "\\");
+ Token = strtok(nullptr, "\\");
}
pg = pg->Next;
}
@@ -391,7 +391,7 @@ static void BuildMenus(TEnumData *lParam) lParam->Self->hRecentMenu = CreatePopupMenu();
lParam->Self->RecentCount = 0;
// create group menus only if they exist!
- if (lParam->ipch->GroupsBegin != NULL) {
+ if (lParam->ipch->GroupsBegin != nullptr) {
BuildMenuGroupTree(j.First, lParam, hGroupMenu);
// add contacts that have a group somewhere
BuildContactTree(j.First, lParam);
@@ -402,11 +402,11 @@ static void BuildMenus(TEnumData *lParam) mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_DATA;
// add all the contacts that have no group (which maybe all of them)
pg = lParam->ipch->ContactsBegin;
- while (pg != NULL) {
+ while (pg != nullptr) {
if (pg->cbSize != sizeof(TSlotIPC) || pg->fType != REQUEST_CONTACTS)
break;
if (pg->hGroup == 0) {
- DecideMenuItemInfo(pg, NULL, mii, lParam);
+ DecideMenuItemInfo(pg, nullptr, mii, lParam);
BuildMRU(pg, mii, lParam);
InsertMenuItemA(hGroupMenu, 0xFFFFFFFF, true, &mii);
}
@@ -462,7 +462,7 @@ static void BuildMenus(TEnumData *lParam) else {
// no items were attached to the MRU, delete the MRU menu
DestroyMenu(lParam->Self->hRecentMenu);
- lParam->Self->hRecentMenu = 0;
+ lParam->Self->hRecentMenu = nullptr;
}
// allocate display info/memory for "Miranda" string
@@ -484,8 +484,8 @@ static void BuildMenus(TEnumData *lParam) lstrcpynA(psd->szText, lParam->ipch->MirandaName, sizeof(lParam->ipch->MirandaName) - 1);
// there may not be a profile name
pg = lParam->ipch->DataPtr;
- psd->szProfile = NULL;
- if (pg != NULL && pg->Status == STATUS_PROFILENAME) {
+ psd->szProfile = nullptr;
+ if (pg != nullptr && pg->Status == STATUS_PROFILENAME) {
psd->szProfile = (LPSTR)HeapAlloc(hDllHeap, 0, pg->cbStrSection);
lstrcpyA(psd->szProfile, LPSTR(UINT_PTR(pg) + sizeof(TSlotIPC)));
}
@@ -522,16 +522,16 @@ static void BuildMenus(TEnumData *lParam) // add it all
InsertMenuItemA(hBaseMenu, 0, true, &mii);
// free the group tree
- FreeGroupTreeAndEmptyGroups(hGroupMenu, NULL, j.First);
+ FreeGroupTreeAndEmptyGroups(hGroupMenu, nullptr, j.First);
}
static void BuildSkinIcons(TEnumData *lParam)
{
- IWICImagingFactory *factory = (bIsVistaPlus) ? ARGB_GetWorker() : NULL;
+ IWICImagingFactory *factory = (bIsVistaPlus) ? ARGB_GetWorker() : nullptr;
TSlotIPC *pct = lParam->ipch->NewIconsBegin;
TShellExt *Self = lParam->Self;
- while (pct != NULL) {
+ while (pct != nullptr) {
if (pct->cbSize != sizeof(TSlotIPC) || pct->fType != REQUEST_NEWICONS)
break;
@@ -547,10 +547,10 @@ static void BuildSkinIcons(TEnumData *lParam) for (int j = 0; j < 10; j++) {
if (bIsVistaPlus) {
d->hBitmaps[j] = ARGB_BitmapFromIcon(factory, Self->hMemDC, p->hIcons[j]);
- d->hIcons[j] = NULL;
+ d->hIcons[j] = nullptr;
}
else {
- d->hBitmaps[j] = NULL;
+ d->hBitmaps[j] = nullptr;
d->hIcons[j] = CopyIcon(p->hIcons[j]);
}
}
@@ -576,7 +576,7 @@ BOOL __stdcall ProcessRequest(HWND hwnd, LPARAM param) // this was fine for most Oses (not the best way) but now actually compares
// the class string (a bit slower) but should get rid of those bugs finally.
HANDLE hMirandaWorkEvent = OpenEventA(EVENT_ALL_ACCESS, false, CreateProcessUID(pid, szBuf, sizeof(szBuf)));
- if (hMirandaWorkEvent != 0) {
+ if (hMirandaWorkEvent != nullptr) {
GetClassNameA(hwnd, szBuf, sizeof(szBuf));
if ( lstrcmpA(szBuf, MIRANDACLASS) != 0) {
// opened but not valid.
@@ -586,7 +586,7 @@ BOOL __stdcall ProcessRequest(HWND hwnd, LPARAM param) }
}
// if the event object exists, a shlext.dll running in the instance must of created it.
- if (hMirandaWorkEvent != 0) {
+ if (hMirandaWorkEvent != nullptr) {
logA("ProcessRequest(%d, %p): window found\n", pid, hwnd);
// prep the request
ipcPrepareRequests(IPC_PACKET_SIZE, lParam->ipch, REQUEST_ICONS | REQUEST_GROUPS | REQUEST_CONTACTS | REQUEST_NEWICONS);
@@ -598,7 +598,7 @@ BOOL __stdcall ProcessRequest(HWND hwnd, LPARAM param) // replyBits will be REPLY_FAIL if the wait timed out, or it'll be the request
// bits as sent or a series of *_NOTIMPL bits where the request bit were, if there are no
// contacts to speak of, don't bother showing this instance of Miranda }
- if (replyBits != REPLY_FAIL && lParam->ipch->ContactsBegin != NULL) {
+ if (replyBits != REPLY_FAIL && lParam->ipch->ContactsBegin != nullptr) {
logA("ProcessRequest(%d, %p): IPC succeeded\n", pid, hwnd);
// load the address again, the server side will always overwrite it
lParam->ipch->pClientBaseAddress = lParam->ipch;
@@ -639,7 +639,7 @@ HRESULT TShellExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFirs bool bMF_OWNERDRAW = false;
// get the shell version
pfnDllGetVersion DllGetVersionProc = (pfnDllGetVersion)GetProcAddress( GetModuleHandleA("shell32.dll"), "DllGetVersion");
- if (DllGetVersionProc != NULL) {
+ if (DllGetVersionProc != nullptr) {
DllVersionInfo dvi;
dvi.cbSize = sizeof(dvi);
if (DllGetVersionProc(&dvi) >= 0) // it's at least 4.00
@@ -650,12 +650,12 @@ HRESULT TShellExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFirs if (bIsVistaPlus)
bMF_OWNERDRAW = false;
- HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME);
- if (hMap != 0 && GetLastError() != ERROR_ALREADY_EXISTS) {
- TEnumData ed = { 0 };
+ HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME);
+ if (hMap != nullptr && GetLastError() != ERROR_ALREADY_EXISTS) {
+ TEnumData ed = {};
// map the memory to this address space
THeaderIPC *pipch = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
- if (pipch != NULL) {
+ if (pipch != nullptr) {
// let the callback have instance vars
ed.Self = this;
// not used 'ere
@@ -671,8 +671,8 @@ HRESULT TShellExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFirs // since it has to used by OpenEvent()
CreateUID(pipch->SignalEventName, sizeof(pipch->SignalEventName));
// create the wait wait-for-wait object
- ed.hWaitFor = CreateEventA(NULL, false, false, pipch->SignalEventName);
- if (ed.hWaitFor != 0) {
+ ed.hWaitFor = CreateEventA(nullptr, false, false, pipch->SignalEventName);
+ if (ed.hWaitFor != nullptr) {
// enumerate all the top level windows to find all loaded MIRANDACLASS classes
EnumWindows(&ProcessRequest, LPARAM(&ed));
// close the wait-for-reply object
@@ -699,7 +699,7 @@ HRESULT ipcGetFiles(THeaderIPC *pipch, IDataObject* pDataObject, MCONTACT hConta {
FORMATETC fet;
fet.cfFormat = CF_HDROP;
- fet.ptd = NULL;
+ fet.ptd = nullptr;
fet.dwAspect = DVASPECT_CONTENT;
fet.lindex = -1;
fet.tymed = TYMED_HGLOBAL;
@@ -709,16 +709,16 @@ HRESULT ipcGetFiles(THeaderIPC *pipch, IDataObject* pDataObject, MCONTACT hConta if (hr == S_OK) {
// FIX, actually lock the global object and get a pointer
HANDLE hDrop = GlobalLock(stgm.hGlobal);
- if (hDrop != 0) {
+ if (hDrop != nullptr) {
// get the maximum number of files
- UINT iFile, iFileMax = DragQueryFileA((HDROP)stgm.hGlobal, -1, NULL, 0);
+ UINT iFile, iFileMax = DragQueryFileA((HDROP)stgm.hGlobal, -1, nullptr, 0);
for (iFile = 0; iFile < iFileMax; iFile++) {
// get the size of the file path
- int cbSize = DragQueryFileA((HDROP)stgm.hGlobal, iFile, NULL, 0);
+ int cbSize = DragQueryFileA((HDROP)stgm.hGlobal, iFile, nullptr, 0);
// get the buffer
TSlotIPC *pct = ipcAlloc(pipch, cbSize + 1); // including null term
// allocated?
- if (pct == NULL)
+ if (pct == nullptr)
break;
// store the hContact
pct->hContact = hContact;
@@ -747,27 +747,27 @@ HRESULT RequestTransfer(TShellExt *Self, int idxCmd) // get the pointer
TMenuDrawInfo *psd = (TMenuDrawInfo*)mii.dwItemData;
// the ID stored in the item pointer and the ID for the menu must match
- if (psd == NULL || psd->wID != mii.wID)
+ if (psd == nullptr || psd->wID != mii.wID)
return E_INVALIDARG;
// is there an IDataObject instance?
HRESULT hr = E_INVALIDARG;
- if (Self->pDataObject != NULL) {
+ if (Self->pDataObject != nullptr) {
// OpenEvent() the work object to see if the instance is still around
char szBuf[100];
HANDLE hTransfer = OpenEventA(EVENT_ALL_ACCESS, false, CreateProcessUID(psd->pid, szBuf, sizeof(szBuf)));
- if (hTransfer != 0) {
+ if (hTransfer != nullptr) {
// map the ipc file again
- HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME);
- if (hMap != 0 && GetLastError() != ERROR_ALREADY_EXISTS) {
+ HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME);
+ if (hMap != nullptr && GetLastError() != ERROR_ALREADY_EXISTS) {
// map it to process
THeaderIPC *pipch = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
- if (pipch != NULL) {
+ if (pipch != nullptr) {
// create the name of the object to be signalled by the ST
lstrcpyA(pipch->SignalEventName, CreateUID(szBuf, sizeof(szBuf)));
// create it
- HANDLE hReply = CreateEventA(NULL, false, false, pipch->SignalEventName);
- if (hReply != 0) {
+ HANDLE hReply = CreateEventA(nullptr, false, false, pipch->SignalEventName);
+ if (hReply != nullptr) {
if (psd->fTypes & dtCommand) {
if (psd->MenuCommandCallback)
hr = psd->MenuCommandCallback(pipch, hTransfer, hReply);
@@ -811,7 +811,7 @@ HRESULT TShellExt::InvokeCommand(CMINVOKECOMMANDINFO *pici) HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
{
LRESULT Dummy;
- if (plResult == NULL)
+ if (plResult == nullptr)
plResult = &Dummy;
SIZE tS;
@@ -857,7 +857,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU dwi->rcItem.left += dwi->rcItem.bottom - dwi->rcItem.top - 2;
DrawTextA(dwi->hDC, psd->szText, psd->cch, &dwi->rcItem, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
// draw the name of the database text if it's there
- if (psd->szProfile != NULL) {
+ if (psd->szProfile != nullptr) {
GetTextExtentPoint32A(dwi->hDC, psd->szText, psd->cch, &tS);
dwi->rcItem.left += tS.cx + 8;
SetTextColor(dwi->hDC, GetSysColor(COLOR_GRAYTEXT));
@@ -906,7 +906,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU GetTextExtentPoint32A(hMemDC, psd->szText, psd->cch, &tS);
dx += tS.cx;
// main menu item?
- if (psd->szProfile != NULL) {
+ if (psd->szProfile != nullptr) {
GetTextExtentPoint32A(hMemDC, psd->szProfile, lstrlenA(psd->szProfile), &tS);
dx += tS.cx;
}
@@ -924,5 +924,5 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU HRESULT TShellExt::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- return HandleMenuMsg2(uMsg, wParam, lParam, NULL);
+ return HandleMenuMsg2(uMsg, wParam, lParam, nullptr);
}
diff --git a/plugins/ShellExt/src/shlfactory.cpp b/plugins/ShellExt/src/shlfactory.cpp index 973dbb0aec..fba9fdabba 100644 --- a/plugins/ShellExt/src/shlfactory.cpp +++ b/plugins/ShellExt/src/shlfactory.cpp @@ -22,7 +22,7 @@ HRESULT TClassFactoryRec::QueryInterface(REFIID riid, void **ppvObject) logA("TClassFactoryRec::QueryInterface {%s} failed\n", szGuid);
RpcStringFreeA(&szGuid);
#endif
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
@@ -49,15 +49,15 @@ ULONG TClassFactoryRec::Release() HRESULT TClassFactoryRec::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
{
- if (ppvObject == 0)
+ if (ppvObject == nullptr)
return E_POINTER;
- *ppvObject = NULL;
+ *ppvObject = nullptr;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
TShellExt *p = new TShellExt();
- if (p == NULL)
+ if (p == nullptr)
return E_OUTOFMEMORY;
HRESULT hr = p->QueryInterface(riid, ppvObject);
diff --git a/plugins/ShellExt/src/shlicons.cpp b/plugins/ShellExt/src/shlicons.cpp index 20f941a03e..8f9162a7c0 100644 --- a/plugins/ShellExt/src/shlicons.cpp +++ b/plugins/ShellExt/src/shlicons.cpp @@ -22,14 +22,14 @@ Why didn't they just do this themselves? ... IWICImagingFactory* ARGB_GetWorker()
{
- IWICImagingFactory *res = NULL;
- CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (void**)&res);
+ IWICImagingFactory *res = nullptr;
+ CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (void**)&res);
return res;
}
HBITMAP ARGB_BitmapFromIcon(IWICImagingFactory *Factory, HDC hDC, HICON hIcon)
{
- HBITMAP hBmp = NULL;
+ HBITMAP hBmp = nullptr;
// This code gives an icon to WIC and gets a bitmap object in return, it then creates a DIB section
// which is 32bits and the same H*W as the icon. It then asks the bitmap object to copy itself into the DIB }
@@ -40,7 +40,7 @@ HBITMAP ARGB_BitmapFromIcon(IWICImagingFactory *Factory, HDC hDC, HICON hIcon) bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biBitCount = 32;
- IWICBitmap *bitmap = NULL;
+ IWICBitmap *bitmap = nullptr;
HRESULT hr = Factory->CreateBitmapFromHICON(hIcon, &bitmap);
if (hr == S_OK) {
int cx, cy;
@@ -50,16 +50,16 @@ HBITMAP ARGB_BitmapFromIcon(IWICImagingFactory *Factory, HDC hDC, HICON hIcon) bmi.bmiHeader.biHeight = -cy;
void *pbBuffer;
- hBmp = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pbBuffer, 0, 0);
- if (hBmp != 0) {
+ hBmp = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pbBuffer, nullptr, 0);
+ if (hBmp != nullptr) {
UINT cbStride = cx * sizeof(DWORD); // ARGB = DWORD
UINT cbBuffer = cy * cbStride;
// note: the pbBuffer memory is owned by the DIB and will be freed when the bitmap is released
- hr = bitmap->CopyPixels(NULL, cbStride, cbBuffer, (PBYTE)pbBuffer);
+ hr = bitmap->CopyPixels(nullptr, cbStride, cbBuffer, (PBYTE)pbBuffer);
if (hr != S_OK) {
// the copy failed, delete the DIB
DeleteObject(hBmp);
- hBmp = NULL;
+ hBmp = nullptr;
}
}
}
diff --git a/plugins/ShellExt/src/shlipc.cpp b/plugins/ShellExt/src/shlipc.cpp index 41a195af77..ac2ba3ef01 100644 --- a/plugins/ShellExt/src/shlipc.cpp +++ b/plugins/ShellExt/src/shlipc.cpp @@ -3,13 +3,13 @@ TGroupNode* FindGroupNode(TGroupNode *p, const DWORD Hash, int Depth)
{
- while (p != NULL) {
+ while (p != nullptr) {
if (p->Hash == Hash && p->Depth == Depth)
return p;
- if (p->Left != NULL) {
+ if (p->Left != nullptr) {
TGroupNode *q = FindGroupNode(p->Left, Hash, Depth);
- if (q != NULL)
+ if (q != nullptr)
return q;
}
p = p->Right;
@@ -22,19 +22,19 @@ TGroupNode* AllocGroupNode(TGroupNodeList *list, TGroupNode *Root, int Depth) TGroupNode *p = (TGroupNode*)calloc(1, sizeof(TGroupNode));
p->Depth = Depth;
if (Depth > 0) {
- if (Root->Left == NULL)
+ if (Root->Left == nullptr)
Root->Left = p;
else {
Root = Root->Left;
- while (Root->Right != NULL)
+ while (Root->Right != nullptr)
Root = Root->Right;
Root->Right = p;
}
}
else {
- if (list->First == NULL)
+ if (list->First == nullptr)
list->First = p;
- if (list->Last != NULL)
+ if (list->Last != nullptr)
list->Last->Right = p;
list->Last = p;
}
@@ -47,14 +47,14 @@ void ipcPrepareRequests(int ipcPacketSize, THeaderIPC *pipch, DWORD fRequests) pipch->cbSize = sizeof(THeaderIPC);
pipch->dwVersion = PLUGIN_MAKE_VERSION(2, 0, 1, 2);
pipch->dwFlags = 0;
- pipch->pServerBaseAddress = NULL;
+ pipch->pServerBaseAddress = nullptr;
pipch->pClientBaseAddress = pipch;
pipch->fRequests = fRequests;
pipch->Slots = 0;
- pipch->IconsBegin = NULL;
- pipch->ContactsBegin = NULL;
- pipch->GroupsBegin = NULL;
- pipch->NewIconsBegin = NULL;
+ pipch->IconsBegin = nullptr;
+ pipch->ContactsBegin = nullptr;
+ pipch->GroupsBegin = nullptr;
+ pipch->NewIconsBegin = nullptr;
pipch->DataSize = ipcPacketSize - pipch->cbSize;
// the server side will adjust these pointers as soon as it opens
// the mapped file to it's base address, these are set 'ere because ipcAlloc()
@@ -94,7 +94,7 @@ TSlotIPC* ipcAlloc(THeaderIPC *pipch, int nSize) UINT_PTR PSP = UINT_PTR(pipch->DataFramePtr) + sizeof(TSlotIPC) + nSize;
// is it past the end?
if (PSP >= UINT_PTR(pipch->DataPtrEnd))
- return NULL;
+ return nullptr;
// return the pointer
TSlotIPC *p = (TSlotIPC*)pipch->DataFramePtr;
// set up the item
@@ -115,16 +115,16 @@ void ipcFixupAddresses(THeaderIPC *pipch) INT_PTR diff = INT_PTR(pipch->pClientBaseAddress) - INT_PTR(pipch->pServerBaseAddress);
// fix up all the pointers in the header
- if (pipch->IconsBegin != NULL)
+ if (pipch->IconsBegin != nullptr)
pipch->IconsBegin = (TSlotIPC*)(UINT_PTR(pipch->IconsBegin) + diff);
- if (pipch->ContactsBegin != NULL)
+ if (pipch->ContactsBegin != nullptr)
pipch->ContactsBegin = (TSlotIPC*)(UINT_PTR(pipch->ContactsBegin) + diff);
- if (pipch->GroupsBegin != NULL)
+ if (pipch->GroupsBegin != nullptr)
pipch->GroupsBegin = (TSlotIPC*)(UINT_PTR(pipch->GroupsBegin) + diff);
- if (pipch->NewIconsBegin != NULL)
+ if (pipch->NewIconsBegin != nullptr)
pipch->NewIconsBegin = (TSlotIPC*)(UINT_PTR(pipch->NewIconsBegin) + diff);
pipch->DataPtr = (TSlotIPC*)(UINT_PTR(pipch->DataPtr) + diff);
@@ -133,11 +133,11 @@ void ipcFixupAddresses(THeaderIPC *pipch) // and the link list
TSlotIPC *pct = pipch->DataPtr;
- while (pct != NULL) {
+ while (pct != nullptr) {
// the first pointer is already fixed up, have to get a pointer
// to the next pointer and modify where it jumps to
TSlotIPC **q = &pct->Next;
- if (*q != NULL)
+ if (*q != nullptr)
*q = (TSlotIPC*)(UINT_PTR(*q) + diff);
pct = *q;
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index e4d87817d7..8feceb95bf 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -98,7 +98,7 @@ INT CheckDefaults(WPARAM, LPARAM) interval = db_get_w(NULL, protocolname, KEY_REPEATINTERVAL, 300);
wchar_t *ptszVal = db_get_wsa(NULL, protocolname, KEY_HEADING);
- if (ptszVal == 0)
+ if (ptszVal == nullptr)
// Heading not set
db_set_ws(NULL, protocolname, KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
else
@@ -111,7 +111,7 @@ INT CheckDefaults(WPARAM, LPARAM) char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", c);
ptszVal = db_get_wsa(NULL, protocolname, szStatus);
- if (ptszVal == 0) {
+ if (ptszVal == nullptr) {
wchar_t *ptszDefault;
if (c < ID_STATUS_FREECHAT)
// This mode does not have a preset message
@@ -119,7 +119,7 @@ INT CheckDefaults(WPARAM, LPARAM) else if (c > ID_STATUS_INVISIBLE)
ptszDefault = ptszDefaultMsg[c - ID_STATUS_ONLINE - 3];
else
- ptszDefault = 0;
+ ptszDefault = nullptr;
if (ptszDefault)
db_set_ws(NULL, protocolname, szStatus, TranslateW(ptszDefault));
}
@@ -165,7 +165,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) return FALSE;
wchar_t *ptszVal = db_get_wsa(hContact, "Protocol", "p");
- if (ptszVal == NULL) // Contact with no protocol ?!!
+ if (ptszVal == nullptr) // Contact with no protocol ?!!
return FALSE;
mir_free(ptszVal);
@@ -176,7 +176,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) return FALSE;
if (!(dbei.flags & DBEF_SENT)) {
- int timeBetween = time(NULL) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
+ int timeBetween = time(nullptr) - db_get_dw(hContact, protocolname, "LastReplyTS", 0);
if (timeBetween > interval || db_get_w(hContact, protocolname, "LastStatus", 0) != status) {
size_t msgLen = 1;
int isQun = db_get_b(hContact, pszProto, "IsQun", 0);
@@ -191,7 +191,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) CMStringW ptszTemp;
wchar_t *ptszNick = db_get_wsa(hContact, pszProto, "Nick");
- if (ptszNick == 0) {
+ if (ptszNick == nullptr) {
mir_free(ptszVal);
return FALSE;
}
@@ -199,7 +199,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) msgLen += mir_wstrlen(ptszVal);
wchar_t *ptszHead = db_get_wsa(NULL, protocolname, KEY_HEADING);
- if (ptszHead != NULL) {
+ if (ptszHead != nullptr) {
ptszTemp = ptszHead;
ptszTemp.Replace(L"%user%", ptszNick);
msgLen += mir_wstrlen(ptszTemp);
@@ -209,7 +209,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) wchar_t *ptszTemp2 = (wchar_t*)mir_alloc(sizeof(wchar_t) * (msgLen + 5));
mir_snwprintf(ptszTemp2, msgLen + 5, L"%s\r\n\r\n%s", ptszTemp.c_str(), ptszVal);
if (ServiceExists(MS_VARS_FORMATSTRING)) {
- ptszTemp = variables_parse(ptszTemp2, 0, hContact);
+ ptszTemp = variables_parse(ptszTemp2, nullptr, hContact);
}
else ptszTemp = Utils_ReplaceVarsW(ptszTemp2);
@@ -219,7 +219,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT; //DBEF_READ;
dbei.szModule = pszProto;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)pszUtf;
db_event_add(hContact, &dbei);
@@ -232,7 +232,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) }
}
- db_set_dw(hContact, protocolname, "LastReplyTS", time(NULL));
+ db_set_dw(hContact, protocolname, "LastReplyTS", time(nullptr));
db_set_w(hContact, protocolname, "LastStatus", status);
}
return 0;
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index ee932589a6..c541651d96 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-wchar_t* ptszMessage[6]={0};
+wchar_t* ptszMessage[6]= {};
INT lastIndex=-1;
INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -123,9 +123,9 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara continue;
else {
if (c<ID_STATUS_FREECHAT)
- ptszMessage[c - ID_STATUS_ONLINE - 1] = NULL;
+ ptszMessage[c - ID_STATUS_ONLINE - 1] = nullptr;
else if (c>ID_STATUS_INVISIBLE)
- ptszMessage[c - ID_STATUS_ONLINE - 3] = NULL;
+ ptszMessage[c - ID_STATUS_ONLINE - 3] = nullptr;
}
}
break;
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index f80213728b..37ae062f63 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -32,8 +32,8 @@ static MWindowList hWindowList, hWindowList2; static wchar_t *StrNormNewline(wchar_t *tszStr)
{
- if (tszStr == NULL)
- return NULL;
+ if (tszStr == nullptr)
+ return nullptr;
int nCR = 0;
for (int i = 0; tszStr[i]; i++)
@@ -76,7 +76,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat->hContact = lParam;
dat->hSeq = (HANDLE)ProtoChainSend(dat->hContact, PSS_GETAWAYMSG, 0, 0);
- dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL;
+ dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : nullptr;
WindowList_Add(hWindowList, hwndDlg, dat->hContact);
{
wchar_t str[256], format[128];
@@ -112,7 +112,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP break;
if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) {
UnhookEvent(dat->hAwayMsgEvent);
- dat->hAwayMsgEvent = NULL;
+ dat->hAwayMsgEvent = nullptr;
}
wchar_t *tszMsg = StrNormNewline((wchar_t *)ack->lParam);
@@ -143,7 +143,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP if (len) {
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
- if (hglbCopy == NULL) {
+ if (hglbCopy == nullptr) {
CloseClipboard();
break;
}
@@ -183,7 +183,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) SetForegroundWindow(hwnd);
SetFocus(hwnd);
}
- else CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam);
+ else CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), nullptr, ReadAwayMsgDlgProc, wParam);
return 0;
}
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat->hContact = lParam;
dat->hSeq = (HANDLE)ProtoChainSend(dat->hContact, PSS_GETAWAYMSG, 0, 0);
- dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL;
+ dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : nullptr;
WindowList_Add(hWindowList2, hwndDlg, dat->hContact);
wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
wchar_t str[256], format[128];
@@ -225,7 +225,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP }
if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) {
UnhookEvent(dat->hAwayMsgEvent);
- dat->hAwayMsgEvent = NULL;
+ dat->hAwayMsgEvent = nullptr;
}
if (!OpenClipboard(hwndDlg)) {
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP if (len) {
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
- if (hglbCopy == NULL) {
+ if (hglbCopy == nullptr) {
CloseClipboard();
DestroyWindow(hwndDlg);
break;
@@ -288,21 +288,21 @@ static INT_PTR CopyAwayMsgCommand(WPARAM wParam, LPARAM) SetFocus(hwnd);
}
else
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COPY), NULL, CopyAwayMsgDlgProc, wParam);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COPY), nullptr, CopyAwayMsgDlgProc, wParam);
return 0;
}
static char *StrFindURL(char *pszStr)
{
- char *pszURL = NULL;
+ char *pszURL = nullptr;
- if (pszStr != NULL && *pszStr != '\0') {
+ if (pszStr != nullptr && *pszStr != '\0') {
pszURL = strstr(pszStr, "www.");
- if (pszURL == NULL)
+ if (pszURL == nullptr)
pszURL = strstr(pszStr, "http://");
- if (pszURL == NULL)
+ if (pszURL == nullptr)
pszURL = strstr(pszStr, "https://");
- if (pszURL == NULL)
+ if (pszURL == nullptr)
pszURL = strstr(pszStr, "ftp://");
}
@@ -314,7 +314,7 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM) ptrA szMsg(db_get_sa(wParam, "CList", "StatusMsg"));
char *szURL = StrFindURL(szMsg);
- if (szURL != NULL) {
+ if (szURL != nullptr) {
int i;
for (i = 0; szURL[i] != ' ' && szURL[i] != '\n' && szURL[i] != '\r' && szURL[i] != '\t' && szURL[i] != '\0'; i++);
@@ -336,7 +336,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) Menu_ShowItem(hAwayMsgMenuItem, false);
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || db_get_b(hContact, szProto, "ChatRoom", 0))
+ if (szProto == nullptr || db_get_b(hContact, szProto, "ChatRoom", 0))
return 0;
wchar_t str[128];
@@ -353,7 +353,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) mir_snwprintf(str, TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
Menu_ModifyItem(hCopyMsgMenuItem, str);
- if (StrFindURL(szMsg) != NULL) {
+ if (StrFindURL(szMsg) != nullptr) {
mir_snwprintf(str, TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
Menu_ModifyItem(hGoToURLMenuItem, str);
}
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 48b7a21ecd..f1fc07fed6 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -29,7 +29,7 @@ PROTOACCOUNTS *accounts; static int g_iIdleTime = -1;
UINT_PTR g_uUpdateMsgTimer = 0, *g_uSetStatusTimer;
static wchar_t *g_ptszWinampSong;
-HANDLE hTTBButton = 0, h_statusmodechange;
+HANDLE hTTBButton = nullptr, h_statusmodechange;
HWND hwndSAMsgDialog;
static HANDLE *hProtoStatusMenuItem;
@@ -66,14 +66,14 @@ void log2file(const char *fmt, ...) DWORD dwBytesWritten;
va_list va;
char szText[1024];
- HANDLE hFile = CreateFileA("simplestatusmsg.log", GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- SetFilePointer(hFile, 0, 0, FILE_END);
+ HANDLE hFile = CreateFileA("simplestatusmsg.log", GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ SetFilePointer(hFile, 0, nullptr, FILE_END);
strncpy(szText, "[\0", _countof(szText));
- WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
+ WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, nullptr);
- GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, szText, _countof(szText));
- WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
+ GetTimeFormatA(LOCALE_USER_DEFAULT, 0, nullptr, nullptr, szText, _countof(szText));
+ WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, nullptr);
strncpy(szText, "] \0", _countof(szText));
@@ -81,10 +81,10 @@ void log2file(const char *fmt, ...) mir_vsnprintf(szText + mir_strlen(szText), _countof(szText) - mir_strlen(szText), fmt, va);
va_end(va);
- WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
+ WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, nullptr);
strncpy(szText, "\n\0", _countof(szText));
- WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
+ WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, nullptr);
CloseHandle(hFile);
}
@@ -92,51 +92,51 @@ void log2file(const char *fmt, ...) static wchar_t *GetWinampSong(void)
{
- wchar_t *szTitle, *pstr, *res = NULL;
- HWND hwndWinamp = FindWindow(L"STUDIO", NULL);
+ wchar_t *szTitle, *pstr, *res = nullptr;
+ HWND hwndWinamp = FindWindow(L"STUDIO", nullptr);
int iTitleLen;
- if (hwndWinamp == NULL)
- hwndWinamp = FindWindow(L"Winamp v1.x", NULL);
+ if (hwndWinamp == nullptr)
+ hwndWinamp = FindWindow(L"Winamp v1.x", nullptr);
- if (hwndWinamp == NULL)
- return NULL;
+ if (hwndWinamp == nullptr)
+ return nullptr;
iTitleLen = GetWindowTextLength(hwndWinamp);
szTitle = (wchar_t *)mir_alloc((iTitleLen + 1) * sizeof(wchar_t));
- if (szTitle == NULL)
- return NULL;
+ if (szTitle == nullptr)
+ return nullptr;
if (GetWindowText(hwndWinamp, szTitle, iTitleLen + 1) == 0)
{
mir_free(szTitle);
- return NULL;
+ return nullptr;
}
pstr = wcsstr(szTitle, L" - Winamp");
- if (pstr == NULL)
+ if (pstr == nullptr)
{
mir_free(szTitle);
- return NULL;
+ return nullptr;
}
if (pstr < szTitle + (iTitleLen / 2))
{
memmove(szTitle, pstr + 9, mir_wstrlen(pstr + 9) * sizeof(wchar_t));
pstr = wcsstr(pstr + 1, L" - Winamp");
- if (pstr == NULL)
+ if (pstr == nullptr)
{
mir_free(szTitle);
- return NULL;
+ return nullptr;
}
}
*pstr = 0;
pstr = wcschr(szTitle, '.');
- if (pstr == NULL)
+ if (pstr == nullptr)
{
mir_free(szTitle);
- return NULL;
+ return nullptr;
}
pstr += 2;
@@ -181,7 +181,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) {
wchar_t *ptszWinampTitle = GetWinampSong();
- if (ptszWinampTitle != NULL)
+ if (ptszWinampTitle != nullptr)
{
mir_free(g_ptszWinampSong);
g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
@@ -225,9 +225,9 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) }
t.wMinute = mm % 60;
t.wHour = mm / 60;
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &t, NULL, substituteStr, _countof(substituteStr));
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &t, nullptr, substituteStr, _countof(substituteStr));
}
- else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, _countof(substituteStr));
+ else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, nullptr, nullptr, substituteStr, _countof(substituteStr));
if (mir_wstrlen(substituteStr) > 6)
msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
@@ -237,7 +237,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) }
else if (!wcsnicmp(msg + i, L"%date%", 6))
{
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, substituteStr, _countof(substituteStr));
if (mir_wstrlen(substituteStr) > 6)
msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
@@ -253,7 +253,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) temp = mir_wstrdup(msg + i + 6);
token = wcstok(temp, L",)");
ran_from = _wtoi(token);
- token = wcstok(NULL, L",)%%");
+ token = wcstok(nullptr, L",)%%");
ran_to = _wtoi(token);
if (ran_to > ran_from)
@@ -290,7 +290,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) mir_snprintf(buff, "SMsg%d", k);
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", buff);
- if (tszStatusMsg == NULL)
+ if (tszStatusMsg == nullptr)
continue;
mir_wstrcpy(substituteStr, tszStatusMsg);
@@ -299,7 +299,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (!mir_wstrlen(substituteStr))
continue;
- if (wcsstr(substituteStr, L"%randmsg%") != NULL || wcsstr(substituteStr, L"%randdefmsg%") != NULL)
+ if (wcsstr(substituteStr, L"%randmsg%") != nullptr || wcsstr(substituteStr, L"%randdefmsg%") != nullptr)
{
if (k == maxk) maxk--;
}
@@ -335,7 +335,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) mir_snprintf(buff, "DefMsg%d", k);
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", buff);
- if (tszStatusMsg == NULL)
+ if (tszStatusMsg == nullptr)
continue;
mir_wstrcpy(substituteStr, tszStatusMsg);
@@ -344,7 +344,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (!mir_wstrlen(substituteStr))
continue;
- if (wcsstr(substituteStr, L"%randmsg%") != NULL || wcsstr(substituteStr, L"%randdefmsg%") != NULL)
+ if (wcsstr(substituteStr, L"%randmsg%") != nullptr || wcsstr(substituteStr, L"%randdefmsg%") != nullptr)
{
if (k == maxk) maxk--;
}
@@ -382,8 +382,8 @@ wchar_t *InsertVarsIntoMsg(wchar_t *tszMsg, const char *szProto, int iStatus, MC {
if (ServiceExists(MS_VARS_FORMATSTRING) && db_get_b(NULL, "SimpleStatusMsg", "EnableVariables", 1))
{
- wchar_t *tszVarsMsg = variables_parse(tszMsg, NULL, hContact);
- if (tszVarsMsg != NULL)
+ wchar_t *tszVarsMsg = variables_parse(tszMsg, nullptr, hContact);
+ if (tszVarsMsg != nullptr)
{
wchar_t *format = InsertBuiltinVarsIntoMsg(tszVarsMsg, szProto, iStatus);
mir_free(tszVarsMsg);
@@ -423,8 +423,8 @@ static wchar_t *GetAwayMessageFormat(int iStatus, const char *szProto) mir_snprintf(szSetting, "LastMsg");
char *szLastMsg = db_get_sa(NULL, "SimpleStatusMsg", szSetting);
- if (szLastMsg == NULL)
- return NULL; //mir_wstrdup(L"");
+ if (szLastMsg == nullptr)
+ return nullptr; //mir_wstrdup(L"");
format = db_get_wsa(NULL, "SimpleStatusMsg", szLastMsg);
mir_free(szLastMsg);
@@ -437,7 +437,7 @@ static wchar_t *GetAwayMessageFormat(int iStatus, const char *szProto) mir_snprintf(szSetting, "Default");
format = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting));
- if (format == NULL)
+ if (format == nullptr)
format = mir_wstrdup(L"");
}
else
@@ -520,7 +520,7 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar iStatus = GetCurrentStatus(szProto);
if (szProto && !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)))
- return NULL;
+ return nullptr;
mir_snprintf(szSetting, "Proto%sFlags", szProto ? szProto : "");
int flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
@@ -534,7 +534,7 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar {
mir_snprintf(szSetting, "Proto%sDefault", szProto);
format = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
- if (format == NULL)
+ if (format == nullptr)
format = mir_wstrdup(L"");
}
else if (flags & PROTO_NOCHANGE && szProto)
@@ -545,13 +545,13 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar else if (flags & PROTO_POPUPDLG)
format = GetAwayMessageFormat(iStatus, szProto);
else
- format = NULL;
+ format = nullptr;
}
#ifdef _DEBUG
log2file("GetAwayMessage(): %s has %s status and \"%S\" status message.", szProto, StatusModeToDbSetting(iStatus, ""), format);
#endif
- if (bInsertVars && format != NULL)
+ if (bInsertVars && format != nullptr)
{
wchar_t *tszVarsMsg = InsertVarsIntoMsg(format, szProto, iStatus, hContact); // TODO random values not the same!
mir_free(format);
@@ -601,7 +601,7 @@ static void Proto_SetStatus(const char *szProto, int iInitialStatus, int iStatus CallProtoService(szProto, PS_SETSTATUS, (WPARAM)iMsgStatus, 0);
}
if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE))
- announce_status_change((char*)szProto, ID_STATUS_OFFLINE, NULL);
+ announce_status_change((char*)szProto, ID_STATUS_OFFLINE, nullptr);
CallProtoService(szProto, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
return;
}
@@ -619,16 +619,16 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus if (flags & PROTO_NO_MSG)
{
- Proto_SetStatus(szProto, iInitialStatus, iStatus, NULL);
- SaveMessageToDB(szProto, NULL, TRUE);
- SaveMessageToDB(szProto, NULL, FALSE);
+ Proto_SetStatus(szProto, iInitialStatus, iStatus, nullptr);
+ SaveMessageToDB(szProto, nullptr, TRUE);
+ SaveMessageToDB(szProto, nullptr, FALSE);
return 1;
}
else if (flags & PROTO_THIS_MSG)
{
mir_snprintf(szSetting, "Proto%sDefault", szProto);
wchar_t *szSimpleStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
- if (szSimpleStatusMsg != NULL)
+ if (szSimpleStatusMsg != nullptr)
{
SaveMessageToDB(szProto, szSimpleStatusMsg, TRUE);
wchar_t *msg = InsertVarsIntoMsg(szSimpleStatusMsg, szProto, iStatus, NULL);
@@ -679,7 +679,7 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam) if ((Proto_Status2Flag(newStatus) & status_modes_msg) || (newStatus == ID_STATUS_OFFLINE && (Proto_Status2Flag(ID_STATUS_INVISIBLE) & status_modes_msg)))
{
- wchar_t *msg = NULL;
+ wchar_t *msg = nullptr;
if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, GetCurrentStatus(accounts->pa[i]->szModuleName), newStatus))
continue;
@@ -703,7 +703,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam); void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wchar_t *message, BOOL bOnStartup)
{
- wchar_t *msg = NULL;
+ wchar_t *msg = nullptr;
#ifdef _DEBUG
log2file("SetStatusMessage(\"%s\", %d, %d, \"%S\", %d)", szProto, iInitialStatus, iStatus, message, bOnStartup);
#endif
@@ -807,7 +807,7 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wcha mir_free(msg);
}
- if (GetCurrentStatus(NULL) != iStatus && !bIsStatusCurrent && !iProfileStatus)
+ if (GetCurrentStatus(nullptr) != iStatus && !bIsStatusCurrent && !iProfileStatus)
{
// not so nice...
UnhookEvent(h_statusmodechange);
@@ -878,7 +878,7 @@ INT_PTR ShowStatusMessageDialogInternal(WPARAM, LPARAM lParam) }
if (!idvstatusmsg)
{
- box_data->m_szProto = NULL;
+ box_data->m_szProto = nullptr;
box_data->m_iStatusModes = accounts->statusFlags;
box_data->m_iStatusMsgModes = accounts->statusMsgFlags;
}
@@ -889,7 +889,7 @@ INT_PTR ShowStatusMessageDialogInternal(WPARAM, LPARAM lParam) if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), NULL, AwayMsgBoxDlgProc, (LPARAM)box_data);
+ hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), nullptr, AwayMsgBoxDlgProc, (LPARAM)box_data);
return 0;
}
@@ -928,7 +928,7 @@ INT_PTR ShowStatusMessageDialog(WPARAM, LPARAM lParam) }
if (!idvstatusmsg)
{
- box_data->m_szProto = NULL;
+ box_data->m_szProto = nullptr;
box_data->m_iStatusModes = accounts->statusFlags;
box_data->m_iStatusMsgModes = accounts->statusMsgFlags;
}
@@ -938,7 +938,7 @@ INT_PTR ShowStatusMessageDialog(WPARAM, LPARAM lParam) if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), NULL, AwayMsgBoxDlgProc, (LPARAM)box_data);
+ hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), nullptr, AwayMsgBoxDlgProc, (LPARAM)box_data);
return 0;
}
@@ -954,7 +954,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) // TODO this could be done better
BOOL bOnStartup = FALSE, bGlobalStartupStatus = TRUE;
if (szProto && !mir_strcmp(szProto, "SimpleStatusMsgGlobalStartupStatus")) {
- szProto = NULL;
+ szProto = nullptr;
bOnStartup = TRUE;
}
@@ -1050,7 +1050,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), NULL, AwayMsgBoxDlgProc, (LPARAM)box_data);
+ hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), nullptr, AwayMsgBoxDlgProc, (LPARAM)box_data);
}
else {
// iStatus == ID_STATUS_CURRENT only when bOnStartup == TRUE
@@ -1079,7 +1079,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) msg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
}
else
- msg = GetAwayMessageFormat(iStatus, NULL);
+ msg = GetAwayMessageFormat(iStatus, nullptr);
#ifdef _DEBUG
log2file("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, accounts->pa[i]->szModuleName);
#endif
@@ -1091,7 +1091,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) }
MsgBoxInitData *box_data = (MsgBoxInitData*)mir_alloc( sizeof(MsgBoxInitData));
- box_data->m_szProto = NULL;
+ box_data->m_szProto = nullptr;
box_data->m_iStatus = iStatus;
box_data->m_iStatusModes = accounts->statusFlags;
box_data->m_iStatusMsgModes = accounts->statusMsgFlags;
@@ -1100,7 +1100,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), NULL, AwayMsgBoxDlgProc, (LPARAM)box_data);
+ hwndSAMsgDialog = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AWAYMSGBOX), nullptr, AwayMsgBoxDlgProc, (LPARAM)box_data);
}
return 0;
}
@@ -1134,7 +1134,7 @@ static int ProcessProtoAck(WPARAM , LPARAM lParam) int SetStartupStatus(int i)
{
char szSetting[80];
- wchar_t *fmsg, *msg = NULL;
+ wchar_t *fmsg, *msg = nullptr;
int iStatus = GetStartupStatus(accounts->pa[i]->szModuleName);
if (iStatus == ID_STATUS_OFFLINE)
@@ -1154,7 +1154,7 @@ int SetStartupStatus(int i) if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, ID_STATUS_OFFLINE, iStatus))
return 0;
else
- fmsg = NULL;
+ fmsg = nullptr;
}
else if (flags & PROTO_NOCHANGE)
{
@@ -1253,7 +1253,7 @@ VOID CALLBACK SetStartupStatusProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) if (g_uSetStatusTimer[i] == idEvent)
{
- KillTimer(NULL, g_uSetStatusTimer[i]);
+ KillTimer(nullptr, g_uSetStatusTimer[i]);
found = true;
break;
}
@@ -1297,7 +1297,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_snprintf(szBuffer, "FCur%sMsg", accounts->pa[i]->szModuleName);
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szBuffer);
- if (tszStatusMsg == NULL)
+ if (tszStatusMsg == nullptr)
continue;
tszMsg = InsertVarsIntoMsg(tszStatusMsg, accounts->pa[i]->szModuleName, iCurrentStatus, NULL);
@@ -1330,7 +1330,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) static int AddTopToolbarButton(WPARAM, LPARAM)
{
- TTBButton tbb = { 0 };
+ TTBButton tbb = {};
tbb.hIconHandleUp = tbb.hIconHandleDn = GetIconHandle(IDI_CSMSG);
tbb.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
tbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
@@ -1492,14 +1492,14 @@ static int CSStatusChange(WPARAM wParam, LPARAM) PROTOCOLSETTINGEX **ps = *(PROTOCOLSETTINGEX***)wParam;
int status_mode, CSProtoCount;
char szSetting[80];
- wchar_t *msg = NULL;
+ wchar_t *msg = nullptr;
- if (ps == NULL) return -1;
+ if (ps == nullptr) return -1;
CSProtoCount = CallService(MS_CS_GETPROTOCOUNT, 0, 0);
for (int i = 0; i < CSProtoCount; ++i)
{
- if (ps[i]->m_szName == NULL || !*ps[i]->m_szName) continue;
+ if (ps[i]->m_szName == nullptr || !*ps[i]->m_szName) continue;
if (ps[i]->m_status == ID_STATUS_IDLE)
status_mode = ps[i]->m_lastStatus;
else if (ps[i]->m_status == ID_STATUS_CURRENT)
@@ -1527,7 +1527,7 @@ static int CSStatusChange(WPARAM wParam, LPARAM) {
mir_snprintf(buff, "SMsg%d", j);
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", buff);
- if (tszStatusMsg != NULL)
+ if (tszStatusMsg != nullptr)
{
if (!mir_wstrcmp(tszStatusMsg, szMsgW))
{
@@ -1567,12 +1567,12 @@ static int CSStatusChange(WPARAM wParam, LPARAM) static wchar_t *ParseWinampSong(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t *ptszWinampTitle = GetWinampSong();
- if (ptszWinampTitle != NULL) {
+ if (ptszWinampTitle != nullptr) {
mir_free(g_ptszWinampSong);
g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
@@ -1585,11 +1585,11 @@ static wchar_t *ParseWinampSong(ARGUMENTSINFO *ai) static wchar_t *ParseDate(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
wchar_t szStr[128] = {0};
ai->flags |= AIF_DONTPARSE;
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szStr, _countof(szStr));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, szStr, _countof(szStr));
return mir_wstrdup(szStr);
}
@@ -1715,11 +1715,11 @@ static int OnModulesLoaded(WPARAM, LPARAM) }
g_ptszWinampSong = db_get_wsa(NULL, "SimpleStatusMsg", "AmpLastTitle");
- if (g_ptszWinampSong == NULL)
+ if (g_ptszWinampSong == nullptr)
g_ptszWinampSong = mir_wstrdup(L"SimpleStatusMsg");
if (db_get_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1))
- g_uUpdateMsgTimer = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
+ g_uUpdateMsgTimer = SetTimer(nullptr, 0, db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
if (ServiceExists(MS_CS_SETSTATUSEX))
HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange);
@@ -1729,7 +1729,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) if (!ServiceExists(MS_SS_GETPROFILECOUNT)) {
if (db_get_b(NULL, "SimpleStatusMsg", "GlobalStatusDelay", 1))
- SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "SetStatusDelay", 300), SetStartupStatusGlobal);
+ SetTimer(nullptr, 0, db_get_w(NULL, "SimpleStatusMsg", "SetStatusDelay", 300), SetStartupStatusGlobal);
else {
g_uSetStatusTimer = (UINT_PTR *)mir_alloc(sizeof(UINT_PTR) * accounts->count);
for (int i = 0; i < accounts->count; ++i) {
@@ -1741,7 +1741,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) char szSetting[80];
mir_snprintf(szSetting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
- g_uSetStatusTimer[i] = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), SetStartupStatusProc);
+ g_uSetStatusTimer[i] = SetTimer(nullptr, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), SetStartupStatusProc);
}
}
}
@@ -1782,7 +1782,7 @@ static int OnPreShutdown(WPARAM, LPARAM) if (hProtoStatusMenuItem) mir_free(hProtoStatusMenuItem);
if (g_uSetStatusTimer) mir_free(g_uSetStatusTimer);
if (g_ptszWinampSong) mir_free(g_ptszWinampSong);
- if (g_uUpdateMsgTimer) KillTimer(NULL, g_uUpdateMsgTimer);
+ if (g_uUpdateMsgTimer) KillTimer(nullptr, g_uUpdateMsgTimer);
return 0;
}
@@ -1798,7 +1798,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- hwndSAMsgDialog = NULL;
+ hwndSAMsgDialog = nullptr;
accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS));
db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index debf97e35b..d35a8eb527 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -102,11 +102,11 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) wchar_t *status_desc; if (!(data->m_iDlgFlags & DLG_SHOW_STATUS)) - return NULL; + return nullptr; - HWND handle = CreateWindowEx(0, WC_COMBOBOXEX, NULL, + HWND handle = CreateWindowEx(0, WC_COMBOBOXEX, nullptr, WS_TABSTOP | CBS_NOINTEGRALHEIGHT | WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST, - 0, 0, 0, 240, hwndDlg, NULL, g_hInst, NULL); + 0, 0, 0, 240, hwndDlg, nullptr, g_hInst, nullptr); COMBOBOXEXITEM cbei = {0}; if (!(data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS)) @@ -177,7 +177,7 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) cbei.iItem = j; cbei.pszText = (LPTSTR)tszProfileName; if (data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS) { - int k = GetCurrentStatus(NULL) - ID_STATUS_OFFLINE; + int k = GetCurrentStatus(nullptr) - ID_STATUS_OFFLINE; if (k < 0 || k > 9) k = 0; // valid status modes only cbei.iImage = statusicon_nr[k]; @@ -199,7 +199,7 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) SendMessage(handle, CB_SETITEMHEIGHT, 0, (LPARAM)18); SendMessage(handle, CBEM_SETIMAGELIST, 0, (LPARAM)data->status_icons); } - SetWindowPos(handle, NULL, 11, 11, 112, 20, SWP_NOACTIVATE); + SetWindowPos(handle, nullptr, 11, 11, 112, 20, SWP_NOACTIVATE); SendMessage(handle, CB_SETCURSEL, (WPARAM)cur_sel, 0); SendMessage(handle, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)16); @@ -219,9 +219,9 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) BOOL found = FALSE; wchar_t text[128]; - HWND handle = CreateWindowEx(0, WC_COMBOBOXEX, NULL, + HWND handle = CreateWindowEx(0, WC_COMBOBOXEX, nullptr, WS_TABSTOP | CBS_NOINTEGRALHEIGHT | WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST, - 0, 0, 0, 300, hwndDlg, NULL, g_hInst, NULL); + 0, 0, 0, 300, hwndDlg, nullptr, g_hInst, nullptr); COMBOBOXEXITEM cbei = {0}; if (!(data->m_iDlgFlags & DLG_SHOW_LIST_ICONS)) @@ -239,7 +239,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) j--; wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", buff); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { found = TRUE; cbei.iItem = -1; @@ -333,7 +333,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) // predefined messages mir_snprintf(buff, "DefMsg%d", i); wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", buff); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { cbei.iItem = -1; cbei.pszText = tszStatusMsg; @@ -370,11 +370,11 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) SendMessage(handle, CBEM_SETIMAGELIST, 0, (LPARAM)data->other_icons); if (!(data->m_iDlgFlags & DLG_SHOW_STATUS)) { - SetWindowPos(handle, NULL, 11, 11, 290, 20, SWP_NOACTIVATE); + SetWindowPos(handle, nullptr, 11, 11, 290, 20, SWP_NOACTIVATE); SendMessage(handle, CB_SETDROPPEDWIDTH, (WPARAM)290, 0); } else { - SetWindowPos(handle, NULL, 127, 11, 174, 20, SWP_NOACTIVATE); + SetWindowPos(handle, nullptr, 127, 11, 174, 20, SWP_NOACTIVATE); SendMessage(handle, CB_SETDROPPEDWIDTH, (WPARAM)250, 0); } SendMessage(handle, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)16); @@ -392,7 +392,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) { HMENU hmenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_EDITMENU)); - if (hmenu == NULL) + if (hmenu == nullptr) return; HMENU hmenuTrackPopup = GetSubMenu(hmenu, 0); @@ -401,7 +401,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) ClientToScreen(hwnd, (LPPOINT)&pt); - LPDWORD sel_s = NULL, sel_e = NULL; + LPDWORD sel_s = nullptr, sel_e = nullptr; SendMessage(edit_control, EM_GETSEL, (WPARAM)&sel_s, (LPARAM)&sel_e); if (sel_s == sel_e) { EnableMenuItem(hmenuTrackPopup, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); @@ -417,7 +417,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) DeleteMenu(hmenuTrackPopup, 7, MF_BYPOSITION); - int m_selection = TrackPopupMenu(hmenuTrackPopup, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + int m_selection = TrackPopupMenu(hmenuTrackPopup, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); switch (m_selection) { case IDM_COPY: SendMessage(edit_control, WM_COPY, 0, 0); @@ -454,8 +454,8 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) vhi.cbSize = sizeof(vhi); vhi.flags = VHF_FULLDLG | VHF_SETLASTSUBJECT; vhi.hwndCtrl = edit_control; - vhi.szSubjectDesc = NULL; - vhi.szExtraTextDesc = NULL; + vhi.szSubjectDesc = nullptr; + vhi.szExtraTextDesc = nullptr; CallService(MS_VARS_SHOWHELPEX, (WPARAM)hwnd, (LPARAM)&vhi); } break; @@ -472,7 +472,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) if (len) { LPTSTR lptstrCopy; HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t)); - if (hglbCopy == NULL) { + if (hglbCopy == nullptr) { CloseClipboard(); break; } @@ -551,7 +551,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_LBUTTONDBLCLK: { MsgEditCtrl *mec = (MsgEditCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (mec != NULL) { + if (mec != nullptr) { mec->ctLastDblClk = clock(); mec->uClocksPerDblClk = GetDoubleClickTime() * CLOCKS_PER_SEC / 1000; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)mec); @@ -562,7 +562,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_LBUTTONDOWN: { MsgEditCtrl *mec = (MsgEditCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (mec != NULL && UINT(clock() - mec->ctLastDblClk) < mec->uClocksPerDblClk) { + if (mec != nullptr && UINT(clock() - mec->ctLastDblClk) < mec->uClocksPerDblClk) { SendMessage(hwndDlg, EM_SETSEL, 0, -1); return 0; } @@ -580,7 +580,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L { MsgEditCtrl *mec = (MsgEditCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); mir_free(mec); - mec = NULL; + mec = nullptr; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)mec); break; } @@ -714,10 +714,10 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) mir_snprintf(setting, "LastMsg"); char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting); - if (szSetting != NULL) { + if (szSetting != nullptr) { if (*szSetting != '\0') { wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg); fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)tszStatusMsg); @@ -746,7 +746,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) mir_snprintf(setting, "Default"); wchar_t *tszStatusMsg = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting)); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg); fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)tszStatusMsg); if (fcursel != CB_ERR) @@ -761,7 +761,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) mir_snprintf(setting, "Msg"); wchar_t *tszStatusMsg = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting)); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg); fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)tszStatusMsg); if (fcursel != CB_ERR) @@ -802,7 +802,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) if (iStatus == ID_STATUS_CURRENT) iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(msgbox_data->m_szProto) : GetCurrentStatus(msgbox_data->m_szProto); else if (iStatus > ID_STATUS_CURRENT) - iStatus = GetCurrentStatus(NULL); + iStatus = GetCurrentStatus(nullptr); Window_FreeIcon_IcoLib(hwndDlg); Window_SetProtoIcon_IcoLib(hwndDlg, msgbox_data->m_szProto, iStatus); @@ -974,8 +974,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } } else { - SetWindowPos(GetDlgItem(hwndDlg, IDC_OK), NULL, 52, 115, 0, 0, SWP_NOSIZE | SWP_NOZORDER); - SetWindowPos(GetDlgItem(hwndDlg, IDC_CANCEL), NULL, 160, 115, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(GetDlgItem(hwndDlg, IDC_OK), nullptr, 52, 115, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(GetDlgItem(hwndDlg, IDC_CANCEL), nullptr, 160, 115, 0, 0, SWP_NOSIZE | SWP_NOZORDER); ShowWindow(GetDlgItem(hwndDlg, IDC_BADD), FALSE); ShowWindow(GetDlgItem(hwndDlg, IDC_BDEL), FALSE); ShowWindow(GetDlgItem(hwndDlg, IDC_BCLEAR), FALSE); @@ -987,7 +987,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA copy_init_data->m_iStatus = GetStartupStatus(copy_init_data->m_szProto); else copy_init_data->m_iStatus = GetCurrentStatus(copy_init_data->m_szProto); - if (copy_init_data->m_szProto == NULL) + if (copy_init_data->m_szProto == nullptr) bCurrentStatus = TRUE; } @@ -1049,7 +1049,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (db_get_b(NULL, "SimpleStatusMsg", "AutoClose", 1) && init_data->m_bOnEvent) { copy_init_data->m_iCountdown = db_get_b(NULL, "SimpleStatusMsg", "DlgTime", 5); SendMessage(hwndDlg, WM_TIMER, 0, 0); - SetTimer(hwndDlg, 1, 1000, 0); + SetTimer(hwndDlg, 1, 1000, nullptr); } else { copy_init_data->m_iCountdown = -2; @@ -1113,12 +1113,12 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (msgbox_data->m_iStatus == ID_STATUS_CURRENT) { msgbox_data->m_iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(msgbox_data->m_szProto) : GetCurrentStatus(msgbox_data->m_szProto); - if (msgbox_data->m_szProto == NULL) + if (msgbox_data->m_szProto == nullptr) bCurrentStatus = TRUE; } else if (msgbox_data->m_iStatus >= ID_STATUS_CURRENT) { iProfileStatus = msgbox_data->m_iStatus; - msgbox_data->m_iStatus = GetCurrentStatus(NULL); + msgbox_data->m_iStatus = GetCurrentStatus(nullptr); } if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1))) @@ -1160,11 +1160,11 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } if (bCurrentStatus) - SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, ID_STATUS_CURRENT, 0, msgbox_data->m_bOnStartup); + SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, ID_STATUS_CURRENT, nullptr, msgbox_data->m_bOnStartup); else if (iProfileStatus != 0) - SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, iProfileStatus, 0, FALSE); + SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, iProfileStatus, nullptr, FALSE); else - SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, msgbox_data->m_iStatus, 0, msgbox_data->m_bOnStartup); + SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, msgbox_data->m_iStatus, nullptr, msgbox_data->m_bOnStartup); } else { char buff[64], buff2[80]; @@ -1173,7 +1173,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA for (int i = 1; i <= msgbox_data->max_hist_msgs; i++) { mir_snprintf(buff, "SMsg%d", i); wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", buff); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { if (!mir_wstrcmp(tszStatusMsg, tszMsg)) { found = true; if (msgbox_data->m_szProto) { @@ -1363,7 +1363,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } } else if (LOWORD(cbitem.lParam) == CLEAR_HISTORY) { - if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES) + if (MessageBox(nullptr, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES) ClearHistory(msgbox_data, cur_sel); else if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1))) { wchar_t msg[1024]; @@ -1469,7 +1469,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_BCLEAR)) { switch (HIWORD(wParam)) { case BN_CLICKED: - if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES) + if (MessageBox(nullptr, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES) { ClearHistory(msgbox_data, 0); @@ -1571,7 +1571,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break; case WM_DESTROY: - if (msgbox_data == NULL) + if (msgbox_data == nullptr) break; { WINDOWPLACEMENT wp; @@ -1616,7 +1616,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA ReleaseIconEx("clear"); Window_FreeIcon_IcoLib(hwndDlg); - hwndSAMsgDialog = NULL; + hwndSAMsgDialog = nullptr; mir_free(msgbox_data); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); break; diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index fb3c1d931e..5c6f80052b 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -180,7 +180,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (index != CB_ERR && index != CB_ERRSPACE)
{
- data->proto_msg[0].msg = NULL;
+ data->proto_msg[0].msg = nullptr;
val = db_get_b(NULL, "SimpleStatusMsg", "ProtoFlags", PROTO_DEFAULT);
data->proto_msg[0].flags = val;
@@ -194,7 +194,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l || !CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)
|| !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
- data->proto_msg[i+1].msg = NULL;
+ data->proto_msg[i+1].msg = nullptr;
continue;
}
@@ -232,8 +232,8 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (ServiceExists(MS_VARS_FORMATSTRING))
{
- HICON hIcon=NULL;
- char *szTipInfo=NULL;
+ HICON hIcon=nullptr;
+ char *szTipInfo=nullptr;
if (ServiceExists(MS_VARS_GETSKINITEM))
{
@@ -241,12 +241,12 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l szTipInfo = (char *)CallService(MS_VARS_GETSKINITEM, 0, VSI_HELPTIPTEXT);
}
- if (hIcon != NULL)
+ if (hIcon != nullptr)
SendDlgItemMessage(hwndDlg, IDC_VARSHELP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
else
SetDlgItemText(hwndDlg, IDC_VARSHELP, L"V");
- if (szTipInfo == NULL)
+ if (szTipInfo == nullptr)
SendDlgItemMessage(hwndDlg, IDC_VARSHELP, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open string formatting help"), 0);
else
SendDlgItemMessage(hwndDlg, IDC_VARSHELP, BUTTONADDTOOLTIP, (WPARAM)szTipInfo, 0);
@@ -600,7 +600,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
- if (szSetting != NULL)
+ if (szSetting != nullptr)
{
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg)
@@ -640,7 +640,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "Msg");
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
- if (tszStatusMsg != NULL)
+ if (tszStatusMsg != nullptr)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
mir_free(tszStatusMsg);
@@ -695,7 +695,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
- if (szSetting != NULL)
+ if (szSetting != nullptr)
{
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg)
@@ -727,7 +727,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "Msg");
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
- if (tszStatusMsg != NULL)
+ if (tszStatusMsg != nullptr)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
mir_free(tszStatusMsg);
@@ -805,7 +805,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
- if (szSetting != NULL)
+ if (szSetting != nullptr)
{
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg)
@@ -838,7 +838,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "Msg");
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting));
- if (tszStatusMsg != NULL)
+ if (tszStatusMsg != nullptr)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
mir_free(tszStatusMsg);
@@ -869,7 +869,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, _countof(msg));
if (len > 0)
{
- if (data->proto_msg[j].msg == NULL)
+ if (data->proto_msg[j].msg == nullptr)
data->proto_msg[j].msg = mir_wstrdup(msg);
else
{
@@ -879,10 +879,10 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
else
{
- if (data->proto_msg[j].msg != NULL)
+ if (data->proto_msg[j].msg != nullptr)
{
mir_free(data->proto_msg[j].msg);
- data->proto_msg[j].msg = NULL;
+ data->proto_msg[j].msg = nullptr;
}
}
}
@@ -896,7 +896,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
case IDC_VARSHELP:
- variables_showhelp(hwndDlg, IDC_OPTEDIT1, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
+ variables_showhelp(hwndDlg, IDC_OPTEDIT1, VHF_FULLDLG|VHF_SETLASTSUBJECT, nullptr, nullptr);
break;
case IDC_BOPTPROTO:
@@ -932,7 +932,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l size_t len = mir_wstrlen(data->proto_msg[j].msg);
if (len > 0)
{
- if (data->proto_msg[k+1].msg == NULL)
+ if (data->proto_msg[k+1].msg == nullptr)
data->proto_msg[k+1].msg = mir_wstrdup(data->proto_msg[j].msg);
else
{
@@ -942,10 +942,10 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
else
{
- if (data->proto_msg[k+1].msg != NULL)
+ if (data->proto_msg[k+1].msg != nullptr)
{
mir_free(data->proto_msg[k+1].msg);
- data->proto_msg[k+1].msg = NULL;
+ data->proto_msg[k+1].msg = nullptr;
}
}
}
@@ -1122,7 +1122,7 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM case IDC_ESECUPDTMSG:
{
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_ESECUPDTMSG, NULL, FALSE);
+ int val = GetDlgItemInt(hwndDlg, IDC_ESECUPDTMSG, nullptr, FALSE);
if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG)))
SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)1, 0));
break;
@@ -1143,7 +1143,7 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
{
if (g_uUpdateMsgTimer)
- KillTimer(NULL, g_uUpdateMsgTimer);
+ KillTimer(nullptr, g_uUpdateMsgTimer);
int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
db_set_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
@@ -1151,7 +1151,7 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val)
{
db_set_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
- g_uUpdateMsgTimer = SetTimer(NULL, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
+ g_uUpdateMsgTimer = SetTimer(nullptr, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
}
else
{
@@ -1182,7 +1182,7 @@ static bool IsHistoryMsgsFound(HWND, int histMax) j = histMax;
mir_snprintf(szSetting, "SMsg%d", j);
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
- if (tszStatusMsg != NULL) {
+ if (tszStatusMsg != nullptr) {
if (*tszStatusMsg != '\0') {
mir_free(tszStatusMsg);
return true;
@@ -1296,7 +1296,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w {
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE)
return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE);
+ int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, nullptr, FALSE);
if (val > 25)
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETPOS, 0, MAKELONG((short)25, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), val != 0);
@@ -1311,7 +1311,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w {
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE)
return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE);
+ int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE);
if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ETIMEOUT)))
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)1, 0));
else if (val > 60)
@@ -1320,7 +1320,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w }
case IDC_BOPTHIST:
- if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
+ if (MessageBox(nullptr, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
{
if (hwndSAMsgDialog)
@@ -1355,7 +1355,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w return 0;
case IDC_BOPTDEF:
- if (MessageBox(NULL, TranslateT("Are you sure you want to clear predefined status messages?"), TranslateT("Confirm clearing predefined"), MB_ICONQUESTION | MB_YESNO) == IDYES)
+ if (MessageBox(nullptr, TranslateT("Are you sure you want to clear predefined status messages?"), TranslateT("Confirm clearing predefined"), MB_ICONQUESTION | MB_YESNO) == IDYES)
{
if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
@@ -1395,9 +1395,9 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w db_set_b(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
// Misc.
- db_set_b(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
+ db_set_b(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, nullptr, FALSE));
db_set_b(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
- db_set_b(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
+ db_set_b(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE));
db_set_b(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
db_set_b(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
db_set_b(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index f0bbf520b5..5bca49336f 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -52,7 +52,7 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(const char *name)
@@ -104,7 +104,7 @@ const wchar_t *GetDefaultMessage(int status) case ID_STATUS_OUTTOLUNCH: return TranslateT("Mmm... food.");
case ID_STATUS_IDLE: return TranslateT("idleeeeeeee");
}
- return NULL;
+ return nullptr;
}
const char *StatusModeToDbSetting(int status, const char *suffix)
@@ -124,7 +124,7 @@ const char *StatusModeToDbSetting(int status, const char *suffix) case ID_STATUS_ONTHEPHONE: prefix = "Otp"; break;
case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
case ID_STATUS_IDLE: prefix = "Idl"; break;
- default: return NULL;
+ default: return nullptr;
}
mir_snprintf(str, "%s%s", prefix, suffix);
return str;
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp index 1b9c1d8e11..c6a233ed39 100644 --- a/plugins/SkypeStatusChange/src/main.cpp +++ b/plugins/SkypeStatusChange/src/main.cpp @@ -22,14 +22,14 @@ PLUGININFOEX g_pluginInfo = { 0x2925520b, 0x6677, 0x4658, { 0x8b, 0xad, 0x56, 0x61, 0xd1, 0x3e, 0x46, 0x92 } }
};
-HINSTANCE g_hModule = NULL;
+HINSTANCE g_hModule = nullptr;
UINT g_MsgIDSkypeControlAPIAttach = 0;
UINT g_MsgIDSkypeControlAPIDiscover = 0;
-HWND g_wndMainWindow = NULL;
+HWND g_wndMainWindow = nullptr;
-HANDLE g_hThread = NULL;
-HANDLE g_hEventShutdown = NULL;
+HANDLE g_hThread = nullptr;
+HANDLE g_hEventShutdown = nullptr;
bool g_bMirandaIsShutdown = false;
@@ -116,7 +116,7 @@ int SSC_OnProtocolAck(WPARAM, LPARAM lParam) if (0 == ::PostMessage(HWND_BROADCAST, g_MsgIDSkypeControlAPIDiscover, (WPARAM)g_wndMainWindow, 0)) {
mir_cslock guard(g_csStatusInfo);
g_CurrStatusInfo.StatusIndex(INVALID_INDEX);
- g_CurrStatusInfo.Module(NULL);
+ g_CurrStatusInfo.Module(nullptr);
}
else g_Options.SetPreviousStatus(pAckData->szModule, nStatus);
}
@@ -154,7 +154,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) switch (msg) {
case WM_DESTROY:
- g_wndMainWindow = NULL;
+ g_wndMainWindow = nullptr;
break;
case WM_COPYDATA:
@@ -187,11 +187,11 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) oCopyData.cbData = cLength + 1;
SendMessage(wndSkypeAPIWindow, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&oCopyData);
if (g_Options.GetSyncStatusMsgFlag()) {
- wchar_t* pszStatusMsg = NULL;
+ wchar_t* pszStatusMsg = nullptr;
if (ProtoServiceExists(si.Module(), PS_GETMYAWAYMSG))
pszStatusMsg = reinterpret_cast<wchar_t*>(CallProtoService(si.Module(), PS_GETMYAWAYMSG, (WPARAM)ms.m_nMirandaStatus, SGMA_UNICODE));
- if ((NULL == pszStatusMsg) || (CALLSERVICE_NOTFOUND == INT_PTR(pszStatusMsg)))
+ if ((nullptr == pszStatusMsg) || (CALLSERVICE_NOTFOUND == INT_PTR(pszStatusMsg)))
pszStatusMsg = reinterpret_cast<wchar_t*>(CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM)ms.m_nMirandaStatus, 0));
if (pszStatusMsg && reinterpret_cast<LPARAM>(pszStatusMsg) != CALLSERVICE_NOTFOUND) {
@@ -251,7 +251,7 @@ int SSC_OnPreShutdown(WPARAM/* wParam*/, LPARAM/* lParam*/) if (g_wndMainWindow) {
b = DestroyWindow(g_wndMainWindow);
assert(b && "DestoryWindow");
- g_wndMainWindow = NULL;
+ g_wndMainWindow = nullptr;
}
UnregisterClass(g_pszSkypeWndClassName, g_hModule);
@@ -292,14 +292,14 @@ extern "C" int __declspec(dllexport) Load() g_wndMainWindow = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
g_pszSkypeWndClassName, L"", WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, g_hModule, 0);
- if (g_wndMainWindow == NULL)
+ CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, nullptr, nullptr, g_hModule, nullptr);
+ if (g_wndMainWindow == nullptr)
return 1;
g_bMirandaIsShutdown = false;
- g_hEventShutdown = ::CreateEvent(NULL, TRUE, FALSE, NULL);
+ g_hEventShutdown = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
- g_hThread = mir_forkthread(ThreadFunc, NULL);
+ g_hThread = mir_forkthread(ThreadFunc, nullptr);
HookEvent(ME_PROTO_ACK, SSC_OnProtocolAck);
HookEvent(ME_SYSTEM_PRESHUTDOWN, SSC_OnPreShutdown);
diff --git a/plugins/SkypeStatusChange/src/options.cpp b/plugins/SkypeStatusChange/src/options.cpp index df8fc16054..d2917833df 100644 --- a/plugins/SkypeStatusChange/src/options.cpp +++ b/plugins/SkypeStatusChange/src/options.cpp @@ -28,7 +28,7 @@ enum ETreeCheckBoxState HTREEITEM tree_insert_item(HWND hwndTree, wchar_t *pName, HTREEITEM htiParent, ETreeCheckBoxState nState, CTreeItemData *pData)
{
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = htiParent;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE;
@@ -129,7 +129,7 @@ const CTreeItemData* get_item_data(HWND hwndTreeCtrl,HTREEITEM hti) CTreeItemData* pData = reinterpret_cast<CTreeItemData*>(tvi.lParam);
return pData;
}
- return NULL;
+ return nullptr;
}
diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp index c0c41f39c6..78bf8dba2b 100644 --- a/plugins/SmileyAdd/src/AniSmileyObject.cpp +++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp @@ -60,7 +60,7 @@ public: void LoadSmiley()
{
- if (m_img != NULL) return;
+ if (m_img != nullptr) return;
m_img = m_sml->CreateCachedImage();
if (m_img && m_img->IsAnimated() && opt.AnimateDlg) {
@@ -76,15 +76,15 @@ public: m_bRegistered = false;
}
- if (m_img != NULL) {
+ if (m_img != nullptr) {
m_img->Release();
- m_img = NULL;
+ m_img = nullptr;
}
}
void GetDrawingProp()
{
- if (m_hwnd == NULL)
+ if (m_hwnd == nullptr)
return;
REOBJECT reObj = { 0 };
@@ -173,7 +173,7 @@ public: DoDirectDraw(hdc);
- SelectClipRgn(hdc, res < 1 ? NULL : hrgnOld);
+ SelectClipRgn(hdc, res < 1 ? nullptr : hrgnOld);
DeleteObject(hrgnOld);
}
else {
@@ -186,7 +186,7 @@ public: void DrawOnHPP()
{
- FVCNDATA_NMHDR nmh = { 0 };
+ FVCNDATA_NMHDR nmh = {};
nmh.code = NM_FIREVIEWCHANGE;
nmh.hwndFrom = m_hwnd;
@@ -263,7 +263,7 @@ public: if (m_visible) LoadSmiley();
else UnloadSmiley();
- if (lpRect == NULL) return;
+ if (lpRect == nullptr) return;
if (m_animtype == animStdOle) {
m_animtype = animDrctRichEd;
GetDrawingProp();
@@ -296,11 +296,11 @@ public: STDMETHOD(Draw)(DWORD dwAspect, LONG, void*, DVTARGETDEVICE*, HDC, HDC hdc, LPCRECTL pRectBounds, LPCRECTL, BOOL(__stdcall *)(ULONG_PTR), ULONG_PTR)
{
if (dwAspect != DVASPECT_CONTENT) return DV_E_DVASPECT;
- if (pRectBounds == NULL) return E_INVALIDARG;
+ if (pRectBounds == nullptr) return E_INVALIDARG;
LoadSmiley();
- if (m_img == NULL) return E_FAIL;
+ if (m_img == nullptr) return E_FAIL;
m_sizeExtent.cx = pRectBounds->right - pRectBounds->left;
m_sizeExtent.cy = pRectBounds->bottom - pRectBounds->top;
@@ -358,7 +358,7 @@ public: ISmileyBase* CreateAniSmileyObject(SmileyType *sml, COLORREF clr, bool ishpp)
{
if (!sml->IsValid())
- return NULL;
+ return nullptr;
return new CAniSmileyObject(sml, clr, ishpp);
}
diff --git a/plugins/SmileyAdd/src/SmileyBase.cpp b/plugins/SmileyAdd/src/SmileyBase.cpp index 2749923e6f..3ecc9e7a10 100644 --- a/plugins/SmileyAdd/src/SmileyBase.cpp +++ b/plugins/SmileyAdd/src/SmileyBase.cpp @@ -20,10 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static void HiMetricToPixel(const SIZEL *lpSizeInHiMetric, LPSIZEL lpSizeInPix)
{
- HDC hDCScreen = GetDC(NULL);
+ HDC hDCScreen = GetDC(nullptr);
const int nPixelsPerInchX = GetDeviceCaps(hDCScreen, LOGPIXELSX);
const int nPixelsPerInchY = GetDeviceCaps(hDCScreen, LOGPIXELSY);
- ReleaseDC(NULL, hDCScreen);
+ ReleaseDC(nullptr, hDCScreen);
lpSizeInPix->cx = (lpSizeInHiMetric->cx * nPixelsPerInchX + (2540 / 2)) / 2540;
lpSizeInPix->cy = (lpSizeInHiMetric->cy * nPixelsPerInchY + (2540 / 2)) / 2540;
@@ -41,13 +41,13 @@ const GUID IID_ITooltipData = ISmileyBase::ISmileyBase(void)
{
- m_spAdviseSink = NULL;
- m_spClientSite = NULL;
- m_spAdviseHolder = NULL;
+ m_spAdviseSink = nullptr;
+ m_spClientSite = nullptr;
+ m_spAdviseHolder = nullptr;
m_lRefCount = 1;
m_advf = 0;
- m_smltxt = NULL;
- m_hwnd = NULL;
+ m_smltxt = nullptr;
+ m_hwnd = nullptr;
m_visible = false;
m_dirAniAllow = false;
@@ -66,12 +66,12 @@ ISmileyBase::~ISmileyBase(void) if (m_spClientSite) {
m_spClientSite->Release();
- m_spClientSite = NULL;
+ m_spClientSite = nullptr;
}
if (m_spAdviseHolder) {
m_spAdviseHolder->Release();
- m_spAdviseHolder = NULL;
+ m_spAdviseHolder = nullptr;
}
}
@@ -86,7 +86,7 @@ void ISmileyBase::SendOnViewChange(void) if (m_spAdviseSink) m_spAdviseSink->OnViewChange(DVASPECT_CONTENT, -1);
if (m_advf & ADVF_ONLYONCE) {
m_spAdviseSink->Release();
- m_spAdviseSink = NULL;
+ m_spAdviseSink = nullptr;
m_advf = 0;
}
}
@@ -110,7 +110,7 @@ void ISmileyBase::SetHint(wchar_t *smltxt) void ISmileyBase::SetPosition(HWND hwnd, LPCRECT lpRect)
{
m_hwnd = hwnd;
- if (lpRect == NULL || lpRect->top == -1 || lpRect->bottom == -1) {
+ if (lpRect == nullptr || lpRect->top == -1 || lpRect->bottom == -1) {
m_visible = false;
return;
}
@@ -154,7 +154,7 @@ ULONG ISmileyBase::Release(void) HRESULT ISmileyBase::QueryInterface(REFIID iid, void **ppvObject)
{
// check to see what interface has been requested
- if (ppvObject == NULL) return E_POINTER;
+ if (ppvObject == nullptr) return E_POINTER;
if (iid == IID_ISmileyAddSmiley)
*ppvObject = this;
else if (iid == IID_ITooltipData)
@@ -168,7 +168,7 @@ HRESULT ISmileyBase::QueryInterface(REFIID iid, void **ppvObject) else if (iid == IID_IViewObject2)
*ppvObject = static_cast<IViewObject2*>(this);
else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
AddRef();
@@ -180,17 +180,17 @@ HRESULT ISmileyBase::QueryInterface(REFIID iid, void **ppvObject) //
HRESULT ISmileyBase::SetClientSite(IOleClientSite *pClientSite)
{
- if (m_spClientSite != NULL) m_spClientSite->Release();
+ if (m_spClientSite != nullptr) m_spClientSite->Release();
m_spClientSite = pClientSite;
- if (m_spClientSite != NULL) m_spClientSite->AddRef();
+ if (m_spClientSite != nullptr) m_spClientSite->AddRef();
return S_OK;
}
HRESULT ISmileyBase::GetClientSite(IOleClientSite **ppClientSite)
{
- if (ppClientSite == NULL) return E_POINTER;
+ if (ppClientSite == nullptr) return E_POINTER;
*ppClientSite = m_spClientSite;
- if (m_spClientSite != NULL) m_spClientSite->AddRef();
+ if (m_spClientSite != nullptr) m_spClientSite->AddRef();
return S_OK;
}
@@ -205,7 +205,7 @@ HRESULT ISmileyBase::Close(DWORD) if (m_spAdviseSink) {
m_spAdviseSink->Release();
- m_spAdviseSink = NULL;
+ m_spAdviseSink = nullptr;
}
return S_OK;
@@ -255,7 +255,7 @@ HRESULT ISmileyBase::GetUserType(DWORD, LPOLESTR*) HRESULT ISmileyBase::SetExtent(DWORD dwDrawAspect, SIZEL *psizel)
{
if (dwDrawAspect != DVASPECT_CONTENT) return E_FAIL;
- if (psizel == NULL) return E_POINTER;
+ if (psizel == nullptr) return E_POINTER;
HiMetricToPixel(psizel, &m_sizeExtent);
m_sizeExtentHiM = *psizel;
@@ -265,7 +265,7 @@ HRESULT ISmileyBase::SetExtent(DWORD dwDrawAspect, SIZEL *psizel) HRESULT ISmileyBase::GetExtent(DWORD dwDrawAspect, SIZEL *psizel)
{
if (dwDrawAspect != DVASPECT_CONTENT) return E_FAIL;
- if (psizel == NULL) return E_POINTER;
+ if (psizel == nullptr) return E_POINTER;
*psizel = m_sizeExtentHiM;
return S_OK;
@@ -274,12 +274,12 @@ HRESULT ISmileyBase::GetExtent(DWORD dwDrawAspect, SIZEL *psizel) HRESULT ISmileyBase::Advise(IAdviseSink *pAdvSink, DWORD *pdwConnection)
{
HRESULT hr = S_OK;
- if (m_spAdviseHolder == NULL)
+ if (m_spAdviseHolder == nullptr)
hr = CreateOleAdviseHolder(&m_spAdviseHolder);
if (SUCCEEDED(hr))
hr = m_spAdviseHolder->Advise(pAdvSink, pdwConnection);
else
- m_spAdviseHolder = NULL;
+ m_spAdviseHolder = nullptr;
return hr;
}
@@ -290,13 +290,13 @@ HRESULT ISmileyBase::Unadvise(DWORD dwConnection) HRESULT ISmileyBase::EnumAdvise(IEnumSTATDATA **ppEnumAdvise)
{
- if (ppEnumAdvise == NULL) return E_POINTER;
+ if (ppEnumAdvise == nullptr) return E_POINTER;
return m_spAdviseHolder ? m_spAdviseHolder->EnumAdvise(ppEnumAdvise) : E_FAIL;
}
HRESULT ISmileyBase::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus)
{
- if (pdwStatus == NULL) return E_POINTER;
+ if (pdwStatus == nullptr) return E_POINTER;
if (dwAspect == DVASPECT_CONTENT) {
*pdwStatus = OLEMISC_STATIC | OLEMISC_INVISIBLEATRUNTIME |
OLEMISC_CANTLINKINSIDE | OLEMISC_NOUIACTIVATE;
@@ -343,7 +343,7 @@ HRESULT ISmileyBase::GetColorSet(DWORD, long, void*, DVTARGETDEVICE*, HDC, LOGPA //
HRESULT ISmileyBase::GetExtent(DWORD aspect, long, DVTARGETDEVICE*, SIZEL *pSize)
{
- if (pSize == NULL) return E_POINTER;
+ if (pSize == nullptr) return E_POINTER;
if (aspect != DVASPECT_CONTENT) return DV_E_DVASPECT;
*pSize = m_sizeExtent;
return S_OK;
@@ -360,7 +360,7 @@ HRESULT ISmileyBase::SetTooltip(BSTR) HRESULT ISmileyBase::GetTooltip(BSTR *bstrHint)
{
- if (bstrHint == NULL) return E_POINTER;
+ if (bstrHint == nullptr) return E_POINTER;
*bstrHint = SysAllocString(m_smltxt);
return S_OK;
}
diff --git a/plugins/SmileyAdd/src/anim.cpp b/plugins/SmileyAdd/src/anim.cpp index 6770f81064..4e04871e89 100644 --- a/plugins/SmileyAdd/src/anim.cpp +++ b/plugins/SmileyAdd/src/anim.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. Animate::Animate(SmileyType *sml, RECT &rect, HDC hdcMem, HBRUSH hbr, bool clip) :
m_sml(sml),
- m_img(NULL),
+ m_img(nullptr),
m_nFramePosition(0), m_sel(false), m_clip(clip),
m_offset(0), m_running(false),
m_hdcMem(hdcMem), m_hbr(hbr)
@@ -97,15 +97,15 @@ void Animate::SetOffset(int off, int wsize) m_running = m_cliprect.top >= 0 && m_cliprect.top < wsize;
if (m_running) {
- if (m_img == NULL) {
+ if (m_img == nullptr) {
StartAnimation();
- if (m_img == NULL)
+ if (m_img == nullptr)
m_running = false;
}
}
else {
if (m_img) m_img->Release();
- m_img = NULL;
+ m_img = nullptr;
}
}
diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index 5f9ff1b9fb..aa631e3b2e 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -23,7 +23,7 @@ SmileyPackCListType g_SmileyPackCStore; bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, wchar_t *dir)
{
bool res = true;
- if (GetSmileyPack(hContact) == NULL) {
+ if (GetSmileyPack(hContact) == nullptr) {
SmileyPackCType *smileyPack = new SmileyPackCType;
res = smileyPack->LoadSmileyDir(dir);
@@ -39,7 +39,7 @@ bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, wchar_t *dir) bool SmileyPackCListType::AddSmiley(MCONTACT hContact, wchar_t *path)
{
SmileyPackCType *smpack = GetSmileyPack(hContact);
- if (smpack == NULL) {
+ if (smpack == nullptr) {
smpack = new SmileyPackCType;
smpack->SetId(hContact);
@@ -55,7 +55,7 @@ SmileyPackCType* SmileyPackCListType::GetSmileyPack(MCONTACT id) if (m_SmileyPacks[i].GetId() == id)
return &m_SmileyPacks[i];
- return NULL;
+ return nullptr;
}
@@ -81,7 +81,7 @@ bool SmileyCType::CreateTriggerText(char *text) wchar_t *txt = mir_utf8decodeW(res);
res[reslen] = save;
- if (txt == NULL)
+ if (txt == nullptr)
return false;
m_TriggerText = txt;
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index fff1cfee75..b502c72000 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -36,7 +36,7 @@ struct MsgWndData : public MZeroedObject doSmileyButton = opt.ButtonStatus != 0;
SmileyPackType *SmileyPack = GetSmileyPack(ProtocolName, hContact);
- doSmileyButton &= SmileyPack != NULL && SmileyPack->VisibleSmileyCount() != 0;
+ doSmileyButton &= SmileyPack != nullptr && SmileyPack->VisibleSmileyCount() != 0;
doSmileyReplace = true;
@@ -83,7 +83,7 @@ static MsgWndData* IsMsgWnd(HWND hwnd) static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
MsgWndData *dat = IsMsgWnd(hwnd);
- if (dat == NULL)
+ if (dat == nullptr)
return 0;
switch (uMsg) {
@@ -122,7 +122,7 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, if (dat->doSmileyReplace) {
SmileyPackCType *smcp;
SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp);
- if (SmileyPack != NULL) {
+ if (SmileyPack != nullptr) {
const CHARRANGE sel = { dat->idxLastChar, LONG_MAX };
ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false);
}
@@ -133,7 +133,7 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, if (dat->doSmileyReplace) {
SmileyPackCType *smcp;
SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp);
- if (SmileyPack != NULL) {
+ if (SmileyPack != nullptr) {
static const CHARRANGE sel = { 0, LONG_MAX };
ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false);
}
@@ -176,7 +176,7 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam) return 0;
MsgWndData *dat = IsMsgWnd(pcbc->hwndFrom);
- if (dat == NULL)
+ if (dat == nullptr)
return 0;
SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index e524d9ad8b..a305436364 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -42,7 +42,7 @@ static bool threadRunning; bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwnl)
{
int result = 0xBADBAD;
- char *szRedirUrl = NULL;
+ char *szRedirUrl = nullptr;
NETLIBHTTPREQUEST nlhr = { 0 };
// initialize the netlib request
@@ -94,7 +94,7 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwn const char *szPref = strstr(szUrl, "://");
szPref = szPref ? szPref + 3 : szUrl;
const char *szPath = strchr(szPref, '/');
- rlen = szPath != NULL ? szPath - szUrl : mir_strlen(szUrl);
+ rlen = szPath != nullptr ? szPath - szUrl : mir_strlen(szUrl);
}
szRedirUrl = (char*)mir_realloc(szRedirUrl, rlen + mir_strlen(nlhrReply->headers[i].szValue) * 3 + 1);
@@ -110,7 +110,7 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwn else result = 1;
}
else {
- hHttpDwnl = NULL;
+ hHttpDwnl = nullptr;
result = 1;
}
@@ -127,7 +127,7 @@ void __cdecl SmileyDownloadThread(void*) Thread_SetName("SmileyAdd: SmileyDownloadThread");
bool needext = false;
- HNETLIBCONN hHttpDwnl = NULL;
+ HNETLIBCONN hHttpDwnl = nullptr;
WaitForSingleObject(g_hDlMutex, 3000);
while (!Miranda_IsTerminated() && dlQueue.getCount()) {
ReleaseMutex(g_hDlMutex);
@@ -193,7 +193,7 @@ bool GetSmileyFile(CMStringW &url, const CMStringW &packstr) if (!threadRunning) {
threadRunning = true;
- mir_forkthread(SmileyDownloadThread, NULL);
+ mir_forkthread(SmileyDownloadThread, nullptr);
}
url = filename;
@@ -225,7 +225,7 @@ void DownloadInit(void) hNetlibUser = Netlib_RegisterUser(&nlu);
GetSmileyCacheFolder();
- g_hDlMutex = CreateMutex(NULL, FALSE, NULL);
+ g_hDlMutex = CreateMutex(nullptr, FALSE, nullptr);
}
void DownloadClose(void)
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index 277e49bda6..e23f1e835b 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -49,7 +49,7 @@ int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf) HICON GetDefaultIcon(bool copy)
{
HICON resIco = IcoLib_GetIcon("SmileyAdd_ButtonSmiley");
- if (resIco == NULL)
+ if (resIco == nullptr)
resIco = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_SMILINGICON), IMAGE_ICON, 0, 0, copy ? 0 : LR_SHARED);
else if (copy) {
resIco = (HICON)CopyImage(resIco, IMAGE_ICON, 0, 0, 0);
@@ -93,20 +93,20 @@ HICON ImageList_GetIconFixed(HIMAGELIST himl, INT i, UINT fStyle) int cx, cy;
ImageList_GetIconSize(himl, &cx, &cy);
- hdcDst = CreateCompatibleDC(NULL);
+ hdcDst = CreateCompatibleDC(nullptr);
ii.fIcon = TRUE;
ii.xHotspot = 0;
ii.yHotspot = 0;
// draw mask
- ii.hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
+ ii.hbmMask = CreateBitmap(cx, cy, 1, 1, nullptr);
hOldDstBitmap = (HBITMAP)SelectObject(hdcDst, ii.hbmMask);
PatBlt(hdcDst, 0, 0, cx, cy, WHITENESS);
ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle | ILD_MASK);
// draw image
- ii.hbmColor = CreateBitmap(cx, cy, 1, 32, NULL);
+ ii.hbmColor = CreateBitmap(cx, cy, 1, 32, nullptr);
SelectObject(hdcDst, ii.hbmColor);
PatBlt(hdcDst, 0, 0, cx, cy, BLACKNESS);
ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle | ILD_TRANSPARENT);
@@ -136,7 +136,7 @@ void pathToAbsolute(const CMStringW &pSrc, CMStringW &pOut) wchar_t szOutPath[MAX_PATH];
wchar_t *szVarPath = Utils_ReplaceVarsW(pSrc.c_str());
- if (szVarPath == (wchar_t*)CALLSERVICE_NOTFOUND || szVarPath == NULL) {
+ if (szVarPath == (wchar_t*)CALLSERVICE_NOTFOUND || szVarPath == nullptr) {
wchar_t szExpPath[MAX_PATH];
ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, _countof(szExpPath));
PathToAbsoluteW(szExpPath, szOutPath);
@@ -191,7 +191,7 @@ bool InitGdiPlus(void) __try {
if (g_gdiplusToken == 0 && !gdiPlusFail)
- Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL);
+ Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, nullptr);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
@@ -236,5 +236,5 @@ void ReportError(const wchar_t *errmsg) mir_wstrcpy(pd.lpwzText, errmsg);
pd.iSeconds = -1;
if (PUAddPopupT(&pd) == CALLSERVICE_NOTFOUND)
- MessageBox(NULL, errmsg, title, MB_OK | MB_ICONWARNING | MB_TOPMOST);
+ MessageBox(nullptr, errmsg, title, MB_OK | MB_ICONWARNING | MB_TOPMOST);
}
diff --git a/plugins/SmileyAdd/src/imagecache.cpp b/plugins/SmileyAdd/src/imagecache.cpp index 8f4ea9fe4c..26842e284b 100644 --- a/plugins/SmileyAdd/src/imagecache.cpp +++ b/plugins/SmileyAdd/src/imagecache.cpp @@ -29,10 +29,10 @@ static UINT_PTR timerId; static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
{
WaitForSingleObject(g_hMutexIm, 3000);
- const time_t ts = time(NULL) - 10;
+ const time_t ts = time(nullptr) - 10;
if (lastmodule && ts > laststamp) {
FreeLibrary(lastmodule);
- lastmodule = NULL;
+ lastmodule = nullptr;
lastdllname.Empty();
}
@@ -41,8 +41,8 @@ static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) if (g_imagecache.getCount() == 0) {
g_imagecache.destroy();
- if (timerId && (timerId + 1) && lastmodule == NULL) {
- KillTimer(NULL, timerId);
+ if (timerId && (timerId + 1) && lastmodule == nullptr) {
+ KillTimer(nullptr, timerId);
timerId = 0;
}
}
@@ -54,7 +54,7 @@ static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) static void CALLBACK sttMainThreadCallback(PVOID)
{
if (timerId == 0xffffffff)
- timerId = SetTimer(NULL, 0, 10000, (TIMERPROC)timerProc);
+ timerId = SetTimer(nullptr, 0, 10000, (TIMERPROC)timerProc);
}
@@ -66,10 +66,10 @@ static HMODULE LoadDll(const CMStringW &file) FreeLibrary(lastmodule);
lastdllname = file;
- lastmodule = LoadLibraryEx(file.c_str(), NULL, LOAD_LIBRARY_AS_DATAFILE);
+ lastmodule = LoadLibraryEx(file.c_str(), nullptr, LOAD_LIBRARY_AS_DATAFILE);
}
- laststamp = time(NULL);
+ laststamp = time(nullptr);
ReleaseMutex(g_hMutexIm);
return lastmodule;
@@ -98,7 +98,7 @@ long ImageBase::Release(void) long cnt = m_lRefCount;
if (cnt) m_lRefCount = --cnt;
- if (cnt == 0) m_timestamp = time(NULL);
+ if (cnt == 0) m_timestamp = time(nullptr);
ReleaseMutex(g_hMutexIm);
return cnt;
@@ -125,7 +125,7 @@ int ImageBase::CompareImg(const ImageBase *p1, const ImageBase *p2) void ImageBase::Draw(HDC hdc, RECT &rc, bool clip)
{
- HRGN hrgn = NULL;
+ HRGN hrgn = nullptr;
if (clip) {
hrgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
SelectClipRgn(hdc, hrgn);
@@ -146,7 +146,7 @@ void ImageBase::Draw(HDC hdc, RECT &rc, bool clip) DrawInternal(hdc, x, y, scaleX, scaleY);
if (clip) {
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
DeleteObject(hrgn);
}
}
@@ -165,7 +165,7 @@ HBITMAP ImageBase::GetBitmap(COLORREF bkgClr, int sizeX, int sizeY) }
HBRUSH hBkgBrush = CreateSolidBrush(bkgClr);
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);
HDC hdcMem = CreateCompatibleDC(hdc);
SelectObject(hdcMem, hBmp);
@@ -175,7 +175,7 @@ HBITMAP ImageBase::GetBitmap(COLORREF bkgClr, int sizeX, int sizeY) Draw(hdcMem, rc, false);
DeleteDC(hdcMem);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
DeleteObject(hBkgBrush);
return hBmp;
@@ -193,23 +193,23 @@ int ImageBase::SelectNextFrame(const int frame) IconType::IconType(const unsigned id, const CMStringW &file, const int index, const IcoTypeEnum type)
: ImageBase(id)
{
- m_SmileyIcon = NULL;
+ m_SmileyIcon = nullptr;
switch (type) {
case icoDll:
{
const HMODULE hModule = LoadDll(file);
- if (hModule != NULL)
+ if (hModule != nullptr)
m_SmileyIcon = (HICON)LoadImage(hModule, MAKEINTRESOURCE(-index), IMAGE_ICON, 0, 0, 0);
}
break;
case icoFile:
- m_SmileyIcon = (HICON)LoadImage(NULL, file.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
+ m_SmileyIcon = (HICON)LoadImage(nullptr, file.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
break;
default:
- ExtractIconEx(file.c_str(), index, NULL, &m_SmileyIcon, 1);
+ ExtractIconEx(file.c_str(), index, nullptr, &m_SmileyIcon, 1);
break;
}
}
@@ -221,8 +221,8 @@ IconType::~IconType() void IconType::DrawInternal(HDC hdc, int x, int y, int sizeX, int sizeY)
{
- if (m_SmileyIcon != NULL)
- DrawIconEx(hdc, x, y, m_SmileyIcon, sizeX, sizeY, 0, NULL, DI_NORMAL);
+ if (m_SmileyIcon != nullptr)
+ DrawIconEx(hdc, x, y, m_SmileyIcon, sizeX, sizeY, 0, nullptr, DI_NORMAL);
}
HICON IconType::GetIcon(void)
@@ -232,7 +232,7 @@ HICON IconType::GetIcon(void) void IconType::GetSize(SIZE &size)
{
- if (m_SmileyIcon == NULL)
+ if (m_SmileyIcon == nullptr)
return;
ICONINFO ii;
@@ -264,7 +264,7 @@ void ImageListItemType::DrawInternal(HDC hdc, int x, int y, int sizeX, int sizeY ImageList_Draw(m_hImList, m_index, hdc, x, y, ILD_TRANSPARENT);
else {
HICON hIcon = ImageList_GetIconFixed(m_hImList, m_index, ILD_TRANSPARENT);
- DrawIconEx(hdc, x, y, hIcon, sizeX, sizeY, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, x, y, hIcon, sizeX, sizeY, 0, nullptr, DI_NORMAL);
DestroyIcon(hIcon);
}
}
@@ -282,8 +282,8 @@ void ImageListItemType::GetSize(SIZE &size) ImageType::ImageType(const unsigned id, const CMStringW &file, IStream *pStream)
: ImageBase(id)
{
- m_bmp = NULL;
- m_pPropertyItem = NULL;
+ m_bmp = nullptr;
+ m_pPropertyItem = nullptr;
m_nCurrentFrame = 0;
m_nFrameCount = 0;
@@ -296,7 +296,7 @@ ImageType::ImageType(const unsigned id, const CMStringW &file, IStream *pStream) if (m_bmp->GetLastStatus() != Gdiplus::Ok) {
delete m_bmp;
- m_bmp = NULL;
+ m_bmp = nullptr;
return;
}
@@ -313,8 +313,8 @@ ImageType::ImageType(const unsigned id, const CMStringW &file, IStream *pStream) ImageType::ImageType(const unsigned id, const CMStringW &file, const int index, const IcoTypeEnum type)
: ImageBase(id)
{
- m_bmp = NULL;
- m_pPropertyItem = NULL;
+ m_bmp = nullptr;
+ m_pPropertyItem = nullptr;
m_nCurrentFrame = 0;
m_nFrameCount = 0;
@@ -324,7 +324,7 @@ ImageType::ImageType(const unsigned id, const CMStringW &file, const int index, case icoDll:
{
const HMODULE hModule = LoadDll(file);
- if (hModule != NULL) {
+ if (hModule != nullptr) {
HICON hIcon = (HICON)LoadImage(hModule, MAKEINTRESOURCE(-index), IMAGE_ICON, 0, 0, 0);
m_bmp = new Gdiplus::Bitmap(hIcon);
DestroyIcon(hIcon);
@@ -337,8 +337,8 @@ ImageType::ImageType(const unsigned id, const CMStringW &file, const int index, break;
default:
- HICON hIcon = NULL;
- ExtractIconEx(file.c_str(), index, NULL, &hIcon, 1);
+ HICON hIcon = nullptr;
+ ExtractIconEx(file.c_str(), index, nullptr, &hIcon, 1);
m_bmp = new Gdiplus::Bitmap(hIcon);
DestroyIcon(hIcon);
break;
@@ -346,7 +346,7 @@ ImageType::ImageType(const unsigned id, const CMStringW &file, const int index, if (m_bmp->GetLastStatus() != Gdiplus::Ok) {
delete m_bmp;
- m_bmp = NULL;
+ m_bmp = nullptr;
}
}
@@ -370,7 +370,7 @@ void ImageType::SelectFrame(int frame) void ImageType::DrawInternal(HDC hdc, int x, int y, int sizeX, int sizeY)
{
- if (m_bmp == NULL) return;
+ if (m_bmp == nullptr) return;
WaitForSingleObject(g_hMutexIm, 3000);
@@ -388,9 +388,9 @@ int ImageType::GetFrameDelay(void) const HICON ImageType::GetIcon(void)
{
- if (m_bmp == NULL) return NULL;
+ if (m_bmp == nullptr) return nullptr;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
WaitForSingleObject(g_hMutexIm, 3000);
m_bmp->GetHICON(&hIcon);
@@ -413,13 +413,13 @@ void ImageType::GetSize(SIZE &size) ImageFType::ImageFType(const unsigned id)
: ImageBase(id)
{
- m_bmp = NULL;
+ m_bmp = nullptr;
}
ImageFType::ImageFType(const unsigned id, const CMStringW &file)
: ImageBase(id)
{
- m_bmp = NULL;
+ m_bmp = nullptr;
FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeU(file.c_str(), 0);
if (fif == FIF_UNKNOWN)
@@ -427,7 +427,7 @@ ImageFType::ImageFType(const unsigned id, const CMStringW &file) if (fif == FIF_UNKNOWN) return;
FIBITMAP *dib = fei->FI_LoadU(fif, file.c_str(), 0);
- if (dib == NULL) return;
+ if (dib == nullptr) return;
bool transp = fei->FI_IsTransparent(dib) != 0;
FREE_IMAGE_TYPE imt = fei->FI_GetImageType(dib);
@@ -458,7 +458,7 @@ ImageFType::~ImageFType() void ImageFType::DrawInternal(HDC hdc, int x, int y, int sizeX, int sizeY)
{
- if (m_bmp == NULL) return;
+ if (m_bmp == nullptr) return;
HDC hdcImg = CreateCompatibleDC(hdc);
HBITMAP oldBmp = (HBITMAP)SelectObject(hdcImg, m_bmp);
@@ -480,8 +480,8 @@ void ImageFType::DrawInternal(HDC hdc, int x, int y, int sizeX, int sizeY) HICON ImageFType::GetIcon(void)
{
- if (m_bmp == NULL)
- return NULL;
+ if (m_bmp == nullptr)
+ return nullptr;
BITMAP bm;
GetObject(m_bmp, sizeof(bm), &bm);
@@ -490,7 +490,7 @@ HICON ImageFType::GetIcon(void) ii.fIcon = TRUE;
ii.xHotspot = 0;
ii.yHotspot = 0;
- ii.hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL);
+ ii.hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, nullptr);
ii.hbmColor = m_bmp;
HICON hIcon = CreateIconIndirect(&ii);
DeleteObject(ii.hbmMask);
@@ -510,14 +510,14 @@ void ImageFType::GetSize(SIZE &size) void InitImageCache(void)
{
- g_hMutexIm = CreateMutex(NULL, FALSE, NULL);
+ g_hMutexIm = CreateMutex(nullptr, FALSE, nullptr);
}
void DestroyImageCache(void)
{
WaitForSingleObject(g_hMutexIm, 3000);
- if (timerId) KillTimer(NULL, timerId);
+ if (timerId) KillTimer(nullptr, timerId);
if (lastmodule) FreeLibrary(lastmodule);
g_imagecache.destroy();
@@ -535,10 +535,10 @@ ImageBase* AddCacheImage(const CMStringW &file, int index) ImageBase srch(id);
ImageBase *img = g_imagecache.find(&srch);
- if (img == NULL) {
+ if (img == nullptr) {
int ind = file.ReverseFind('.');
if (ind == -1)
- return NULL;
+ return nullptr;
CMStringW ext = file.Mid(ind + 1);
ext.MakeLower();
@@ -549,17 +549,17 @@ ImageBase* AddCacheImage(const CMStringW &file, int index) else if (ext == L"icl")
img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, index, icoIcl) : (ImageBase*)new IconType(id, file, index, icoIcl);
else if (ext == L"gif")
- img = new ImageType(id, file, NULL);
- else if (fei == NULL || ext == L"tif" || ext == L"tiff")
- img = new ImageType(id, file, NULL);
+ img = new ImageType(id, file, nullptr);
+ else if (fei == nullptr || ext == L"tif" || ext == L"tiff")
+ img = new ImageType(id, file, nullptr);
else
- img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, NULL) : (ImageBase*)new ImageFType(id, file);
+ img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, nullptr) : (ImageBase*)new ImageFType(id, file);
g_imagecache.insert(img);
if (timerId == 0) {
timerId = 0xffffffff;
- CallFunctionAsync(sttMainThreadCallback, NULL);
+ CallFunctionAsync(sttMainThreadCallback, nullptr);
}
}
else img->AddRef();
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 30a6bd2798..b0fd12b50b 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -43,7 +43,7 @@ private: void PopulateSmPackList(void);
void UpdateVisibleSmPackList(void);
void UserAction(HTREEITEM hItem);
- long GetSelProto(HTREEITEM hItem = NULL);
+ long GetSelProto(HTREEITEM hItem = nullptr);
public:
OptionsDialogType(HWND hWnd) { m_hwndDialog = hWnd; }
@@ -245,7 +245,7 @@ void OptionsDialogType::SetChanged(void) void OptionsDialogType::UpdateControls(bool force)
{
const SmileyCategoryType *smc = tmpsmcat.GetSmileyCategory(GetSelProto());
- if (smc == NULL)
+ if (smc == nullptr)
return;
const CMStringW &smf = smc->GetFilename();
@@ -268,7 +268,7 @@ long OptionsDialogType::GetSelProto(HTREEITEM hItem) TVITEM tvi = { 0 };
tvi.mask = TVIF_PARAM;
- tvi.hItem = hItem == NULL ? TreeView_GetSelection(hLstView) : hItem;
+ tvi.hItem = hItem == nullptr ? TreeView_GetSelection(hLstView) : hItem;
TreeView_GetItem(hLstView, &tvi);
@@ -300,7 +300,7 @@ void OptionsDialogType::UpdateVisibleSmPackList(void) if (!ProtoName.IsEmpty()) {
PhysProtoName += ProtoName;
SmileyCategoryType *scm = tmpsmcat.GetSmileyCategory(PhysProtoName);
- if (scm == NULL)
+ if (scm == nullptr)
visible = false;
else if (scm->GetFilename().IsEmpty())
visible = true;
@@ -318,7 +318,7 @@ void OptionsDialogType::PopulateSmPackList(void) TreeView_SelectItem(hLstView, NULL);
TreeView_DeleteAllItems(hLstView);
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
@@ -389,13 +389,13 @@ void OptionsDialogType::InitDialog(void) SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList();
for (int i = 0; i < smc.getCount(); i++) {
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (smc[i].IsProto()) {
hIcon = (HICON)CallProtoService(_T2A(smc[i].GetName().c_str()), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- if (hIcon == NULL || (INT_PTR)hIcon == CALLSERVICE_NOTFOUND)
+ if (hIcon == nullptr || (INT_PTR)hIcon == CALLSERVICE_NOTFOUND)
hIcon = (HICON)CallProtoService(_T2A(smc[i].GetName().c_str()), PS_LOADICON, PLI_PROTOCOL, 0);
}
- if (hIcon == NULL || hIcon == (HICON)CALLSERVICE_NOTFOUND)
+ if (hIcon == nullptr || hIcon == (HICON)CALLSERVICE_NOTFOUND)
hIcon = GetDefaultIcon();
ImageList_AddIcon(hImList, hIcon);
@@ -437,8 +437,8 @@ void OptionsDialogType::ApplyChanges(void) opt.HorizontalSorting = IsDlgButtonChecked(m_hwndDialog, IDC_SORTING_HORIZONTAL) == BST_CHECKED;
opt.ButtonStatus = (unsigned)SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_GETCURSEL, 0, 0);
- opt.MaxCustomSmileySize = GetDlgItemInt(m_hwndDialog, IDC_MAXCUSTSMSZ, NULL, FALSE);
- opt.MinSmileySize = GetDlgItemInt(m_hwndDialog, IDC_MINSMSZ, NULL, FALSE);
+ opt.MaxCustomSmileySize = GetDlgItemInt(m_hwndDialog, IDC_MAXCUSTSMSZ, nullptr, FALSE);
+ opt.MinSmileySize = GetDlgItemInt(m_hwndDialog, IDC_MINSMSZ, nullptr, FALSE);
opt.Save();
@@ -446,7 +446,7 @@ void OptionsDialogType::ApplyChanges(void) CMStringW empty;
SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList();
for (int i = 0; i < smc.getCount(); i++)
- if (tmpsmcat.GetSmileyCategory(smc[i].GetName()) == NULL)
+ if (tmpsmcat.GetSmileyCategory(smc[i].GetName()) == nullptr)
opt.WritePackFileName(empty, smc[i].GetName());
g_SmileyCategories = tmpsmcat;
@@ -530,7 +530,7 @@ void OptionsDialogType::ShowSmileyPreview(void) SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
stwp->pSmileyPack = &smPack;
stwp->hWndParent = m_hwndDialog;
- stwp->hWndTarget = NULL;
+ stwp->hWndTarget = nullptr;
stwp->targetMessage = 0;
stwp->targetWParam = 0;
stwp->xPosition = rect.left;
@@ -637,7 +637,7 @@ void OptionsType::WriteContactCategory(MCONTACT hContact, const CMStringW &cats) static INT_PTR CALLBACK DlgProcSmileysOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
OptionsDialogType *pOD = (OptionsDialogType*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (pOD == NULL) {
+ if (pOD == nullptr) {
pOD = new OptionsDialogType(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pOD);
}
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.cpp b/plugins/SmileyAdd/src/regexp/WCPattern.cpp index 2ce1a1b301..e2b99b6f3e 100644 --- a/plugins/SmileyAdd/src/regexp/WCPattern.cpp +++ b/plugins/SmileyAdd/src/regexp/WCPattern.cpp @@ -64,13 +64,13 @@ static inline int str_icmp(const wchar_t *a, const wchar_t *b) WCPattern::WCPattern(const CMStringW &rhs)
{
- matcher = NULL;
+ matcher = nullptr;
pattern = rhs;
curInd = 0;
groupCount = 0;
nonCapGroupCount = 0;
error = 0;
- head = NULL;
+ head = nullptr;
}
// convenient function in case we want to add any extra debugging output
@@ -165,7 +165,7 @@ bool WCPattern::quantifyCurly(int &sNum, int &eNum) NFAUNode* WCPattern::quantifyGroup(NFAUNode *start, NFAUNode *stop, const int gn)
{
- NFAUNode *newNode = NULL;
+ NFAUNode *newNode = nullptr;
int type = 0;
if (curInd < pattern.GetLength()) {
@@ -218,7 +218,7 @@ NFAUNode* WCPattern::quantifyGroup(NFAUNode *start, NFAUNode *stop, const int gn }
}
}
- return NULL;
+ return nullptr;
}
NFAUNode* WCPattern::quantify(NFAUNode *newNode)
@@ -531,15 +531,15 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) {
int i, j;
CMStringW s;
- NFAUNode *ret = NULL;
+ NFAUNode *ret = nullptr;
for (i = curInd; i < pattern.GetLength() && pattern[i] != '}'; ++i) {}
- if (pattern[i] != '}') { raiseError(); return NULL; }
- if (i == curInd + 1) { raiseError(); return NULL; } // {}
+ if (pattern[i] != '}') { raiseError(); return nullptr; }
+ if (i == curInd + 1) { raiseError(); return nullptr; } // {}
if (!((pattern[curInd] >= 'a' && pattern[curInd] <= 'z') ||
(pattern[curInd] >= 'A' && pattern[curInd] <= 'Z') ||
(pattern[curInd] == '_'))) {
raiseError();
- return NULL;
+ return nullptr;
}
for (j = curInd; !error && j < i; ++j) {
@@ -548,7 +548,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) (pattern[j] >= '0' && pattern[j] <= '9') ||
(pattern[j] == '_'))) {
raiseError();
- return NULL;
+ return nullptr;
}
}
s = pattern.Mid(curInd, i - curInd);
@@ -569,7 +569,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) curInd = ci;
flags = oflags;
}
- if (error) { *end = ret = NULL; }
+ if (error) { *end = ret = nullptr; }
return ret;
}
@@ -620,7 +620,7 @@ NFAUNode* WCPattern::parseQuote() }
NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
{
- NFAUNode *start, *cur, *next = NULL;
+ NFAUNode *start, *cur, *next = nullptr;
CMStringW t;
int grc = groupCount++;
bool inv, quo;
@@ -642,7 +642,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) while (!done) {
if (curInd >= pattern.GetLength()) {
raiseError();
- return NULL;
+ return nullptr;
}
else if (negate) {
switch (pattern[curInd]) {
@@ -658,7 +658,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) case '-':
default:
raiseError();
- return NULL;
+ return nullptr;
}
}
else {
@@ -675,7 +675,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) return *end;
default:
raiseError();
- return NULL;
+ return nullptr;
}
}
++curInd;
@@ -694,8 +694,8 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) while (curInd < pattern.GetLength()) {
wchar_t ch = pattern[curInd++];
- next = NULL;
- if (error) return NULL;
+ next = nullptr;
+ if (error) return nullptr;
switch (ch) {
case '^':
if ((flags & WCPattern::MULTILINE_MATCHING) != 0) next = registerNode(new NFAStartOfLineUNode);
@@ -774,7 +774,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) NFAUNode *pEnd, *t1, *t2;
t1 = parse(1, 0, &pEnd);
if (!t1) raiseError();
- else if (t1->isGroupHeadNode() && (t2 = quantifyGroup(t1, pEnd, grc)) != NULL) {
+ else if (t1->isGroupHeadNode() && (t2 = quantifyGroup(t1, pEnd, grc)) != nullptr) {
cur->next = t2;
cur = t2->next;
}
@@ -840,7 +840,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) }
flags = oldFlags;
- if (error) return NULL;
+ if (error) return nullptr;
return start;
}
@@ -861,7 +861,7 @@ WCPattern* WCPattern::compile(const CMStringW &pattern, const unsigned long mode p->head = p->parse(0, 0, &end);
if (!p->head) {
delete p;
- p = NULL;
+ p = nullptr;
}
else {
if (!(p->head && p->head->isStartOfInputNode())) {
@@ -873,7 +873,7 @@ WCPattern* WCPattern::compile(const CMStringW &pattern, const unsigned long mode }
}
- if (p != NULL)
+ if (p != nullptr)
p->matcher = new WCMatcher(p, L"");
return p;
@@ -881,7 +881,7 @@ WCPattern* WCPattern::compile(const CMStringW &pattern, const unsigned long mode WCPattern* WCPattern::compileAndKeep(const CMStringW &pattern, const unsigned long mode)
{
- WCPattern *ret = NULL;
+ WCPattern *ret = nullptr;
std::map<CMStringW, WCPattern*>::iterator it = compiledWCPatterns.find(pattern);
if (it != compiledWCPatterns.end())
ret = it->second;
@@ -1060,7 +1060,7 @@ WCMatcher *WCPattern::createWCMatcher(const CMStringW &str) // NFAUNode
-NFAUNode::NFAUNode() { next = NULL; }
+NFAUNode::NFAUNode() { next = nullptr; }
NFAUNode::~NFAUNode() {}
void NFAUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar)
{
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index fcfcdac239..67ab0a5c98 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -107,7 +107,7 @@ static void SetTooltip(long x, long y, HWND hwnd, RichEditData *rdt) if (needtip != -1) {
if (rdt->tipActive == -1) {
rdt->hToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", TTS_NOPREFIX | WS_POPUP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, NULL, g_hInst, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, nullptr, g_hInst, nullptr);
SendMessage(rdt->hToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
@@ -119,7 +119,7 @@ static void SetTooltip(long x, long y, HWND hwnd, RichEditData *rdt) else if (rdt->tipActive != -1) {
SendMessage(rdt->hToolTip, TTM_ACTIVATE, FALSE, 0);
DestroyWindow(rdt->hToolTip);
- rdt->hToolTip = NULL;
+ rdt->hToolTip = nullptr;
}
rdt->tipActive = needtip;
@@ -130,8 +130,8 @@ static const CHARRANGE allsel = { 0, LONG_MAX }; static void ReplaceContactSmileys(RichEditData *rdt, const CHARRANGE &sel, bool ignoreLast, bool unFreeze)
{
if ((rdt->inputarea && !opt.InputSmileys) || rdt->dontReplace) return;
- SmileyPackCType *smcp = NULL;
- SmileyPackType *SmileyPack = GetSmileyPack(NULL, rdt->hContact, rdt->inputarea ? NULL : &smcp);
+ SmileyPackCType *smcp = nullptr;
+ SmileyPackType *SmileyPack = GetSmileyPack(nullptr, rdt->hContact, rdt->inputarea ? nullptr : &smcp);
ReplaceSmileys(rdt->hwnd, SmileyPack, smcp, sel, false, ignoreLast, unFreeze);
}
@@ -161,13 +161,13 @@ static void SmileyToTextCutRest(RichEditData *rdt) SendMessage(rdt->hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
ReplaceContactSmileys(rdt, sel, false, true);
SendMessage(rdt->hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(rdt->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(rdt->hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
}
static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RichEditData *rdt = g_RichEditList.find((RichEditData*)&hwnd);
- if (rdt == NULL)
+ if (rdt == nullptr)
return 0;
CHARRANGE sel;
@@ -294,7 +294,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP bool SetRichCallback(HWND hwnd, MCONTACT hContact, bool subany, bool subnew)
{
RichEditData *rdt = g_RichEditList.find((RichEditData*)&hwnd);
- if (rdt == NULL) {
+ if (rdt == nullptr) {
CComPtr<IRichEditOle> RichEditOle;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return false;
@@ -338,7 +338,7 @@ void CloseRichCallback(HWND hwnd) static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RichEditOwnerData *rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
- if (rdto == NULL)
+ if (rdto == nullptr)
return 0;
switch (uMsg) {
@@ -383,7 +383,7 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog)
{
RichEditOwnerData *rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
- if (rdto == NULL) {
+ if (rdto == nullptr) {
rdto = new RichEditOwnerData;
rdto->hwnd = hwnd;
rdto->hwndInput = hwndInput;
@@ -396,9 +396,9 @@ void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog) mir_subclassWindow(hwnd, RichEditOwnerSubclass);
}
else {
- if (rdto->hwndInput == NULL)
+ if (rdto->hwndInput == nullptr)
rdto->hwndInput = hwndInput;
- if (rdto->hwndLog == NULL)
+ if (rdto->hwndLog == nullptr)
rdto->hwndLog = hwndLog;
}
}
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 33bb7fb796..c4583145d3 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -28,23 +28,23 @@ SmileyPackType* GetSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCT {
hContact = DecodeMetaContact(hContact);
if (smlc)
- *smlc = opt.DisableCustom ? NULL : g_SmileyPackCStore.GetSmileyPack(hContact);
+ *smlc = opt.DisableCustom ? nullptr : g_SmileyPackCStore.GetSmileyPack(hContact);
- if (proto != NULL && IsBadStringPtrA(proto, 10))
- return NULL;
+ if (proto != nullptr && IsBadStringPtrA(proto, 10))
+ return nullptr;
CMStringW categoryName;
if (hContact != NULL) {
opt.ReadContactCategory(hContact, categoryName);
- if (categoryName == L"<None>") return NULL;
- if (!categoryName.IsEmpty() && g_SmileyCategories.GetSmileyCategory(categoryName) == NULL) {
+ if (categoryName == L"<None>") return nullptr;
+ if (!categoryName.IsEmpty() && g_SmileyCategories.GetSmileyCategory(categoryName) == nullptr) {
categoryName.Empty();
opt.WriteContactCategory(hContact, categoryName);
}
if (categoryName.IsEmpty() && !opt.UseOneForAll) {
char *protonam = GetContactProto(hContact);
- if (protonam != NULL) {
+ if (protonam != nullptr) {
DBVARIANT dbv;
if (db_get_ws(hContact, protonam, "Transport", &dbv) == 0) {
categoryName = dbv.ptszVal;
@@ -65,13 +65,13 @@ SmileyPackType* GetSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCT }
if (categoryName.IsEmpty()) {
- if (proto == NULL || proto[0] == 0)
+ if (proto == nullptr || proto[0] == 0)
categoryName = L"Standard";
else {
categoryName = _A2T(proto);
if (opt.UseOneForAll) {
SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(categoryName);
- if (smc == NULL || smc->IsProto())
+ if (smc == nullptr || smc->IsProto())
categoryName = L"Standard";
}
}
@@ -84,19 +84,19 @@ SmileyPackType* GetSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCT INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam)
{
SMADD_RICHEDIT3 *smre = (SMADD_RICHEDIT3*)lParam;
- if (smre == NULL)
+ if (smre == nullptr)
return FALSE;
SMADD_RICHEDIT3 smrec = { 0 };
memcpy(&smrec, smre, min(smre->cbSize, sizeof(smrec)));
static const CHARRANGE selection = { 0, LONG_MAX };
- if (smre->rangeToReplace == NULL) smrec.rangeToReplace = (CHARRANGE*)&selection;
+ if (smre->rangeToReplace == nullptr) smrec.rangeToReplace = (CHARRANGE*)&selection;
else if (smrec.rangeToReplace->cpMax < 0) smrec.rangeToReplace->cpMax = LONG_MAX;
- SmileyPackCType *smcp = NULL;
+ SmileyPackCType *smcp = nullptr;
SmileyPackType *SmileyPack = GetSmileyPack(smrec.Protocolname, smrec.hContact,
- (smrec.flags & (SAFLRE_OUTGOING | SAFLRE_NOCUSTOM)) ? NULL : &smcp);
+ (smrec.flags & (SAFLRE_OUTGOING | SAFLRE_NOCUSTOM)) ? nullptr : &smcp);
ReplaceSmileys(smre->hwndRichEditControl, SmileyPack, smcp, *smrec.rangeToReplace,
smrec.hContact == NULL, false, false, (smre->flags & SAFLRE_FIREVIEW) ? true : false);
@@ -109,7 +109,7 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam) {
SMADD_SHOWSEL3 *smaddInfo = (SMADD_SHOWSEL3*)lParam;
- if (smaddInfo == NULL) return FALSE;
+ if (smaddInfo == nullptr) return FALSE;
HWND parent = smaddInfo->hwndParent;
MCONTACT hContact = smaddInfo->hContact;
@@ -133,13 +133,13 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam) static int GetInfoCommandE(SMADD_INFO2 *smre, bool retDup)
{
- if (smre == NULL) return FALSE;
+ if (smre == nullptr) return FALSE;
MCONTACT hContact = smre->hContact;
SmileyPackType *SmileyPack = GetSmileyPack(smre->Protocolname, hContact);
- if (SmileyPack == NULL || SmileyPack->SmileyCount() == 0) {
- smre->ButtonIcon = NULL;
+ if (SmileyPack == nullptr || SmileyPack->SmileyCount() == 0) {
+ smre->ButtonIcon = nullptr;
smre->NumberOfSmileys = 0;
smre->NumberOfVisibleSmileys = 0;
return FALSE;
@@ -147,7 +147,7 @@ static int GetInfoCommandE(SMADD_INFO2 *smre, bool retDup) SmileyType *sml = FindButtonSmiley(SmileyPack);
- if (sml != NULL)
+ if (sml != nullptr)
smre->ButtonIcon = retDup ? sml->GetIconDup() : sml->GetIcon();
else
smre->ButtonIcon = GetDefaultIcon(retDup);
@@ -176,12 +176,12 @@ INT_PTR ParseTextBatch(WPARAM, LPARAM lParam) {
SMADD_BATCHPARSE2 *smre = (SMADD_BATCHPARSE2*)lParam;
- if (smre == NULL) return FALSE;
+ if (smre == nullptr) return FALSE;
MCONTACT hContact = smre->hContact;
- SmileyPackCType *smcp = NULL;
+ SmileyPackCType *smcp = nullptr;
SmileyPackType *SmileyPack = GetSmileyPack(smre->Protocolname, hContact,
- (smre->flag & (SAFL_OUTGOING | SAFL_NOCUSTOM)) ? NULL : &smcp);
+ (smre->flag & (SAFL_OUTGOING | SAFL_NOCUSTOM)) ? nullptr : &smcp);
SmileysQueueType smllist;
@@ -231,7 +231,7 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam) {
SMADD_REGCAT *smre = (SMADD_REGCAT*)lParam;
- if (smre == NULL || smre->cbSize < sizeof(SMADD_REGCAT)) return FALSE;
+ if (smre == nullptr || smre->cbSize < sizeof(SMADD_REGCAT)) return FALSE;
if (IsBadStringPtrA(smre->name, 50) || IsBadStringPtrA(smre->dispname, 50)) return FALSE;
@@ -246,7 +246,7 @@ INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam) {
if (lParam != 0) {
SmileyCategoryType *smct = g_SmileyCategories.GetSmileyCategory((unsigned)lParam - 3);
- if (smct != NULL)
+ if (smct != nullptr)
opt.WriteContactCategory(hContact, smct->GetName());
else {
CMStringW empty;
@@ -342,7 +342,7 @@ INT_PTR ReloadPack(WPARAM, LPARAM lParam) if (lParam) {
CMStringW categoryName = _A2T((char*)lParam);
SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(categoryName);
- if (smc != NULL)
+ if (smc != nullptr)
smc->Load();
}
else {
@@ -381,7 +381,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) switch (wParam) {
case PRAC_ADDED:
- if (acc != NULL) {
+ if (acc != nullptr) {
CMStringW catname(L"Standard");
const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
g_SmileyCategories.AddAccountAsCategory(acc, defaultFile);
@@ -389,10 +389,10 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) break;
case PRAC_CHANGED:
- if (acc != NULL && acc->szModuleName != NULL) {
+ if (acc != nullptr && acc->szModuleName != nullptr) {
CMStringW name(_A2T(acc->szModuleName));
SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(name);
- if (smc != NULL) {
+ if (smc != nullptr) {
if (acc->tszAccountName) name = acc->tszAccountName;
smc->SetDisplayName(name);
}
@@ -404,7 +404,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) break;
case PRAC_CHECKED:
- if (acc != NULL) {
+ if (acc != nullptr) {
if (acc->bIsEnabled) {
CMStringW catname(L"Standard");
const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
@@ -429,7 +429,7 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam) if (strcmp(cws->szSetting, "Transport") == 0) {
CMStringW catname(L"Standard");
SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(catname);
- if (smc != NULL)
+ if (smc != nullptr)
g_SmileyCategories.AddContactTransportAsCategory(hContact, smc->GetFilename());
}
return 0;
diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index 2dbc049b16..2741cab5d6 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -32,10 +32,10 @@ const GUID IID_ITextDocument = void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const wchar_t *lpstrText, SmileysQueueType &smllist, const bool firstOnly)
{
- if (lpstrText == NULL || *lpstrText == 0) return;
+ if (lpstrText == nullptr || *lpstrText == 0) return;
- SmileyPackType::SmileyLookupType *sml = smileyPack ? smileyPack->GetSmileyLookup() : NULL;
- SmileyPackCType::SmileyLookupType *smlc = smileyCPack ? &smileyCPack->GetSmileyLookup() : NULL;
+ SmileyPackType::SmileyLookupType *sml = smileyPack ? smileyPack->GetSmileyLookup() : nullptr;
+ SmileyPackCType::SmileyLookupType *smlc = smileyCPack ? &smileyCPack->GetSmileyLookup() : nullptr;
// Precompute number of smileys
int smlszo = sml ? sml->getCount() : 0;
@@ -72,7 +72,7 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, while (true) {
int firstSml = -1;
int firstSmlRef = -1;
- SmileyLookup::SmileyLocVecType *smlf = NULL;
+ SmileyLookup::SmileyLocVecType *smlf = nullptr;
for (int csml=0; csml < smlsz; csml++) {
SmileyLookup::SmileyLocVecType &smlv = smileys[csml];
@@ -106,7 +106,7 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, // check if leading space exist
const wchar_t *prech = _wcsdec(textToSearch, textSmlStart);
- dat->ldspace = prech != NULL ? iswspace(*prech) != 0 : smloff == 0;
+ dat->ldspace = prech != nullptr ? iswspace(*prech) != 0 : smloff == 0;
// check if trailing space exist
dat->trspace = *textSmlEnd == 0 || iswspace(*textSmlEnd);
@@ -121,14 +121,14 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, if (firstSml < smlszo) {
dat->sml = smileyPack->GetSmiley((*sml)[firstSml].GetIndex());
- dat->smlc = NULL;
+ dat->smlc = nullptr;
}
else {
dat->smlc = smileyCPack->GetSmiley((*smlc)[firstSml-smlszo].GetIndex());
- dat->sml = NULL;
+ dat->sml = nullptr;
}
- if (dat->sml != NULL || dat->smlc != NULL) {
+ if (dat->sml != nullptr || dat->smlc != nullptr) {
// First smiley found record it
smllist.insert(dat);
if (firstOnly) break;
@@ -148,10 +148,10 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, void FindSmileyInText(SmileyPackType *smp, const wchar_t *str, unsigned &first, unsigned &size, SmileyType **sml)
{
SmileysQueueType smllist;
- LookupAllSmileys(smp, NULL, str, smllist, true);
+ LookupAllSmileys(smp, nullptr, str, smllist, true);
if (smllist.getCount() == 0) {
size = 0;
- *sml = NULL;
+ *sml = nullptr;
}
else {
first = smllist[0].loc.cpMin;
@@ -190,7 +190,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const CComPtr<IRichEditOle> RichEditOle;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
- if (RichEditOle == NULL)
+ if (RichEditOle == nullptr)
return;
CComPtr<ITextDocument> TextDocument;
@@ -198,7 +198,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const return;
long cnt;
- if (smp == NULL && smcp == NULL) {
+ if (smp == nullptr && smcp == nullptr) {
if (unFreeze)
TextDocument->Unfreeze(&cnt);
return;
@@ -210,7 +210,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const return;
// retrieve text to parse for smileys
- BSTR btxt = 0;
+ BSTR btxt = nullptr;
if (TextRange->GetText(&btxt) != S_OK)
return;
@@ -296,15 +296,15 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const SmileyType *sml = smllist[j].sml;
SmileyCType *smlc = smllist[j].smlc;
- if (sml == NULL && smlc == NULL)
+ if (sml == nullptr && smlc == nullptr)
continue;
// Select text analyze
TextSelection->SetRange(smlpos.cpMin, smlpos.cpMax);
- BSTR bstrText = NULL;
+ BSTR bstrText = nullptr;
- if (smlc == NULL && sml->IsText()) {
+ if (smlc == nullptr && sml->IsText()) {
bstrText = SysAllocString(sml->GetToolText().c_str());
TextSelection->SetText(bstrText);
}
@@ -343,7 +343,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const sizeY = osize.cy;
}
- if (smlc != NULL && opt.MaxCustomSmileySize && (unsigned)sizeY > opt.MaxCustomSmileySize) {
+ if (smlc != nullptr && opt.MaxCustomSmileySize && (unsigned)sizeY > opt.MaxCustomSmileySize) {
sizeY = opt.MaxCustomSmileySize;
sizeX = osize.cx * sizeY / osize.cy;
@@ -391,13 +391,13 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const else UpdateSelection(oldSel, smlpos.cpMin, -(int)SysStringLen(bstrText)+1);
ISmileyBase *smileyBase = CreateAniSmileyObject(smlc ? smlc : sml, chf.crBackColor, ishpp);
- if (smileyBase == NULL)
+ if (smileyBase == nullptr)
continue;
smileyBase->SetExtent(DVASPECT_CONTENT, &sizehm);
smileyBase->SetHint(bstrText);
- smileyBase->SetPosition(hwnd, NULL);
+ smileyBase->SetPosition(hwnd, nullptr);
// Get the RichEdit container site
IOleClientSite *pOleClientSite;
@@ -448,10 +448,10 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const void ReplaceSmileysWithText(HWND hwnd, CHARRANGE &sel, bool keepFrozen)
{
- CComPtr<IRichEditOle> RichEditOle = NULL;
+ CComPtr<IRichEditOle> RichEditOle = nullptr;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
- if (RichEditOle == NULL)
+ if (RichEditOle == nullptr)
return;
CComPtr<ITextDocument> TextDocument;
@@ -487,17 +487,17 @@ void ReplaceSmileysWithText(HWND hwnd, CHARRANGE &sel, bool keepFrozen) break;
}
- ISmileyBase *igsc = NULL;
+ ISmileyBase *igsc = nullptr;
if (reObj.cp < sel.cpMax && reObj.clsid == CLSID_NULL)
reObj.poleobj->QueryInterface(IID_ISmileyAddSmiley, (void**) &igsc);
reObj.poleobj->Release();
- if (igsc == NULL)
+ if (igsc == nullptr)
continue;
TextRange->SetRange(reObj.cp, reObj.cp + 1);
- BSTR bstr = NULL;
+ BSTR bstr = nullptr;
igsc->GetTooltip(&bstr);
TextRange->SetText(bstr);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index c08b7f4bb6..f66a6e374e 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. SmileyPackListType g_SmileyPacks;
SmileyCategoryListType g_SmileyCategories;
-static HWND hwndHidden = NULL;
+static HWND hwndHidden = nullptr;
static void CALLBACK timerProc(HWND, UINT, UINT_PTR param, DWORD)
{
@@ -34,8 +34,8 @@ static void CALLBACK timerProc(HWND, UINT, UINT_PTR param, DWORD) // these two functions must be called from the main thread
static void CALLBACK sttStartTimer(PVOID obj)
{
- if (hwndHidden == NULL)
- hwndHidden = CreateWindowEx(0, L"STATIC", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+ if (hwndHidden == nullptr)
+ hwndHidden = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
SmileyType *pType = (SmileyType*)obj;
pType->SetFrameDelay();
@@ -53,8 +53,8 @@ static void CALLBACK sttStopTimer(PVOID obj) SmileyType::SmileyType(void) :
m_arSmileys(10, PtrKeySortT)
{
- m_SmileyIcon = NULL;
- m_xepimg = NULL;
+ m_SmileyIcon = nullptr;
+ m_xepimg = nullptr;
m_flags = 0;
m_index = 0;
m_size.cx = 0;
@@ -65,19 +65,19 @@ SmileyType::~SmileyType() {
if (m_xepimg) {
m_xepimg->Release();
- m_xepimg = NULL;
+ m_xepimg = nullptr;
}
- if (m_SmileyIcon != NULL) {
+ if (m_SmileyIcon != nullptr) {
DestroyIcon(m_SmileyIcon);
- m_SmileyIcon = NULL;
+ m_SmileyIcon = nullptr;
}
}
void SmileyType::AddObject(ISmileyBase *pObject)
{
if (m_arSmileys.getCount() == 0) {
- if (m_xepimg == NULL)
+ if (m_xepimg == nullptr)
m_xepimg = AddCacheImage(m_filepath, m_index);
CallFunctionAsync(sttStartTimer, this);
}
@@ -98,7 +98,7 @@ void SmileyType::RemoveObject(ISmileyBase *pObject) void SmileyType::SetFrameDelay()
{
- int iFrameDelay = (m_xepimg == NULL) ? 0 : m_xepimg->GetFrameDelay();
+ int iFrameDelay = (m_xepimg == nullptr) ? 0 : m_xepimg->GetFrameDelay();
if (iFrameDelay <= 0)
KillTimer(hwndHidden, (DWORD_PTR)this);
else
@@ -117,10 +117,10 @@ void SmileyType::MoveToNextFrame() HICON SmileyType::GetIcon(void)
{
- if (m_SmileyIcon == NULL) {
+ if (m_SmileyIcon == nullptr) {
ImageBase *img = CreateCachedImage();
if (!img)
- return NULL;
+ return nullptr;
img->SelectFrame(m_index);
m_SmileyIcon = img->GetIcon();
@@ -185,7 +185,7 @@ void SmileyType::SetImList(HIMAGELIST hImLst, long i) HBITMAP SmileyType::GetBitmap(COLORREF bkgClr, int sizeX, int sizeY)
{
ImageBase *img = CreateCachedImage();
- if (!img) return NULL;
+ if (!img) return nullptr;
img->SelectFrame(m_index);
HBITMAP hBmp = img->GetBitmap(bkgClr, sizeX, sizeY);
img->Release();
@@ -199,18 +199,18 @@ HBITMAP SmileyType::GetBitmap(COLORREF bkgClr, int sizeX, int sizeY) SmileyPackType::SmileyPackType()
{
- m_hSmList = NULL;
+ m_hSmList = nullptr;
errorFound = false;
}
SmileyType* SmileyPackType::GetSmiley(unsigned index)
{
- return (index < (unsigned)m_SmileyList.getCount()) ? &m_SmileyList[index] : NULL;
+ return (index < (unsigned)m_SmileyList.getCount()) ? &m_SmileyList[index] : nullptr;
}
static DWORD_PTR ConvertServiceParam(MCONTACT hContact, const wchar_t *param)
{
- if (param == NULL)
+ if (param == nullptr)
return 0;
if (mir_wstrcmpi(L"hContact", param) == 0)
return hContact;
@@ -238,7 +238,7 @@ void SmileyType::CallSmileyService(MCONTACT hContact) if (name[0] == '/') {
proto = (const char*)GetContactProto(hContact);
- if (proto == NULL) return;
+ if (proto == nullptr) return;
}
mir_snprintf(str, "%s%s", proto, _T2A(name.c_str()));
CallService(str,
@@ -250,7 +250,7 @@ void SmileyType::CallSmileyService(MCONTACT hContact) SmileyPackType::~SmileyPackType()
{
- if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
+ if (m_hSmList != nullptr) ImageList_Destroy(m_hSmList);
}
static const wchar_t urlRegEx[] =
@@ -330,7 +330,7 @@ void SmileyPackType::Clear(void) {
m_SmileyList.destroy();
m_SmileyLookup.destroy();
- if (m_hSmList != NULL) { ImageList_Destroy(m_hSmList); m_hSmList = NULL; }
+ if (m_hSmList != nullptr) { ImageList_Destroy(m_hSmList); m_hSmList = nullptr; }
m_Filename.Empty();
m_Name.Empty();
m_Date.Empty();
@@ -554,18 +554,18 @@ static IStream* DecodeBase64Data(const char *pData) unsigned dataLen;
ptrA data((char*)mir_base64_decode(pData, &dataLen));
if (data == NULL)
- return NULL;
+ return nullptr;
// Read image list
HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, dataLen);
if (!hBuffer)
- return NULL;
+ return nullptr;
void *dst = GlobalLock(hBuffer);
memcpy(dst, data, dataLen);
GlobalUnlock(hBuffer);
- IStream *pStream = NULL;
+ IStream *pStream = nullptr;
CreateStreamOnHGlobal(hBuffer, TRUE, &pStream);
return pStream;
}
@@ -627,8 +627,8 @@ bool SmileyPackType::LoadSmileyFileXEP(CMStringW &tbuf, bool onlyInfo, CMStringW m1 = imagedt_re->createWCMatcher(images);
if (m1->findFirstMatch()) {
IStream *pStream = DecodeBase64Data(_T2A(m1->getGroup(1).c_str()));
- if (pStream != NULL) {
- if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
+ if (pStream != nullptr) {
+ if (m_hSmList != nullptr) ImageList_Destroy(m_hSmList);
m_hSmList = ImageList_Read(pStream);
pStream->Release();
}
@@ -670,7 +670,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMStringW &tbuf, bool onlyInfo, CMStringW m2 = imagedt_re->createWCMatcher(images);
if (m2->findFirstMatch()) {
IStream *pStream = DecodeBase64Data(_T2A(m2->getGroup(1).c_str()));
- if (pStream != NULL) {
+ if (pStream != nullptr) {
dat->LoadFromImage(pStream);
pStream->Release();
}
@@ -712,7 +712,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMStringW &tbuf, bool onlyInfo, CMStringW bool SmileyPackListType::AddSmileyPack(CMStringW &filename, CMStringW &packname)
{
bool res = true;
- if (GetSmileyPack(filename) == NULL) { //not exist yet, so add
+ if (GetSmileyPack(filename) == nullptr) { //not exist yet, so add
SmileyPackType *smileyPack = new SmileyPackType;
res = smileyPack->LoadSmileyFile(filename, packname, FALSE);
@@ -735,7 +735,7 @@ SmileyPackType* SmileyPackListType::GetSmileyPack(CMStringW &filename) pathToAbsolute(m_SmileyPacks[i].GetFilename(), modpath1);
if (mir_wstrcmpi(modpath.c_str(), modpath1.c_str()) == 0) return &m_SmileyPacks[i];
}
- return NULL;
+ return nullptr;
}
void SmileyPackListType::ClearAndFreeAll()
@@ -806,20 +806,20 @@ SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMStringW &n if (name.CompareNoCase(m_SmileyCategories[i].GetName()) == 0)
return &m_SmileyCategories[i];
- return NULL;
+ return nullptr;
}
SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(unsigned index)
{
- return index < (unsigned)m_SmileyCategories.getCount() ? &m_SmileyCategories[index] : NULL;
+ return index < (unsigned)m_SmileyCategories.getCount() ? &m_SmileyCategories[index] : nullptr;
}
SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMStringW &categoryname)
{
SmileyCategoryType *smc = GetSmileyCategory(categoryname);
- return smc != NULL ? smc->GetSmileyPack() : NULL;
+ return smc != nullptr ? smc->GetSmileyPack() : nullptr;
}
@@ -839,7 +839,7 @@ void SmileyCategoryListType::SaveSettings(void) void SmileyCategoryListType::AddAndLoad(const CMStringW &name, const CMStringW &displayName)
{
- if (GetSmileyCategory(name) != NULL)
+ if (GetSmileyCategory(name) != nullptr)
return;
AddCategory(name, displayName, smcExt);
@@ -851,7 +851,7 @@ void SmileyCategoryListType::AddAndLoad(const CMStringW &name, const CMStringW & void SmileyCategoryListType::AddCategory(const CMStringW &name, const CMStringW &displayName, SmcType typ, const CMStringW &defaultFilename)
{
- if (GetSmileyCategory(name) == NULL)
+ if (GetSmileyCategory(name) == nullptr)
m_SmileyCategories.insert(new SmileyCategoryType(m_pSmileyPackStore, name, displayName, defaultFilename, typ));
}
@@ -887,7 +887,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr const char *packnam = acc->szProtoName;
if (mir_strcmp(packnam, "JABBER") == 0)
packnam = "JGMail";
- else if (strstr(packnam, "SIP") != NULL)
+ else if (strstr(packnam, "SIP") != nullptr)
packnam = "MSN";
char path[MAX_PATH];
@@ -908,13 +908,13 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMStringW &defaultFile)
{
- if (acc == NULL)
+ if (acc == nullptr)
return;
const char *packnam = acc;
if (mir_strcmp(packnam, "JABBER") == 0)
packnam = "JGMail";
- else if (strstr(packnam, "SIP") != NULL)
+ else if (strstr(packnam, "SIP") != nullptr)
packnam = "MSN";
char path[MAX_PATH];
@@ -938,7 +938,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *proto = GetContactProto(hContact);
- if (proto == NULL)
+ if (proto == nullptr)
continue;
DBVARIANT dbv;
@@ -961,7 +961,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, const CMStringW &defaultFile)
{
char *proto = GetContactProto(hContact);
- if (proto == NULL)
+ if (proto == nullptr)
return;
DBVARIANT dbv;
@@ -973,22 +973,22 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co char *trsp = mir_strdup(_T2A(dbv.ptszVal));
_strlwr(trsp);
- const char *packname = NULL;
- if (strstr(trsp, "msn") != NULL)
+ const char *packname = nullptr;
+ if (strstr(trsp, "msn") != nullptr)
packname = "msn";
- else if (strstr(trsp, "icq") != NULL)
+ else if (strstr(trsp, "icq") != nullptr)
packname = "icq";
- else if (strstr(trsp, "yahoo") != NULL)
+ else if (strstr(trsp, "yahoo") != nullptr)
packname = "yahoo";
- else if (strstr(trsp, "aim") != NULL)
+ else if (strstr(trsp, "aim") != nullptr)
packname = "aim";
- else if (strstr(trsp, "lcs") != NULL)
+ else if (strstr(trsp, "lcs") != nullptr)
packname = "msn";
mir_free(trsp);
CMStringW displayName = dbv.ptszVal;
- if (packname != NULL) {
+ if (packname != nullptr) {
char path[MAX_PATH];
mir_snprintf(path, "Smileys\\nova\\%s.msl", packname);
@@ -1061,7 +1061,7 @@ SmileyLookup::SmileyLookup(const CMStringW &str, const bool regexs, const int in m_ind = ind;
if (regexs) {
m_pattern = _TPattern::compile(str);
- m_valid = m_pattern != NULL;
+ m_valid = m_pattern != nullptr;
if (m_valid) {
_TMatcher *matcher = m_pattern->createWCMatcher(testString);
m_valid &= (!matcher->findFirstMatch() ||
@@ -1082,7 +1082,7 @@ SmileyLookup::SmileyLookup(const CMStringW &str, const bool regexs, const int in }
else {
m_text = str;
- m_pattern = NULL;
+ m_pattern = nullptr;
m_valid = !str.IsEmpty();
}
}
@@ -1113,7 +1113,7 @@ void SmileyLookup::Find(const CMStringW &str, SmileyLocVecType &smlcur, bool fir }
else {
const wchar_t *pos = str.c_str();
- while ((pos = wcsstr(pos, m_text.c_str())) != NULL) {
+ while ((pos = wcsstr(pos, m_text.c_str())) != nullptr) {
smlcur.insert(new SmileyLocType(pos - str.c_str(), m_text.GetLength()));
pos += m_text.GetLength();
if (firstOnly && m_ind != -1)
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index c71d2e5aac..84c0e687ea 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -76,7 +76,7 @@ public: LRESULT CALLBACK DlgProcSmileyToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
SmileyToolWindowType *pOD = (SmileyToolWindowType*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (pOD == NULL) {
+ if (pOD == nullptr) {
pOD = new SmileyToolWindowType(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pOD);
}
@@ -96,7 +96,7 @@ SmileyToolWindowType::SmileyToolWindowType(HWND hWnd) {
m_hwndDialog = hWnd;
rowSel = -1;
- m_AniPack = NULL;
+ m_AniPack = nullptr;
m_NumberOfVerticalButtons = 0;
m_NumberOfHorizontalButtons = 0;
@@ -130,7 +130,7 @@ LRESULT SmileyToolWindowType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lP case WM_DESTROY:
KillTimer(m_hwndDialog, 1);
if (m_AniPack) delete m_AniPack;
- m_AniPack = NULL;
+ m_AniPack = nullptr;
DestroyWindow(m_hToolTip);
PostQuitMessage(0);
if (m_Choosing)
@@ -194,7 +194,7 @@ void CALLBACK smileyServiceCallback(void *arg) void SmileyToolWindowType::InsertSmiley(void)
{
- if (m_CurrentHotTrack >= 0 && m_hWndTarget != NULL) {
+ if (m_CurrentHotTrack >= 0 && m_hWndTarget != nullptr) {
SmileyType *sml = m_pSmileyPack->GetSmiley(m_CurrentHotTrack);
if (sml->IsService()) {
@@ -213,7 +213,7 @@ void SmileyToolWindowType::InsertSmiley(void) m_Choosing = true;
DestroyWindow(m_hwndDialog);
}
- else if (m_hWndTarget == NULL)
+ else if (m_hWndTarget == nullptr)
DestroyWindow(m_hwndDialog);
}
@@ -315,7 +315,7 @@ void SmileyToolWindowType::ScrollV(int action, int dist) m_AniPack->SetOffset(si.nPos*GetRowSize());
ScrollWindowEx(m_hwndDialog, 0, (yPos - si.nPos) * GetRowSize(),
- NULL, NULL, NULL, NULL, SW_INVALIDATE);
+ nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
UpdateWindow(m_hwndDialog);
}
@@ -536,7 +536,7 @@ void SmileyToolWindowType::InitDialog(LPARAM lParam) if (m_XPosition < xoScreen) m_XPosition = xoScreen;
// Move window to desired location
- SetWindowPos(m_hwndDialog, NULL, m_XPosition, m_YPosition,
+ SetWindowPos(m_hwndDialog, nullptr, m_XPosition, m_YPosition,
width, height, SWP_NOZORDER);
m_AniPack = new AnimatedPack(m_hwndDialog, height, m_ButtonSize, opt.SelWndBkgClr);
@@ -548,11 +548,11 @@ void SmileyToolWindowType::InitDialog(LPARAM lParam) m_AniPack->SetOffset(0);
- if (opt.AnimateSel) SetTimer(m_hwndDialog, 1, 100, NULL);
+ if (opt.AnimateSel) SetTimer(m_hwndDialog, 1, 100, nullptr);
//add tooltips
m_hToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"",
- TTS_NOPREFIX | WS_POPUP, 0, 0, 0, 0, m_hwndDialog, NULL, g_hInst, NULL);
+ TTS_NOPREFIX | WS_POPUP, 0, 0, 0, 0, m_hwndDialog, nullptr, g_hInst, nullptr);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
@@ -750,23 +750,23 @@ void __cdecl SmileyToolThread(void *arg) wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 4;
wndclass.hInstance = g_hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hIcon = nullptr;
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = CreateSolidBrush(opt.SelWndBkgClr);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = L"SmileyTool";
- wndclass.hIconSm = NULL;
+ wndclass.hIconSm = nullptr;
RegisterClassEx(&wndclass);
- CreateWindowEx(WS_EX_TOPMOST | WS_EX_NOPARENTNOTIFY, L"SmileyTool", NULL,
+ CreateWindowEx(WS_EX_TOPMOST | WS_EX_NOPARENTNOTIFY, L"SmileyTool", nullptr,
WS_BORDER | WS_POPUP | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- ((SmileyToolWindowParam*)arg)->hWndParent, NULL, g_hInst, arg);
+ ((SmileyToolWindowParam*)arg)->hWndParent, nullptr, g_hInst, arg);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
MSG msg;
- while (GetMessage(&msg, NULL, 0, 0)) {
+ while (GetMessage(&msg, nullptr, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index aa377760a7..dc4d23e635 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -22,7 +22,7 @@ int CheckBayes() if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
hBayesFolder = FoldersRegisterCustomPath(PLUGIN_NAME, Translate("Bayes database path"), bayesdb_tmp);
- } else hBayesFolder = 0;
+ } else hBayesFolder = nullptr;
if (hBayesFolder)
FoldersGetCustomPath(hBayesFolder, bayesdb_fullpath, MAX_PATH, bayesdb_tmp);
@@ -62,18 +62,18 @@ int OpenBayes() if (sqlite3_open(bayesdb_fullpath_utf8, &bayesdb) == SQLITE_OK)
{
- sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS spam (token blob(16), num int)", NULL, NULL, &errmsg);
- sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS ham (token blob(16), num int)", NULL, NULL, &errmsg);
- sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS stats (key varchar(32), value int)", NULL, NULL, &errmsg);
- sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS queue (contact int, msgtime int, message text)", NULL, NULL, &errmsg);
- sqlite3_prepare_v2(bayesdb, "SELECT count(1) FROM stats WHERE key='spam_msgcount' OR key='ham_msgcount'", -1, &stmt, NULL);
+ sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS spam (token blob(16), num int)", nullptr, nullptr, &errmsg);
+ sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS ham (token blob(16), num int)", nullptr, nullptr, &errmsg);
+ sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS stats (key varchar(32), value int)", nullptr, nullptr, &errmsg);
+ sqlite3_exec(bayesdb, "CREATE TABLE IF NOT EXISTS queue (contact int, msgtime int, message text)", nullptr, nullptr, &errmsg);
+ sqlite3_prepare_v2(bayesdb, "SELECT count(1) FROM stats WHERE key='spam_msgcount' OR key='ham_msgcount'", -1, &stmt, nullptr);
if (sqlite3_step(stmt) == SQLITE_ROW)
if (sqlite3_column_int(stmt, 0) != 2) {
- sqlite3_exec(bayesdb, "INSERT INTO stats VALUES ('spam_msgcount', 0)", NULL, NULL, NULL);
- sqlite3_exec(bayesdb, "INSERT INTO stats VALUES ('ham_msgcount', 0)", NULL, NULL, NULL);
+ sqlite3_exec(bayesdb, "INSERT INTO stats VALUES ('spam_msgcount', 0)", nullptr, nullptr, nullptr);
+ sqlite3_exec(bayesdb, "INSERT INTO stats VALUES ('ham_msgcount', 0)", nullptr, nullptr, nullptr);
}
} else {
- MessageBoxA(NULL, bayesdb_fullpath_utf8, "Can't open database", MB_OK);
+ MessageBoxA(nullptr, bayesdb_fullpath_utf8, "Can't open database", MB_OK);
}
mir_free(bayesdb_fullpath_utf8);
@@ -87,8 +87,8 @@ int OpenBayes() bayesdb_fullpath_utf8 = mir_utf8encode(bayesdb_fullpath);
if (sqlite3_open(bayesdb_fullpath_utf8, &bayesdbg) == SQLITE_OK)
{
- sqlite3_exec(bayesdbg, "CREATE TABLE spam (token varchar(50), num int)", NULL, NULL, &errmsg);
- sqlite3_exec(bayesdbg, "CREATE TABLE ham (token varchar(50), num int)", NULL, NULL, &errmsg);
+ sqlite3_exec(bayesdbg, "CREATE TABLE spam (token varchar(50), num int)", nullptr, nullptr, &errmsg);
+ sqlite3_exec(bayesdbg, "CREATE TABLE ham (token varchar(50), num int)", nullptr, nullptr, &errmsg);
}
mir_free(bayesdb_fullpath_utf8);
#endif
@@ -108,10 +108,10 @@ int get_token_count(int type) int count = 0;
sqlite3_stmt *stmt;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
return 0;
mir_snprintf(q, "SELECT COUNT(1) FROM %s", type == SPAM ? "spam" : "ham");
- sqlite3_prepare_v2(bayesdb, q, -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, q, -1, &stmt, nullptr);
if (sqlite3_step(stmt) == SQLITE_ROW) {
count = sqlite3_column_int(stmt, 0);
}
@@ -124,10 +124,10 @@ int get_msg_count(int type) int count = 0;
sqlite3_stmt *stmt;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
return 0;
- sqlite3_prepare_v2(bayesdb, "SELECT value FROM stats WHERE key=?", -1, &stmt, NULL);
- sqlite3_bind_text(stmt, 1, type == SPAM ? "spam_msgcount" : "ham_msgcount", type == SPAM ? 13 : 12, NULL);
+ sqlite3_prepare_v2(bayesdb, "SELECT value FROM stats WHERE key=?", -1, &stmt, nullptr);
+ sqlite3_bind_text(stmt, 1, type == SPAM ? "spam_msgcount" : "ham_msgcount", type == SPAM ? 13 : 12, nullptr);
if (sqlite3_step(stmt) == SQLITE_ROW) {
count = sqlite3_column_int(stmt, 0);
}
@@ -163,12 +163,12 @@ int get_token_score(int type, char *token) BYTE digest[16];
sqlite3_stmt *stmt;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
return 0;
mir_snprintf(sql, "SELECT num FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
tokenhash(token, digest);
- sqlite3_prepare_v2(bayesdb, sql, -1, &stmt, NULL);
- sqlite3_bind_blob(stmt, 1, digest, 16, NULL);
+ sqlite3_prepare_v2(bayesdb, sql, -1, &stmt, nullptr);
+ sqlite3_bind_blob(stmt, 1, digest, 16, nullptr);
if (sqlite3_step(stmt) == SQLITE_ROW) {
score = sqlite3_column_int(stmt, 0);
@@ -181,10 +181,10 @@ double get_msg_score(wchar_t *msg) {
char *message, *token;
double spam_prob, ham_prob, tmp1 = 1, tmp2 = 1;
- double *scores = NULL;
+ double *scores = nullptr;
int spam_msgcount, ham_msgcount, n = 0, i;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
return 0;
message = mir_u2a(msg);
@@ -194,7 +194,7 @@ double get_msg_score(wchar_t *msg) while (token)
{
if (!is_token_valid(token)) {
- token = strtok(NULL, DELIMS);
+ token = strtok(nullptr, DELIMS);
continue;
}
scores = (double*)realloc(scores, sizeof(double)*(n + 1));
@@ -207,7 +207,7 @@ double get_msg_score(wchar_t *msg) ham_prob = ham_prob > 1.0 ? 1.0 : (ham_prob < 0.01 ? 0.01 : ham_prob);
scores[n++] = spam_prob / (spam_prob + ham_prob);
- token = strtok(NULL, DELIMS);
+ token = strtok(nullptr, DELIMS);
}
for (i = 0; i < n; i++) {
@@ -231,14 +231,14 @@ void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message) if (_getOptB("BayesEnabled", defaultBayesEnabled) == 0)
return;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
OpenBayes();
- sqlite3_prepare_v2(bayesdb, "INSERT INTO queue VALUES(?,?,?)", -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, "INSERT INTO queue VALUES(?,?,?)", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, (DWORD)hContact);
sqlite3_bind_int(stmt, 2, msgtime);
tmp = mir_u2a(message);
- sqlite3_bind_text(stmt, 3, tmp, (int)mir_strlen(tmp), NULL);
+ sqlite3_bind_text(stmt, 3, tmp, (int)mir_strlen(tmp), nullptr);
sqlite3_step(stmt);
mir_free(tmp);
sqlite3_finalize(stmt);
@@ -251,10 +251,10 @@ void bayes_approve_contact(MCONTACT hContact) int d = 0;
sqlite3_stmt *stmt;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
return;
- sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE contact=?", -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE contact=?", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, (DWORD)hContact);
while (sqlite3_step(stmt) == SQLITE_ROW)
{
@@ -266,7 +266,7 @@ void bayes_approve_contact(MCONTACT hContact) }
sqlite3_finalize(stmt);
if (d) {
- sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE contact=?", -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE contact=?", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, (DWORD)hContact);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
@@ -276,16 +276,16 @@ void bayes_approve_contact(MCONTACT hContact) void dequeue_messages()
{
- time_t t = time(NULL);
+ time_t t = time(nullptr);
sqlite3_stmt *stmt;
const char *message;
wchar_t *messageW;
int d = 0;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
return;
- sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE msgtime + ? < ?", -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE msgtime + ? < ?", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, _getOptD("BayesWaitApprove", defaultBayesWaitApprove)*86400);
sqlite3_bind_int(stmt, 2, (DWORD)t);
while (sqlite3_step(stmt) == SQLITE_ROW) {
@@ -297,7 +297,7 @@ void dequeue_messages() }
sqlite3_finalize(stmt);
if (d) {
- sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE msgtime + ? < ?", -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE msgtime + ? < ?", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, _getOptD("BayesWaitApprove", defaultBayesWaitApprove)*86400);
sqlite3_bind_int(stmt, 2, (DWORD)t);
sqlite3_step(stmt);
@@ -318,7 +318,7 @@ void learn(int type, wchar_t *msg) if (_getOptB("BayesEnabled", defaultBayesEnabled) == 0)
return;
- if (bayesdb == NULL)
+ if (bayesdb == nullptr)
OpenBayes();
message = mir_u2a(msg);
@@ -328,49 +328,49 @@ void learn(int type, wchar_t *msg) mir_snprintf(sql_update, "UPDATE %s SET num=num+1 WHERE token=?", type ? "spam" : "ham");
mir_snprintf(sql_insert, "INSERT INTO %s VALUES(?, 1)", type ? "spam" : "ham");
#ifdef _DEBUG
- sqlite3_exec(bayesdbg, "BEGIN", NULL, NULL, NULL);
+ sqlite3_exec(bayesdbg, "BEGIN", nullptr, nullptr, nullptr);
#endif
- sqlite3_exec(bayesdb, "BEGIN", NULL, NULL, NULL);
+ sqlite3_exec(bayesdb, "BEGIN", nullptr, nullptr, nullptr);
while (tok) {
if (!is_token_valid(tok)) {
- tok = strtok(NULL, DELIMS);
+ tok = strtok(nullptr, DELIMS);
continue;
}
tokenhash(tok, digest);
- sqlite3_prepare_v2(bayesdb, sql_select, -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, sql_select, -1, &stmt, nullptr);
sqlite3_bind_blob(stmt, 1, digest, 16, SQLITE_STATIC);
if (SQLITE_ROW == sqlite3_step(stmt)) {
sqlite3_finalize(stmt);
- sqlite3_prepare_v2(bayesdb, sql_update, -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, sql_update, -1, &stmt, nullptr);
} else {
sqlite3_finalize(stmt);
- sqlite3_prepare_v2(bayesdb, sql_insert, -1, &stmt, NULL);
+ sqlite3_prepare_v2(bayesdb, sql_insert, -1, &stmt, nullptr);
}
sqlite3_bind_blob(stmt, 1, digest, 16, SQLITE_STATIC);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
#ifdef _DEBUG
- sqlite3_prepare_v2(bayesdbg, sql_select, -1, &stmtdbg, NULL);
- sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), NULL);
+ sqlite3_prepare_v2(bayesdbg, sql_select, -1, &stmtdbg, nullptr);
+ sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), nullptr);
if (SQLITE_ROW == sqlite3_step(stmtdbg)) {
sqlite3_finalize(stmtdbg);
- sqlite3_prepare_v2(bayesdbg, sql_update, -1, &stmtdbg, NULL);
+ sqlite3_prepare_v2(bayesdbg, sql_update, -1, &stmtdbg, nullptr);
} else {
sqlite3_finalize(stmtdbg);
- sqlite3_prepare_v2(bayesdbg, sql_insert, -1, &stmtdbg, NULL);
+ sqlite3_prepare_v2(bayesdbg, sql_insert, -1, &stmtdbg, nullptr);
}
sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), SQLITE_STATIC);
sqlite3_step(stmtdbg);
sqlite3_finalize(stmtdbg);
#endif
- tok = strtok(NULL, DELIMS);
+ tok = strtok(nullptr, DELIMS);
}
- sqlite3_exec(bayesdb, sql_counter, NULL, NULL, NULL);
- sqlite3_exec(bayesdb, "COMMIT", NULL, NULL, NULL);
+ sqlite3_exec(bayesdb, sql_counter, nullptr, nullptr, nullptr);
+ sqlite3_exec(bayesdb, "COMMIT", nullptr, nullptr, nullptr);
#ifdef _DEBUG
- sqlite3_exec(bayesdbg, "COMMIT", NULL, NULL, NULL);
+ sqlite3_exec(bayesdbg, "COMMIT", nullptr, nullptr, nullptr);
#endif
mir_free(message);
}
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 1c528f9d52..f4d4733a49 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -83,7 +83,7 @@ BOOL _saveDlgItemScore(HWND hDialog, int controlID, char* option) len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
- _setOptD(option, wcstod(tmp, NULL)/SCORE_C);
+ _setOptD(option, wcstod(tmp, nullptr)/SCORE_C);
return TRUE;
}
@@ -374,7 +374,7 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP break;
}
if (_saveDlgItemResponse(optDlg, IDC_OPT_RESPONSE, "Response") == -1) {
- MessageBox(NULL, TranslateT("Invalid regular expression.\nKeeping previous value."), L"Error", MB_OK);
+ MessageBox(nullptr, TranslateT("Invalid regular expression.\nKeeping previous value."), L"Error", MB_OK);
return FALSE;
}
_saveDlgItemText(optDlg, IDC_OPT_SUCCESS_RESPONSE, "SuccessResponse");
@@ -521,7 +521,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
mir_snprintf(cbuf, "%0.04f", get_msg_score(dbuf));
SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, L"");
- MessageBoxA(NULL, cbuf, Translate("Message score"), MB_OK);
+ MessageBoxA(nullptr, cbuf, Translate("Message score"), MB_OK);
free(dbuf);
return FALSE;
@@ -579,7 +579,7 @@ int OnOptInitialize(WPARAM wParam, LPARAM) odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_POPUPS);
odp.pfnDlgProc = DlgProcOptionsPopups;
odp.szGroup.a = LPGEN("Popups");
- odp.szTab.a = NULL;
+ odp.szTab.a = nullptr;
Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/plugins/Spamotron/src/popups.cpp b/plugins/Spamotron/src/popups.cpp index 27bc8f392b..a5f6afde33 100644 --- a/plugins/Spamotron/src/popups.cpp +++ b/plugins/Spamotron/src/popups.cpp @@ -108,9 +108,9 @@ INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wParam, LPAR return FALSE;
break;
case IDC_OPT_POPUPS_PREVIEW:
- ShowPopupPreview(optDlg, POPUP_BLOCKED, NULL, TranslateT("Message blocked due to preview action"));
- ShowPopupPreview(optDlg, POPUP_APPROVED, NULL, TranslateT("Contact approved due to preview action"));
- ShowPopupPreview(optDlg, POPUP_CHALLENGE, NULL, TranslateT("Challenge sent to preview contact"));
+ ShowPopupPreview(optDlg, POPUP_BLOCKED, nullptr, TranslateT("Message blocked due to preview action"));
+ ShowPopupPreview(optDlg, POPUP_APPROVED, nullptr, TranslateT("Contact approved due to preview action"));
+ ShowPopupPreview(optDlg, POPUP_CHALLENGE, nullptr, TranslateT("Challenge sent to preview contact"));
return FALSE;
}
SendMessage(GetParent(optDlg), PSM_CHANGED, 0, 0);
@@ -155,19 +155,19 @@ int ShowPopupPreview(HWND optDlg, BYTE popupType, wchar_t *line1, wchar_t *line2 case POPUP_BLOCKED:
ppdp.colorText = SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_BLOCKED_FOREGROUND,CPM_GETCOLOUR,0,0);
ppdp.colorBack = SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_BLOCKED_BACKGROUND,CPM_GETCOLOUR,0,0);
- ppdp.iSeconds = GetDlgItemInt(optDlg, IDC_OPT_POPUPS_BLOCKED_TIMEOUT, NULL, TRUE);
+ ppdp.iSeconds = GetDlgItemInt(optDlg, IDC_OPT_POPUPS_BLOCKED_TIMEOUT, nullptr, TRUE);
ppdp.lchIcon = Skin_LoadIcon(SKINICON_OTHER_DELETE);
break;
case POPUP_APPROVED:
ppdp.colorText = SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_APPROVED_FOREGROUND,CPM_GETCOLOUR,0,0);
ppdp.colorBack = SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_APPROVED_BACKGROUND,CPM_GETCOLOUR,0,0);
- ppdp.iSeconds = GetDlgItemInt(optDlg, IDC_OPT_POPUPS_APPROVED_TIMEOUT, NULL, TRUE);
+ ppdp.iSeconds = GetDlgItemInt(optDlg, IDC_OPT_POPUPS_APPROVED_TIMEOUT, nullptr, TRUE);
ppdp.lchIcon = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT);
break;
case POPUP_CHALLENGE:
ppdp.colorText = SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_CHALLENGE_FOREGROUND,CPM_GETCOLOUR,0,0);
ppdp.colorBack = SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_CHALLENGE_BACKGROUND,CPM_GETCOLOUR,0,0);
- ppdp.iSeconds = GetDlgItemInt(optDlg, IDC_OPT_POPUPS_CHALLENGE_TIMEOUT, NULL, TRUE);
+ ppdp.iSeconds = GetDlgItemInt(optDlg, IDC_OPT_POPUPS_CHALLENGE_TIMEOUT, nullptr, TRUE);
ppdp.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
break;
}
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 3cf7247c4a..f9462b77e6 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -42,7 +42,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) char protoOption[256] = {0};
int buflen = MAX_BUFFER_LENGTH;
wchar_t buf[MAX_BUFFER_LENGTH];
- wchar_t *challengeW = NULL, *tmpW = NULL;
+ wchar_t *challengeW = nullptr, *tmpW = nullptr;
wchar_t mexpr[64];
int maxmsglen = 0, a, b, i;
BOOL bayesEnabled = _getOptB("BayesEnabled", defaultBayesEnabled);
@@ -59,9 +59,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) /*** Dequeue and learn messages ***/
if (bayesEnabled && _getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
- if (time(NULL) - last_queue_check > 4*3600) { // dequeue every 4 hours
+ if (time(nullptr) - last_queue_check > 4*3600) { // dequeue every 4 hours
dequeue_messages();
- last_queue_check = time(NULL);
+ last_queue_check = time(nullptr);
}
/*** Check for conditional and unconditional approval ***/
@@ -121,9 +121,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) for(a = 4; a > 0; a--)
msgblob += mir_strlen(msgblob)+1;
}
- else msgblob = NULL;
+ else msgblob = nullptr;
- wchar_t *message = NULL;
+ wchar_t *message = nullptr;
if (dbei->flags & DBEF_UTF)
message = mir_utf8decodeW(msgblob);
else
@@ -132,7 +132,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) /*** Check for words in white-list ***/
if (_getOptB("ApproveOnMsgIn", defaultApproveOnMsgIn)) {
wchar_t *whitelist = (wchar_t*)malloc(2048 * sizeof(wchar_t));
- if (whitelist != NULL) {
+ if (whitelist != nullptr) {
_getOptS(whitelist, 2048, "ApproveOnMsgInWordlist", defaultApproveOnMsgInWordlist);
if (_isregex(whitelist)) {
if (_regmatch(message, whitelist))
@@ -140,12 +140,12 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) }
else {
wchar_t *ptok = wcstok(whitelist, L" ");
- while (ptok != NULL) {
+ while (ptok != nullptr) {
if (wcsstr(message, ptok)) {
bCorrectResponse = TRUE;
break;
}
- ptok = wcstok(NULL, L" ");
+ ptok = wcstok(nullptr, L" ");
}
}
free(whitelist);
@@ -205,7 +205,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) break;
case SPAMOTRON_MODE_MATH:
- if (message == NULL)
+ if (message == nullptr)
break;
_itow(_getCOptD(hContact, "ResponseMath", -1), buf, 10);
if (wcsstr(message, buf) && (mir_wstrlen(buf) == mir_wstrlen(message))) {
@@ -227,7 +227,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) T2Utf response(_getOptS(buf, buflen, "SuccessResponse", defaultSuccessResponse));
ProtoChainSend(hContact, PSS_MESSAGE, 0, response);
}
- _notify(hContact, POPUP_APPROVED, TranslateT("Contact %s approved."), NULL);
+ _notify(hContact, POPUP_APPROVED, TranslateT("Contact %s approved."), nullptr);
// Resubmit pending authorization request
if (_getCOptB(hContact, "AuthEventPending", FALSE)) {
@@ -236,7 +236,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) char* szAuthEventModule;
if (db_get(hContact, PLUGIN_NAME, "AuthEvent", &_dbv) == 0) {
DBEVENTINFO *_dbei = (DBEVENTINFO *)malloc(sizeof(DBEVENTINFO));
- if (_dbei != NULL) {
+ if (_dbei != nullptr) {
memcpy(&_dbei->cbBlob, _dbv.pbVal, sizeof(DWORD));
_dbei->eventType = EVENTTYPE_AUTHREQUEST;
_getCOptS(AuthEventModule, 100, hContact, "AuthEventModule", L"ICQ");
@@ -377,7 +377,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) else
_getOptS(challengeW, maxmsglen, "Challenge", defaultChallenge);
_getOptS(buf, buflen, "Response", defaultResponse);
- srand(time(NULL));
+ srand(time(nullptr));
_setCOptD(hContact, "ResponseNum", rand() % get_response_num(buf));
ReplaceVarsNum(challengeW, maxmsglen, _getCOptD(hContact, "ResponseNum", 0));
ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
@@ -407,7 +407,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) db_set_b(hContact, "CList", "Delete", 1);
// Queue user message in Bayes db
- if (bayesEnabled && message != NULL)
+ if (bayesEnabled && message != nullptr)
queue_message(hContact, dbei->timestamp, message);
@@ -421,7 +421,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _setCOptD(hContact, "MsgSentTime", dbei->timestamp);
// Save Last Msg and update SameMsgCount
- if (message != NULL) {
+ if (message != nullptr) {
if (mir_wstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", L""), message) == 0)
_setCOptD(hContact, "SameMsgCount", 1 + _getCOptD(hContact, "SameMsgCount", 0));
else
@@ -429,7 +429,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _setCOptTS(hContact, "LastInMsg", message);
}
- if (message != NULL)
+ if (message != nullptr)
mir_free(message);
// Finally silently save the message to contact history if corresponding option is set
@@ -437,7 +437,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
// Save the request to database so that it can be automatically submitted on user approval
PBYTE eventdata = (PBYTE)malloc(sizeof(DWORD) + dbei->cbBlob);
- if (eventdata != NULL && dbei->cbBlob > 0) {
+ if (eventdata != nullptr && dbei->cbBlob > 0) {
memcpy(eventdata, &dbei->cbBlob, sizeof(DWORD));
memcpy(eventdata + sizeof(DWORD), dbei->pBlob, dbei->cbBlob);
db_set_blob(hContact, PLUGIN_NAME, "AuthEvent", eventdata, sizeof(DWORD) + dbei->cbBlob);
@@ -452,7 +452,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) DWORD dbei_size = 3 * sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule) + 1;
PBYTE eventdata = (PBYTE)malloc(dbei_size);
PBYTE pos = eventdata;
- if (eventdata != NULL && dbei->cbBlob > 0) {
+ if (eventdata != nullptr && dbei->cbBlob > 0) {
if (db_get(hContact, PLUGIN_NAME, "LastMsgEvents", &_dbv) == 0) {
eventdata = (PBYTE)realloc(eventdata, dbei_size + _dbv.cpbVal);
pos = eventdata;
@@ -512,14 +512,14 @@ extern "C" __declspec(dllexport) int Load() mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- srand((unsigned)time(0));
- bayesdb = NULL;
+ srand((unsigned)time(nullptr));
+ bayesdb = nullptr;
if (_getOptB("BayesEnabled", defaultBayesEnabled)) {
if (CheckBayes()) {
OpenBayes();
if (_getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved)) {
dequeue_messages();
- last_queue_check = time(NULL);
+ last_queue_check = time(nullptr);
}
}
}
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index fd963d0aa5..6084dc7a4d 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -4,8 +4,8 @@ wchar_t *_tcstolower(wchar_t *dst) { - if (dst == NULL) - return NULL; + if (dst == nullptr) + return nullptr; SIZE_T dst_len = mir_wstrlen(dst); for (SIZE_T i = 0; i < dst_len; i ++) @@ -15,8 +15,8 @@ wchar_t *_tcstolower(wchar_t *dst) wchar_t *_tcstoupper(wchar_t *dst) { - if (dst == NULL) - return NULL; + if (dst == nullptr) + return nullptr; SIZE_T dst_len = mir_wstrlen(dst); for (SIZE_T i = 0; i < dst_len; i ++) @@ -34,15 +34,15 @@ BOOL _isregex(wchar_t* strSearch) wchar_t regex_parse[] = L"/(.*)/([igsm]*)"; int ovector[9]; - if (strSearch == NULL) + if (strSearch == nullptr) return FALSE; - re = pcre16_compile(regex_parse, 0, &error, &erroroffs, NULL); - if (re == NULL) + re = pcre16_compile(regex_parse, 0, &error, &erroroffs, nullptr); + if (re == nullptr) return FALSE; regex = mir_wstrdup(strSearch); - if (regex == NULL) + if (regex == nullptr) goto err_out; - rc = pcre16_exec(re, NULL, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, nullptr, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); if (rc == 3) ret = TRUE; mir_free(regex); @@ -63,17 +63,17 @@ BOOL _isvalidregex(wchar_t* strSearch) wchar_t regex_parse[] = L"/(.*)/([igsm]*)"; int ovector[9]; - if (strSearch == NULL) + if (strSearch == nullptr) return FALSE; - re = pcre16_compile(regex_parse, 0, &error, &erroroffs, NULL); - if (re == NULL) + re = pcre16_compile(regex_parse, 0, &error, &erroroffs, nullptr); + if (re == nullptr) return FALSE; regex = mir_wstrdup(strSearch); - if (regex == NULL) { + if (regex == nullptr) { pcre16_free(re); return FALSE; } - rc = pcre16_exec(re, NULL, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, nullptr, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); pcre16_free(re); if (rc != 3) goto err_out; @@ -89,8 +89,8 @@ BOOL _isvalidregex(wchar_t* strSearch) if (wcsstr(mod, L"s")) opts |= PCRE_DOTALL; - re = pcre16_compile(regexp, opts, &error, &erroroffs, NULL); - if (re != NULL) { + re = pcre16_compile(regexp, opts, &error, &erroroffs, nullptr); + if (re != nullptr) { pcre16_free(re); ret = TRUE; } @@ -106,22 +106,22 @@ BOOL _regmatch(wchar_t* str, wchar_t* strSearch) pcre16 *re; const char *error; int erroroffs, rc; - wchar_t *regex, *regexp, *data = NULL, *mod; + wchar_t *regex, *regexp, *data = nullptr, *mod; int opts = 0; wchar_t regex_parse[] = L"^/(.*)/([igsm]*)"; int ovector[9]; - if (str == NULL || strSearch == NULL) + if (str == nullptr || strSearch == nullptr) return FALSE; - re = pcre16_compile(regex_parse, 0, &error, &erroroffs, NULL); - if (re == NULL) + re = pcre16_compile(regex_parse, 0, &error, &erroroffs, nullptr); + if (re == nullptr) return FALSE; // [TODO] and log some error regex = mir_wstrdup(strSearch); - if (regex == NULL) { + if (regex == nullptr) { pcre16_free(re); return FALSE; } - rc = pcre16_exec(re, NULL, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, nullptr, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); pcre16_free(re); if (rc != 3) goto err_out; // [TODO] and log some error (better check for valid regex on options save) @@ -131,7 +131,7 @@ BOOL _regmatch(wchar_t* str, wchar_t* strSearch) mod[ovector[5] - ovector[4]] = 0; data = mir_wstrdup(str); - if (data == NULL) + if (data == nullptr) goto err_out; if (wcsstr(mod, L"i")) opts |= PCRE_CASELESS; @@ -140,10 +140,10 @@ BOOL _regmatch(wchar_t* str, wchar_t* strSearch) if (wcsstr(mod, L"s")) opts |= PCRE_DOTALL; - re = pcre16_compile(regexp, opts, &error, &erroroffs, NULL); - if (re == NULL) + re = pcre16_compile(regexp, opts, &error, &erroroffs, nullptr); + if (re == nullptr) goto err_out; - rc = pcre16_exec(re, NULL, data, (int)mir_wstrlen(data), 0, 0, NULL, 0); + rc = pcre16_exec(re, nullptr, data, (int)mir_wstrlen(data), 0, 0, nullptr, 0); pcre16_free(re); if (rc >= 0) ret = TRUE; @@ -164,17 +164,17 @@ int get_response_id(const wchar_t* strvar) wchar_t regex[] = L"^%response([#-_]([0-9]+))?%$"; int ovector[9]; - if (strvar == NULL) + if (strvar == nullptr) return 0; - re = pcre16_compile(regex, 0, &error, &erroroffs, NULL); - if (re == NULL) + re = pcre16_compile(regex, 0, &error, &erroroffs, nullptr); + if (re == nullptr) return 0; // [TODO] and log some error _strvar = mir_wstrdup(strvar); - if (_strvar == NULL) { + if (_strvar == nullptr) { pcre16_free(re); return 0; } - rc = pcre16_exec(re, NULL, _strvar, (int)mir_wstrlen(_strvar), 0, 0, ovector, 9); + rc = pcre16_exec(re, nullptr, _strvar, (int)mir_wstrlen(_strvar), 0, 0, ovector, 9); pcre16_free(re); if (rc < 0) { ret = -1; @@ -193,15 +193,15 @@ int get_response_num(const wchar_t *str) int i = 0; wchar_t *tmp, *strc; - if (str == NULL) + if (str == nullptr) return 0; strc = mir_wstrdup(str); - if (strc == NULL) + if (strc == nullptr) return 0; tmp = wcstok(strc, L"\r\n"); while (tmp) { i ++; - tmp = wcstok(NULL, L"\r\n"); /* Move next. */ + tmp = wcstok(nullptr, L"\r\n"); /* Move next. */ } mir_free(strc); @@ -213,10 +213,10 @@ wchar_t* get_response(wchar_t* dst, unsigned int dstlen, int num) int i = 0; wchar_t *tmp, *src; - if (dst == NULL || dstlen == 0 || num < 0) + if (dst == nullptr || dstlen == 0 || num < 0) return dst; src = (wchar_t*)mir_alloc(MAX_BUFFER_LENGTH * sizeof(wchar_t)); - if (src == NULL) + if (src == nullptr) goto err_out; _getOptS(src, MAX_BUFFER_LENGTH, "Response", defaultResponse); tmp = wcstok(src, L"\r\n"); @@ -227,7 +227,7 @@ wchar_t* get_response(wchar_t* dst, unsigned int dstlen, int num) return dst; } i ++; - tmp = wcstok(NULL, L"\r\n"); /* Move next. */ + tmp = wcstok(nullptr, L"\r\n"); /* Move next. */ } mir_free(src); err_out: @@ -237,19 +237,19 @@ err_out: wchar_t* _tcsstr_cc(wchar_t* str, wchar_t* strSearch, BOOL cc) { - wchar_t *ret = NULL, *_str = NULL, *_strSearch = NULL; + wchar_t *ret = nullptr, *_str = nullptr, *_strSearch = nullptr; if (cc) return wcsstr(str, strSearch); _str = mir_wstrdup(str); - if (_str == NULL) + if (_str == nullptr) goto err_out; _strSearch = mir_wstrdup(strSearch); - if (_strSearch == NULL) + if (_strSearch == nullptr) goto err_out; ret = wcsstr(_tcstolower(_str), _tcstolower(_strSearch)); - if (ret != NULL) + if (ret != nullptr) ret = ((ret - _str) + str); err_out: mir_free(_str); @@ -261,16 +261,16 @@ err_out: BOOL Contains(wchar_t* dst, wchar_t* src) // Checks for occurence of substring from src in dst { BOOL ret = FALSE; - wchar_t *tsrc = NULL, *tdst = NULL, *token, *token_end; + wchar_t *tsrc = nullptr, *tdst = nullptr, *token, *token_end; SIZE_T dst_len; - if (dst == NULL || src == NULL) + if (dst == nullptr || src == nullptr) return FALSE; tsrc = mir_wstrdup(src); - if (tsrc == NULL) + if (tsrc == nullptr) goto err_out; tdst = mir_wstrdup(dst); - if (tdst == NULL) + if (tdst == nullptr) goto err_out; tdst = _tcstoupper(tdst); dst_len = mir_wstrlen(tdst); @@ -291,7 +291,7 @@ BOOL Contains(wchar_t* dst, wchar_t* src) // Checks for occurence of substring f ret = TRUE; break; } - token = wcstok(NULL, L","); /* Move next. */ + token = wcstok(nullptr, L","); /* Move next. */ } err_out: mir_free(tsrc); @@ -326,15 +326,15 @@ wchar_t* ReplaceVar(wchar_t *dst, unsigned int len, const wchar_t *var, const wc wchar_t *var_start; SIZE_T dst_len, var_len, rvar_len; - if (dst == NULL || var == NULL || rvar == NULL) - return NULL; + if (dst == nullptr || var == nullptr || rvar == nullptr) + return nullptr; dst_len = mir_wstrlen(dst); var_len = mir_wstrlen(var); rvar_len = mir_wstrlen(rvar); var_start = wcsstr(dst, var); while (var_start) { if (len < (dst_len + rvar_len - var_len + 1)) - return NULL; /* Out of buf space. */ + return nullptr; /* Out of buf space. */ memmove((var_start + rvar_len), (var_start + var_len), (((dst + dst_len + 1) - (var_start + var_len)) * sizeof(wchar_t))); @@ -362,34 +362,34 @@ wchar_t* ReplaceVarsNum(wchar_t *dst, unsigned int len, int num) pcre16 *re; const char *error; int erroroffs, rc; - wchar_t *_str, *tmp, **r = NULL, **tr, *ttmp, *dstcopy; + wchar_t *_str, *tmp, **r = nullptr, **tr, *ttmp, *dstcopy; wchar_t regex[] = L"%response([#-_]([0-9]+))?%"; int ovector[9]; - re = pcre16_compile(regex, 0, &error, &erroroffs, NULL); - if (re == NULL) + re = pcre16_compile(regex, 0, &error, &erroroffs, nullptr); + if (re == nullptr) return FALSE; // [TODO] and log some error _getOptS(response, _countof(response), "Response", defaultResponse); ttmp = wcstok(response, L"\r\n"); - for (i = 0; ttmp != NULL; i ++) { + for (i = 0; ttmp != nullptr; i ++) { tr = (wchar_t**)mir_realloc(r, ((i + 1) * sizeof(wchar_t*))); - if (tr == NULL) + if (tr == nullptr) goto err_out; r = tr; r[i] = ttmp; - ttmp = wcstok(NULL, L"\r\n"); /* Move next. */ + ttmp = wcstok(nullptr, L"\r\n"); /* Move next. */ } do { _str = mir_wstrdup(dst); dstcopy = mir_wstrdup(dst); - if (_str == NULL || dstcopy == NULL) { + if (_str == nullptr || dstcopy == nullptr) { mir_free(_str); mir_free(dstcopy); goto err_out; } - rc = pcre16_exec(re, NULL, _str, (int)mir_wstrlen(_str), 0, 0, ovector, 9); + rc = pcre16_exec(re, nullptr, _str, (int)mir_wstrlen(_str), 0, 0, ovector, 9); if (rc < 0) { ret = -1; } else if (rc == 3) { @@ -432,7 +432,7 @@ int _notify(MCONTACT hContact, BYTE type, wchar_t *message, wchar_t *origmessage if (_getOptB("LogActions", defaultLogActions)) { tmp = mir_u2a(msg); tmporig = mir_u2a(origmessage); - LogToSystemHistory(tmp, origmessage ? tmporig : NULL); + LogToSystemHistory(tmp, origmessage ? tmporig : nullptr); mir_free(tmp); mir_free(tmporig); } @@ -440,15 +440,15 @@ int _notify(MCONTACT hContact, BYTE type, wchar_t *message, wchar_t *origmessage if (_NOTIFYP) { if (type == POPUP_BLOCKED) { if (_getOptB("NotifyPopupBlocked", defaultNotifyPopupBlocked)) - ShowPopup(hContact, type, NULL, msg); + ShowPopup(hContact, type, nullptr, msg); } else if (type == POPUP_APPROVED) { if (_getOptB("NotifyPopupApproved", defaultNotifyPopupApproved)) - ShowPopup(hContact, type, NULL, msg); + ShowPopup(hContact, type, nullptr, msg); } else if (type == POPUP_CHALLENGE) { if (_getOptB("NotifyPopupChallenge", defaultNotifyPopupChallenge)) - ShowPopup(hContact, type, NULL, msg); + ShowPopup(hContact, type, nullptr, msg); } else { - ShowPopup(hContact, type, NULL, msg); + ShowPopup(hContact, type, nullptr, msg); } } return 0; @@ -459,7 +459,7 @@ int LogToSystemHistory(char *message, char *origmessage) char msg[MAX_BUFFER_LENGTH]; time_t tm; - if (message == NULL) + if (message == nullptr) return 0; DBEVENTINFO dbei = {}; diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp index e81e679606..8cc6fd0e20 100644 --- a/plugins/SpellChecker/src/RichEdit.cpp +++ b/plugins/SpellChecker/src/RichEdit.cpp @@ -7,9 +7,9 @@ DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D);
RichEdit::RichEdit(HWND hwnd) :
- m_hwnd(NULL),
- m_ole(NULL),
- m_textDocument(NULL),
+ m_hwnd(nullptr),
+ m_ole(nullptr),
+ m_textDocument(nullptr),
m_stopped(0),
m_undoEnabled(TRUE)
{
@@ -18,12 +18,12 @@ RichEdit::RichEdit(HWND hwnd) : RichEdit::~RichEdit()
{
- SetHWND(NULL);
+ SetHWND(nullptr);
}
bool RichEdit::IsValid() const
{
- return m_ole != NULL;
+ return m_ole != nullptr;
}
HWND RichEdit::GetHWND() const
@@ -33,26 +33,26 @@ HWND RichEdit::GetHWND() const void RichEdit::SetHWND(HWND hwnd)
{
- if (m_textDocument != NULL) {
+ if (m_textDocument != nullptr) {
m_textDocument->Release();
- m_textDocument = NULL;
+ m_textDocument = nullptr;
}
- if (m_ole != NULL) {
+ if (m_ole != nullptr) {
m_ole->Release();
- m_ole = NULL;
+ m_ole = nullptr;
}
m_hwnd = hwnd;
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return;
SendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&m_ole);
- if (m_ole == NULL)
+ if (m_ole == nullptr)
return;
if (m_ole->QueryInterface(IID_ITextDocument, (void**)&m_textDocument) != S_OK)
- m_textDocument = NULL;
+ m_textDocument = nullptr;
}
LRESULT RichEdit::SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam) const
@@ -67,16 +67,16 @@ bool RichEdit::IsReadOnly() const void RichEdit::SuspendUndo()
{
- if (m_textDocument != NULL) {
- m_textDocument->Undo(tomSuspend, NULL);
+ if (m_textDocument != nullptr) {
+ m_textDocument->Undo(tomSuspend, nullptr);
m_undoEnabled = FALSE;
}
}
void RichEdit::ResumeUndo()
{
- if (m_textDocument != NULL) {
- m_textDocument->Undo(tomResume, NULL);
+ if (m_textDocument != nullptr) {
+ m_textDocument->Undo(tomResume, nullptr);
m_undoEnabled = TRUE;
}
}
@@ -123,7 +123,7 @@ void RichEdit::Start() SendMessage(EM_SETSCROLLPOS, 0, (LPARAM)&m_old_scroll_pos);
SendMessage(WM_SETREDRAW, TRUE, 0);
- InvalidateRect(m_hwnd, NULL, FALSE);
+ InvalidateRect(m_hwnd, nullptr, FALSE);
ResumeUndo();
}
@@ -198,12 +198,12 @@ wchar_t* RichEdit::GetText(int start, int end) const if (end <= start)
end = GetTextLength();
- if (m_textDocument != NULL) {
+ if (m_textDocument != nullptr) {
ITextRange *range;
if (m_textDocument->Range(start, end, &range) != S_OK)
return mir_wstrdup(L"");
- BSTR text = NULL;
+ BSTR text = nullptr;
if (FAILED(range->GetText(&text))) {
if (text)
::SysFreeString(text);
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index f74058bcab..a5948d3ec7 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -48,10 +48,10 @@ BOOL ShowAutoReplaceDialog(HWND parent, BOOL modal, data->callback = callback;
data->param = param;
- if (find != NULL)
+ if (find != nullptr)
data->find = find;
- if (replace != NULL)
+ if (replace != nullptr)
data->replace = replace;
if (modal)
@@ -110,7 +110,7 @@ static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP static BOOL CenterParent(HWND hwnd)
{
HWND hwndParent = GetParent(hwnd);
- if (hwndParent == NULL)
+ if (hwndParent == nullptr)
return FALSE;
RECT rect, rectP;
@@ -194,7 +194,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa GetWindowRect(GetDlgItem(hwndDlg, IDC_NEW), &rc_new);
rc_new.right = rc_old.right;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_NEW), NULL, 0, 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_NEW), nullptr, 0, 0,
rc_new.right - rc_new.left, rc_new.bottom - rc_new.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOZORDER);
}
@@ -252,7 +252,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa break;
case IDC_VAR_HELP:
- variables_showhelp(hwndDlg, IDC_NEW, VHF_FULLDLG, NULL, "The wrong word typed by the user");
+ variables_showhelp(hwndDlg, IDC_NEW, VHF_FULLDLG, nullptr, "The wrong word typed by the user");
break;
}
break;
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp index 5eb276939b..ea3449e56d 100644 --- a/plugins/SpellChecker/src/autoreplace.cpp +++ b/plugins/SpellChecker/src/autoreplace.cpp @@ -40,7 +40,7 @@ AutoReplaceMap::AutoReplaceMap(wchar_t *aFilename, Dictionary *dict) void AutoReplaceMap::loadAutoReplaceMap()
{
FILE *file = _wfopen(m_filename, L"rb");
- if (file == NULL)
+ if (file == nullptr)
return;
char tmp[1024];
@@ -53,17 +53,17 @@ void AutoReplaceMap::loadAutoReplaceMap() // Get from
BOOL useVars = FALSE;
char *p;
- if ((p = strstr(tmp, "->")) != NULL) {
+ if ((p = strstr(tmp, "->")) != nullptr) {
*p = '\0';
p += 2;
}
- else if ((p = strstr(tmp, "-V>")) != NULL) {
+ else if ((p = strstr(tmp, "-V>")) != nullptr) {
*p = '\0';
p += 3;
useVars = TRUE;
}
- if (p != NULL) {
+ if (p != nullptr) {
Utf8ToTchar find(tmp);
Utf8ToTchar replace(p);
@@ -89,7 +89,7 @@ void AutoReplaceMap::writeAutoReplaceMap() {
// Create path
wchar_t *p = wcsrchr(m_filename, '\\');
- if (p != NULL) {
+ if (p != nullptr) {
*p = 0;
CreateDirectoryTreeW(m_filename);
*p = '\\';
@@ -97,7 +97,7 @@ void AutoReplaceMap::writeAutoReplaceMap() // Write it
FILE *file = _wfopen(m_filename, L"wb");
- if (file != NULL) {
+ if (file != nullptr) {
map<std::wstring, AutoReplacement>::iterator it = m_replacements.begin();
for (; it != m_replacements.end(); it++) {
AutoReplacement &ar = it->second;
@@ -120,7 +120,7 @@ BOOL AutoReplaceMap::isWordChar(wchar_t c) if (IsNumber(c))
return TRUE;
- if (wcschr(L"-_.!@#$%&*()[]{}<>:?/\\=+", c) != NULL)
+ if (wcschr(L"-_.!@#$%&*()[]{}<>:?/\\=+", c) != nullptr)
return TRUE;
return m_dict->isWordChar(c);
@@ -132,7 +132,7 @@ wchar_t* AutoReplaceMap::autoReplace(const wchar_t * word) scoped_free<wchar_t> from = wcslwr(wcsdup(word));
if (m_replacements.find(from.get()) == m_replacements.end())
- return NULL;
+ return nullptr;
AutoReplacement &ar = m_replacements[from.get()];
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index b5efcd4b29..30ab2b499a 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -368,7 +368,7 @@ protected: mir_snwprintf(filename, L"%s\\%s.cdic", userPath, language); FILE *file = _wfopen(filename, L"rb"); - if (file != NULL) { + if (file != nullptr) { char tmp[1024]; int c, pos = 0; while ((c = fgetc(file)) != EOF) { @@ -396,7 +396,7 @@ protected: mir_snwprintf(filename, L"%s\\%s.cdic", userPath, language); FILE *file = _wfopen(filename, L"ab"); - if (file != NULL) { + if (file != nullptr) { char tmp[1024]; toHunspell(tmp, word, _countof(tmp)); fprintf(file, "%s\n", tmp); @@ -417,12 +417,12 @@ protected: void toHunspell(char *hunspellWord, const wchar_t *word, size_t hunspellWordLen) { - WideCharToMultiByte(codePage, 0, word, -1, hunspellWord, (int)hunspellWordLen, NULL, NULL); + WideCharToMultiByte(codePage, 0, word, -1, hunspellWord, (int)hunspellWordLen, nullptr, nullptr); } wchar_t* fromHunspell(const char *hunspellWord) { - int len = MultiByteToWideChar(codePage, 0, hunspellWord, -1, NULL, 0); + int len = MultiByteToWideChar(codePage, 0, hunspellWord, -1, nullptr, 0); WCHAR *ret = (WCHAR *)malloc((len + 1) * sizeof(WCHAR)); MultiByteToWideChar(codePage, 0, hunspellWord, -1, ret, len + 1); return ret; @@ -430,8 +430,8 @@ protected: wchar_t* fromHunspellAndFree(char *hunspellWord) { - if (hunspellWord == NULL) - return NULL; + if (hunspellWord == nullptr) + return nullptr; wchar_t *ret = fromHunspell(hunspellWord); free(hunspellWord); @@ -444,7 +444,7 @@ public: mir_wstrncpy(language, aLanguage, _countof(language)); mir_wstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension)); mir_wstrncpy(userPath, anUserPath, _countof(userPath)); - if (aSource == NULL) + if (aSource == nullptr) source[0] = '\0'; else mir_wstrncpy(source, aSource, _countof(source)); @@ -453,24 +453,24 @@ public: localized_name[0] = '\0'; english_name[0] = '\0'; full_name[0] = '\0'; - hunspell = NULL; - wordChars = NULL; + hunspell = nullptr; + wordChars = nullptr; codePage = CP_ACP; - autoReplace = NULL; + autoReplace = nullptr; } virtual ~HunspellDictionary() { - if (hunspell != NULL) + if (hunspell != nullptr) delete hunspell; - if (wordChars != NULL) + if (wordChars != nullptr) free(wordChars); } wchar_t * merge(wchar_t * s1, wchar_t *s2) { - int len1 = (s1 == NULL ? 0 : mir_wstrlen(s1)); - int len2 = (s2 == NULL ? 0 : mir_wstrlen(s2)); + int len1 = (s1 == nullptr ? 0 : mir_wstrlen(s1)); + int len2 = (s2 == nullptr ? 0 : mir_wstrlen(s2)); wchar_t *ret; if (len1 > 0 && len2 > 0) { @@ -556,11 +556,11 @@ public: wordChars = merge(merge(casechars, hwordchars), try_string); // Make a suggestion to load hunspell internalls - char ** words = NULL; + char ** words = nullptr; int count = hunspell->suggest(&words, "asdf"); for (int i = 0; i < count; i++) free(words[i]); - if (words != NULL) + if (words != nullptr) free(words); loadCustomDict(); @@ -586,7 +586,7 @@ public: // Return a list of suggestions to a word virtual Suggestions suggest(const wchar_t * word) { - Suggestions ret = { 0 }; + Suggestions ret = {}; load(); if (loaded != LANGUAGE_LOADED) @@ -595,10 +595,10 @@ public: char hunspell_word[1024]; toHunspell(hunspell_word, word, _countof(hunspell_word)); - char ** words = NULL; + char ** words = nullptr; ret.count = hunspell->suggest(&words, hunspell_word); - if (ret.count > 0 && words != NULL) { + if (ret.count > 0 && words != nullptr) { // Oki, lets make our array ret.words = (wchar_t **)malloc(ret.count * sizeof(wchar_t *)); for (unsigned i = 0; i < ret.count; i++) { @@ -606,7 +606,7 @@ public: free(words[i]); } } - if (words != NULL) + if (words != nullptr) free(words); return ret; @@ -615,7 +615,7 @@ public: // Return a list of auto suggestions to a word virtual Suggestions autoSuggest(const wchar_t * word) { - Suggestions ret = { 0 }; + Suggestions ret = {}; load(); if (loaded != LANGUAGE_LOADED) @@ -648,7 +648,7 @@ public: { load(); if (loaded != LANGUAGE_LOADED) - return NULL; + return nullptr; char hunspell_word[1024]; toHunspell(hunspell_word, word, _countof(hunspell_word)); @@ -657,7 +657,7 @@ public: int count = hunspell->suggest(&words, hunspell_word); if (count <= 0) - return NULL; + return nullptr; wchar_t *ret = fromHunspell(words[0]); @@ -679,7 +679,7 @@ public: if (loaded != LANGUAGE_LOADED) return TRUE; - return wcschr(wordChars, c) != NULL; + return wcschr(wordChars, c) != nullptr; } // Assert that all needed data is loaded @@ -725,7 +725,7 @@ LIST<Dictionary> *tmp_dicts; // To get the names of the languages BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { - wchar_t *stopped = NULL; + wchar_t *stopped = nullptr; USHORT langID = (USHORT)wcstol(lpLocaleString, &stopped, 16); wchar_t ini[32]; @@ -782,7 +782,7 @@ void GetDictsInfo(LIST<Dictionary> &dicts) DBVARIANT dbv; char lang[128]; - WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), nullptr, nullptr); if (!db_get_ws(NULL, MODULE_NAME, lang, &dbv)) { mir_wstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name)); db_free(&dbv); @@ -864,7 +864,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, wchar_t *path, w void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *user_path) { // Get miranda folder dicts - GetHunspellDictionariesFromFolder(dicts, path, user_path, NULL); + GetHunspellDictionariesFromFolder(dicts, path, user_path, nullptr); if (opts.use_other_apps_dicts) { // Get other apps dicts @@ -872,11 +872,11 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use wchar_t key[1024]; mir_snwprintf(key, APPPATH, otherHunspellApps[i].key); - HKEY hKey = 0; + HKEY hKey = nullptr; LONG lResult = 0; if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &hKey)) { DWORD size = _countof(key); - lResult = RegQueryValueEx(hKey, L"Path", NULL, NULL, (LPBYTE)key, &size); + lResult = RegQueryValueEx(hKey, L"Path", nullptr, nullptr, (LPBYTE)key, &size); RegCloseKey(hKey); } else { @@ -884,13 +884,13 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use lResult = RegOpenKeyEx(HKEY_CURRENT_USER, MUICACHE, 0, KEY_QUERY_VALUE, &hKey); if (ERROR_SUCCESS == lResult) { DWORD numValues; - if (ERROR_SUCCESS != RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &numValues, NULL, NULL, NULL, NULL)) + if (ERROR_SUCCESS != RegQueryInfoKey(hKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &numValues, nullptr, nullptr, nullptr, nullptr)) numValues = 0; lResult = ERROR_NO_MORE_ITEMS; for (DWORD local = 0; local < numValues; local++) { DWORD cchValue = _countof(key); - if (ERROR_SUCCESS != RegEnumValue(hKey, local, key, &cchValue, NULL, NULL, NULL, NULL)) + if (ERROR_SUCCESS != RegEnumValue(hKey, local, key, &cchValue, nullptr, nullptr, nullptr, nullptr)) break; key[cchValue] = 0; wchar_t *pos; @@ -955,6 +955,6 @@ void FreeSuggestions(Suggestions &suggestions) free(suggestions.words); - suggestions.words = NULL; + suggestions.words = nullptr; suggestions.count = 0; } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 578d36c88f..5dd5db0a0d 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -140,7 +140,7 @@ static void DrawItem(LPDRAWITEMSTRUCT lpdis, Dictionary *dict) HICON hFlag = IcoLib_GetIconByHandle(dict->hIcolib);
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - ICON_SIZE) / 2;
- DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, nullptr, DI_NORMAL);
rc.left += ICON_SIZE + 4;
@@ -343,7 +343,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1) AutoreplaceData *data = (AutoreplaceData *)SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_GETITEMDATA, sel, 0);
wchar_t find[256];
- const wchar_t *replace = NULL;
+ const wchar_t *replace = nullptr;
BOOL useVariables = FALSE;
if (item < 0)
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 4726369e2b..935749e4ac 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -39,13 +39,13 @@ HINSTANCE hInst; int hLangpack = 0; -HANDLE hDictionariesFolder = NULL; +HANDLE hDictionariesFolder = nullptr; wchar_t *dictionariesFolder; -HANDLE hCustomDictionariesFolder = NULL; +HANDLE hCustomDictionariesFolder = nullptr; wchar_t *customDictionariesFolder; -HANDLE hFlagsDllFolder = NULL; +HANDLE hFlagsDllFolder = nullptr; wchar_t *flagsDllFolder; HBITMAP hCheckedBmp; @@ -135,12 +135,12 @@ static int ModulesLoaded(WPARAM, LPARAM) // Load flags dll wchar_t flag_file[MAX_PATH]; mir_snwprintf(flag_file, L"%s\\flags_icons.dll", flagsDllFolder); - HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE); + HMODULE hFlagsDll = LoadLibraryEx(flag_file, nullptr, LOAD_LIBRARY_AS_DATAFILE); wchar_t path[MAX_PATH]; GetModuleFileName(hInst, path, MAX_PATH); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE | SIDF_SORTED; sid.section.w = LPGENW("Spell Checker") L"/" LPGENW("Flags"); @@ -153,26 +153,26 @@ static int ModulesLoaded(WPARAM, LPARAM) mir_snprintf(lang, "spell_lang_%d", i); sid.pszName = lang; - HICON hFlag = NULL, hFlagIcoLib = NULL; - if (hFlagsDll != NULL) + HICON hFlag = nullptr, hFlagIcoLib = nullptr; + if (hFlagsDll != nullptr) hFlag = (HICON)LoadImage(hFlagsDll, p->language, IMAGE_ICON, 16, 16, 0); - if (hFlag != NULL) { + if (hFlag != nullptr) { sid.hDefaultIcon = hFlag; - sid.defaultFile.w = NULL; + sid.defaultFile.w = nullptr; sid.iDefaultIndex = 0; } else { hFlagIcoLib = IcoLib_GetIcon("spellchecker_unknown"); sid.hDefaultIcon = hFlagIcoLib; - sid.defaultFile.w = NULL; + sid.defaultFile.w = nullptr; sid.iDefaultIndex = 0; } // Oki, lets add to IcoLib, then p->hIcolib = IcoLib_AddIcon(&sid); - if (hFlag != NULL) + if (hFlag != nullptr) DestroyIcon(hFlag); else IcoLib_ReleaseIcon(hFlagIcoLib); @@ -248,7 +248,7 @@ extern "C" int __declspec(dllexport) Load(void) CreateServiceFunction(MS_SPELLCHECKER_REMOVE_RICHEDIT, RemoveContactTextBoxService); CreateServiceFunction(MS_SPELLCHECKER_SHOW_POPUP_MENU, ShowPopupMenuService); - hCheckedBmp = LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CHECK)); + hCheckedBmp = LoadBitmap(nullptr, MAKEINTRESOURCE(OBM_CHECK)); if (GetObject(hCheckedBmp, sizeof(bmpChecked), &bmpChecked) == 0) bmpChecked.bmHeight = bmpChecked.bmWidth = 10; diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 0c62b9e307..57f29e47ff 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -108,7 +108,7 @@ inline BOOL IsURL(wchar_t c) || c == '@' || c == '#';
}
-int FindURLEnd(Dialog *dlg, wchar_t *text, int start_pos, int *checked_until = NULL)
+int FindURLEnd(Dialog *dlg, wchar_t *text, int start_pos, int *checked_until = nullptr)
{
int num_slashes = 0;
int num_ats = 0;
@@ -126,7 +126,7 @@ int FindURLEnd(Dialog *dlg, wchar_t *text, int start_pos, int *checked_until = N num_ats++;
}
- if (checked_until != NULL)
+ if (checked_until != nullptr)
*checked_until = i;
if (num_slashes <= 0 && num_ats <= 0 && num_dots <= 0)
@@ -218,7 +218,7 @@ public: // Has to auto-correct?
if (opts.auto_replace_dict) {
*replacement = dict->autoSuggestOne(text);
- if (*replacement != NULL) {
+ if (*replacement != nullptr) {
*replace = true;
return;
}
@@ -264,7 +264,7 @@ public: virtual void deal(const wchar_t *text, bool*, bool *replace, wchar_t **replacement)
{
*replacement = ar->autoReplace(text);
- if (*replacement != NULL)
+ if (*replacement != nullptr)
*replace = true;
}
};
@@ -356,7 +356,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, bool mark = false;
bool replace = false;
- wchar_t *replacement = NULL;
+ wchar_t *replacement = nullptr;
parser->deal(&text[last_pos], &mark, &replace, &replacement);
if (replace) {
@@ -378,7 +378,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, else if (mark) {
SetUnderline(dlg, sel.cpMin, sel.cpMax);
- if (callback != NULL)
+ if (callback != nullptr)
callback(&text[last_pos], sel, param);
errors++;
@@ -389,7 +389,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, }
// Checks for errors in all text
-int CheckText(Dialog *dlg, BOOL check_all, FoundWrongWordCallback callback = NULL, void *param = NULL)
+int CheckText(Dialog *dlg, BOOL check_all, FoundWrongWordCallback callback = nullptr, void *param = nullptr)
{
int errors = 0;
@@ -433,7 +433,7 @@ int CheckText(Dialog *dlg, BOOL check_all, FoundWrongWordCallback callback = NUL void ToLocaleID(wchar_t *szKLName, size_t size)
{
- wchar_t *stopped = NULL;
+ wchar_t *stopped = nullptr;
USHORT langID = (USHORT)wcstol(szKLName, &stopped, 16);
wchar_t ini[32], end[32];
@@ -466,11 +466,11 @@ int TimerCheck(Dialog *dlg, BOOL forceCheck = FALSE) {
KillTimer(dlg->hwnd, TIMER_ID);
- if (!dlg->enabled || dlg->lang == NULL)
+ if (!dlg->enabled || dlg->lang == nullptr)
return -1;
if (!dlg->lang->isLoaded()) {
- SetTimer(dlg->hwnd, TIMER_ID, 500, NULL);
+ SetTimer(dlg->hwnd, TIMER_ID, 500, nullptr);
return -1;
}
@@ -517,7 +517,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Schedule to re-parse
KillTimer(dlg->hwnd, TIMER_ID);
- SetTimer(dlg->hwnd, TIMER_ID, 100, NULL);
+ SetTimer(dlg->hwnd, TIMER_ID, 100, nullptr);
dlg->changed = TRUE;
}
@@ -534,7 +534,7 @@ void ToggleEnabled(Dialog *dlg) SetNoUnderline(dlg);
else {
dlg->changed = TRUE;
- SetTimer(dlg->hwnd, TIMER_ID, 100, NULL);
+ SetTimer(dlg->hwnd, TIMER_ID, 100, nullptr);
}
if (dlg->srmm)
@@ -548,7 +548,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return -1;
Dialog *dlg = dlgit->second;
- if (dlg == NULL)
+ if (dlg == nullptr)
return -1;
// Hotkey support
@@ -584,14 +584,14 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Need to do that to avoid changing the word while typing
KillTimer(hwnd, TIMER_ID);
- SetTimer(hwnd, TIMER_ID, 1000, NULL);
+ SetTimer(hwnd, TIMER_ID, 1000, nullptr);
dlg->changed = TRUE;
if (!deleting && (lParam & 0xFF) > 1) // Repeat rate
break;
- if (!dlg->enabled || dlg->lang == NULL || !dlg->lang->isLoaded())
+ if (!dlg->enabled || dlg->lang == nullptr || !dlg->lang->isLoaded())
break;
// Don't check if field is read-only
@@ -632,7 +632,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
KillTimer(hwnd, TIMER_ID);
- SetTimer(hwnd, TIMER_ID, 100, NULL);
+ SetTimer(hwnd, TIMER_ID, 100, nullptr);
dlg->changed = TRUE;
break;
@@ -644,7 +644,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WMU_DICT_CHANGED:
KillTimer(hwnd, TIMER_ID);
- SetTimer(hwnd, TIMER_ID, 100, NULL);
+ SetTimer(hwnd, TIMER_ID, 100, nullptr);
dlg->changed = TRUE;
break;
@@ -652,7 +652,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WMU_KBDL_CHANGED:
if (opts.auto_locale) {
KillTimer(hwnd, TIMER_ID);
- SetTimer(hwnd, TIMER_ID, 100, NULL);
+ SetTimer(hwnd, TIMER_ID, 100, nullptr);
dlg->changed = TRUE;
@@ -683,7 +683,7 @@ int GetClosestLanguage(wchar_t *lang_name) mir_wstrncpy(lang, lang_name, _countof(lang));
{
wchar_t *p = wcschr(lang, '_');
- if (p != NULL) *p = '\0';
+ if (p != nullptr) *p = '\0';
}
// First check if there is a language that is only the prefix
@@ -695,7 +695,7 @@ int GetClosestLanguage(wchar_t *lang_name) size_t len = mir_wstrlen(lang);
for (i = 0; i < languages.getCount(); i++) {
wchar_t *p = wcschr(languages[i]->language, '_');
- if (p == NULL)
+ if (p == nullptr)
continue;
size_t prefix_len = p - languages[i]->language;
@@ -716,7 +716,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch int caps = (isProtocol ? CallProtoService(group, PS_GETCAPS, PFLAGNUM_4, 0) : 0);
if (caps & PF4_INFOSETTINGSVC) {
- DBCONTACTGETSETTING cgs = { 0 };
+ DBCONTACTGETSETTING cgs = {};
cgs.szModule = group;
cgs.szSetting = setting;
cgs.pValue = &dbv;
@@ -728,7 +728,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch return;
}
- if (dbv.type == DBVT_WCHAR && dbv.ptszVal != NULL) {
+ if (dbv.type == DBVT_WCHAR && dbv.ptszVal != nullptr) {
wchar_t *lang = dbv.ptszVal;
for (int i = 0; i < languages.getCount(); i++) {
@@ -747,7 +747,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch void GetUserLanguageSetting(Dialog *dlg, char *setting)
{
char *proto = GetContactProto(dlg->hContact);
- if (proto == NULL)
+ if (proto == nullptr)
return;
GetUserProtoLanguageSetting(dlg, dlg->hContact, proto, setting);
@@ -834,7 +834,7 @@ void GetContactLanguage(Dialog *dlg) dlg->lang = languages[i];
dlg->lang->load();
}
- else dlg->lang = NULL;
+ else dlg->lang = nullptr;
}
void ModifyIcon(Dialog *dlg)
@@ -857,10 +857,10 @@ void ModifyIcon(Dialog *dlg) INT_PTR AddContactTextBoxService(WPARAM wParam, LPARAM)
{
SPELLCHECKER_ITEM *sci = (SPELLCHECKER_ITEM *)wParam;
- if (sci == NULL || sci->cbSize != sizeof(SPELLCHECKER_ITEM))
+ if (sci == nullptr || sci->cbSize != sizeof(SPELLCHECKER_ITEM))
return -1;
- return AddContactTextBox(sci->hContact, sci->hwnd, sci->window_name, FALSE, NULL);
+ return AddContactTextBox(sci->hContact, sci->hwnd, sci->window_name, FALSE, nullptr);
}
int AddContactTextBox(MCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND hwndOwner)
@@ -894,7 +894,7 @@ int AddContactTextBox(MCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND mir_subclassWindow(dlg->hwnd, EditProc);
dialogs[hwnd] = dlg;
- if (dlg->srmm && hwndOwner != NULL) {
+ if (dlg->srmm && hwndOwner != nullptr) {
dlg->hwnd_owner = hwndOwner;
mir_subclassWindow(dlg->hwnd_owner, OwnerProc);
dialogs[dlg->hwnd_owner] = dlg;
@@ -902,10 +902,10 @@ int AddContactTextBox(MCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND ModifyIcon(dlg);
}
- if (dlg->lang != NULL)
+ if (dlg->lang != nullptr)
dlg->lang->load();
- SetTimer(hwnd, TIMER_ID, 1000, NULL);
+ SetTimer(hwnd, TIMER_ID, 1000, nullptr);
}
return 0;
@@ -918,7 +918,7 @@ void FreePopupData(Dialog *dlg) DESTROY_MENY(dlg->hLanguageSubMenu);
DESTROY_MENY(dlg->hWrongWordsSubMenu);
- if (dlg->wrong_words != NULL) {
+ if (dlg->wrong_words != nullptr) {
for (unsigned i = 0; i < dlg->wrong_words->size(); i++) {
FREE((*dlg->wrong_words)[i].word);
@@ -930,14 +930,14 @@ void FreePopupData(Dialog *dlg) }
delete dlg->wrong_words;
- dlg->wrong_words = NULL;
+ dlg->wrong_words = nullptr;
}
}
INT_PTR RemoveContactTextBoxService(WPARAM wParam, LPARAM)
{
HWND hwnd = (HWND)wParam;
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return -1;
return RemoveContactTextBox(hwnd);
@@ -956,7 +956,7 @@ int RemoveContactTextBox(HWND hwnd) mir_unsubclassWindow(dlg->hwnd_owner, OwnerProc);
dialogs.erase(hwnd);
- if (dlg->hwnd_owner != NULL)
+ if (dlg->hwnd_owner != nullptr)
dialogs.erase(dlg->hwnd_owner);
delete dlg->re;
@@ -1004,7 +1004,7 @@ wchar_t *GetWordUnderPoint(Dialog *dlg, POINT pt, CHARRANGE &sel) {
// Get text
if (dlg->re->GetTextLength() <= 0)
- return NULL;
+ return nullptr;
// Get pos
sel.cpMin = sel.cpMax = dlg->re->GetCharFromPos(pt);
@@ -1014,7 +1014,7 @@ wchar_t *GetWordUnderPoint(Dialog *dlg, POINT pt, CHARRANGE &sel) int first_char;
if (!GetWordCharRange(dlg, sel, text, _countof(text), first_char))
- return NULL;
+ return nullptr;
// copy the word
text[sel.cpMax - first_char] = '\0';
@@ -1058,7 +1058,7 @@ void AppendMenuItem(HMENU hMenu, int id, wchar_t *name, HICON hIcon, BOOL checke void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOOL in_submenu, UINT base)
{
- if (dlg->wrong_words == NULL)
+ if (dlg->wrong_words == nullptr)
dlg->wrong_words = new vector<WrongWordPopupMenuData>(1);
else
dlg->wrong_words->resize(dlg->wrong_words->size() + 1);
@@ -1083,7 +1083,7 @@ void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOO InsertMenu(data.hReplaceSubMenu, 0, MF_BYPOSITION, base + AUTOREPLACE_MENU_ID_BASE + suggestions.count, TranslateT("Other..."));
if (suggestions.count > 0) {
- InsertMenu(data.hReplaceSubMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenu(data.hReplaceSubMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
for (int i = (int)suggestions.count - 1; i >= 0; i--)
InsertMenu(data.hReplaceSubMenu, 0, MF_BYPOSITION, base + AUTOREPLACE_MENU_ID_BASE + i, suggestions.words[i]);
}
@@ -1100,7 +1100,7 @@ void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOO AppendSubmenu(hMenu, hSubMenu, TranslateT("Corrections"));
}
else {
- InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
hSubMenu = hMenu;
}
@@ -1109,7 +1109,7 @@ void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOO }
if (!in_submenu && opts.show_wrong_word) {
- InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
wchar_t text[128];
mir_snwprintf(text, TranslateT("Wrong word: %s"), word);
@@ -1142,12 +1142,12 @@ void AddItemsToMenu(Dialog *dlg, HMENU hMenu, POINT pt, HWND hwndOwner) // Make menu
if (GetMenuItemCount(hMenu) > 0)
- InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
if (languages.getCount() > 0 && dlg->enabled) {
dlg->hLanguageSubMenu = CreatePopupMenu();
- if (dlg->hwnd_menu_owner != NULL)
+ if (dlg->hwnd_menu_owner != nullptr)
mir_subclassWindow(dlg->hwnd_menu_owner, MenuWndProc);
// First add languages
@@ -1162,7 +1162,7 @@ void AddItemsToMenu(Dialog *dlg, HMENU hMenu, POINT pt, HWND hwndOwner) CheckMenuItem(hMenu, 1, MF_BYCOMMAND | (dlg->enabled ? MF_CHECKED : MF_UNCHECKED));
// Get text
- if (dlg->lang != NULL && dlg->enabled) {
+ if (dlg->lang != nullptr && dlg->enabled) {
if (opts.show_all_corrections) {
dlg->hWrongWordsSubMenu = CreatePopupMenu();
@@ -1175,8 +1175,8 @@ void AddItemsToMenu(Dialog *dlg, HMENU hMenu, POINT pt, HWND hwndOwner) else {
CHARRANGE sel;
wchar_t *word = GetWordUnderPoint(dlg, pt, sel);
- if (word != NULL && !dlg->lang->spell(word)) {
- InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ if (word != nullptr && !dlg->lang->spell(word)) {
+ InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
AddMenuForWord(dlg, word, sel, hMenu, FALSE, WORD_MENU_ID_BASE);
}
}
@@ -1194,7 +1194,7 @@ static void AddWordToDictCallback(BOOL canceled, Dictionary *dict, dict->autoReplace->add(find, replace, useVariables);
HWND hwndParent = (HWND)param;
- if (hwndParent != NULL)
+ if (hwndParent != nullptr)
PostMessage(hwndParent, WMU_DICT_CHANGED, 0, 0);
}
@@ -1224,7 +1224,7 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection) ret = TRUE;
}
- else if (selection > 0 && dlg->wrong_words != NULL
+ else if (selection > 0 && dlg->wrong_words != nullptr
&& selection >= WORD_MENU_ID_BASE
&& selection < (dlg->wrong_words->size() + 1) * WORD_MENU_ID_BASE) {
int pos = selection / WORD_MENU_ID_BASE;
@@ -1248,8 +1248,8 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection) else if (selection >= AUTOREPLACE_MENU_ID_BASE && selection < AUTOREPLACE_MENU_ID_BASE + data.suggestions.count + 1) {
selection -= AUTOREPLACE_MENU_ID_BASE;
if (selection == data.suggestions.count) {
- ShowAutoReplaceDialog(dlg->hwnd_owner != NULL ? dlg->hwnd_owner : dlg->hwnd, FALSE,
- dlg->lang, data.word, NULL, FALSE,
+ ShowAutoReplaceDialog(dlg->hwnd_owner != nullptr ? dlg->hwnd_owner : dlg->hwnd, FALSE,
+ dlg->lang, data.word, nullptr, FALSE,
TRUE, &AddWordToDictCallback, dlg->hwnd);
}
else {
@@ -1263,7 +1263,7 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection) if (ret) {
KillTimer(dlg->hwnd, TIMER_ID);
- SetTimer(dlg->hwnd, TIMER_ID, 100, NULL);
+ SetTimer(dlg->hwnd, TIMER_ID, 100, nullptr);
dlg->changed = TRUE;
}
@@ -1275,7 +1275,7 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection) int MsgWindowPopup(WPARAM, LPARAM lParam)
{
MessageWindowPopupData *mwpd = (MessageWindowPopupData *)lParam;
- if (mwpd == NULL || mwpd->uFlags != MSG_WINDOWPOPUP_INPUT)
+ if (mwpd == nullptr || mwpd->uFlags != MSG_WINDOWPOPUP_INPUT)
return 0;
DialogMapType::iterator dlgit = dialogs.find(mwpd->hwnd);
@@ -1298,10 +1298,10 @@ int MsgWindowPopup(WPARAM, LPARAM lParam) INT_PTR ShowPopupMenuService(WPARAM wParam, LPARAM)
{
SPELLCHECKER_POPUPMENU *scp = (SPELLCHECKER_POPUPMENU *)wParam;
- if (scp == NULL || scp->cbSize != sizeof(SPELLCHECKER_POPUPMENU))
+ if (scp == nullptr || scp->cbSize != sizeof(SPELLCHECKER_POPUPMENU))
return -1;
- return ShowPopupMenu(scp->hwnd, scp->hMenu, scp->pt, scp->hwndOwner == NULL ? scp->hwnd : scp->hwndOwner);
+ return ShowPopupMenu(scp->hwnd, scp->hMenu, scp->pt, scp->hwndOwner == nullptr ? scp->hwnd : scp->hwndOwner);
}
int ShowPopupMenu(HWND hwnd, HMENU hMenu, POINT pt, HWND hwndOwner)
@@ -1321,7 +1321,7 @@ int ShowPopupMenu(HWND hwnd, HMENU hMenu, POINT pt, HWND hwndOwner) }
else ScreenToClient(hwnd, &pt);
- BOOL create_menu = (hMenu == NULL);
+ BOOL create_menu = (hMenu == nullptr);
if (create_menu)
hMenu = CreatePopupMenu();
@@ -1330,7 +1330,7 @@ int ShowPopupMenu(HWND hwnd, HMENU hMenu, POINT pt, HWND hwndOwner) // Show menu
ClientToScreen(hwnd, &pt);
- int selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndOwner, NULL);
+ int selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndOwner, nullptr);
// Do action
if (HandleMenuSelection(dlg, selection))
@@ -1345,7 +1345,7 @@ int ShowPopupMenu(HWND hwnd, HMENU hMenu, POINT pt, HWND hwndOwner) int MsgWindowEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
- if (event == NULL)
+ if (event == nullptr)
return 0;
if (event->uType == MSG_WINDOW_EVT_OPEN)
@@ -1360,14 +1360,14 @@ int MsgWindowEvent(WPARAM, LPARAM lParam) int IconPressed(WPARAM hContact, LPARAM lParam)
{
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if (sicd == NULL || mir_strcmp(sicd->szModule, MODULE_NAME) != 0)
+ if (sicd == nullptr || mir_strcmp(sicd->szModule, MODULE_NAME) != 0)
return 0;
if (hContact == NULL)
return 0;
// Find the dialog
- Dialog *dlg = NULL;
+ Dialog *dlg = nullptr;
for (DialogMapType::iterator it = dialogs.begin(); it != dialogs.end(); it++) {
Dialog *p = it->second;
if (p->srmm && p->hContact == hContact) {
@@ -1376,7 +1376,7 @@ int IconPressed(WPARAM hContact, LPARAM lParam) }
}
- if (dlg == NULL)
+ if (dlg == nullptr)
return 0;
if ((sicd->flags & MBCF_RIGHTBUTTON) == 0) {
@@ -1396,14 +1396,14 @@ int IconPressed(WPARAM hContact, LPARAM lParam) for (int i = 0; i < languages.getCount(); i++)
AppendMenu(hMenu, MF_STRING | (languages[i] == dlg->lang ? MF_CHECKED : 0), LANGUAGE_MENU_ID_BASE + i, languages[i]->full_name);
- InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
}
InsertMenu(hMenu, 0, MF_BYPOSITION, 1, TranslateT("Enable spell checking"));
CheckMenuItem(hMenu, 1, MF_BYCOMMAND | (dlg->enabled ? MF_CHECKED : MF_UNCHECKED));
// Show menu
- int selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, dlg->hwnd, NULL);
+ int selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, dlg->hwnd, nullptr);
HandleMenuSelection(dlg, selection);
DestroyMenu(hMenu);
}
@@ -1436,7 +1436,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) GetMenuItemInfo(hMenu, id, FALSE, &mii);
// Make ownerdraw
- ModifyMenu(hMenu, id, mii.fState | MF_BYCOMMAND | MF_OWNERDRAW, id, NULL);
+ ModifyMenu(hMenu, id, mii.fState | MF_BYCOMMAND | MF_OWNERDRAW, id, nullptr);
}
}
break;
@@ -1484,7 +1484,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) HICON hFlag = IcoLib_GetIconByHandle(dict->hIcolib);
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - ICON_SIZE) / 2;
- DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(hFlag);
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);
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index d4cb167508..86b7295749 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -29,8 +29,8 @@ int hLangpack; HGENMENU hSSMenuToggleOnOff;
HANDLE GetIconHandle(char *szIcon);
HANDLE hOptionsInitialize;
-HANDLE hTTBarloaded = NULL;
-HANDLE Buttons = NULL;
+HANDLE hTTBarloaded = nullptr;
+HANDLE Buttons = nullptr;
int InitializeOptions(WPARAM wParam,LPARAM lParam);
int DisablePopup(WPARAM wParam, LPARAM lParam);
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
@@ -91,7 +91,7 @@ INT_PTR StartupSilence() {
InitSettings();
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- mir_forkthread((pThreadFunc)AdvSt, NULL);
+ mir_forkthread((pThreadFunc)AdvSt, nullptr);
CreateServiceFunction(SS_SERVICE_NAME, StartupSilenceEnabled);
CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection);
IsMenu();
@@ -108,7 +108,7 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- if (hTTBarloaded != NULL){
+ if (hTTBarloaded != nullptr){
UnhookEvent(hTTBarloaded);
}
return 0;
@@ -118,7 +118,7 @@ int ModulesLoaded(WPARAM, LPARAM) {
HookEvent(ME_POPUP_FILTER, DisablePopup);
hTTBarloaded = HookEvent(ME_TTB_MODULELOADED, CreateTTButtons);
- if (TTBButtons == 1 && hTTBarloaded != NULL) {
+ if (TTBButtons == 1 && hTTBarloaded != nullptr) {
Icon_Register(hInst, "Toolbar/" MENU_NAME, iconttbList, _countof(iconttbList), MENU_NAME);
RemoveTTButtons();
CreateTTButtons(0,0);
@@ -311,13 +311,13 @@ void UpdateMenu() void UpdateTTB()
{
- if (hTTBarloaded != NULL && TTBButtons == 1)
+ if (hTTBarloaded != nullptr && TTBButtons == 1)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)Buttons, (Enabled == 1 ? 0 : TTBST_PUSHED));
}
static int CreateTTButtons(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = (Enabled == 1 ? 0 : TTBBF_PUSHED) | TTBBF_VISIBLE | TTBBF_ASPUSHBUTTON;
ttb.pszService = SS_SERVICE_NAME;
ttb.hIconHandleDn = GetIconHandle(DISABLE_SILENCETTB);
@@ -379,7 +379,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_SSTIME:
DWORD min;
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return FALSE;
- min = GetDlgItemInt(hwndDlg, IDC_SSTIME, NULL, FALSE);
+ min = GetDlgItemInt(hwndDlg, IDC_SSTIME, nullptr, FALSE);
if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SSTIME)))
SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
delay = (DWORD)db_set_dw(NULL, MODULE_NAME, DelayComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_GETPOS, 0, 0)));
@@ -387,7 +387,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_SSPOPUPTIME:
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return FALSE;
- min = GetDlgItemInt(hwndDlg, IDC_SSPOPUPTIME, NULL, FALSE);
+ min = GetDlgItemInt(hwndDlg, IDC_SSPOPUPTIME, nullptr, FALSE);
if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SSPOPUPTIME)))
SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
PopUpTime = (DWORD)db_set_dw(NULL, MODULE_NAME, PopUpTimeComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_GETPOS, 0, 0)));
@@ -399,7 +399,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DELAY2:
if (!ServiceExists(MS_POPUP_QUERY)) {
- MessageBox(0, NEEDPOPUP, NOTICE, MB_OK);
+ MessageBox(nullptr, NEEDPOPUP, NOTICE, MB_OK);
CheckDlgButton(hwndDlg, IDC_DELAY2, BST_UNCHECKED);
PopUp = (BYTE)db_set_b(NULL, MODULE_NAME, PopUpComp, 0);
}
@@ -412,7 +412,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TTB:
if (!hTTBarloaded) {
- MessageBox(0, NEEDTTBMOD, NOTICE, MB_OK);
+ MessageBox(nullptr, NEEDTTBMOD, NOTICE, MB_OK);
CheckDlgButton(hwndDlg, IDC_TTB, BST_UNCHECKED);
TTBButtons = (BYTE)db_set_b(NULL, MODULE_NAME, TTBButtonsComp, 0);
}
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp index 71805df1c1..aba644ffd4 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp @@ -389,9 +389,9 @@ static int HookWindowsHooks(int hookMiranda, int hookAll) } if (hookAll) { if (monitorKeyboard && hKeyBoardHook == nullptr) - hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, 0, GetCurrentThreadId()); + hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, nullptr, GetCurrentThreadId()); if (monitorMouse && hMouseHook == nullptr) - hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, 0, GetCurrentThreadId()); + hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, nullptr, GetCurrentThreadId()); } return 0; diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp index 7f12d2dfeb..6f5349098e 100644 --- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp +++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp @@ -28,7 +28,7 @@ struct TimerInfo HANDLE hEvent; }; -HANDLE hMainThread = 0; +HANDLE hMainThread = nullptr; unsigned long mainThreadId = 0; HANDLE hConnectionEvent = nullptr; @@ -108,7 +108,7 @@ int KSLoadOptions() UnhookEvent(hStatusChangeHook); UnhookEvent(hCSStatusChangeHook); UnhookEvent(hCSStatusChangeExHook); - hProtoAckHook = hStatusChangeHook = hCSStatusChangeHook = hCSStatusChangeExHook = 0; + hProtoAckHook = hStatusChangeHook = hCSStatusChangeHook = hCSStatusChangeExHook = nullptr; if (IsWindow(hMessageWindow)) DestroyWindow(hMessageWindow); @@ -803,7 +803,7 @@ static void CheckContinueslyFunction(void *) hostent = gethostbyname(host); if (hostent != nullptr) { addr = (DWORD *)(*hostent->h_addr_list); - bLastPingResult = (IcmpSendEcho(hICMPFile, *addr, 0, 0, nullptr, reply, sizeof(ICMP_ECHO_REPLY) + 8, 5000) != 0); + bLastPingResult = (IcmpSendEcho(hICMPFile, *addr, nullptr, 0, nullptr, reply, sizeof(ICMP_ECHO_REPLY) + 8, 5000) != 0); if (bLastPingResult) pingFailures = 0; diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp index a8af185308..7b637c35aa 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp @@ -250,7 +250,7 @@ INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_DESTROY: - delete optionsProtoSettings; optionsProtoSettings = 0; + delete optionsProtoSettings; optionsProtoSettings = nullptr; break; } diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp index 9bacd8e27c..d90a5a890b 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp @@ -114,7 +114,7 @@ INT_PTR GetProfileCount(WPARAM wParam, LPARAM) { int *def = (int*)wParam; int count = db_get_w(0, SSMODULENAME, SETTING_PROFILECOUNT, 0); - if (def != 0) { + if (def != nullptr) { *def = db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0); if (*def >= count) *def = 0; diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp index e80f19f2a4..628f4f192c 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp @@ -45,7 +45,7 @@ int CreateTopToolbarButtons(WPARAM, LPARAM) int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0); - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszService = MS_SS_LOADANDSETPROFILE; for (int i = 0; i < profileCount; i++) { diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp index 4487d2830f..146b69a96d 100644 --- a/plugins/StatusManager/src/commonstatus.cpp +++ b/plugins/StatusManager/src/commonstatus.cpp @@ -155,9 +155,9 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus) wchar_t substituteStr[128]; if (!wcsnicmp(tszMsg + j, L"%time%", 6)) - GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, 0, 0, substituteStr, _countof(substituteStr)); + GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, nullptr, nullptr, substituteStr, _countof(substituteStr)); else if (!wcsnicmp(tszMsg + j, L"%date%", 6)) - GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, 0, 0, substituteStr, _countof(substituteStr)); + GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, substituteStr, _countof(substituteStr)); else continue; diff --git a/plugins/StatusManager/src/confirmdialog.cpp b/plugins/StatusManager/src/confirmdialog.cpp index 2e92f31b0f..c5d125150d 100644 --- a/plugins/StatusManager/src/confirmdialog.cpp +++ b/plugins/StatusManager/src/confirmdialog.cpp @@ -394,7 +394,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_DESTROY: - delete confirmSettings; confirmSettings = 0; + delete confirmSettings; confirmSettings = nullptr; break; } diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index aeac374fd9..436f74125b 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -43,7 +43,7 @@ BOOL gbAutoAddToServerList=0; BOOL gbAutoReqAuth=1;
BOOL gbMathExpression = 0;
-HANDLE hStopSpamLogDirH=0;
+HANDLE hStopSpamLogDirH=nullptr;
wstring gbSpammersGroup = L"Spammers";
wstring gbAutoAuthGroup = L"NotSpammers";
@@ -128,7 +128,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) return 0;
}
-HANDLE hEventFilter = 0, hOptInitialise = 0, hSettingChanged = 0;
+HANDLE hEventFilter = nullptr, hOptInitialise = nullptr, hSettingChanged = nullptr;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index cfb15f66c3..b06dae9313 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -50,7 +50,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) switch (nmhdr->code) {
case PSN_APPLY:
{
- db_set_dw(NULL, pluginName, "maxQuestCount", gbMaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE));
+ db_set_dw(NULL, pluginName, "maxQuestCount", gbMaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, nullptr, FALSE));
db_set_b(NULL, pluginName, "infTalkProtection", gbInfTalkProtection = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
db_set_b(NULL, pluginName, "addPermanent", gbAddPermanent = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
db_set_b(NULL, pluginName, "handleAuthReq", gbHandleAuthReq = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
@@ -98,7 +98,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar return TRUE;
case IDC_VARS:
- variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, NULL, NULL);
+ variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr);
return TRUE;
}
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index c68e5581bf..ac47d6d7b0 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -71,7 +71,7 @@ void DeleteCListGroupsByName(wchar_t* szGroupName) db_set_b(NULL, "CList", "ConfirmDelete", 0);
wchar_t *szGroup;
- for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++)
+ for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++)
if (!mir_wstrcmp(szGroupName, szGroup))
Clist_GroupDelete(i);
@@ -133,7 +133,7 @@ const int Stricmp(const wchar_t *str, const wchar_t *substr) wchar_t* ReqGetText(DBEVENTINFO* dbei)
{
if (!dbei->pBlob)
- return 0;
+ return nullptr;
char * ptr = (char *)&dbei->pBlob[sizeof(DWORD) * 2];
int len = dbei->cbBlob - sizeof(DWORD) * 2;
@@ -149,12 +149,12 @@ wchar_t* ReqGetText(DBEVENTINFO* dbei) char * tstr = (char *)mir_alloc(len + 1);
memcpy(tstr, ptr, len);
tstr[len] = 0;
- WCHAR* msg = NULL;
+ WCHAR* msg = nullptr;
msg = (dbei->flags&DBEF_UTF) ? mir_utf8decodeW(tstr) : mir_a2u(tstr);
mir_free(tstr);
return (wchar_t *)msg;
};
- return 0;
+ return nullptr;
}
BOOL IsUrlContains(wchar_t * Str)
@@ -316,7 +316,7 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags) Event.szModule = pluginName;
Event.eventType = event_type;
Event.flags = flags | DBEF_UTF;
- Event.timestamp = (DWORD)time(NULL);
+ Event.timestamp = (DWORD)time(nullptr);
Event.cbBlob = (DWORD)mir_strlen(data) + 1;
Event.pBlob = (PBYTE)_strdup(data);
db_event_add(hContact, &Event);
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index a926efd551..2810d8d68d 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -50,7 +50,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l) {
MCONTACT hContact = (MCONTACT)w;
DBEVENTINFO *dbei = (DBEVENTINFO*)l;
- if (dbei == NULL) //fix potential DEP crash
+ if (dbei == nullptr) //fix potential DEP crash
return 0;
// if event is in protocol that is not despammed
diff --git a/plugins/StopSpamPlus/src/opt_proto.cpp b/plugins/StopSpamPlus/src/opt_proto.cpp index ab4e3c7df0..90592d4047 100644 --- a/plugins/StopSpamPlus/src/opt_proto.cpp +++ b/plugins/StopSpamPlus/src/opt_proto.cpp @@ -16,7 +16,7 @@ int FillTree(HWND hwnd) ProtocolData *PD;
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
@@ -79,7 +79,7 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) tvi.hItem = TreeView_GetRoot(hwndProto);
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
TreeView_GetItem(hwndProto, &tvi);
if (tvi.lParam != 0) {
diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index 3feb724e8f..2fcf6eeb47 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
case PSN_APPLY:
{
- plSets->MaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE);
+ plSets->MaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, nullptr, FALSE);
plSets->InfTalkProtection = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
plSets->AddPermanent = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
plSets->HandleAuthReq = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
@@ -103,7 +103,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
return TRUE;
case IDC_VARS:
- variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, NULL, NULL);
+ variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr);
return TRUE;
}
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 31863978a3..7cc8fec1a5 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -3,7 +3,7 @@ INT_PTR IsContactPassed(WPARAM hContact, LPARAM /*lParam*/)
{
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return CS_PASSED;
if (!plSets->ProtoDisabled(szProto))
@@ -29,7 +29,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) if (db_get_b(hContact, "CList", "NotOnList", 0) || (szGroup != NULL && (wcsstr(szGroup, L"Not In List") || wcsstr(szGroup, TranslateT("Not In List"))))) {
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
// Check if protocol uses server side lists
DWORD caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_SERVERCLIST) {
@@ -49,8 +49,8 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) int hGroup = 1;
wchar_t *group_name;
do {
- group_name = Clist_GroupGetName(hGroup, 0);
- if (group_name != NULL && wcsstr(group_name, TranslateT("Not In List"))) {
+ group_name = Clist_GroupGetName(hGroup, nullptr);
+ if (group_name != nullptr && wcsstr(group_name, TranslateT("Not In List"))) {
BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
if (ConfirmDelete)
db_set_b(NULL, "CList", "ConfirmDelete", 0);
@@ -63,7 +63,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) hGroup++;
} while (group_name);
if (!lParam)
- MessageBox(NULL, TranslateT("Complete"), TranslateT(pluginName), MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Complete"), TranslateT(pluginName), MB_ICONINFORMATION);
return 0;
}
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 7bcc6c7f0b..167b604547 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -34,7 +34,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA // External theme methods and properties
static BLENDFUNCTION bf_buttonglyph;
-static HDC hdc_buttonglyph = 0;
+static HDC hdc_buttonglyph = nullptr;
static HBITMAP hbm_buttonglyph, hbm_buttonglyph_old;
// Used for our own cheap TrackMouseEvent
@@ -84,7 +84,7 @@ int TSAPI RBStateConvert2Flat(int state) */
static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
{
- if (hdc_buttonglyph == 0) {
+ if (hdc_buttonglyph == nullptr) {
hdc_buttonglyph = CreateCompatibleDC(hdcPaint);
hbm_buttonglyph = CreateCompatibleBitmap(hdcPaint, 16, 16);
hbm_buttonglyph_old = (HBITMAP)SelectObject(hdc_buttonglyph, hbm_buttonglyph);
@@ -103,7 +103,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) HDC hdcMem;
HBITMAP hbmMem, hOld;
- HANDLE hbp = 0;
+ HANDLE hbp = nullptr;
bool bAero = M.isAero();
RECT rcClient, rcContent;
@@ -112,7 +112,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) if (CMimAPI::m_haveBufferedPaint) {
hbp = CMimAPI::m_pfnBeginBufferedPaint(hdcPaint, &rcContent, BPBF_TOPDOWNDIB, nullptr, &hdcMem);
- hbmMem = hOld = 0;
+ hbmMem = hOld = nullptr;
}
else {
hdcMem = CreateCompatibleDC(hdcPaint);
@@ -127,7 +127,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) if (ctl->bIsFlat) {
if (ctl->pContainer && CSkin::m_skinEnabled) {
- CSkinItem *item, *realItem = 0;
+ CSkinItem *item, *realItem = nullptr;
if (ctl->bTitleButton)
item = &SkinItems[ctl->stateId == PBS_NORMAL ? ID_EXTBKTITLEBUTTON : (ctl->stateId == PBS_HOT ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTONPRESSED)];
else {
@@ -236,13 +236,13 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) rcContent.right = rcContent.left;
DrawIconEx(hdcMem, rcClient.right - 15, (rcClient.bottom - rcClient.top) / 2 - (PluginConfig.m_smcyicon / 2),
- PluginConfig.g_buttonBarIcons[ICON_DEFAULT_PULLDOWN], 16, 16, 0, 0, DI_NORMAL);
+ PluginConfig.g_buttonBarIcons[ICON_DEFAULT_PULLDOWN], 16, 16, 0, nullptr, DI_NORMAL);
}
if (ctl->hIcon || ctl->hIconPrivate) {
int ix = (rcClient.right - rcClient.left) / 2 - 8;
int iy = (rcClient.bottom - rcClient.top) / 2 - 8;
- HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon;
+ HICON hIconNew = ctl->hIconPrivate != nullptr ? ctl->hIconPrivate : ctl->hIcon;
if (ctl->stateId == PBS_PRESSED) {
ix++;
@@ -256,15 +256,15 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) CSkin::DrawDimmedIcon(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hIconNew, 180);
else {
if (ctl->stateId != PBS_DISABLED) {
- DrawIconEx(hdcMem, ix, iy, hIconNew, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdcMem, ix, iy, hIconNew, 16, 16, 0, nullptr, DI_NORMAL);
if (ctl->overlay)
- DrawIconEx(hdcMem, ix, iy, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdcMem, ix, iy, ctl->overlay, 16, 16, 0, nullptr, DI_NORMAL);
}
else {
BitBlt(hdc_buttonglyph, 0, 0, 16, 16, hdcMem, ix, iy, SRCCOPY);
- DrawIconEx(hdc_buttonglyph, 0, 0, hIconNew, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdc_buttonglyph, 0, 0, hIconNew, 16, 16, 0, nullptr, DI_NORMAL);
if (ctl->overlay)
- DrawIconEx(hdc_buttonglyph, 0, 0, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdc_buttonglyph, 0, 0, ctl->overlay, 16, 16, 0, nullptr, DI_NORMAL);
GdiAlphaBlend(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hdc_buttonglyph, 0, 0, 16, 16, bf_buttonglyph);
}
}
@@ -354,11 +354,11 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);
ImageList_RemoveAll(hImageList);
ImageList_Destroy(hImageList);
- bct->hIcon = 0;
+ bct->hIcon = nullptr;
}
else {
bct->hIcon = (HICON)lParam;
- bct->hIconPrivate = 0;
+ bct->hIconPrivate = nullptr;
}
DeleteObject(ii.hbmMask);
@@ -465,12 +465,12 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (bct->sitem->testCloseButton() != -1) {
if (bct->sitem->m_sideBar->getHoveredClose() != bct->sitem) {
bct->sitem->m_sideBar->setHoveredClose(bct->sitem);
- InvalidateRect(hwndDlg, 0, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
}
else {
- bct->sitem->m_sideBar->setHoveredClose(0);
- InvalidateRect(hwndDlg, 0, FALSE);
+ bct->sitem->m_sideBar->setHoveredClose(nullptr);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
}
break;
@@ -485,8 +485,8 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L);
KillTimer(hwndDlg, BUTTON_POLLID);
if (bct->sitem) {
- bct->sitem->m_sideBar->setHoveredClose(0);
- InvalidateRect(hwndDlg, 0, FALSE);
+ bct->sitem->m_sideBar->setHoveredClose(nullptr);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
}
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 4d05595db1..4024e3d918 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -92,8 +92,8 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) bbd.dwButtonID = 1; bbd.pszModuleName = "tb_splitter"; bbd.dwDefPos = 35; - bbd.hIcon = 0; - bbd.pwszTooltip = 0; + bbd.hIcon = nullptr; + bbd.pwszTooltip = nullptr; Srmm_AddButton(&bbd); bbd.dwButtonID = 2; @@ -188,7 +188,7 @@ void CTabBaseDlg::BB_RedrawButtons() HWND hwndToggleSideBar = GetDlgItem(m_hwnd, IDC_TOGGLESIDEBAR); if (hwndToggleSideBar && IsWindow(hwndToggleSideBar)) - InvalidateRect(hwndToggleSideBar, 0, TRUE); + InvalidateRect(hwndToggleSideBar, nullptr, TRUE); } void CTabBaseDlg::BB_RefreshTheme() diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp index 182c8f2618..2211f60496 100644 --- a/plugins/TabSRMM/src/chat_log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -828,7 +828,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw)
{
- if (m_hwnd == 0 || lin == 0 || m_si == 0)
+ if (m_hwnd == nullptr || lin == nullptr || m_si == nullptr)
return;
LOGSTREAMDATA streamData;
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 9669930aea..93c5485407 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -44,7 +44,7 @@ static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi) si->pDlg->UpdateStatusBar();
if (mi)
- mi->idleTimeStamp = time(0);
+ mi->idleTimeStamp = time(nullptr);
}
static void OnReplaceSession(SESSION_INFO *si)
@@ -77,7 +77,7 @@ static void OnChangeNick(SESSION_INFO *si) static void OnCreateModule(MODULEINFO *mi)
{
- mi->idleTimeStamp = time(0);
+ mi->idleTimeStamp = time(nullptr);
}
static void OnLoadSettings()
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 8d459906bd..2adbadfe10 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -172,7 +172,7 @@ static branch_t branch2[] = { { LPGENW("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, nullptr }
};
-static HWND hPathTip = 0;
+static HWND hPathTip = nullptr;
void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szMod)
{
@@ -246,10 +246,10 @@ static HTREEITEM InsertBranch(HWND hwndTree, wchar_t* pszDescr, BOOL bExpanded) static void FillBranch(HWND hwndTree, HTREEITEM hParent, branch_t *branch, int nValues, DWORD defaultval)
{
- if (hParent == 0)
+ if (hParent == nullptr)
return;
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
for (int i = 0; i < nValues; i++) {
tvis.hParent = hParent;
@@ -390,8 +390,8 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static HTREEITEM hListHeading1 = 0;
- static HTREEITEM hListHeading2 = 0;
+ static HTREEITEM hListHeading1 = nullptr;
+ static HTREEITEM hListHeading2 = nullptr;
switch (uMsg) {
case WM_INITDIALOG:
@@ -776,7 +776,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM LPMALLOC psMalloc;
if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
- BROWSEINFO bi = { 0 };
+ BROWSEINFO bi = {};
bi.hwndOwner = hwndDlg;
bi.pszDisplayName = tszDirectory;
bi.lpszTitle = TranslateT("Select folder");
@@ -899,7 +899,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (hPathTip) {
KillTimer(hwndDlg, 0);
DestroyWindow(hPathTip);
- hPathTip = 0;
+ hPathTip = nullptr;
}
break;
}
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 2377e9a7e4..29d612b30a 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -158,7 +158,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) return 0;
}
}
- if (dat && pContainer != 0) { // message window is open, need to check the container config if we want to see a popup nonetheless
+ if (dat && pContainer != nullptr) { // message window is open, need to check the container config if we want to see a popup nonetheless
if (nen_options.bWindowCheck) { // no popups at all for open windows... no exceptions
if (!PluginConfig.m_bHideOnClose)
return 0;
@@ -207,7 +207,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) if (si == nullptr)
return;
- CTabBaseDlg *dat = 0;
+ CTabBaseDlg *dat = nullptr;
if (si->pDlg) {
dat = si->pDlg;
if (dat) {
@@ -288,7 +288,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix)
{
- if (gce == 0 || si == 0 || gce->bIsMe || si->iType == GCW_SERVER)
+ if (gce == nullptr || si == nullptr || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
CTabBaseDlg *dat = nullptr;
@@ -565,7 +565,7 @@ bool IsHighlighted(SESSION_INFO *si, GCEVENT *gce) if (si && g_Settings.bLogClassicIndicators) {
size_t len = mir_wstrlen(gce->ptszNick) + 1;
wchar_t *tmp = (wchar_t*)_alloca(sizeof(wchar_t)*(len + 1));
- *tmp = GetIndicator(si, gce->ptszNick, 0);
+ *tmp = GetIndicator(si, gce->ptszNick, nullptr);
mir_wstrcpy(tmp + 1, gce->ptszNick);
evTmp.ptszNick = tmp;
}
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 1bc1ae0706..9ac5627bac 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -104,7 +104,7 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT *ptClient, UINT uMsg, WPARAM wPa if (RichEditOle) RichEditOle->Release(); if (bIsCustomLink) { - ENLINK enlink = { 0 }; + ENLINK enlink = {}; enlink.nmhdr.hwndFrom = hwndDlg; enlink.nmhdr.idFrom = IDC_SRMM_LOG; enlink.nmhdr.code = EN_LINK; @@ -156,7 +156,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) GetWindowRect(m_hwndFilter, &rcFilter); if (!PtInRect(&rcFilter, pt)) { SendMessage(m_hwndFilter, WM_CLOSE, 1, 1); - m_hwndFilter = 0; + m_hwndFilter = nullptr; } } @@ -169,7 +169,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) m_dwUnread = 0; if (m_pWnd) { m_pWnd->activateTab(); - m_pWnd->setOverlayIcon(0, true); + m_pWnd->setOverlayIcon(nullptr, true); } if (m_pContainer->hwndSaved == m_hwnd) @@ -193,7 +193,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) if (KillTimer(m_hwnd, TIMERID_FLASHWND) || m_iFlashIcon) { FlashTab(false); m_bCanFlashTab = FALSE; - m_iFlashIcon = 0; + m_iFlashIcon = nullptr; } if (m_pContainer->dwFlashingStarted != 0) { FlashContainer(m_pContainer, 0, 0); @@ -205,7 +205,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0); if (PluginConfig.m_bAutoLocaleSupport) { - if (hkl == 0) + if (hkl == nullptr) DM_LoadLocale(); else SendMessage(m_hwnd, DM_SETLOCALE, 0, 0); @@ -537,8 +537,8 @@ void CChatRoomDlg::OnInitDialog() m_pPanel.loadHeight(); - if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != nullptr) - UpdateTrayMenu(0, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE); + if (PluginConfig.g_hMenuTrayUnread != nullptr && m_hContact != 0 && m_szProto != nullptr) + UpdateTrayMenu(nullptr, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE); m_log.SendMsg(EM_HIDESELECTION, TRUE, 0); @@ -660,7 +660,7 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*) if (ptszText[0] == '/' || m_si->iType == GCW_SERVER) fSound = false; Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0); - mi->idleTimeStamp = time(0); + mi->idleTimeStamp = time(nullptr); mi->lastIdleCheck = 0; UpdateStatusBar(); if (m_pContainer) @@ -676,7 +676,7 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) return; if (m_iLogFilterFlags == 0 && !m_bFilterEnabled) { - MessageBox(0, TranslateT("The filter cannot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK); + MessageBox(nullptr, TranslateT("The filter cannot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK); m_bFilterEnabled = false; } else m_bFilterEnabled = !m_bFilterEnabled; @@ -874,7 +874,7 @@ void CChatRoomDlg::UpdateOptions() void CChatRoomDlg::UpdateStatusBar() { - if (m_pContainer->m_hwndActive != m_hwnd || m_pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || m_wszStatusBar[0]) + if (m_pContainer->m_hwndActive != m_hwnd || m_pContainer->hwndStatus == nullptr || CMimAPI::m_shutDown || m_wszStatusBar[0]) return; if (m_si->pszModule == nullptr) @@ -894,7 +894,7 @@ void CChatRoomDlg::UpdateStatusBar() wchar_t szFinalStatusBarText[512]; if (m_pPanel.isActive()) { - time_t now = time(0); + time_t now = time(nullptr); DWORD diff = (now - mi->idleTimeStamp) / 60; if ((diff >= 1 && diff != mi->lastIdleCheck)) { @@ -936,7 +936,7 @@ void CChatRoomDlg::UpdateTitle() } wchar_t szTemp[100]; - HICON hIcon = 0; + HICON hIcon = nullptr; switch (m_si->iType) { case GCW_CHATROOM: @@ -1932,7 +1932,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: if (LOWORD(wParam) != WA_ACTIVE) { - m_pContainer->hwndSaved = 0; + m_pContainer->hwndSaved = nullptr; break; } // fall through @@ -2215,7 +2215,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (CMimAPI::m_haveBufferedPaint) { hbp = CSkin::InitiateBufferedPaint(hdc, rcClient, hdcMem); - hbm = hbmOld = 0; + hbm = hbmOld = nullptr; } else { hdcMem = CreateCompatibleDC(hdc); @@ -2343,7 +2343,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) pt.x = pt.y = 0; m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&pt); if (PluginConfig.m_bAutoLocaleSupport) { - if (hkl == 0) + if (hkl == nullptr) DM_LoadLocale(); else PostMessage(m_hwnd, DM_SETLOCALE, 0, 0); @@ -2427,7 +2427,7 @@ void ShowRoom(TContainerData *pContainer, SESSION_INFO *si) return; // smth went wrong, nothing to do here MCONTACT hContact = si->hContact; - if (Srmm_FindWindow(hContact) != 0) + if (Srmm_FindWindow(hContact) != nullptr) return; if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->m_wszName, L"default", 6)) diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 33a5aa1fc2..70626350a4 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -59,14 +59,14 @@ CContactCache::CContactCache(MCONTACT hContact) void CContactCache::initPhaseTwo() { - m_szAccount = 0; + m_szAccount = nullptr; if (cc->szProto) { PROTOACCOUNT *acc = Proto_GetAccount(cc->szProto); if (acc && acc->tszAccountName) m_szAccount = acc->tszAccountName; } - m_isValid = (cc->szProto != 0 && m_szAccount != 0) ? true : false; + m_isValid = (cc->szProto != nullptr && m_szAccount != nullptr) ? true : false; if (m_isValid) { m_isMeta = db_mc_isMeta(cc->contactID) != 0; // don't use cc->IsMeta() here if (m_isMeta) @@ -87,7 +87,7 @@ void CContactCache::initPhaseTwo() void CContactCache::resetMeta() { m_isMeta = false; - m_szMetaProto = 0; + m_szMetaProto = nullptr; m_iMetaStatus = ID_STATUS_OFFLINE; initPhaseTwo(); } @@ -167,7 +167,7 @@ bool CContactCache::updateUIN() void CContactCache::updateStats(int iType, size_t value) { - if (m_stats == 0) + if (m_stats == nullptr) allocStats(); switch (iType) { @@ -180,7 +180,7 @@ void CContactCache::updateStats(int iType, size_t value) m_stats->lastReceivedChars = 0; break; case TSessionStats::INIT_TIMER: - m_stats->started = time(0); + m_stats->started = time(nullptr); break; case TSessionStats::SET_LAST_RCV: m_stats->lastReceivedChars = (unsigned int)value; @@ -195,7 +195,7 @@ void CContactCache::updateStats(int iType, size_t value) void CContactCache::allocStats() { - if (m_stats == 0) { + if (m_stats == nullptr) { m_stats = new TSessionStats; memset(m_stats, 0, sizeof(TSessionStats)); } @@ -359,7 +359,7 @@ void CContactCache::releaseAlloced() { if (m_stats) { delete m_stats; - m_stats = 0; + m_stats = nullptr; } if (m_history) { @@ -367,7 +367,7 @@ void CContactCache::releaseAlloced() mir_free(m_history[i].szText); mir_free(m_history); - m_history = 0; + m_history = nullptr; } mir_free(m_szStatusMsg); @@ -413,26 +413,26 @@ void CContactCache::updateStatusMsg(const char *szKey) MCONTACT hContact = getActiveContact(); - if (szKey == 0 || (szKey && !mir_strcmp("StatusMsg", szKey))) { + if (szKey == nullptr || (szKey && !mir_strcmp("StatusMsg", szKey))) { if (m_szStatusMsg) mir_free(m_szStatusMsg); - m_szStatusMsg = 0; + m_szStatusMsg = nullptr; ptrW szStatus(db_get_wsa(hContact, "CList", "StatusMsg")); if (szStatus != 0) - m_szStatusMsg = (mir_wstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : 0); + m_szStatusMsg = (mir_wstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : nullptr); } - if (szKey == 0 || (szKey && !mir_strcmp("ListeningTo", szKey))) { + if (szKey == nullptr || (szKey && !mir_strcmp("ListeningTo", szKey))) { if (m_ListeningInfo) mir_free(m_ListeningInfo); - m_ListeningInfo = 0; + m_ListeningInfo = nullptr; ptrW szListeningTo(db_get_wsa(hContact, cc->szProto, "ListeningTo")); if (szListeningTo != 0 && *szListeningTo) m_ListeningInfo = szListeningTo.detach(); } - if (szKey == 0 || (szKey && !mir_strcmp("XStatusMsg", szKey))) { + if (szKey == nullptr || (szKey && !mir_strcmp("XStatusMsg", szKey))) { if (m_xStatusMsg) mir_free(m_xStatusMsg); - m_xStatusMsg = 0; + m_xStatusMsg = nullptr; ptrW szXStatusMsg(db_get_wsa(hContact, cc->szProto, "XStatusMsg")); if (szXStatusMsg != 0 && *szXStatusMsg) m_xStatusMsg = szXStatusMsg.detach(); @@ -493,8 +493,8 @@ int CContactCache::cacheUpdateMetaChanged(WPARAM bMetaEnabled, LPARAM) wchar_t* CContactCache::getNormalizedStatusMsg(const wchar_t *src, bool fStripAll) { - if (src == 0 || mir_wstrlen(src) < 2) - return 0; + if (src == nullptr || mir_wstrlen(src) < 2) + return nullptr; CMStringW dest; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 6eb700c8c6..90348e7e05 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -33,7 +33,7 @@ #define CONTAINER_SUBKEY "containerW"
#define CONTAINER_PREFIX "CNTW_"
-TContainerData *pFirstContainer = 0; // the linked list of struct ContainerWindowData
+TContainerData *pFirstContainer = nullptr; // the linked list of struct ContainerWindowData
TContainerData *pLastActiveContainer = nullptr;
static TContainerData* TSAPI AppendToContainerList(TContainerData*);
@@ -158,7 +158,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_NCPAINT:
if (pContainer && bSkinned) {
if (CSkin::m_frameSkins) {
- HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW |/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
+ HDC dcFrame = GetDCEx(hwndDlg, nullptr, DCX_WINDOW |/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
LONG clip_top, clip_left;
RECT rcText;
HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
@@ -208,7 +208,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, // icon
HICON hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
- DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
// title buttons
pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
@@ -247,7 +247,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (pRect) {
CSkinItem *item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
CSkin::DrawItem(dcMem, pRect, item);
- DrawIconEx(dcMem, pRect->left + ((pRect->right - pRect->left) / 2 - 8), pRect->top + ((pRect->bottom - pRect->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(dcMem, pRect->left + ((pRect->right - pRect->left) / 2 - 8), pRect->top + ((pRect->bottom - pRect->top) / 2 - 8), hIcon, 16, 16, 0, nullptr, DI_NORMAL);
}
}
SetBkMode(dcMem, TRANSPARENT);
@@ -374,7 +374,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (rc) {
CSkinItem *item = &SkinItems[pContainer->buttons[i].isPressed ? ID_EXTBKTITLEBUTTONPRESSED : (pContainer->buttons[i].isHot ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTON)];
CSkin::DrawItem(hdc, rc, item);
- DrawIconEx(hdc, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdc, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, nullptr, DI_NORMAL);
}
}
}
@@ -582,7 +582,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, TabCtrl_SetToolTips(hwndTab, pContainer->m_hwndTip);
}
}
- else pContainer->m_hwndTip = 0;
+ else pContainer->m_hwndTip = nullptr;
if (pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
WINDOWPLACEMENT wp = { 0 };
@@ -618,14 +618,14 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, if (Utils_RestoreWindowPositionNoMove(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, "split"))
- SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwndDlg, nullptr, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
}
}
else {
if (pContainer->dwFlags & CNT_GLOBALSIZE) {
if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, "split"))
- SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwndDlg, nullptr, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
}
else {
char szCName[CONTAINER_NAMELEN + 20];
@@ -634,7 +634,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, szCName))
if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, "split"))
- SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwndDlg, nullptr, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
}
}
}
@@ -672,7 +672,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, if (lParam) {
DWORD dwSWPFlags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_DEFERERASE | SWP_NOCOPYBITS; // | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS;
- SetWindowPos(hwndTab, 0, pContainer->tBorder_outer_left + sbarWidth_left, pContainer->tBorder_outer_top + rebarHeight,
+ SetWindowPos(hwndTab, nullptr, pContainer->tBorder_outer_left + sbarWidth_left, pContainer->tBorder_outer_top + rebarHeight,
(rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
(rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
}
@@ -699,7 +699,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, tci.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &tci);
if ((HWND)tci.lParam == pContainer->m_hwndActive) {
- SetWindowPos((HWND)tci.lParam, 0, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
+ SetWindowPos((HWND)tci.lParam, nullptr, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
SWP_NOSENDCHANGING | SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
if (!pContainer->bSizingLoop && sizeChanged) {
dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA);
@@ -750,7 +750,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
- if (pContainer->hwndStatus != 0 && ((LPNMHDR)lParam)->hwndFrom == pContainer->hwndStatus) {
+ if (pContainer->hwndStatus != nullptr && ((LPNMHDR)lParam)->hwndFrom == pContainer->hwndStatus) {
switch (((LPNMHDR)lParam)->code) {
case NM_CLICK:
case NM_RCLICK:
@@ -883,7 +883,7 @@ panel_found: }
break;
case ID_TABMENU_CONTAINEROPTIONS:
- if (pContainer->hWndOptions == 0)
+ if (pContainer->hWndOptions == nullptr)
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer);
break;
case ID_TABMENU_CLOSECONTAINER:
@@ -1180,7 +1180,7 @@ panel_found: BOOL fResult = TRUE;
BroadCastContainer(pContainer, DM_CHECKAUTOHIDE, (WPARAM)pContainer->settings->autoCloseSeconds, (LPARAM)&fResult);
- if (fResult && 0 == pContainer->hWndOptions)
+ if (fResult && nullptr == pContainer->hWndOptions)
PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
@@ -1211,7 +1211,7 @@ panel_found: case IDM_MOREOPTIONS:
if (IsIconic(pContainer->m_hwnd))
SendMessage(pContainer->m_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
- if (pContainer->hWndOptions == 0)
+ if (pContainer->hWndOptions == nullptr)
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer);
break;
case SC_MAXIMIZE:
@@ -1303,7 +1303,7 @@ panel_found: SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->settings->dwTransparency), (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
}
}
- pContainer->hwndSaved = 0;
+ pContainer->hwndSaved = nullptr;
if (LOWORD(wParam) != WA_ACTIVE) {
pContainer->MenuBar->Cancel();
@@ -1352,7 +1352,7 @@ panel_found: pContainer->dwFlags &= ~CNT_DEFERREDCONFIGURE;
pContainer->m_hwndActive = (HWND)item.lParam;
SendMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
- if (pContainer->m_hwndActive != 0 && IsWindow(pContainer->m_hwndActive)) {
+ if (pContainer->m_hwndActive != nullptr && IsWindow(pContainer->m_hwndActive)) {
ShowWindow(pContainer->m_hwndActive, SW_SHOW);
SetFocus(pContainer->m_hwndActive);
SendMessage(pContainer->m_hwndActive, WM_ACTIVATE, WA_ACTIVE, 0);
@@ -1407,7 +1407,7 @@ panel_found: if (M.isAero()) {
HDC hdcMem;
- HANDLE hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, 0, &hdcMem);
+ HANDLE hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, nullptr, &hdcMem);
FillRect(hdcMem, &rc, CSkin::m_BrushBack);
CSkin::FinalizeBufferedPaint(hbp, &rc);
}
@@ -1422,7 +1422,7 @@ panel_found: HPEN hOldPen = reinterpret_cast<HPEN>(::SelectObject(hdc, hPen));
LONG x = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? pContainer->SideBar->getWidth() - 2 + pContainer->tBorder_outer_left :
rc.right - pContainer->SideBar->getWidth() + 1 - pContainer->tBorder_outer_right);
- ::MoveToEx(hdc, x, rc.top, 0);
+ ::MoveToEx(hdc, x, rc.top, nullptr);
::LineTo(hdc, x, rc.bottom);
::SelectObject(hdc, hOldPen);
::DeleteObject(hPen);
@@ -1468,7 +1468,7 @@ panel_found: }
else pContainer->szAbsThemeFile[0] = pContainer->szRelThemeFile[0] = 0;
- pContainer->ltr_templates = pContainer->rtl_templates = 0;
+ pContainer->ltr_templates = pContainer->rtl_templates = nullptr;
}
break;
@@ -1476,11 +1476,11 @@ panel_found: SendMessage(hwndDlg, WM_SIZE, 0, 0);
GetWindowRect(hwndDlg, &rc);
- SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, (rc.bottom - rc.top) + 1, SWP_NOZORDER | SWP_NOACTIVATE);
- SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwndDlg, nullptr, rc.left, rc.top, rc.right - rc.left, (rc.bottom - rc.top) + 1, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwndDlg, nullptr, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
- if (pContainer->hwndStatus != 0 && pContainer->m_hwndActive != 0)
+ if (pContainer->hwndStatus != nullptr && pContainer->m_hwndActive != nullptr)
PostMessage(pContainer->m_hwndActive, DM_STATUSBARCHANGED, 0, 0);
return 0;
@@ -1526,9 +1526,9 @@ panel_found: if (ws != wsold) {
GetWindowRect(hwndDlg, &rc);
if ((ws & WS_CAPTION) != (wsold & WS_CAPTION)) {
- SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
+ SetWindowPos(hwndDlg, nullptr, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
- if (pContainer->m_hwndActive != 0) {
+ if (pContainer->m_hwndActive != nullptr) {
dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA);
dat->DM_ScrollToBottom(0, 0);
}
@@ -1553,18 +1553,18 @@ panel_found: if (pContainer->dwFlags & CNT_NOSTATUSBAR) {
if (pContainer->hwndStatus) {
DestroyWindow(pContainer->hwndStatus);
- pContainer->hwndStatus = 0;
+ pContainer->hwndStatus = nullptr;
pContainer->statusBarHeight = 0;
SendMessage(hwndDlg, DM_STATUSBARCHANGED, 0, 0);
}
}
- else if (pContainer->hwndStatus == 0) {
+ else if (pContainer->hwndStatus == nullptr) {
pContainer->hwndStatus = CreateWindowEx(0, L"TSStatusBarClass", nullptr, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, nullptr, g_hInst, nullptr);
if (sBarHeight && bSkinned)
SendMessage(pContainer->hwndStatus, SB_SETMINHEIGHT, sBarHeight, 0);
}
- if (pContainer->m_hwndActive != 0) {
+ if (pContainer->m_hwndActive != nullptr) {
hContact = 0;
SendMessage(pContainer->m_hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact)
@@ -1587,7 +1587,7 @@ panel_found: RECENTINFO *ri = (RECENTINFO *)lParam;
ri->iFirstIndex = ri->iMostRecent = -1;
ri->dwFirst = ri->dwMostRecent = 0;
- ri->hwndFirst = ri->hwndMostRecent = 0;
+ ri->hwndFirst = ri->hwndMostRecent = nullptr;
for (int i = 0; i < iItems; i++) {
item.mask = TCIF_PARAM;
@@ -1631,7 +1631,7 @@ panel_found: {
dat = (CTabBaseDlg*)wParam;
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
- HICON hIconBig = (dat && dat->m_cache) ? Skin_LoadProtoIcon(dat->m_cache->getProto(), dat->m_cache->getStatus(), true) : 0;
+ HICON hIconBig = (dat && dat->m_cache) ? Skin_LoadProtoIcon(dat->m_cache->getProto(), dat->m_cache->getStatus(), true) : nullptr;
if (Win7Taskbar->haveLargeIcons()) {
if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING] || (HICON)lParam == hIconMsg) {
@@ -1644,12 +1644,12 @@ panel_found: }
if (dat) {
- if (dat->m_hTaskbarIcon == 0)
- dat->m_hTaskbarIcon = ((dat->m_pContainer->dwFlags & CNT_AVATARSONTASKBAR) ? dat->IconFromAvatar() : 0);
+ if (dat->m_hTaskbarIcon == nullptr)
+ dat->m_hTaskbarIcon = ((dat->m_pContainer->dwFlags & CNT_AVATARSONTASKBAR) ? dat->IconFromAvatar() : nullptr);
else {
if (!(dat->m_pContainer->dwFlags & CNT_AVATARSONTASKBAR)) {
DestroyIcon(dat->m_hTaskbarIcon);
- dat->m_hTaskbarIcon = 0;
+ dat->m_hTaskbarIcon = nullptr;
}
}
@@ -1659,7 +1659,7 @@ panel_found: Win7Taskbar->setOverlayIcon(hwndDlg, (LPARAM)(dat->m_hTabIcon ? (LPARAM)dat->m_hTabIcon : lParam));
}
else {
- if (0 == hIconBig || (HICON)CALLSERVICE_NOTFOUND == hIconBig)
+ if (nullptr == hIconBig || (HICON)CALLSERVICE_NOTFOUND == hIconBig)
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)lParam);
else
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBig);
@@ -1689,7 +1689,7 @@ panel_found: hIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
}
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
- if (0 != hIconBig && reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) != hIconBig)
+ if (nullptr != hIconBig && reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) != hIconBig)
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, LPARAM(hIconBig));
pContainer->hIcon = (lParam == (LPARAM)hIconMsg) ? STICK_ICON_MSG : 0;
}
@@ -1724,8 +1724,8 @@ panel_found: return 0;
case WM_DESTROY:
- pContainer->m_hwnd = 0;
- pContainer->m_hwndActive = 0;
+ pContainer->m_hwnd = nullptr;
+ pContainer->m_hwndActive = nullptr;
if (pContainer->hwndStatus)
DestroyWindow(pContainer->hwndStatus);
@@ -1976,7 +1976,7 @@ int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd) if (iItem >= 0) {
TabCtrl_SetCurSel(hwndTab, iItem);
- NMHDR nmhdr = { 0 };
+ NMHDR nmhdr = {};
nmhdr.code = TCN_SELCHANGE;
SendMessage(GetParent(hwndTab), WM_NOTIFY, 0, (LPARAM)&nmhdr); // do it via a WM_NOTIFY / TCN_SELCHANGE to simulate user-activation
return iItem;
@@ -2027,7 +2027,7 @@ static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer) }
TContainerData *p = pFirstContainer;
- while (p->pNext != 0)
+ while (p->pNext != nullptr)
p = p->pNext;
p->pNext = pContainer;
pContainer->pNext = nullptr;
@@ -2037,7 +2037,7 @@ static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer) TContainerData* TSAPI FindContainerByName(const wchar_t *name)
{
if (name == nullptr || mir_wstrlen(name) == 0)
- return 0;
+ return nullptr;
if (M.GetByte("singlewinmode", 0)) // single window mode - always return 0 and force a new container
return nullptr;
@@ -2071,7 +2071,7 @@ static TContainerData* TSAPI RemoveContainerFromList(TContainerData *pContainer) if (pLastActiveContainer == pContainer) // make sure, we don't reference this container anymore
pLastActiveContainer = pFirstContainer;
- return 0;
+ return nullptr;
}
}
return nullptr;
@@ -2219,11 +2219,11 @@ void TSAPI RenameContainer(int iIndex, const wchar_t *szNew) HMENU TSAPI BuildContainerMenu()
{
- if (PluginConfig.g_hMenuContainer != 0) {
+ if (PluginConfig.g_hMenuContainer != nullptr) {
HMENU submenu = GetSubMenu(PluginConfig.g_hMenuContext, 0);
RemoveMenu(submenu, 6, MF_BYPOSITION);
DestroyMenu(PluginConfig.g_hMenuContainer);
- PluginConfig.g_hMenuContainer = 0;
+ PluginConfig.g_hMenuContainer = nullptr;
}
// no container attach menu, if we are using the "clist group mode"
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 51306b17c7..79cc9c7acc 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -145,7 +145,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
int nr_layouts = 0;
const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts);
@@ -369,8 +369,8 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, {
RECT rc;
GetWindowRect(pContainer->m_hwnd, &rc);
- SetWindowPos(pContainer->m_hwnd, 0, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED);
- SetWindowPos(pContainer->m_hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW);
+ SetWindowPos(pContainer->m_hwnd, nullptr, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED);
+ SetWindowPos(pContainer->m_hwnd, nullptr, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW);
}
if (LOWORD(wParam) == IDOK)
@@ -553,7 +553,7 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); case WM_DESTROY:
Window_FreeIcon_IcoLib(hwndDlg);
- pContainer->hWndOptions = 0;
+ pContainer->hWndOptions = nullptr;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_GETFONT, 0, 0);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 5e8a8eb8de..d66da586d5 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -28,13 +28,13 @@ #include "stdafx.h"
-static WNDPROC OldStatusBarproc = 0;
+static WNDPROC OldStatusBarproc = nullptr;
bool CMenuBar::m_buttonsInit = false;
-HHOOK CMenuBar::m_hHook = 0;
+HHOOK CMenuBar::m_hHook = nullptr;
TBBUTTON CMenuBar::m_TbButtons[8] = { 0 };
-CMenuBar *CMenuBar::m_Owner = 0;
-HBITMAP CMenuBar::m_MimIcon = 0;
+CMenuBar *CMenuBar::m_Owner = nullptr;
+HBITMAP CMenuBar::m_MimIcon = nullptr;
int CMenuBar::m_MimIconRefCount = 0;
static int resetLP(WPARAM, LPARAM, LPARAM obj)
@@ -52,7 +52,7 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) {
m_pContainer = const_cast<TContainerData *>(pContainer);
- if (m_MimIcon == 0) {
+ if (m_MimIcon == nullptr) {
HDC hdc = ::GetDC(m_pContainer->m_hwnd);
HANDLE hIcon = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA);
@@ -61,7 +61,7 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) RECT rc = { 0, 0, 16, 16 };
m_MimIcon = CSkin::CreateAeroCompatibleBitmap(rc, hdcTemp);
HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcTemp, m_MimIcon));
- ::DrawIconEx(hdcTemp, 0, 0, (HICON)hIcon, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(hdcTemp, 0, 0, (HICON)hIcon, 16, 16, 0, nullptr, DI_NORMAL);
::SelectObject(hdcTemp, hbmOld);
::DeleteDC(hdcTemp);
@@ -77,11 +77,11 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) checkButtons();
- m_activeMenu = 0;
+ m_activeMenu = nullptr;
m_activeID = 0;
m_isAero = M.isAero();
m_mustAutoHide = false;
- m_activeSubMenu = 0;
+ m_activeSubMenu = nullptr;
m_fTracking = false;
m_isContactMenu = m_isMainMenu = false;
HookEventParam(ME_LANGPACK_CHANGED, &::resetLP, (LPARAM)this);
@@ -98,7 +98,7 @@ CMenuBar::~CMenuBar() m_MimIconRefCount--;
if (m_MimIconRefCount == 0) {
::DeleteObject(m_MimIcon);
- m_MimIcon = 0;
+ m_MimIcon = nullptr;
}
}
@@ -117,8 +117,8 @@ const RECT& CMenuBar::getClientRect() void CMenuBar::obtainHook()
{
releaseHook();
- if (m_hHook == 0)
- m_hHook = ::SetWindowsHookEx(WH_MSGFILTER, CMenuBar::MessageHook, 0, GetCurrentThreadId());
+ if (m_hHook == nullptr)
+ m_hHook = ::SetWindowsHookEx(WH_MSGFILTER, CMenuBar::MessageHook, nullptr, GetCurrentThreadId());
m_Owner = this;
}
@@ -126,7 +126,7 @@ void CMenuBar::releaseHook() {
if (m_hHook) {
::UnhookWindowsHookEx(m_hHook);
- m_hHook = 0;
+ m_hHook = nullptr;
}
}
@@ -240,7 +240,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) m_rcItem.bottom -= 4;
m_hbmDraw = CSkin::CreateAeroCompatibleBitmap(m_rcItem, nmtb->nmcd.hdc);
m_hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(m_hdcDraw, m_hbmDraw));
- m_hTheme = M.isAero() || M.isVSThemed() ? OpenThemeData(m_hwndToolbar, L"REBAR") : 0;
+ m_hTheme = M.isAero() || M.isVSThemed() ? OpenThemeData(m_hwndToolbar, L"REBAR") : nullptr;
m_hOldFont = reinterpret_cast<HFONT>(::SelectObject(m_hdcDraw, reinterpret_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT))));
if (m_isAero) {
nm->rc.bottom--;
@@ -250,7 +250,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) else if ((PluginConfig.m_fillColor || M.isVSThemed()) && !CSkin::m_skinEnabled) {
if (PluginConfig.m_fillColor && PluginConfig.m_tbBackgroundHigh && PluginConfig.m_tbBackgroundLow) {
::DrawAlpha(m_hdcDraw, &m_rcItem, PluginConfig.m_tbBackgroundHigh, 100, PluginConfig.m_tbBackgroundLow, 0,
- GRADIENT_TB, 0, 0, 0);
+ GRADIENT_TB, 0, 0, nullptr);
}
else {
m_rcItem.bottom--;
@@ -283,7 +283,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) nmtb->nmcd.rc.bottom--;
if (CSkin::m_skinEnabled) {
- CSkinItem *item = 0;
+ CSkinItem *item = nullptr;
::FillRect(m_hdcDraw, &nmtb->nmcd.rc, CSkin::m_MenuBGBrush);
@@ -300,13 +300,13 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) COLORREF clr = ::GetSysColor(COLOR_HOTLIGHT);
COLORREF clrRev = clr;
if (uState & CDIS_MARKED || uState & CDIS_CHECKED)
- ::DrawAlpha(m_hdcDraw, &nmtb->nmcd.rc, clrRev, 80, clrRev, 0, 9, 31, 4, 0);
+ ::DrawAlpha(m_hdcDraw, &nmtb->nmcd.rc, clrRev, 80, clrRev, 0, 9, 31, 4, nullptr);
if (uState & CDIS_SELECTED)
- ::DrawAlpha(m_hdcDraw, &nmtb->nmcd.rc, clrRev, 80, clrRev, 0, 9, 31, 4, 0);
+ ::DrawAlpha(m_hdcDraw, &nmtb->nmcd.rc, clrRev, 80, clrRev, 0, 9, 31, 4, nullptr);
if (uState & CDIS_HOT)
- ::DrawAlpha(m_hdcDraw, &nmtb->nmcd.rc, clrRev, 80, clrRev, 0, 9, 31, 4, 0);
+ ::DrawAlpha(m_hdcDraw, &nmtb->nmcd.rc, clrRev, 80, clrRev, 0, 9, 31, 4, nullptr);
}
if (szText) {
@@ -320,7 +320,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) if (iIndex == 0)
::DrawIconEx(m_hdcDraw, (nmtb->nmcd.rc.left + nmtb->nmcd.rc.right) / 2 - 8,
(nmtb->nmcd.rc.top + nmtb->nmcd.rc.bottom) / 2 - 8, Skin_LoadIcon(SKINICON_OTHER_MIRANDA),
- 16, 16, 0, 0, DI_NORMAL);
+ 16, 16, 0, nullptr, DI_NORMAL);
return CDRF_SKIPDEFAULT;
}
@@ -342,7 +342,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) ::DeleteObject(m_hbmDraw);
::SelectObject(m_hdcDraw, m_hOldFont);
::DeleteDC(m_hdcDraw);
- m_hdcDraw = 0;
+ m_hdcDraw = nullptr;
if (m_hTheme)
CloseThemeData(m_hTheme);
return CDRF_SKIPDEFAULT;
@@ -409,13 +409,13 @@ void CMenuBar::invoke(const int id) cancel();
m_activeMenu = hMenu;
- m_activeSubMenu = 0;
+ m_activeSubMenu = nullptr;
m_activeID = id;
updateState(hMenu);
obtainHook();
m_fTracking = true;
::SendMessage(m_hwndToolbar, TB_SETSTATE, (WPARAM)id, TBSTATE_CHECKED | TBSTATE_ENABLED);
- ::TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_pContainer->m_hwnd, 0);
+ ::TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_pContainer->m_hwnd, nullptr);
}
void CMenuBar::cancel()
@@ -424,7 +424,7 @@ void CMenuBar::cancel() if (m_activeID)
::SendMessage(m_hwndToolbar, TB_SETSTATE, (WPARAM)m_activeID, TBSTATE_ENABLED);
m_activeID = 0;
- m_activeMenu = 0;
+ m_activeMenu = nullptr;
m_isContactMenu = m_isMainMenu = false;
::EndMenu();
}
@@ -582,7 +582,7 @@ void CMenuBar::checkButtons() TBADDBITMAP tb;
tb.nID = (UINT_PTR)m_MimIcon;
- tb.hInst = 0;
+ tb.hInst = nullptr;
::SendMessage(m_hwndToolbar, TB_ADDBITMAP, 1, (LPARAM)&tb);
}
@@ -624,9 +624,9 @@ LRESULT CALLBACK CMenuBar::MessageHook(int nCode, WPARAM wParam, LPARAM lParam) case WM_LBUTTONDOWN:
::GetCursorPos(&pt);
- if (::MenuItemFromPoint(0, m_Owner->m_activeMenu, pt) >= 0) // inside menu
+ if (::MenuItemFromPoint(nullptr, m_Owner->m_activeMenu, pt) >= 0) // inside menu
break;
- if (m_Owner->m_activeSubMenu && ::MenuItemFromPoint(0, m_Owner->m_activeSubMenu, pt) >= 0)
+ if (m_Owner->m_activeSubMenu && ::MenuItemFromPoint(nullptr, m_Owner->m_activeSubMenu, pt) >= 0)
break;
else { // anywhere else, cancel the menu
::CallNextHookEx(m_hHook, nCode, wParam, lParam);
@@ -669,7 +669,7 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM CTabBaseDlg *dat = nullptr;
POINT pt;
- if (OldStatusBarproc == 0) {
+ if (OldStatusBarproc == nullptr) {
WNDCLASSEX wc = { 0 };
wc.cbSize = sizeof(wc);
GetClassInfoEx(g_hInst, STATUSCLASSNAME, &wc);
@@ -722,7 +722,7 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM CSkinItem *item = &SkinItems[ID_EXTBKSTATUSBARPANEL];
BOOL bAero = M.isAero();
- HANDLE hTheme = bAero ? OpenThemeData(hWnd, L"ButtonStyle") : 0;
+ HANDLE hTheme = bAero ? OpenThemeData(hWnd, L"ButtonStyle") : nullptr;
if (pContainer)
dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA);
@@ -731,11 +731,11 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM GetClientRect(hWnd, &rcClient);
HBITMAP hbm, hbmOld;
- HANDLE hbp = 0;
+ HANDLE hbp = nullptr;
HDC hdcMem;
if (CMimAPI::m_haveBufferedPaint) {
hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, nullptr, &hdcMem);
- hbm = hbmOld = 0;
+ hbm = hbmOld = nullptr;
}
else {
hdcMem = CreateCompatibleDC(hdc);
@@ -837,16 +837,16 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM else {
if (hIcon) {
if (LOWORD(result) > 1) { // we have a text
- DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
if (dat) {
if (dat->m_bShowTyping == 2)
- DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, PluginConfig.g_iconOverlayEnabled, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, PluginConfig.g_iconOverlayEnabled, 16, 16, 0, nullptr, DI_NORMAL);
}
itemRect.left += 20;
CSkin::RenderText(hdcMem, hTheme, szText, &itemRect, DT_VCENTER | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX,
CSkin::m_glowSize, clr);
}
- else DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ else DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
}
else {
itemRect.left += 2;
@@ -909,7 +909,7 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM tooltip_active = FALSE;
}
KillTimer(hWnd, TIMERID_HOVER);
- SetTimer(hWnd, TIMERID_HOVER, 450, 0);
+ SetTimer(hWnd, TIMERID_HOVER, 450, nullptr);
break;
case WM_LBUTTONDOWN:
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index b42a1792e3..205e5d5dac 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -68,7 +68,7 @@ static void PU_CleanUp() static void CheckForRemoveMask()
{
if (!M.GetByte(MODULE, "firsttime", 0) && (nen_options.maskActL & MASK_REMOVE || nen_options.maskActR & MASK_REMOVE || nen_options.maskActTE & MASK_REMOVE)) {
- MessageBox(0, TranslateT("One of your popup actions is set to DISMISS EVENT.\nNote that this options may have unwanted side effects as it REMOVES the event from the unread queue.\nThis may lead to events not showing up as \"new\". If you don't want this behavior, please review the 'Event notifications' settings page."), TranslateT("TabSRMM warning message"), MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("One of your popup actions is set to DISMISS EVENT.\nNote that this options may have unwanted side effects as it REMOVES the event from the unread queue.\nThis may lead to events not showing up as \"new\". If you don't want this behavior, please review the 'Event notifications' settings page."), TranslateT("TabSRMM warning message"), MB_OK | MB_ICONSTOP);
db_set_b(0, MODULE, "firsttime", 1);
}
}
@@ -153,10 +153,10 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa TreeViewInit(GetDlgItem(hWnd, IDC_EVENTOPTIONS), CTranslator::TREE_NEN, 0, TRUE);
if (!PluginConfig.g_bPopupAvail) {
- HWND hwndChild = FindWindowEx(hWnd, 0, 0, 0);
+ HWND hwndChild = FindWindowEx(hWnd, nullptr, nullptr, nullptr);
while (hwndChild) {
ShowWindow(hwndChild, SW_HIDE);
- hwndChild = FindWindowEx(hWnd, hwndChild, 0, 0);
+ hwndChild = FindWindowEx(hWnd, hwndChild, nullptr, nullptr);
}
Utils::showDlgControl(hWnd, IDC_NOPOPUPAVAIL, SW_SHOW);
}
@@ -373,7 +373,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA break;
case UM_FREEPLUGINDATA:
pdata->hContact = 0; // mark as removeable
- pdata->hWnd = 0;
+ pdata->hWnd = nullptr;
return TRUE;
case UM_INITPOPUP:
pdata->hWnd = hWnd;
@@ -456,7 +456,7 @@ static wchar_t* GetPreviewT(WORD eventType, DBEVENTINFO* dbe) if (dbe->cbBlob > 5) { // min valid size = (sizeof(DWORD) + 1 character file name + terminating 0)
char* szFileName = (char *)dbe->pBlob + sizeof(DWORD);
- char* szDescr = 0;
+ char* szDescr = nullptr;
size_t namelength = Utils::safe_strlen(szFileName, dbe->cbBlob - sizeof(DWORD));
if (dbe->cbBlob > (sizeof(DWORD) + namelength + 1))
@@ -655,7 +655,7 @@ static int TSAPI PopupPreview(NEN_OPTIONS *pluginOptions) // bForced is used to only update the status, nickname etc. and does NOT update the unread count
void TSAPI UpdateTrayMenuState(CTabBaseDlg *dat, BOOL bForced)
{
- if (PluginConfig.g_hMenuTrayUnread == 0 || dat->m_hContact == 0)
+ if (PluginConfig.g_hMenuTrayUnread == nullptr || dat->m_hContact == 0)
return;
MENUITEMINFO mii = { 0 };
@@ -663,7 +663,7 @@ void TSAPI UpdateTrayMenuState(CTabBaseDlg *dat, BOOL bForced) mii.fMask = MIIM_DATA | MIIM_BITMAP;
const wchar_t *tszProto = dat->m_cache->getRealAccount();
- assert(tszProto != 0);
+ assert(tszProto != nullptr);
GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->m_hContact, FALSE, &mii);
if (!bForced)
@@ -690,8 +690,8 @@ int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szPro return 0;
PROTOACCOUNT *acc = Proto_GetAccount(szProto);
- wchar_t *tszFinalProto = (acc && acc->tszAccountName ? acc->tszAccountName : 0);
- if (tszFinalProto == 0)
+ wchar_t *tszFinalProto = (acc && acc->tszAccountName ? acc->tszAccountName : nullptr);
+ if (tszFinalProto == nullptr)
return 0;
WORD wMyStatus = (wStatus == 0) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus;
@@ -705,7 +705,7 @@ int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szPro wchar_t szMenuEntry[80];
const wchar_t *szNick = nullptr;
- if (dat != 0) {
+ if (dat != nullptr) {
szNick = dat->m_cache->getNick();
GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
mii.dwItemData++;
@@ -773,7 +773,7 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi if (nen_options.bNoRSS && szProto != nullptr && !strncmp(szProto, "RSS", 3))
return 0; // filter out RSS popups
- if (windowOpen && pContainer != 0) { // message window is open, need to check the container config if we want to see a popup nonetheless
+ if (windowOpen && pContainer != nullptr) { // message window is open, need to check the container config if we want to see a popup nonetheless
if (nen_options.bWindowCheck && windowOpen) // no popups at all for open windows... no exceptions
return 0;
if (pContainer->dwFlags & CNT_DONTREPORT && (IsIconic(pContainer->m_hwnd))) // in tray counts as "minimised"
@@ -798,9 +798,9 @@ passed: if (PU_GetByContact(hContact) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
if (PopupUpdateT(hContact, hDbEvent) != 0)
- PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : 0);
+ PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : nullptr);
}
- else PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : 0);
+ else PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : nullptr);
return 0;
}
@@ -811,10 +811,10 @@ void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask) if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_bPopupAvail)
return;
- PLUGIN_DATAT *_T = 0;
- while ((_T = PU_GetByContact(hContact)) != 0) {
+ PLUGIN_DATAT *_T = nullptr;
+ while ((_T = PU_GetByContact(hContact)) != nullptr) {
_T->hContact = 0; // make sure, it never "comes back"
- if (_T->hWnd != 0)
+ if (_T->hWnd != nullptr)
PUDeletePopup(_T->hWnd);
}
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 45fc240a4a..939a92e906 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -35,7 +35,7 @@ void CTabBaseDlg::DM_SaveLogAsRTF() const { - if (m_hwndIEView != 0) { + if (m_hwndIEView != nullptr) { IEVIEWEVENT event = { sizeof(event) }; event.hwnd = m_hwndIEView; event.hContact = m_hContact; @@ -130,7 +130,7 @@ bool CTabBaseDlg::DM_GenericHotkeysCheck(MSG *message) return true; case TABSRMM_HK_CONTAINEROPTIONS: - if (m_pContainer->hWndOptions == 0) + if (m_pContainer->hWndOptions == nullptr) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_pContainer->m_hwnd, DlgProcContainerOptions, (LPARAM)m_pContainer); return true; @@ -385,7 +385,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar break; case ID_SENDMENU_SENDTOCONTAINER: m_sendMode ^= SMODE_CONTAINER; - RedrawWindow(m_hwnd, 0, 0, RDW_ERASENOW | RDW_UPDATENOW); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_ERASENOW | RDW_UPDATENOW); break; case ID_SENDMENU_SENDLATER: if (sendLater->isAvail()) @@ -402,18 +402,18 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar break; } db_set_b(m_hContact, SRMSGMOD_T, "no_ack", (BYTE)(m_sendMode & SMODE_NOACK ? 1 : 0)); - SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); + SetWindowPos(m_message.GetHwnd(), nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); if (m_sendMode & SMODE_MULTIPLE || m_sendMode & SMODE_CONTAINER) { - SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SetWindowPos(m_message.GetHwnd(), nullptr, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); - RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } else { if (IsWindow(GetDlgItem(m_hwnd, IDC_CLIST))) DestroyWindow(GetDlgItem(m_hwnd, IDC_CLIST)); - SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SetWindowPos(m_message.GetHwnd(), nullptr, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); - RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } SendMessage(m_pContainer->m_hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); Resize(); @@ -459,9 +459,9 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar DM_ScrollToBottom(0, 1); } } - SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | + SetWindowPos(m_message.GetHwnd(), nullptr, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); - RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); if (m_bEditNotesActive) CWarning::show(CWarning::WARN_EDITUSERNOTES, MB_OK | MB_ICONINFORMATION); @@ -764,7 +764,7 @@ void CTabBaseDlg::DM_RecalcPictureSize() void CTabBaseDlg::DM_UpdateLastMessage() const { - if (m_pContainer->hwndStatus == 0 || m_pContainer->m_hwndActive != m_hwnd) + if (m_pContainer->hwndStatus == nullptr || m_pContainer->m_hwndActive != m_hwnd) return; wchar_t szBuf[100]; @@ -822,7 +822,7 @@ HWND CTabBaseDlg::DM_CreateClist() if (!sendLater->isAvail()) { CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options -> Message sessions -> Advanced tweaks\\b0. Changing this option requires a restart.")); m_sendMode &= ~SMODE_MULTIPLE; - return 0; + return nullptr; } HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, 184, 0, 30, 30, m_hwnd, (HMENU)IDC_CLIST, g_hInst, nullptr); @@ -843,7 +843,7 @@ HWND CTabBaseDlg::DM_CreateClist() SendMessage(hwndClist, CLM_FIRST + 106, 0, 1); SendMessage(hwndClist, CLM_AUTOREBUILD, 0, 0); if (hwndClist) - RedrawWindow(hwndClist, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); + RedrawWindow(hwndClist, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); return hwndClist; } @@ -885,7 +885,7 @@ LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) HWND hwndLog = (m_hwndIEView || m_hwndHPP) ? m_hwndIWebBrowserControl : m_log.GetHwnd(); short wDirection = (short)HIWORD(wParam); - if (hwndLog == 0) + if (hwndLog == nullptr) hwndLog = WindowFromPoint(pt); if (LOWORD(wParam) & MK_SHIFT || M.GetByte("fastscroll", 0)) { @@ -910,15 +910,15 @@ void CTabBaseDlg::DM_FreeTheme() { if (m_hTheme) { CloseThemeData(m_hTheme); - m_hTheme = 0; + m_hTheme = nullptr; } if (m_hThemeIP) { CloseThemeData(m_hThemeIP); - m_hThemeIP = 0; + m_hThemeIP = nullptr; } if (m_hThemeToolbar) { CloseThemeData(m_hThemeToolbar); - m_hThemeToolbar = 0; + m_hThemeToolbar = nullptr; } } @@ -929,17 +929,17 @@ void CTabBaseDlg::DM_ThemeChanged() m_hTheme = OpenThemeData(m_hwnd, L"EDIT"); - if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) { + if (m_hTheme != nullptr || (CSkin::m_skinEnabled && !item_log->IGNORED)) { SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); if (isChat()) SetWindowLongPtr(m_nickList.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_nickList.GetHwnd(), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); } - if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) + if (m_hTheme != nullptr || (CSkin::m_skinEnabled && !item_msg->IGNORED)) SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); - m_hThemeIP = M.isAero() ? OpenThemeData(m_hwnd, L"ButtonStyle") : 0; - m_hThemeToolbar = (M.isAero() || (!CSkin::m_skinEnabled && M.isVSThemed())) ? OpenThemeData(m_hwnd, L"REBAR") : 0; + m_hThemeIP = M.isAero() ? OpenThemeData(m_hwnd, L"ButtonStyle") : nullptr; + m_hThemeToolbar = (M.isAero() || (!CSkin::m_skinEnabled && M.isVSThemed())) ? OpenThemeData(m_hwnd, L"REBAR") : nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1004,7 +1004,7 @@ void CSrmmWindow::DM_OptionsApplied(WPARAM, LPARAM lParam) } LoadLocalFlags(); - m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY); + m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); m_bShowUIElements = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0; @@ -1105,7 +1105,7 @@ void CTabBaseDlg::DM_Typing(bool fForceOff) HandleIconFeedback(this, PluginConfig.g_IconTypingEvent); } } - if ((GetForegroundWindow() != hwndContainer) || (m_pContainer->hwndStatus == 0) || (m_pContainer->m_hwndActive != m_hwnd)) + if ((GetForegroundWindow() != hwndContainer) || (m_pContainer->hwndStatus == nullptr) || (m_pContainer->m_hwndActive != m_hwnd)) SendMessage(hwndContainer, DM_SETICON, (WPARAM)this, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]); m_bShowTyping = 1; diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 298bee3138..a002a44042 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -78,10 +78,10 @@ void CGlobals::reloadSystemStartup() hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS);
hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE);
- HDC hScrnDC = GetDC(0);
+ HDC hScrnDC = GetDC(nullptr);
m_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0;
m_DPIscaleY = GetDeviceCaps(hScrnDC, LOGPIXELSY) / 96.0;
- ReleaseDC(0, hScrnDC);
+ ReleaseDC(nullptr, hScrnDC);
reloadSettings(false);
reloadAdv();
@@ -173,7 +173,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_visualMessageSizeIndicator = M.GetByte("msgsizebar", 0);
m_autoSplit = M.GetByte("autosplit", 0);
m_FlashOnMTN = M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH);
- if (m_MenuBar == 0) {
+ if (m_MenuBar == nullptr) {
m_MenuBar = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENUBAR));
TranslateMenu(m_MenuBar);
}
@@ -191,7 +191,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_fillColor = M.GetDword(FONTMODULE, "fillColor", 0);
if (CSkin::m_BrushFill) {
::DeleteObject(CSkin::m_BrushFill);
- CSkin::m_BrushFill = 0;
+ CSkin::m_BrushFill = nullptr;
}
m_genericTxtColor = M.GetDword(FONTMODULE, "genericTxtClr", GetSysColor(COLOR_BTNTEXT));
m_cRichBorders = M.GetDword(FONTMODULE, "cRichBorders", 0);
@@ -220,7 +220,7 @@ void CGlobals::reloadAdv() const HMENU CGlobals::getMenuBar()
{
- if (m_MenuBar == 0) {
+ if (m_MenuBar == nullptr) {
m_MenuBar = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENUBAR));
TranslateMenu(m_MenuBar);
}
@@ -248,7 +248,7 @@ void CGlobals::hookSystemEvents() int CGlobals::TopToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
ttb.pszService = MS_TABMSG_TRAYSUPPORT;
ttb.name = "TabSRMM session list";
@@ -276,7 +276,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) CSkin::initAeroEffect();
for (int i = 0; i < NR_BUTTONBARICONS; i++)
- PluginConfig.g_buttonBarIcons[i] = 0;
+ PluginConfig.g_buttonBarIcons[i] = nullptr;
::LoadIconTheme();
::CreateImageList(TRUE);
::CB_InitCustomButtons();
@@ -299,7 +299,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) if (M.GetByte("avatarmode", -1) == -1)
db_set_b(0, SRMSGMOD_T, "avatarmode", 2);
- PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, 0, 0, g_hInst, nullptr);
+ PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, nullptr, nullptr, g_hInst, nullptr);
::CreateTrayMenus(TRUE);
if (nen_options.bTraySupport)
@@ -316,7 +316,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) if (sendLater->isAvail()) {
SET_UID(mi, 0x8f32b04e, 0x314e, 0x42eb, 0x89, 0xc6, 0x56, 0x21, 0xf5, 0x1a, 0x2f, 0x22);
mi.position = -500050006;
- mi.hIcolibItem = 0;
+ mi.hIcolibItem = nullptr;
mi.name.a = LPGEN("&Send later job list...");
mi.pszService = MS_TABMSG_SLQMGR;
PluginConfig.m_UserMenuItem = Menu_AddMainMenuItem(&mi);
@@ -449,7 +449,7 @@ int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM) if (pDlg) {
pDlg->UpdateTitle();
::PostMessage(pDlg->GetHwnd(), DM_UPDATEPICLAYOUT, 0, 0);
- InvalidateRect(pDlg->GetHwnd(), 0, TRUE); // force redraw
+ InvalidateRect(pDlg->GetHwnd(), nullptr, TRUE); // force redraw
}
}
return 0;
@@ -544,7 +544,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
{
- if (c == 0)
+ if (c == nullptr)
return;
CSrmmWindow *dat = c->getDat();
@@ -566,7 +566,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) wchar_t *szOldStatus = pcli->pfnGetStatusModeDescription(wOldStatus, 0);
wchar_t *szNewStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
- if (szOldStatus == 0 || szNewStatus == 0)
+ if (szOldStatus == nullptr || szNewStatus == nullptr)
return;
CMStringW text;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 5e613b9f6a..844cf2adfd 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -37,35 +37,35 @@ #include "stdafx.h"
static UINT WM_TASKBARCREATED;
-static HANDLE hSvcHotkeyProcessor = 0;
+static HANDLE hSvcHotkeyProcessor = nullptr;
static HOTKEYDESC _hotkeydescs[] = {
{ "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD },
- { "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND },
- { "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS },
- { "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS },
- { "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE },
- { "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG },
- { "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER },
-
- { "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND },
- { "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY },
- { "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU },
- { "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU },
- { "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU },
- { "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS },
- { "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR },
- { "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL },
- { "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL },
- { "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND },
- { "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG },
- { "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES },
- { "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR },
- { "tabsrmm_muc_cmgr", LPGEN("Channel manager"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'C'), TABSRMM_HK_CHANNELMGR },
- { "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE },
- { "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE },
- { "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER },
- { "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER },
+ { "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND },
+ { "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS },
+ { "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS },
+ { "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE },
+ { "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG },
+ { "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER },
+
+ { "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, nullptr, 0, TABSRMM_HK_SEND },
+ { "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY },
+ { "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU },
+ { "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU },
+ { "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU },
+ { "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS },
+ { "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR },
+ { "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL },
+ { "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL },
+ { "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND },
+ { "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG },
+ { "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES },
+ { "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR },
+ { "tabsrmm_muc_cmgr", LPGEN("Channel manager"), TABSRMM_HK_SECTION_GC, nullptr, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'C'), TABSRMM_HK_CHANNELMGR },
+ { "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, nullptr, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE },
+ { "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, nullptr, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE },
+ { "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, nullptr, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER },
+ { "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER },
};
LRESULT ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -95,11 +95,11 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact) HWND hWnd = Srmm_FindWindow(hContact);
if (hWnd && IsWindow(hWnd)) {
- TContainerData *pContainer = 0;
+ TContainerData *pContainer = nullptr;
SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
if (pContainer) {
ActivateExistingTab(pContainer, hWnd);
- pContainer->hwndSaved = 0;
+ pContainer->hwndSaved = nullptr;
SetForegroundWindow(pContainer->m_hwnd);
}
else CallService(MS_MSG_SENDMESSAGE, hContact, 0);
@@ -115,7 +115,7 @@ void TSAPI DrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, DWORD dwIdle) if (dwIdle)
CSkin::DrawDimmedIcon(dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - 16) / 2, 16, 16, hIcon, 180);
else
- DrawIconEx(dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
+ DrawIconEx(dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - 16) / 2, hIcon, 16, 16, 0, nullptr, DI_NORMAL | DI_COMPAT);
}
LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -183,7 +183,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP hWnd = si ? si->pDlg->GetHwnd() : nullptr;
}
- CSrmmWindow *dat = 0;
+ CSrmmWindow *dat = nullptr;
if (hWnd)
dat = (CSrmmWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
@@ -193,7 +193,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dis->itemData > 0)
hIcon = (dis->itemData & 0x10000000) ? pci->hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent;
else if (dat != nullptr) {
- hIcon = dat->GetMyContactIcon(0);
+ hIcon = dat->GetMyContactIcon(nullptr);
idle = dat->m_idle;
}
else hIcon = PluginConfig.g_iconContainer;
@@ -353,7 +353,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
HWND hWnd = Srmm_FindWindow(lParam);
if (hWnd && IsWindow(hWnd)) {
- TContainerData *pContainer = 0;
+ TContainerData *pContainer = nullptr;
SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
if (pContainer) {
int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS));
@@ -475,7 +475,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (IsWindow(job->hOwnerWnd))
::SendMessage(job->hOwnerWnd, HM_EVENTSENT, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
else
- sendQueue->ackMessage(0, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
+ sendQueue->ackMessage(nullptr, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
}
}
return 0;
@@ -512,7 +512,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SelectObject(pCont->cachedDC, pCont->oldHBM);
DeleteObject(pCont->cachedHBM);
DeleteDC(pCont->cachedDC);
- pCont->cachedDC = 0;
+ pCont->cachedDC = nullptr;
RedrawWindow(pCont->m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
}
break;
@@ -533,8 +533,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(pCont->m_hwnd, WM_TIMER, TIMERID_HEARTBEAT, 0);
// process send later contacts and jobs, if enough time has elapsed
- if (sendLater->isAvail() && !sendLater->isInteractive() && (time(0) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
- sendLater->setLastProcessed(time(0));
+ if (sendLater->isAvail() && !sendLater->isInteractive() && (time(nullptr) - sendLater->lastProcessed()) > CSendLater::SENDLATER_PROCESS_INTERVAL) {
+ sendLater->setLastProcessed(time(nullptr));
// check the list of contacts that may have new send later jobs
// (added on user's request)
@@ -544,7 +544,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!sendLater->isJobListEmpty()) {
KillTimer(hwndDlg, wParam);
sendLater->startJobListProcess();
- SetTimer(hwndDlg, TIMERID_SENDLATER_TICK, TIMEOUT_SENDLATER_TICK, 0);
+ SetTimer(hwndDlg, TIMERID_SENDLATER_TICK, TIMEOUT_SENDLATER_TICK, nullptr);
}
}
}
@@ -555,7 +555,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (wParam == TIMERID_SENDLATER_TICK) {
if (!sendLater->haveJobs()) {
KillTimer(hwndDlg, wParam);
- SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, 0);
+ SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, nullptr);
sendLater->qMgrUpdate(true);
}
else sendLater->processCurrentJob();
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 75448e5f9e..e891fcf5b9 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -38,7 +38,7 @@ wchar_t *xStatusDescr[] = L"<undef>", L"<undef>"
};
-TInfoPanelConfig CInfoPanel::m_ipConfig = { 0 };
+TInfoPanelConfig CInfoPanel::m_ipConfig = {};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -50,9 +50,9 @@ CInfoPanel::CInfoPanel(CTabBaseDlg *dat) }
m_defaultHeight = PluginConfig.m_panelHeight;
m_defaultMUCHeight = PluginConfig.m_MUCpanelHeight;
- m_hwndConfig = 0;
+ m_hwndConfig = nullptr;
m_hoverFlags = 0;
- m_tip = 0;
+ m_tip = nullptr;
}
CInfoPanel::~CInfoPanel()
@@ -288,7 +288,7 @@ void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, rcBlack.top = rc.bottom;// + 1;
rcBlack.bottom = rcBlack.top + 2;
if (CSkin::m_pCurrentAeroEffect && CSkin::m_pCurrentAeroEffect->m_clrBack != 0)
- ::DrawAlpha(hdc, &rcBlack, CSkin::m_pCurrentAeroEffect->m_clrBack, 90, CSkin::m_pCurrentAeroEffect->m_clrBack, 0, 0, 0, 1, 0);
+ ::DrawAlpha(hdc, &rcBlack, CSkin::m_pCurrentAeroEffect->m_clrBack, 90, CSkin::m_pCurrentAeroEffect->m_clrBack, 0, 0, 0, 1, nullptr);
return;
}
@@ -305,7 +305,7 @@ void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, }
rc.bottom -= 2;
- ::DrawAlpha(hdc, &rc, PluginConfig.m_ipBackgroundGradient, 100, PluginConfig.m_ipBackgroundGradientHigh, 0, 17, 0, 0, 0);
+ ::DrawAlpha(hdc, &rc, PluginConfig.m_ipBackgroundGradient, 100, PluginConfig.m_ipBackgroundGradientHigh, 0, 17, 0, 0, nullptr);
if (fAutoCalc) {
rc.top = rc.bottom - 1;
rc.left--; rc.right++;
@@ -377,7 +377,7 @@ void CInfoPanel::renderContent(const HDC hdc) void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem)
{
const wchar_t *szStatusMsg = nullptr;
- const wchar_t *szTextToShow = 0;
+ const wchar_t *szTextToShow = nullptr;
bool fShowUin = false;
COLORREF clr = 0;
@@ -395,7 +395,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) if (szTextToShow[0]) {
HICON xIcon = m_dat->GetXStatusIcon();
if (xIcon) {
- ::DrawIconEx(hdc, rcItem.left, (rcItem.bottom + rcItem.top - PluginConfig.m_smcyicon) / 2, xIcon, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, 0, DI_NORMAL | DI_COMPAT);
+ ::DrawIconEx(hdc, rcItem.left, (rcItem.bottom + rcItem.top - PluginConfig.m_smcyicon) / 2, xIcon, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL | DI_COMPAT);
::DestroyIcon(xIcon);
rcItem.left += 21;
}
@@ -553,7 +553,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) rc.right -= 3;
if (szResult[0]) {
- ::DrawIconEx(hdc, rcItem.left, (rcItem.bottom - rcItem.top) / 2 - 8 + rcItem.top, PluginConfig.g_iconClock, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(hdc, rcItem.left, (rcItem.bottom - rcItem.top) / 2 - 8 + rcItem.top, PluginConfig.g_iconClock, 16, 16, 0, nullptr, DI_NORMAL);
HFONT oldFont = (HFONT)SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_TIME]);
@@ -581,7 +581,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) }
if (m_dat->m_hClientIcon)
- DrawIconEx(hdc, rc.right - 19, (rc.bottom + rc.top - 16) / 2, m_dat->m_hClientIcon, 16, 16, 0, 0, DI_NORMAL);
+ DrawIconEx(hdc, rc.right - 19, (rc.bottom + rc.top - 16) / 2, m_dat->m_hClientIcon, 16, 16, 0, nullptr, DI_NORMAL);
if (hOldFont)
SelectObject(hdc, hOldFont);
@@ -655,7 +655,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
{
SESSION_INFO *si = reinterpret_cast<SESSION_INFO*>(m_dat->m_si);
- if (si == 0)
+ if (si == nullptr)
return;
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_UIN]));
@@ -707,7 +707,7 @@ HMENU CInfoPanel::constructContextualMenu() const mii.hbmpItem = HBMMENU_CALLBACK;
if (!(m_hoverFlags & HOVER_NICK))
- return 0;
+ return nullptr;
HMENU m = ::CreatePopupMenu();
@@ -721,10 +721,10 @@ HMENU CInfoPanel::constructContextualMenu() const if (GCW_SERVER & m_dat->m_si->iType)
::EnableMenuItem(m, IDC_SRMM_CHANMGR, MF_BYCOMMAND | MF_GRAYED);
}
- ::AppendMenu(m, MF_SEPARATOR, 1000, 0);
+ ::AppendMenu(m, MF_SEPARATOR, 1000, nullptr);
Utils::addMenuItem(m, mii, PluginConfig.g_buttonBarIcons[6], TranslateT("Close session"), IDC_CLOSE, 4);
}
- ::AppendMenu(m, MF_SEPARATOR, 1000, 0);
+ ::AppendMenu(m, MF_SEPARATOR, 1000, nullptr);
::AppendMenu(m, MF_STRING, CMD_IP_COPY, TranslateT("Copy to clipboard"));
return m;
@@ -830,23 +830,23 @@ void CInfoPanel::trackMouse(POINT &pt) switch (result) {
case HTSTATUS:
m_hoverFlags |= HOVER_STATUS;
- ::SetCursor(LoadCursor(0, IDC_HAND));
+ ::SetCursor(LoadCursor(nullptr, IDC_HAND));
break;
case HTNICK:
m_hoverFlags |= HOVER_NICK;
- ::SetCursor(LoadCursor(0, IDC_HAND));
+ ::SetCursor(LoadCursor(nullptr, IDC_HAND));
break;
case HTUIN:
- ::SetCursor(LoadCursor(0, IDC_HAND));
+ ::SetCursor(LoadCursor(nullptr, IDC_HAND));
m_hoverFlags |= HOVER_UIN;
break;
}
if (m_hoverFlags) {
if (!(m_dat->m_dwFlagsEx & MWF_SHOW_AWAYMSGTIMER)) {
- ::SetTimer(m_dat->GetHwnd(), TIMERID_AWAYMSG, 1000, 0);
+ ::SetTimer(m_dat->GetHwnd(), TIMERID_AWAYMSG, 1000, nullptr);
m_dat->m_dwFlagsEx |= MWF_SHOW_AWAYMSGTIMER;
}
}
@@ -885,7 +885,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam) DBVARIANT dbv = { 0 };
if (BYTE xStatus = m_dat->m_cache->getXStatusId()) {
- wchar_t *tszXStatusName = 0;
+ wchar_t *tszXStatusName = nullptr;
if (0 == db_get_ws(m_dat->m_cache->getContact(), m_dat->m_cache->getProto(), "XStatusName", &dbv))
tszXStatusName = dbv.ptszVal;
else if (xStatus > 0 && xStatus <= 31)
@@ -942,7 +942,7 @@ void CInfoPanel::hideTip(const HWND hwndNew) return;
if (::IsWindow(m_tip->getHwnd()))
::DestroyWindow(m_tip->getHwnd());
- m_tip = 0;
+ m_tip = nullptr;
}
}
@@ -963,7 +963,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP // parent window of the infopanel ACC control
RECT rc, rcItem;
CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- if (dat == 0)
+ if (dat == nullptr)
break;
GetClientRect(hwnd, &rcItem);
@@ -984,7 +984,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP HBITMAP hbm = CSkin::CreateAeroCompatibleBitmap(rc, dcWin);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdc, hbm);
- if (CSkin::m_pCurrentAeroEffect == 0)
+ if (CSkin::m_pCurrentAeroEffect == nullptr)
FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
else {
if (CSkin::m_pCurrentAeroEffect->m_finalAlpha == 0)
@@ -1097,7 +1097,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L HWND hwndChild = (HWND)lParam;
UINT id = ::GetDlgCtrlID(hwndChild);
- if (m_configDlgFont == 0) {
+ if (m_configDlgFont == nullptr) {
HFONT hFont = (HFONT)::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_GETFONT, 0, 0);
LOGFONT lf = { 0 };
@@ -1225,7 +1225,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L ::DeleteObject(m_configDlgBoldFont);
::DeleteObject(m_configDlgFont);
- m_configDlgBoldFont = m_configDlgFont = 0;
+ m_configDlgBoldFont = m_configDlgFont = nullptr;
::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
break;
}
@@ -1251,9 +1251,9 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt) if (!::PtInRect(&rc, ptTest))
return 0;
- if (m_hwndConfig == 0) {
- m_configDlgBoldFont = m_configDlgFont = 0;
- m_hwndConfig = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_INFOPANEL), 0 /*m_dat->m_pContainer->m_hwnd */,
+ if (m_hwndConfig == nullptr) {
+ m_configDlgBoldFont = m_configDlgFont = nullptr;
+ m_hwndConfig = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_INFOPANEL), nullptr /*m_dat->m_pContainer->m_hwnd */,
ConfigDlgProcStub, (LPARAM)this);
if (m_hwndConfig) {
TranslateDialogDefault(m_hwndConfig);
@@ -1278,7 +1278,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt) void CInfoPanel::dismissConfig(bool fForced)
{
- if (m_hwndConfig == 0)
+ if (m_hwndConfig == nullptr)
return;
if (!m_fDialogCreated) {
@@ -1289,7 +1289,7 @@ void CInfoPanel::dismissConfig(bool fForced) ::GetWindowRect(m_hwndConfig, &rc);
if (fForced || !PtInRect(&rc, pt)) {
SendMessage(m_hwndConfig, WM_CLOSE, 1, 1);
- m_hwndConfig = 0;
+ m_hwndConfig = nullptr;
}
}
m_fDialogCreated = false;
@@ -1306,7 +1306,7 @@ void CInfoPanel::dismissConfig(bool fForced) CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const wchar_t *pszText, const CInfoPanel* panel)
{
m_hwnd = ::CreateWindowEx(WS_EX_TOOLWINDOW, L"RichEditTipClass", L"", (M.isAero() ? WS_THICKFRAME : WS_BORDER) | WS_POPUPWINDOW | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- 0, 0, 40, 40, 0, 0, g_hInst, this);
+ 0, 0, 40, 40, nullptr, nullptr, g_hInst, this);
m_hRich = ::CreateWindowEx(0, L"RICHEDIT50W", L"", WS_CHILD | ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL | WS_TABSTOP,
0, 0, 40, 40, m_hwnd, reinterpret_cast<HMENU>(1000), g_hInst, nullptr);
@@ -1379,7 +1379,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const wchar_t *szT m_rcRich.right = m_rcRich.left + (twips * (m_rcRich.right - m_rcRich.left)) - 10 * twips;
m_rcRich.bottom = m_rcRich.top + (twips * (m_rcRich.bottom - m_rcRich.top));
- FORMATRANGE fr = { 0 };
+ FORMATRANGE fr = {};
fr.hdc = hdc;
fr.hdcTarget = hdc;
fr.rc = m_rcRich;
@@ -1397,7 +1397,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const wchar_t *szT ::SetWindowPos(m_hwnd, HWND_TOP, pt.x - 5, pt.y - 5, m_szRich.cx + m_leftWidth + LEFT_BORDER + RIGHT_BORDER + 2 * xBorder,
m_szRich.cy + TOP_BORDER + BOTTOM_BORDER + 2 * yBorder, SWP_NOACTIVATE | SWP_SHOWWINDOW);
- ::SetWindowPos(m_hRich, 0, LEFT_BORDER + m_leftWidth, TOP_BORDER, m_szRich.cx, m_szRich.cy, SWP_SHOWWINDOW);
+ ::SetWindowPos(m_hRich, nullptr, LEFT_BORDER + m_leftWidth, TOP_BORDER, m_szRich.cx, m_szRich.cy, SWP_SHOWWINDOW);
::ReleaseDC(m_hwnd, hdc);
}
@@ -1473,7 +1473,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case WM_ACTIVATE:
case WM_SETCURSOR:
::KillTimer(hwnd, 1000);
- ::SetTimer(hwnd, 1000, 200, 0);
+ ::SetTimer(hwnd, 1000, 200, nullptr);
if (msg == WM_ACTIVATE && LOWORD(wParam) == WA_INACTIVE)
::DestroyWindow(hwnd);
@@ -1494,7 +1494,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam RECT rcText = { 0, 0, rc.right, TOP_BORDER };
LONG cx = rc.right;
LONG cy = rc.bottom;
- HANDLE hTheme = 0;
+ HANDLE hTheme = nullptr;
mir_snwprintf(szTitle, m_szTitle ? L"%s (%s)" : L"%s%s", c->getNick(), m_szTitle ? m_szTitle : L"");
@@ -1524,7 +1524,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam else {
::FillRect(hdcMem, &rc, br);
::DrawAlpha(hdcMem, &rcText, PluginConfig.m_ipBackgroundGradientHigh, 100, PluginConfig.m_ipBackgroundGradient,
- 0, GRADIENT_TB + 1, 0, 2, 0);
+ 0, GRADIENT_TB + 1, 0, 2, nullptr);
}
::DeleteObject(br);
rcText.left = 20;
@@ -1532,15 +1532,15 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam LONG dy = 4;
if (m_hIcon) {
- ::DrawIconEx(hdcMem, 2, dy, m_hIcon, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(hdcMem, 2, dy, m_hIcon, 16, 16, 0, nullptr, DI_NORMAL);
dy = TOP_BORDER + 4;
}
if (m_panel->getDat()->m_hXStatusIcon) {
- ::DrawIconEx(hdcMem, 2, dy, m_panel->getDat()->m_hXStatusIcon, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(hdcMem, 2, dy, m_panel->getDat()->m_hXStatusIcon, 16, 16, 0, nullptr, DI_NORMAL);
dy += 18;
}
if (m_panel->getDat()->m_hClientIcon)
- ::DrawIconEx(hdcMem, 2, dy, m_panel->getDat()->m_hClientIcon, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(hdcMem, 2, dy, m_panel->getDat()->m_hClientIcon, 16, 16, 0, nullptr, DI_NORMAL);
CSkin::RenderText(hdcMem, hTheme, szTitle, &rcText, DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER, CSkin::m_glowSize, clr);
if (hTheme)
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index d1af47ec4b..cace397ad3 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -29,23 +29,23 @@ #include "stdafx.h" -PDTTE CMimAPI::m_pfnDrawThemeTextEx = 0; -DEFICA CMimAPI::m_pfnDwmExtendFrameIntoClientArea = 0; -DICE CMimAPI::m_pfnDwmIsCompositionEnabled = 0; -DRT CMimAPI::m_pfnDwmRegisterThumbnail = 0; -BPI CMimAPI::m_pfnBufferedPaintInit = 0; -BPU CMimAPI::m_pfnBufferedPaintUninit = 0; -BBP CMimAPI::m_pfnBeginBufferedPaint = 0; -EBP CMimAPI::m_pfnEndBufferedPaint = 0; -BBW CMimAPI::m_pfnDwmBlurBehindWindow = 0; -DGC CMimAPI::m_pfnDwmGetColorizationColor = 0; -BPSA CMimAPI::m_pfnBufferedPaintSetAlpha = 0; -DWMIIB CMimAPI::m_pfnDwmInvalidateIconicBitmaps = 0; -DWMSWA CMimAPI::m_pfnDwmSetWindowAttribute = 0; -DWMUT CMimAPI::m_pfnDwmUpdateThumbnailProperties = 0; -DURT CMimAPI::m_pfnDwmUnregisterThumbnail = 0; -DSIT CMimAPI::m_pfnDwmSetIconicThumbnail = 0; -DSILP CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap = 0; +PDTTE CMimAPI::m_pfnDrawThemeTextEx = nullptr; +DEFICA CMimAPI::m_pfnDwmExtendFrameIntoClientArea = nullptr; +DICE CMimAPI::m_pfnDwmIsCompositionEnabled = nullptr; +DRT CMimAPI::m_pfnDwmRegisterThumbnail = nullptr; +BPI CMimAPI::m_pfnBufferedPaintInit = nullptr; +BPU CMimAPI::m_pfnBufferedPaintUninit = nullptr; +BBP CMimAPI::m_pfnBeginBufferedPaint = nullptr; +EBP CMimAPI::m_pfnEndBufferedPaint = nullptr; +BBW CMimAPI::m_pfnDwmBlurBehindWindow = nullptr; +DGC CMimAPI::m_pfnDwmGetColorizationColor = nullptr; +BPSA CMimAPI::m_pfnBufferedPaintSetAlpha = nullptr; +DWMIIB CMimAPI::m_pfnDwmInvalidateIconicBitmaps = nullptr; +DWMSWA CMimAPI::m_pfnDwmSetWindowAttribute = nullptr; +DWMUT CMimAPI::m_pfnDwmUpdateThumbnailProperties = nullptr; +DURT CMimAPI::m_pfnDwmUnregisterThumbnail = nullptr; +DSIT CMimAPI::m_pfnDwmSetIconicThumbnail = nullptr; +DSILP CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap = nullptr; bool CMimAPI::m_shutDown = 0; wchar_t CMimAPI::m_userDir[] = L"\0"; @@ -161,10 +161,10 @@ void CMimAPI::InitAPI() DWORD dwVer = LOWORD(GetVersion()); m_winVer = MAKEWORD(HIBYTE(dwVer), LOBYTE(dwVer)); - m_hUxTheme = 0; + m_hUxTheme = nullptr; // vista+ DWM API - m_hDwmApi = 0; + m_hDwmApi = nullptr; if (IsWinVerVistaPlus()) { m_hDwmApi = Utils::loadSystemLibrary(L"\\dwmapi.dll"); if (m_hDwmApi) { @@ -190,7 +190,7 @@ void CMimAPI::InitAPI() m_pfnBufferedPaintInit = (BPI)GetProcAddress(m_hUxTheme, "BufferedPaintInit"); m_pfnBufferedPaintUninit = (BPU)GetProcAddress(m_hUxTheme, "BufferedPaintUnInit"); m_pfnBufferedPaintSetAlpha = (BPSA)GetProcAddress(m_hUxTheme, "BufferedPaintSetAlpha"); - m_haveBufferedPaint = (m_pfnBeginBufferedPaint != 0 && m_pfnEndBufferedPaint != 0) ? true : false; + m_haveBufferedPaint = (m_pfnBeginBufferedPaint != nullptr && m_pfnEndBufferedPaint != nullptr) ? true : false; if (m_haveBufferedPaint) m_pfnBufferedPaintInit(); } @@ -253,11 +253,11 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) fShow = true; break; case 2: - if (hwnd == 0) + if (hwnd == nullptr) fShow = true; else { if (PluginConfig.m_bHideOnClose) { - TContainerData *pCont = 0; + TContainerData *pCont = nullptr; SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pCont); if (pCont && pCont->fHidden) fShow = true; @@ -302,7 +302,7 @@ int CMimAPI::ProtoAck(WPARAM, LPARAM lParam) { ACKDATA *pAck = (ACKDATA*)lParam; - if ((pAck != 0) && (pAck->type == ACKTYPE_MESSAGE)) { + if ((pAck != nullptr) && (pAck->type == ACKTYPE_MESSAGE)) { int i = 0, iFound = SendQueue::NR_SENDJOBS; SendJob *jobs = sendQueue->getJobByIndex(0); MCONTACT hMeta = db_mc_getMeta(pAck->hContact); @@ -399,7 +399,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) DWORD dwStatusMask = M.GetDword("autopopupmask", -1); if (hwnd) { - TContainerData *pTargetContainer = 0; + TContainerData *pTargetContainer = nullptr; SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pTargetContainer); if (pTargetContainer == nullptr || !PluginConfig.m_bHideOnClose || IsWindowVisible(pTargetContainer->m_hwnd)) return 0; @@ -439,7 +439,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) return 0; case EVENTTYPE_FILE: - tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, 0, 0, dbei.szModule); + tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, nullptr, nullptr, dbei.szModule); return 0; } } @@ -505,7 +505,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) // the contact list for flashing nowindowcreate: if (!(dbei.flags & DBEF_READ)) { - UpdateTrayMenu(0, 0, dbei.szModule, nullptr, hContact, 1); + UpdateTrayMenu(nullptr, 0, dbei.szModule, nullptr, hContact, 1); if (!nen_options.bTraySupport) { wchar_t toolTip[256], *contactName; @@ -520,10 +520,10 @@ nowindowcreate: cle.szTooltip.w = toolTip; pcli->pfnAddEvent(&cle); } - tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, 0, 0, dbei.szModule); + tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, nullptr, nullptr, dbei.szModule); } return 0; } CMimAPI M; -FI_INTERFACE *FIF = 0; +FI_INTERFACE *FIF = nullptr; diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 3bde72a450..eaa29d336b 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -111,8 +111,8 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) pwszFormatedText.Format(L"[img]%s[/img]", pszText);
- bbd.pwszTooltip = 0;
- bbd.hIcon = 0;
+ bbd.pwszTooltip = nullptr;
+ bbd.hIcon = nullptr;
bbd.bbbFlags = BBSF_RELEASED;
Srmm_SetButtonState(wParam, &bbd);
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index b2046d2473..5ede9f7a68 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -95,7 +95,7 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) }
if (pCtrl.GetCtrlId() == IDC_SRMM_LOG) {
- InsertMenuA(hSubMenu, 6, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenuA(hSubMenu, 6, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr);
CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED));
}
@@ -152,7 +152,7 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 0);
Resize();
if (m_pContainer->hwndStatus)
- RedrawWindow(m_pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(m_pContainer->hwndStatus, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case ID_EDITOR_PASTEANDSENDIMMEDIATELY:
HandlePasteAndSend();
@@ -291,13 +291,13 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0);
if (PluginConfig.m_bAutoLocaleSupport) {
- if (m_hkl == 0)
+ if (m_hkl == nullptr)
DM_LoadLocale();
else
SendMessage(m_hwnd, DM_SETLOCALE, 0, 0);
}
- m_pContainer->hIconTaskbarOverlay = 0;
+ m_pContainer->hIconTaskbarOverlay = nullptr;
m_pContainer->UpdateTitle(m_hContact);
tabUpdateStatusBar();
@@ -312,7 +312,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) m_pPanel.Invalidate();
- if (m_dwFlags & MWF_DEFERREDSCROLL && m_hwndIEView == 0 && m_hwndHPP == 0) {
+ if (m_dwFlags & MWF_DEFERREDSCROLL && m_hwndIEView == nullptr && m_hwndHPP == nullptr) {
m_dwFlags &= ~MWF_DEFERREDSCROLL;
DM_ScrollToBottom(0, 1);
}
@@ -331,8 +331,8 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) if (m_hwndIEView) {
if (M.GetByte("subclassIEView", 0)) {
mir_subclassWindow(m_hwndIEView, IEViewSubclassProc);
- SetWindowPos(m_hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
- RedrawWindow(m_hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ SetWindowPos(m_hwndIEView, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
+ RedrawWindow(m_hwndIEView, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
}
}
m_hwndIWebBrowserControl = WindowFromPoint(pt);
@@ -627,7 +627,7 @@ void CSrmmWindow::OnInitDialog() DBEVENTINFO dbei = {};
m_bWantPopup = false;
db_event_get(m_hDbEventFirst, &dbei);
- tabSRMM_ShowPopup(m_hContact, m_hDbEventFirst, dbei.eventType, 0, 0, m_hwnd, m_cache->getActiveProto());
+ tabSRMM_ShowPopup(m_hContact, m_hDbEventFirst, dbei.eventType, 0, nullptr, m_hwnd, m_cache->getActiveProto());
}
m_hDbEventFirst = 0;
@@ -758,8 +758,8 @@ void CSrmmWindow::OnInitDialog() m_log.SendMsg(EM_SETLANGOPTIONS, 0, m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST);
// add us to the tray list (if it exists)
- if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != nullptr)
- UpdateTrayMenu(0, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE);
+ if (PluginConfig.g_hMenuTrayUnread != nullptr && m_hContact != 0 && m_szProto != nullptr)
+ UpdateTrayMenu(nullptr, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE);
m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
m_log.SendMsg(EM_EXLIMITTEXT, 0, 0x80000000);
@@ -812,7 +812,7 @@ void CSrmmWindow::OnInitDialog() SendMessage(m_pContainer->m_hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
- SetWindowPos(m_hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), m_bActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(m_hwnd, nullptr, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), m_bActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
LoadSplitter();
ShowPicture(true);
@@ -821,7 +821,7 @@ void CSrmmWindow::OnInitDialog() SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
m_bCanFlashTab = true;
- DBEVENTINFO dbei = { 0 };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
FlashOnClist(m_hDbEventFirst, &dbei);
@@ -916,7 +916,7 @@ void CSrmmWindow::OnDestroy() // the hwndOwner is set to 0 because the window handle is now no longer valid.
// Response for such a job is still silently handled by AckMessage() (sendqueue.c)
if (jobs[i].iStatus == (unsigned)SendQueue::SQ_INPROGRESS)
- jobs[i].hOwnerWnd = 0;
+ jobs[i].hOwnerWnd = nullptr;
}
}
}
@@ -942,7 +942,7 @@ void CSrmmWindow::OnDestroy() NotifyEvent(MSG_WINDOW_EVT_CLOSE);
// clean up IEView and H++ log windows
- if (m_hwndIEView != 0) {
+ if (m_hwndIEView != nullptr) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
@@ -974,7 +974,7 @@ void CSrmmWindow::ReplayQueue() void CSrmmWindow::UpdateTitle()
{
DWORD dwOldIdle = m_idle;
- const char *szActProto = 0;
+ const char *szActProto = nullptr;
m_wszStatus[0] = 0;
@@ -1172,7 +1172,7 @@ void CSrmmWindow::onClick_Add(CCtrlButton*) ADDCONTACTSTRUCT acs = {};
acs.hContact = m_hContact;
acs.handleType = HANDLE_CONTACT;
- acs.szProto = 0;
+ acs.szProto = nullptr;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)m_hwnd, (LPARAM)&acs);
if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) {
m_bNotOnList = FALSE;
@@ -1193,7 +1193,7 @@ void CSrmmWindow::onClick_Color(CCtrlButton *pButton) RECT rc;
GetWindowRect(pButton->GetHwnd(), &rc);
- int iSelection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 7), TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL);
+ int iSelection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 7), TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr);
if (iSelection == ID_FONT_CLEARALLFORMATTING) {
cf.dwMask = CFM_BOLD | CFM_COLOR | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT;
cf.crTextColor = M.GetDword(FONTMODULE, "Font16Col", 0);
@@ -1572,9 +1572,9 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) case TABSRMM_HK_TOGGLESENDLATER:
if (sendLater->isAvail()) {
m_sendMode ^= SMODE_SENDLATER;
- SetWindowPos(m_message.GetHwnd(), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER |
+ SetWindowPos(m_message.GetHwnd(), nullptr, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER |
SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS);
- RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
}
else
CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options -> Message sessions -> Advanced tweaks\\b0. Changing this option requires a restart."));
@@ -1615,7 +1615,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) DestroyWindow(GetDlgItem(m_hwnd, IDC_CLIST));
HWND hwndEdit = m_message.GetHwnd();
- SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
+ SetWindowPos(hwndEdit, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
Resize();
RedrawWindow(hwndEdit, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
DM_ScrollToBottom(0, 0);
@@ -1625,7 +1625,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) SetFocus(GetDlgItem(m_hwnd, IDC_CLIST));
else
SetFocus(m_message.GetHwnd());
- RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
return _dlgReturn(m_hwnd, 1);
}
if (DM_GenericHotkeysCheck(&message)) {
@@ -2119,7 +2119,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) else if (wParam == VK_DOWN)
wp = MAKEWPARAM(SB_LINEDOWN, 0);
- if (m_hwndIEView == 0 && m_hwndHPP == 0)
+ if (m_hwndIEView == nullptr && m_hwndHPP == nullptr)
m_log.SendMsg(WM_VSCROLL, wp, 0);
else
SendMessage(m_hwndIWebBrowserControl, WM_VSCROLL, wp, 0);
@@ -2212,17 +2212,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) RECT rcClient, rcWindow;
{
HDC hdc = (HDC)wParam;
- HDC hdcMem = 0;
+ HDC hdcMem = nullptr;
HBITMAP hbm, hbmOld;
- HANDLE hpb = 0;
+ HANDLE hpb = nullptr;
GetClientRect(m_hwnd, &rcClient);
DWORD cx = rcClient.right - rcClient.left;
DWORD cy = rcClient.bottom - rcClient.top;
if (CMimAPI::m_haveBufferedPaint) {
- hpb = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, 0, &hdcMem);
- hbm = hbmOld = 0;
+ hpb = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, nullptr, &hdcMem);
+ hbm = hbmOld = nullptr;
}
else {
hdcMem = CreateCompatibleDC(hdc);
@@ -2323,7 +2323,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
HBITMAP hbm = ((m_pPanel.isActive()) && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown);
- if (hbm != 0) {
+ if (hbm != nullptr) {
BITMAP bminfo;
GetObject(hbm, sizeof(bminfo), &bminfo);
CalcDynamicAvatarSize(&bminfo);
@@ -2382,7 +2382,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_pPanel.Invalidate();
}
- if (GetDlgItem(m_hwnd, IDC_CLIST) != 0) {
+ if (GetDlgItem(m_hwnd, IDC_CLIST) != nullptr) {
RECT rcLog;
GetClientRect(m_hwnd, &rcClient);
GetClientRect(m_log.GetHwnd(), &rcLog);
@@ -2407,7 +2407,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break;
case WM_NOTIFY:
- if (this != 0 && ((NMHDR*)lParam)->hwndFrom == m_hwndTip) {
+ if (this != nullptr && ((NMHDR*)lParam)->hwndFrom == m_hwndTip) {
if (((NMHDR*)lParam)->code == NM_CLICK)
SendMessage(m_hwndTip, TTM_TRACKACTIVATE, FALSE, 0);
break;
@@ -2444,7 +2444,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case DM_UPDATEWINICON:
if (m_hXStatusIcon) {
DestroyIcon(m_hXStatusIcon);
- m_hXStatusIcon = 0;
+ m_hXStatusIcon = nullptr;
}
if (LPCSTR szProto = m_cache->getProto()) {
@@ -2728,12 +2728,12 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) Resize();
PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0);
if (PluginConfig.m_bAutoLocaleSupport) {
- if (m_hkl == 0)
+ if (m_hkl == nullptr)
DM_LoadLocale();
else
PostMessage(m_hwnd, DM_SETLOCALE, 0, 0);
}
- if (m_hwndIEView != 0)
+ if (m_hwndIEView != nullptr)
SetFocus(m_message.GetHwnd());
if (m_pContainer->dwFlags & CNT_SIDEBAR)
m_pContainer->SideBar->Layout();
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 19593fa9e7..21924f7c9a 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -143,9 +143,9 @@ static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic) mir_snwprintf(szFinalPath, L"%s\\%s", M.getSavedAvatarPath(), szProto);
mir_free(szProto);
- if (CreateDirectory(szFinalPath, 0) == 0) {
+ if (CreateDirectory(szFinalPath, nullptr) == 0) {
if (GetLastError() != ERROR_ALREADY_EXISTS) {
- MessageBox(0, TranslateT("Error creating destination directory"),
+ MessageBox(nullptr, TranslateT("Error creating destination directory"),
TranslateT("Save contact picture"), MB_OK | MB_ICONSTOP);
return;
}
@@ -178,7 +178,7 @@ static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic) ofn.lCustData = (LPARAM)&setView;
if (GetSaveFileName(&ofn)) {
if (PathFileExists(szFinalFilename))
- if (MessageBox(0, TranslateT("The file exists. Do you want to overwrite it?"), TranslateT("Save contact picture"), MB_YESNO | MB_ICONQUESTION) == IDNO)
+ if (MessageBox(nullptr, TranslateT("The file exists. Do you want to overwrite it?"), TranslateT("Save contact picture"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return;
IMGSRVC_INFO ii;
@@ -260,7 +260,7 @@ int CTabBaseDlg::MsgWindowUpdateMenu(HMENU submenu, int menuID) wchar_t *szText = nullptr;
char avOverride = (char)M.GetByte(m_hContact, "hideavatar", -1);
HMENU visMenu = GetSubMenu(submenu, 0);
- BOOL picValid = bInfoPanel ? (m_hOwnPic != 0) : (m_ace && m_ace->hbmPic && m_ace->hbmPic != PluginConfig.g_hbmUnknown);
+ BOOL picValid = bInfoPanel ? (m_hOwnPic != nullptr) : (m_ace && m_ace->hbmPic && m_ace->hbmPic != PluginConfig.g_hbmUnknown);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -309,7 +309,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), m_hwnd, SelectContainerDlgProc, (LPARAM)m_hwnd);
return 1;
case ID_TABMENU_CONTAINEROPTIONS:
- if (m_pContainer->hWndOptions == 0)
+ if (m_pContainer->hWndOptions == nullptr)
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_hwnd, DlgProcContainerOptions, (LPARAM)m_pContainer);
return 1;
case ID_TABMENU_CLOSECONTAINER:
@@ -562,7 +562,7 @@ bool CTabBaseDlg::GetAvatarVisibility() if (!bOwnAvatarMode) {
m_bShowAvatar = (m_hOwnPic && m_hOwnPic != PluginConfig.g_hbmUnknown);
if (!m_hwndContactPic)
- m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, nullptr, nullptr);
+ m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)nullptr, nullptr, nullptr);
}
switch (bAvatarMode) {
@@ -572,7 +572,7 @@ bool CTabBaseDlg::GetAvatarVisibility() case 0:
m_bShowInfoAvatar = true;
case 1:
- HBITMAP hbm = ((m_ace && !(m_ace->dwFlags & AVS_HIDEONCLIST)) ? m_ace->hbmPic : 0);
+ HBITMAP hbm = ((m_ace && !(m_ace->dwFlags & AVS_HIDEONCLIST)) ? m_ace->hbmPic : nullptr);
if (hbm == nullptr && !bAvatarMode) {
m_bShowInfoAvatar = false;
break;
@@ -605,14 +605,14 @@ bool CTabBaseDlg::GetAvatarVisibility() m_bShowAvatar = true;
LBL_Check:
if (!m_hwndContactPic)
- m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, nullptr, nullptr);
+ m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)nullptr, nullptr, nullptr);
break;
case 2: // globally OFF
m_bShowAvatar = false;
break;
case 3: // on, if present
case 1:
- HBITMAP hbm = (m_ace && !(m_ace->dwFlags & AVS_HIDEONCLIST)) ? m_ace->hbmPic : 0;
+ HBITMAP hbm = (m_ace && !(m_ace->dwFlags & AVS_HIDEONCLIST)) ? m_ace->hbmPic : nullptr;
m_bShowAvatar = (hbm && hbm != PluginConfig.g_hbmUnknown);
goto LBL_Check;
}
@@ -1223,18 +1223,18 @@ void CTabBaseDlg::GetLocaleID(const wchar_t *szKLName) * Vista+: read ISO locale names from the registry
*/
if (PluginConfig.m_bIsVista) {
- HKEY hKey = 0;
+ HKEY hKey = nullptr;
wchar_t szKey[20];
DWORD dwLID = wcstoul(szKLName, &stopped, 16);
mir_snwprintf(szKey, L"%04.04x", LOWORD(dwLID));
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, L"MIME\\Database\\Rfc1766", 0, KEY_READ, &hKey)) {
DWORD dwLength = 255;
- if (ERROR_SUCCESS == RegQueryValueEx(hKey, szKey, 0, 0, (unsigned char *)szLI, &dwLength)) {
+ if (ERROR_SUCCESS == RegQueryValueEx(hKey, szKey, nullptr, nullptr, (unsigned char *)szLI, &dwLength)) {
wchar_t* p;
szLI[255] = 0;
- if ((p = wcschr(szLI, ';')) != 0)
+ if ((p = wcschr(szLI, ';')) != nullptr)
*p = 0;
}
RegCloseKey(hKey);
@@ -1419,7 +1419,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) bool bAero = M.isAero();
- HRGN clipRgn = 0;
+ HRGN clipRgn = nullptr;
HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcDraw, bAero ? (HBRUSH)GetStockObject(HOLLOW_BRUSH) : GetSysColorBrush(COLOR_3DFACE));
rcFrame = rcClient;
@@ -1518,7 +1518,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) else
CSkin::FillBack(dis->hDC, &dis->rcItem);
DrawIconEx(dis->hDC, (dis->rcItem.right - dis->rcItem.left) / 2 - 8, (dis->rcItem.bottom - dis->rcItem.top) / 2 - 8,
- PluginConfig.g_iconErr, 16, 16, 0, 0, DI_NORMAL);
+ PluginConfig.g_iconErr, 16, 16, 0, nullptr, DI_NORMAL);
return TRUE;
}
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index d96e3ddcbf..11b1a1de13 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -204,7 +204,7 @@ TLogIcon::TLogIcon(HICON hIcon, COLORREF backgroundColor) rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
- m_hdc = GetDC(0);
+ m_hdc = GetDC(nullptr);
m_hBmp = CreateCompatibleBitmap(m_hdc, bih.biWidth, bih.biHeight);
m_hdcMem = CreateCompatibleDC(m_hdc);
@@ -435,8 +435,8 @@ static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *dat, MCONTACT hContact, struct tm event_time = { 0 };
BOOL isBold = FALSE, isItalic = FALSE, isUnderline = FALSE;
- DBEVENTINFO dbei = { 0 };
- if (streamData->dbei != 0)
+ DBEVENTINFO dbei = {};
+ if (streamData->dbei != nullptr)
dbei = *(streamData->dbei);
else {
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
@@ -997,7 +997,7 @@ static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *dat, MCONTACT hContact, str.Append("\\par");
- if (streamData->dbei == 0)
+ if (streamData->dbei == nullptr)
mir_free(dbei.pBlob);
dat->m_iLastEventType = MAKELONG((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)), dbei.eventType);
@@ -1326,7 +1326,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D }
BOOL isSent;
- if (streamData.dbei != 0)
+ if (streamData.dbei != nullptr)
isSent = (streamData.dbei->flags & DBEF_SENT) != 0;
else {
DBEVENTINFO dbei = {};
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index da130dc338..3a5d1e806d 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -82,7 +82,7 @@ void LoadLogfont(int section, int i, LOGFONTA * lf, COLORREF * colour, char *szM HIMAGELIST g_himlOptions;
-static HWND hwndTabConfig = 0;
+static HWND hwndTabConfig = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
// scan a single skin directory and find the.TSK file.Fill the combobox and set the
@@ -227,7 +227,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_SKIN_LOADTEMPLATES, loadMode & THEME_READ_TEMPLATES ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- SetTimer(hwndDlg, 1000, 100, 0);
+ SetTimer(hwndDlg, 1000, 100, nullptr);
return TRUE;
case WM_CTLCOLORSTATIC:
@@ -242,7 +242,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L // windows must be closed.
case WM_USER + 100:
{
- bool fWindowsOpen = (pFirstContainer != 0 ? true : false);
+ bool fWindowsOpen = (pFirstContainer != nullptr ? true : false);
for (int i = 0; _ctrls[i]; i++)
Utils::enableDlgControl(hwndDlg, _ctrls[i], !fWindowsOpen);
@@ -294,7 +294,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L {
const wchar_t *szFilename = GetThemeFileName(1);
if (szFilename != nullptr)
- WriteThemeToINI(szFilename, 0);
+ WriteThemeToINI(szFilename, nullptr);
}
break;
@@ -313,13 +313,13 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DWORD dwFlags = THEME_READ_FONTS;
if (szFilename != nullptr) {
- int result = MessageBox(0, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect Cancel to not load anything at all."),
+ int result = MessageBox(nullptr, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect Cancel to not load anything at all."),
TranslateT("Load theme"), MB_YESNOCANCEL);
if (result == IDCANCEL)
return 1;
if (result == IDYES)
dwFlags |= THEME_READ_TEMPLATES;
- ReadThemeFromINI(szFilename, 0, 0, dwFlags);
+ ReadThemeFromINI(szFilename, nullptr, 0, dwFlags);
CacheLogFonts();
CacheMsgLogIcons();
PluginConfig.reloadSettings();
@@ -386,7 +386,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem)
{
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
TOptionListGroup *lvGroups = CTranslator::getGroupTree(id);
TOptionListItem *lvItems = CTranslator::getTree(id);
@@ -396,7 +396,7 @@ void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem) // fill the list box, create groups first, then add items
for (int i = 0; lvGroups[i].szName != nullptr; i++) {
- tvi.hParent = 0;
+ tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.pszText = TranslateW(lvGroups[i].szName);
@@ -505,7 +505,7 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM, LPARAM lParam) hti.pt.x = (short)LOWORD(GetMessagePos());
hti.pt.y = (short)HIWORD(GetMessagePos());
ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) == 0)
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) == nullptr)
return FALSE;
if ((hti.flags & TVHT_ONITEMICON) == 0)
return FALSE;
@@ -1518,7 +1518,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, {
DWORD dwStatusMask = GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
static DWORD dwNewStatusMask = 0;
- static HWND hwndParent = 0;
+ static HWND hwndParent = nullptr;
switch (msg) {
case WM_INITDIALOG:
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index fad83f4175..67598de9d6 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -32,8 +32,8 @@ #define IDI_CORE_LOAD 132 // icon id for the "connecting" icon
NEN_OPTIONS nen_options;
-static HANDLE hUserPrefsWindowLis = 0;
-HMODULE g_hIconDLL = 0, g_hMsftedit;
+static HANDLE hUserPrefsWindowLis = nullptr;
+HMODULE g_hIconDLL = nullptr, g_hMsftedit;
static void UnloadIcons();
@@ -270,7 +270,7 @@ void CTabBaseDlg::NotifyDeliveryFailure() const ppd.PluginWindowProc = Utils::PopupDlgProcError;
ppd.lchIcon = PluginConfig.g_iconErr;
- ppd.PluginData = 0;
+ ppd.PluginData = nullptr;
ppd.iSeconds = (int)M.GetDword(MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
PUAddPopupT(&ppd);
}
@@ -304,7 +304,7 @@ static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM) SetForegroundWindow(hWnd); // already open, bring it to front
return 0;
}
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS_FRAME), 0, DlgProcUserPrefsFrame, (LPARAM)wParam);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS_FRAME), nullptr, DlgProcUserPrefsFrame, (LPARAM)wParam);
return 0;
}
@@ -331,7 +331,7 @@ static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam) int TSAPI MessageWindowOpened(MCONTACT hContact, HWND _hwnd)
{
- HWND hwnd = 0;
+ HWND hwnd = nullptr;
TContainerData *pContainer = nullptr;
if (hContact)
@@ -374,7 +374,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) MCONTACT hContact = ((CLISTEVENT *)lParam)->hContact;
HWND hwndExisting = Srmm_FindWindow(hContact);
- if (hwndExisting != 0)
+ if (hwndExisting != nullptr)
SendMessage(hwndExisting, DM_ACTIVATEME, 0, 0);
else {
wchar_t szName[CONTAINER_NAMELEN + 1];
@@ -513,7 +513,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) if (!dat || !pContainer)
return FALSE;
- NMHDR nmhdr = { 0 };
+ NMHDR nmhdr = {};
nmhdr.code = TCN_SELCHANGE;
if (TabCtrl_GetItemCount(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS)) > 1 && !(pContainer->dwFlags & CNT_DEFERREDTABSELECT)) {
TabCtrl_SetCurSel(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS), GetTabIndexFromHWND(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS), hwndChild));
@@ -558,16 +558,16 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, bool bActivateTab, bool bPopupContainer, bool bWantPopup, MEVENT hdbEvent, bool bIsUnicode, const char *pszInitialText)
{
- if (Srmm_FindWindow(hContact) != 0) {
+ if (Srmm_FindWindow(hContact) != nullptr) {
_DebugPopup(hContact, L"Warning: trying to create duplicate window");
- return 0;
+ return nullptr;
}
// if we have a max # of tabs/container set and want to open something in the default container...
if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->m_wszName, L"default", 6))
if ((pContainer = FindMatchingContainer(L"default")) == nullptr)
if ((pContainer = CreateContainer(L"default", CNT_CREATEFLAG_CLONED, hContact)) == nullptr)
- return 0;
+ return nullptr;
char *szProto = GetContactProto(hContact);
@@ -743,10 +743,10 @@ void TSAPI CreateImageList(BOOL bInitial) PluginConfig.g_IconMsgEvent = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
PluginConfig.g_IconMsgEventBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
if ((HICON)CALLSERVICE_NOTFOUND == PluginConfig.g_IconMsgEventBig)
- PluginConfig.g_IconMsgEventBig = 0;
+ PluginConfig.g_IconMsgEventBig = nullptr;
PluginConfig.g_IconTypingEventBig = Skin_LoadIcon(SKINICON_OTHER_TYPING, true);
if ((HICON)CALLSERVICE_NOTFOUND == PluginConfig.g_IconTypingEventBig)
- PluginConfig.g_IconTypingEventBig = 0;
+ PluginConfig.g_IconTypingEventBig = nullptr;
PluginConfig.g_IconSend = PluginConfig.g_buttonBarIcons[9];
PluginConfig.g_IconTypingEvent = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
}
@@ -859,7 +859,7 @@ static int TSAPI SetupIconLibConfig() wchar_t szFilename[MAX_PATH];
wcsncpy(szFilename, L"icons\\tabsrmm_icons.dll", MAX_PATH);
g_hIconDLL = LoadLibrary(szFilename);
- if (g_hIconDLL == 0) {
+ if (g_hIconDLL == nullptr) {
CWarning::show(CWarning::WARN_ICONPACKMISSING, CWarning::CWF_NOALLOWHIDE | MB_ICONERROR | MB_OK);
return 0;
}
@@ -868,9 +868,9 @@ static int TSAPI SetupIconLibConfig() Chat_AddIcons();
version = GetIconPackVersion(g_hIconDLL);
FreeLibrary(g_hIconDLL);
- g_hIconDLL = 0;
+ g_hIconDLL = nullptr;
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.defaultFile.w = szFilename;
sid.flags = SIDF_PATH_UNICODE;
@@ -967,9 +967,9 @@ static void UnloadIcons() {
for (int n = 0; n < _countof(ICONBLOCKS); n++)
for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
- if (*(ICONBLOCKS[n].idesc[i].phIcon) != 0) {
+ if (*(ICONBLOCKS[n].idesc[i].phIcon) != nullptr) {
DestroyIcon(*(ICONBLOCKS[n].idesc[i].phIcon));
- *(ICONBLOCKS[n].idesc[i].phIcon) = 0;
+ *(ICONBLOCKS[n].idesc[i].phIcon) = nullptr;
}
if (PluginConfig.g_hbmUnknown)
@@ -1036,8 +1036,8 @@ static void TSAPI InitAPI() int LoadSendRecvMessageModule(void)
{
- if (FIF == 0) {
- MessageBox(0, TranslateT("The image service plugin (AdvaImg) is not properly installed.\n\nTabSRMM is disabled."), TranslateT("TabSRMM fatal error"), MB_OK | MB_ICONERROR);
+ if (FIF == nullptr) {
+ MessageBox(nullptr, TranslateT("The image service plugin (AdvaImg) is not properly installed.\n\nTabSRMM is disabled."), TranslateT("TabSRMM fatal error"), MB_OK | MB_ICONERROR);
return 1;
}
diff --git a/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index 11a3a46e4d..85b131ff3f 100644 --- a/plugins/TabSRMM/src/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -32,12 +32,12 @@ void CMUCHighlight::cleanup() {
mir_free(m_NickPatternString);
mir_free(m_TextPatternString);
- m_TextPatternString = m_NickPatternString = 0;
+ m_TextPatternString = m_NickPatternString = nullptr;
mir_free(m_NickPatterns);
mir_free(m_TextPatterns);
m_iNickPatterns = m_iTextPatterns = 0;
- m_NickPatterns = m_TextPatterns = 0;
+ m_NickPatterns = m_TextPatterns = nullptr;
}
void CMUCHighlight::init()
@@ -67,7 +67,7 @@ void CMUCHighlight::init() void CMUCHighlight::tokenize(wchar_t *tszString, wchar_t**& patterns, UINT& nr)
{
- if (tszString == 0)
+ if (tszString == nullptr)
return;
wchar_t *p = tszString;
@@ -114,17 +114,17 @@ bool CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dw {
int result = 0, nResult = 0;
- if (pgce == 0 || m_Valid == false)
+ if (pgce == nullptr || m_Valid == false)
return false;
- if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != 0) {
+ if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != nullptr) {
wchar_t *p = pci->RemoveFormatting(pgce->ptszText);
p = NEWWSTR_ALLOCA(p);
if (p == nullptr)
return false;
CharLower(p);
- wchar_t *tszMe = ((psi && psi->pMe) ? NEWWSTR_ALLOCA(psi->pMe->pszNick) : 0);
+ wchar_t *tszMe = ((psi && psi->pMe) ? NEWWSTR_ALLOCA(psi->pMe->pszNick) : nullptr);
if (tszMe)
CharLower(tszMe);
@@ -148,7 +148,7 @@ bool CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dw if (*p1)
*p1 = 0;
else
- p1 = 0;
+ p1 = nullptr;
for (UINT i = 0; i < m_iTextPatterns && !result; i++)
result = wildcmpw(p, m_TextPatterns[i]) ? MATCH_TEXT : 0;
@@ -157,7 +157,7 @@ bool CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dw *p1 = ' ';
p = p1 + 1;
}
- else p = 0;
+ else p = nullptr;
}
}
@@ -240,7 +240,7 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
- wchar_t* szBuf = 0;
+ wchar_t* szBuf = nullptr;
int iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTNICKPATTERN));
if (iLen) {
szBuf = reinterpret_cast<wchar_t *>(mir_alloc((iLen + 2) * sizeof(wchar_t)));
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index bbe61242b5..2f8e50f92d 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -30,7 +30,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- HWND hwndMsgDlg = 0;
+ HWND hwndMsgDlg = nullptr;
hwndMsgDlg = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -58,7 +58,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L GetWindowRect(hwndDlg, &rc);
GetWindowRect(GetParent(hwndDlg), &rcParent);
- SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ SetWindowPos(hwndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
return TRUE;
}
@@ -113,7 +113,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t szOldName[CONTAINER_NAMELEN + 1];
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szOldName);
if (mir_wstrlen(szOldName) == mir_wstrlen(szNewName)) {
- MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
break;
}
@@ -149,7 +149,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iItem != LB_ERR || !wcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
if (mir_wstrlen(szName) == mir_wstrlen(szNewName) || !wcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
- MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
break;
}
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index eb2e1ecc19..2858ef040a 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -28,7 +28,7 @@ #include "stdafx.h"
-CSendLater *sendLater = 0;
+CSendLater *sendLater = nullptr;
// implementation of the CSendLaterJob class
CSendLaterJob::CSendLaterJob()
@@ -139,7 +139,7 @@ CSendLaterJob::~CSendLaterJob() ppd.colorBack = fFailed ? RGB(191, 0, 0) : nen_options.colBackMsg;
ppd.PluginWindowProc = Utils::PopupDlgProcError;
ppd.lchIcon = fFailed ? PluginConfig.g_iconErr : PluginConfig.g_IconMsgEvent;
- ppd.PluginData = 0;
+ ppd.PluginData = nullptr;
ppd.iSeconds = fFailed ? -1 : nen_options.iDelayMsg;
PUAddPopupT(&ppd);
}
@@ -161,7 +161,7 @@ CSendLater::CSendLater() : m_hFilter(0)
{
m_fAvail = M.GetByte("sendLaterAvail", 0) != 0;
- m_last_sendlater_processed = time(0);
+ m_last_sendlater_processed = time(nullptr);
m_fIsInteractive = false;
m_fErrorPopups = M.GetByte("qmgrErrorPopups", 0) != 0;
m_fSuccessPopups = M.GetByte("qmgrSuccessPopups", 0) != 0;
@@ -276,7 +276,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) {
MCONTACT hContact = lParam;
DBVARIANT dbv = { 0 };
- char *szOrig_Utf = 0;
+ char *szOrig_Utf = nullptr;
if (!m_fAvail || !szSetting || !mir_strcmp(szSetting, "count") || mir_strlen(szSetting) < 8)
return 0;
@@ -319,7 +319,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) job->sendBuffer[iLen] = 0;
// construct conventional send buffer
- wchar_t *szWchar = 0;
+ wchar_t *szWchar = nullptr;
char *szAnsi = mir_utf8decodecp(szOrig_Utf, CP_ACP, &szWchar);
iLen = mir_strlen(szAnsi);
size_t required = iLen + 1;
@@ -347,7 +347,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) // this is ONLY called from the WM_TIMER handler and should never be executed directly.
int CSendLater::sendIt(CSendLaterJob *job)
{
- time_t now = time(0);
+ time_t now = time(nullptr);
if (job->bCode == CSendLaterJob::JOB_HOLD || job->bCode == CSendLaterJob::JOB_DEFERRED || job->fSuccess || job->fFailed || job->lastSent > now)
return 0; // this one is frozen or done (will be removed soon), don't process it now.
@@ -376,7 +376,7 @@ int CSendLater::sendIt(CSendLaterJob *job) MCONTACT hContact = c->getActiveContact();
const char *szProto = c->getActiveProto();
- if (!hContact || szProto == 0)
+ if (!hContact || szProto == nullptr)
return 0;
WORD wMyStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
@@ -434,7 +434,7 @@ void CSendLater::addContact(const MCONTACT hContact) HANDLE CSendLater::processAck(const ACKDATA *ack)
{
if (m_sendLaterJobList.getCount() == 0 || !m_fAvail)
- return 0;
+ return nullptr;
for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
CSendLaterJob *p = m_sendLaterJobList[i];
@@ -456,10 +456,10 @@ HANDLE CSendLater::processAck(const ACKDATA *ack) p->hProcess = (HANDLE)-1;
p->bCode = '-';
qMgrUpdate();
- return 0;
+ return nullptr;
}
}
- return 0;
+ return nullptr;
}
// UI stuff (dialog procedures for the queue manager dialog
@@ -541,7 +541,7 @@ void CSendLater::qMgrFillList(bool fClear) mir_free(preview);
mir_free(msg);
- const wchar_t *tszStatusText = 0;
+ const wchar_t *tszStatusText = nullptr;
if (p->fFailed) {
tszStatusText = p->bCode == CSendLaterJob::JOB_REMOVABLE ?
TranslateT("Removed") : TranslateT("Failed");
@@ -773,7 +773,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM item.stateMask = LVIS_SELECTED;
if (HIWORD(wParam) != ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD) {
- if (MessageBox(0, TranslateT("You are about to modify the state of one or more items in the\nunattended send queue. The requested action(s) will be executed at the next scheduled queue processing.\n\nThis action cannot be made undone."), TranslateT("Queue manager"),
+ if (MessageBox(nullptr, TranslateT("You are about to modify the state of one or more items in the\nunattended send queue. The requested action(s) will be executed at the next scheduled queue processing.\n\nThis action cannot be made undone."), TranslateT("Queue manager"),
MB_ICONQUESTION | MB_OKCANCEL) == IDCANCEL)
break;
}
@@ -809,7 +809,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else if (job->bCode == CSendLaterJob::JOB_AGE) {
job->fFailed = false;
job->bCode = '-';
- job->created = time(0);
+ job->created = time(nullptr);
}
break;
}
@@ -825,7 +825,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case WM_NCDESTROY:
- m_hwndDlg = 0;
+ m_hwndDlg = nullptr;
db_set_dw(0, SRMSGMOD_T, "qmgrFilterContact", m_hFilter);
break;
}
@@ -835,8 +835,8 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // invoke queue manager dialog - do nothing if this dialog is already open
void CSendLater::invokeQueueMgrDlg()
{
- if (m_hwndDlg == 0)
- m_hwndDlg = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SENDLATER_QMGR), 0, CSendLater::DlgProcStub, LPARAM(this));
+ if (m_hwndDlg == nullptr)
+ m_hwndDlg = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SENDLATER_QMGR), nullptr, CSendLater::DlgProcStub, LPARAM(this));
}
// service function to invoke the queue manager
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index cae1d654e7..60dc9eb154 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -28,7 +28,7 @@ #include "stdafx.h" -SendQueue *sendQueue = 0; +SendQueue *sendQueue = nullptr; ///////////////////////////////////////////////////////////////////////////////////////// // searches the queue for a message belonging to the given contact which has been marked @@ -224,7 +224,7 @@ int SendQueue::sendQueued(CTabBaseDlg *dat, const int iEntry) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0); if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { - doSendLater(iEntry, 0, hContact, false); + doSendLater(iEntry, nullptr, hContact, false); iJobs++; } } @@ -342,7 +342,7 @@ void SendQueue::checkQueue(const CTabBaseDlg *dat) const void SendQueue::logError(CTabBaseDlg *dat, int iSendJobIndex, const wchar_t *szErrMsg) const { - if (dat == 0) + if (dat == nullptr) return; size_t iMsgLen; @@ -416,7 +416,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) { ACKDATA *ack = (ACKDATA *)lParam; - TContainerData *m_pContainer = 0; + TContainerData *m_pContainer = nullptr; if (dat) m_pContainer = dat->m_pContainer; @@ -520,7 +520,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) LRESULT SendQueue::WarnPendingJobs(unsigned int) { - return MessageBox(0, + return MessageBox(nullptr, TranslateT("There are unsent messages waiting for confirmation.\nIf you close the window now, Miranda will try to send them but may be unable to inform you about possible delivery errors.\nDo you really want to close the window(s)?"), TranslateT("Message window warning"), MB_YESNO | MB_ICONHAND); } @@ -540,7 +540,7 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b { bool fAvail = sendLater->isAvail(); - const wchar_t *szNote = 0; + const wchar_t *szNote = nullptr; if (fIsSendLater && dat) { if (fAvail) @@ -579,13 +579,13 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b wchar_t tszHeader[150]; if (fIsSendLater) { - time_t now = time(0); + time_t now = time(nullptr); wchar_t tszTimestamp[30]; wcsftime(tszTimestamp, _countof(tszTimestamp), L"%Y.%m.%d - %H:%M", _localtime32((__time32_t *)&now)); mir_snprintf(szKeyName, "S%d", now); mir_snwprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp); } - else mir_snwprintf(tszHeader, L"M%d|", time(0)); + else mir_snwprintf(tszHeader, L"M%d|", time(nullptr)); T2Utf utf_header(tszHeader); size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10; diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index dc99331396..9edf862b52 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -81,7 +81,7 @@ CSideBarButton::CSideBarButton(CTabBaseDlg *dat, CSideBar *sideBar) CSideBarButton::CSideBarButton(const UINT id, CSideBar *sideBar)
{
- m_dat = 0;
+ m_dat = nullptr;
m_id = id;
m_sideBar = sideBar;
_create();
@@ -90,7 +90,7 @@ CSideBarButton::CSideBarButton(const UINT id, CSideBar *sideBar) // Internal method to create the button item and configure the associated button control
void CSideBarButton::_create()
{
- m_hwnd = 0;
+ m_hwnd = nullptr;
m_isTopAligned = true;
m_sz.cx = m_sz.cy = 0;
@@ -342,7 +342,7 @@ void CSideBarButton::invokeContextMenu() const TContainerData *pContainer = m_sideBar->getContainer();
if (pContainer) {
- TSideBarNotify tsn = { 0 };
+ TSideBarNotify tsn = {};
tsn.nmHdr.code = NM_RCLICK;
tsn.nmHdr.idFrom = 5000;
tsn.nmHdr.hwndFrom = ::GetDlgItem(pContainer->m_hwnd, 5000);
@@ -355,9 +355,9 @@ CSideBar::CSideBar(TContainerData *pContainer) : m_buttonlist(1, PtrKeySortT)
{
m_pContainer = pContainer;
- m_up = m_down = 0;
- m_hwndScrollWnd = 0;
- m_activeItem = 0;
+ m_up = m_down = nullptr;
+ m_hwndScrollWnd = nullptr;
+ m_activeItem = nullptr;
m_isVisible = true;
Init();
@@ -389,7 +389,7 @@ void CSideBar::Init() m_dwFlags = (m_pContainer->dwFlagsEx & TCF_SBARRIGHT ? m_dwFlags | SIDEBARORIENTATION_RIGHT : m_dwFlags & ~SIDEBARORIENTATION_RIGHT);
if (m_pContainer->dwFlags & CNT_SIDEBAR) {
- if (m_hwndScrollWnd == 0)
+ if (m_hwndScrollWnd == nullptr)
m_hwndScrollWnd = ::CreateWindowEx(0, L"TS_SideBarClass", L"", WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD,
0, 0, m_width, 40, m_pContainer->m_hwnd, reinterpret_cast<HMENU>(5000), g_hInst, this);
@@ -407,12 +407,12 @@ void CSideBar::Init() destroyScroller();
m_width = 0;
m_isActive = m_isVisible = false;
- m_activeItem = 0;
+ m_activeItem = nullptr;
removeAll();
if (m_hwndScrollWnd)
::DestroyWindow(m_hwndScrollWnd);
- m_hwndScrollWnd = 0;
+ m_hwndScrollWnd = nullptr;
}
}
@@ -445,9 +445,9 @@ void CSideBar::setVisible(bool fNewVisible) */
void CSideBar::createScroller()
{
- if (m_up == 0)
+ if (m_up == nullptr)
m_up = new CSideBarButton(IDC_SIDEBARUP, this);
- if (m_down == 0)
+ if (m_down == nullptr)
m_down = new CSideBarButton(IDC_SIDEBARDOWN, this);
m_up->setLayout(m_currentLayout);
@@ -461,11 +461,11 @@ void CSideBar::destroyScroller() {
if (m_up) {
delete m_up;
- m_up = 0;
+ m_up = nullptr;
}
if (m_down) {
delete m_down;
- m_down = 0;
+ m_down = nullptr;
}
}
@@ -597,7 +597,7 @@ void CSideBar::scrollIntoView(const CSideBarButton *item) if (!m_isActive)
return;
- if (item == 0)
+ if (item == nullptr)
item = m_activeItem;
int i;
@@ -687,7 +687,7 @@ const CSideBarButton* CSideBar::setActiveItem(const CTabBaseDlg *dat) if (item != nullptr)
return setActiveItem(item);
- return 0;
+ return nullptr;
}
/**
@@ -747,14 +747,14 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) if (p.isTopAligned()) {
if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible
if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */
- hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, -(m_firstVisibleOffset - m_totalItemHeight),
+ hdwp = ::DeferWindowPos(hdwp, hwnd, nullptr, 2, -(m_firstVisibleOffset - m_totalItemHeight),
m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
spaceUsed += ((height + 1) - (m_firstVisibleOffset - m_totalItemHeight));
m_totalItemHeight += (height + 1);
}
else {
if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */
- hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, spaceUsed, m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
+ hdwp = ::DeferWindowPos(hdwp, hwnd, nullptr, 2, spaceUsed, m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
spaceUsed += (height + 1);
m_totalItemHeight += (height + 1);
}
@@ -771,9 +771,9 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) LONG dx = m_dwFlags & SIDEBARORIENTATION_LEFT ? m_pContainer->tBorder_outer_left :
rcContainer.right - m_pContainer->tBorder_outer_right - (m_elementWidth + 4);
- ::SetWindowPos(m_up->getHwnd(), 0, dx, m_pContainer->tBorder_outer_top + m_pContainer->MenuBar->getHeight(),
+ ::SetWindowPos(m_up->getHwnd(), nullptr, dx, m_pContainer->tBorder_outer_top + m_pContainer->MenuBar->getHeight(),
m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW);
- ::SetWindowPos(m_down->getHwnd(), 0, dx, (rcContainer.bottom - 14 - m_pContainer->statusBarHeight - 1),
+ ::SetWindowPos(m_down->getHwnd(), nullptr, dx, (rcContainer.bottom - 14 - m_pContainer->statusBarHeight - 1),
m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW);
::EnableWindow(m_up->getHwnd(), topEnabled);
::EnableWindow(m_down->getHwnd(), bottomEnabled);
@@ -784,7 +784,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) inline void CSideBar::Invalidate()
{
- Layout(0);
+ Layout(nullptr);
}
void CSideBar::showAll(int showCmd)
@@ -844,7 +844,7 @@ CSideBarButton* CSideBar::findSession(const MCONTACT hContact) void CSideBar::processScrollerButtons(UINT commandID)
{
- if (!m_isActive || m_down == 0)
+ if (!m_isActive || m_down == nullptr)
return;
if (commandID == IDC_SIDEBARDOWN && ::IsWindowEnabled(m_down->getHwnd()))
@@ -852,7 +852,7 @@ void CSideBar::processScrollerButtons(UINT commandID) else if (commandID == IDC_SIDEBARUP && ::IsWindowEnabled(m_up->getHwnd()))
m_firstVisibleOffset = max(0, m_firstVisibleOffset - 10);
- Layout(0);
+ Layout(nullptr);
}
void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG, LONG height) const
@@ -861,7 +861,7 @@ void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG, LONG height) const ::ShowWindow(m_hwndScrollWnd, SW_HIDE);
return;
}
- ::SetWindowPos(m_hwndScrollWnd, 0, x, y + 15, m_width, height - 30,
+ ::SetWindowPos(m_hwndScrollWnd, nullptr, x, y + 15, m_width, height - 30,
SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
}
@@ -870,7 +870,7 @@ void CSideBar::invalidateButton(CTabBaseDlg *dat) if (m_isActive && m_isVisible) {
CSideBarButton *item = findSession(dat);
if (item != nullptr)
- RedrawWindow(item->m_buttonControl->hwnd, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(item->m_buttonControl->hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
@@ -899,12 +899,12 @@ LRESULT CALLBACK CSideBar::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP }
else if (M.isAero() || M.isVSThemed()) {
HDC hdcMem;
- HANDLE hbp = 0;
+ HANDLE hbp = nullptr;
HBITMAP hbm, hbmOld;
if (CMimAPI::m_haveBufferedPaint) {
hbp = CSkin::InitiateBufferedPaint(hdc, rc, hdcMem);
- hbm = hbmOld = 0;
+ hbm = hbmOld = nullptr;
}
else {
hdcMem = ::CreateCompatibleDC(hdc);
@@ -979,10 +979,10 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT if (stateId == PBS_HOT || stateId == PBS_PRESSED)
DrawAlpha(hdc, const_cast<RECT *>(rc), 0xf0f0f0, 70, 0x000000, 0, 9,
- 31, 4, 0);
+ 31, 4, nullptr);
else
DrawAlpha(hdc, const_cast<RECT *>(rc), 0xf0f0f0, 30, 0x707070, 0, 9,
- 31, 4, 0);
+ 31, 4, nullptr);
}
else {
if (PluginConfig.m_fillColor)
@@ -1046,7 +1046,7 @@ void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rc if (id == IDC_SIDEBARUP || id == IDC_SIDEBARDOWN) {
::DrawIconEx(hdc, (rcBox->left + rcBox->right) / 2 - 8, (rcBox->top + rcBox->bottom) / 2 - 8, id == IDC_SIDEBARUP ? PluginConfig.g_buttonBarIcons[26] : PluginConfig.g_buttonBarIcons[16],
- 16, 16, 0, 0, DI_NORMAL);
+ 16, 16, 0, nullptr, DI_NORMAL);
if (!M.isAero() && stateID == PBS_HOT)
::DrawEdge(hdc, const_cast<RECT *>(rcBox), BDR_INNER, BF_RECT | BF_SOFT | BF_FLAT);
}
@@ -1122,7 +1122,7 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r // TODO support larger icons at a later time. This side bar button
// could use 32x32 icons as well.
rc.top = rc.bottom - szSecondLine.cy - 2;
- ::DrawIconEx(hdc, rc.left, rc.top + (rc.bottom - rc.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(hdc, rc.left, rc.top + (rc.bottom - rc.top) / 2 - 8, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
rc.left += 18;
::SelectObject(hdc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS]);
CSkin::RenderText(hdc, dat->m_hThemeIP, dat->m_wszStatus, &rc,
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 9c2de2c656..9e4de29270 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -68,7 +68,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRMM, extern "C" int __declspec(dllexport) Load(void) { if (WinVerMajor() < 5) { - MessageBox(0, TranslateT("This version of TabSRMM requires Windows 2000 or later."), L"tabSRMM", MB_OK | MB_ICONERROR); + MessageBox(nullptr, TranslateT("This version of TabSRMM requires Windows 2000 or later."), L"tabSRMM", MB_OK | MB_ICONERROR); return 1; } diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 41348286a6..f02a185743 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -116,7 +116,7 @@ static tabcolors[] = { COLOR_3DFACE, "tab_bg_active", "tab_bg_active" },
{ COLOR_3DFACE, "tab_bg_hottrack", "tab_bg_hottrack" },
{ COLOR_3DFACE, "tab_bg_unread", "tab_bg_unread" },
- { 0, 0, nullptr }
+ { 0, nullptr, nullptr }
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -418,7 +418,7 @@ static HRESULT DrawThemesPartWithAero(const TabControlData *tabdat, HDC hDC, int if (iStateId != PBS_NORMAL)
tabdat->helperGlowItem->Render(hDC, prcBox, true);
}
- else if (tabdat->hTheme != 0) {
+ else if (tabdat->hTheme != nullptr) {
hResult = DrawThemeBackground(tabdat->hTheme, hDC, iPartId, iStateId, prcBox, nullptr);
}
@@ -432,7 +432,7 @@ static HRESULT DrawThemesPart(const TabControlData *tabdat, HDC hDC, int iPartId {
HRESULT hResult = 0;
- if (tabdat->hTheme != 0)
+ if (tabdat->hTheme != nullptr)
hResult = DrawThemeBackground(tabdat->hTheme, hDC, iPartId, iStateId, prcBox, nullptr);
return hResult;
@@ -548,7 +548,7 @@ static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlDa SetDIBits(hdcTemp, hbmTemp, nStart, 50 - nLenSub, pcImg, &biOut, DIB_RGB_COLORS);
mir_free(pcImg);
}
- CImageItem tempItem(10, 10, 10, 10, hdcTemp, 0, IMAGE_FLAG_DIVIDED | IMAGE_FILLSOLID,
+ CImageItem tempItem(10, 10, 10, 10, hdcTemp, nullptr, IMAGE_FLAG_DIVIDED | IMAGE_FILLSOLID,
GetSysColorBrush(COLOR_3DFACE), 255, 30, 80, 50, 100);
if (PluginConfig.m_bIsVista) // hide right tab sheet shadow (only draw the actual border line)
@@ -616,7 +616,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) tabdat->fAeroTabs = (CSkin::m_fAeroSkinsValid && (isAero || PluginConfig.m_fillColor)) ? TRUE : FALSE;
tabdat->fCloseButton = (tabdat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON ? TRUE : FALSE);
- tabdat->helperDat = 0;
+ tabdat->helperDat = nullptr;
if (tabdat->fAeroTabs) {
CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(tabdat->pContainer->m_hwndActive, GWLP_USERDATA);
@@ -656,7 +656,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) HBITMAP bmpMem, bmpOld;
if (CMimAPI::m_haveBufferedPaint) {
hpb = tabdat->hbp = CSkin::InitiateBufferedPaint(hdcreal, rctPage, hdc);
- bmpMem = bmpOld = 0;
+ bmpMem = bmpOld = nullptr;
}
else {
hpb = nullptr;
@@ -724,7 +724,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) if (PluginConfig.m_fillColor)
DrawCustomTabPage(hdc, rcClient);
else
- DrawThemesXpTabItem(hdc, &rcClient, uiFlags, tabdat, 0); // TABP_PANE=9,0,'TAB'
+ DrawThemesXpTabItem(hdc, &rcClient, uiFlags, tabdat, nullptr); // TABP_PANE=9,0,'TAB'
if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
}
@@ -847,7 +847,7 @@ page_done: continue;
TabCtrl_GetItem(hwnd, i, &tci);
- CSrmmWindow *dat = 0;
+ CSrmmWindow *dat = nullptr;
if (tci.lParam)
dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
TabCtrl_GetItemRect(hwnd, i, &rcItem);
@@ -877,7 +877,7 @@ page_done: rctActive.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
}
if (rctActive.left >= 0) {
- CSrmmWindow *dat = 0;
+ CSrmmWindow *dat = nullptr;
int nHint = 0;
rcItem = rctActive;
@@ -964,11 +964,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tabdat->m_VisualStyles = FALSE;
if (IsThemeActive()) {
tabdat->m_VisualStyles = TRUE;
- if (tabdat->hTheme != 0) {
+ if (tabdat->hTheme != nullptr) {
CloseThemeData(tabdat->hTheme);
CloseThemeData(tabdat->hThemeButton);
}
- if ((tabdat->hTheme = OpenThemeData(hwnd, L"TAB")) == 0 || (tabdat->hThemeButton = OpenThemeData(hwnd, L"BUTTON")) == 0)
+ if ((tabdat->hTheme = OpenThemeData(hwnd, L"TAB")) == nullptr || (tabdat->hThemeButton = OpenThemeData(hwnd, L"BUTTON")) == nullptr)
tabdat->m_VisualStyles = FALSE;
}
return 0;
@@ -980,7 +980,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara // it is sufficient to search it once. So this message is called, whenever
// a new tab is inserted
HWND hwndChild;
- if ((hwndChild = FindWindowEx(hwnd, 0, L"msctls_updown32", nullptr)) != 0)
+ if ((hwndChild = FindWindowEx(hwnd, nullptr, L"msctls_updown32", nullptr)) != nullptr)
DestroyWindow(hwndChild);
return 0;
@@ -1018,7 +1018,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_DESTROY:
if (tabdat) {
- if (tabdat->hTheme != 0) {
+ if (tabdat->hTheme != nullptr) {
CloseThemeData(tabdat->hTheme);
CloseThemeData(tabdat->hThemeButton);
}
@@ -1051,7 +1051,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara }
KillTimer(hwnd, TIMERID_HOVER_T);
if (tabdat->pContainer && (!tabdat->pContainer->SideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->dwFlags & CNT_HIDETABS))))
- SetTimer(hwnd, TIMERID_HOVER_T, 750, 0);
+ SetTimer(hwnd, TIMERID_HOVER_T, 750, nullptr);
break;
case WM_SIZE:
@@ -1173,7 +1173,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (tabdat->himlDrag) {
ImageList_RemoveAll(tabdat->himlDrag);
ImageList_Destroy(tabdat->himlDrag);
- tabdat->himlDrag = 0;
+ tabdat->himlDrag = nullptr;
}
break;
@@ -1226,7 +1226,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (tabdat->himlDrag) {
ImageList_RemoveAll(tabdat->himlDrag);
ImageList_Destroy(tabdat->himlDrag);
- tabdat->himlDrag = 0;
+ tabdat->himlDrag = nullptr;
}
}
if (tabdat->fCloseButton) {
@@ -1266,7 +1266,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara /*
* get the message window data for the session to which this tab item belongs
*/
- CSrmmWindow *dat = 0;
+ CSrmmWindow *dat = nullptr;
if (IsWindow((HWND)item.lParam) && item.lParam != 0)
dat = (CSrmmWindow*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
if (dat) {
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 6f802725a8..18d2087273 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -59,7 +59,7 @@ * used by getMUCBigICon()
*/
-CTaskbarInteract* Win7Taskbar = 0;
+CTaskbarInteract* Win7Taskbar = nullptr;
/**
* set the overlay icon for a task bar button. Used for typing notifications and incoming
@@ -98,13 +98,13 @@ bool CTaskbarInteract::haveLargeIcons() * also, figure out the button grouping mode.
*/
if (::RegOpenKey(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", &hKey) == ERROR_SUCCESS) {
- ::RegQueryValueEx(hKey, L"TaskbarSmallIcons", 0, &dwType, (LPBYTE)&val, &size);
+ ::RegQueryValueEx(hKey, L"TaskbarSmallIcons", nullptr, &dwType, (LPBYTE)&val, &size);
size = 4;
dwType = REG_DWORD;
/*
* this is the "grouping mode" setting for the task bar. 0 = always combine, no labels
*/
- ::RegQueryValueEx(hKey, L"TaskbarGlomLevel", 0, &dwType, (LPBYTE)&valGrouping, &size);
+ ::RegQueryValueEx(hKey, L"TaskbarGlomLevel", nullptr, &dwType, (LPBYTE)&valGrouping, &size);
::RegCloseKey(hKey);
}
m_fHaveLargeicons = (val ? false : true); // small icons in use, revert to default icon feedback
@@ -140,7 +140,7 @@ void CTaskbarInteract::registerTab(const HWND hwndTab, const HWND hwndContainer) {
if (m_isEnabled) {
m_pTaskbarInterface->RegisterTab(hwndTab, hwndContainer);
- m_pTaskbarInterface->SetTabOrder(hwndTab, 0);
+ m_pTaskbarInterface->SetTabOrder(hwndTab, nullptr);
}
}
@@ -210,8 +210,8 @@ void CTabBaseDlg::VerifyProxy() CProxyWindow::CProxyWindow(CTabBaseDlg *dat)
{
m_dat = dat;
- m_hBigIcon = 0;
- m_thumb = 0;
+ m_hBigIcon = nullptr;
+ m_thumb = nullptr;
m_hwndProxy = ::CreateWindowEx(/*WS_EX_TOOLWINDOW | */WS_EX_NOACTIVATE, PROXYCLASSNAME, L"",
WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION, -32000, -32000, 10, 10, nullptr, nullptr, g_hInst, (LPVOID)this);
@@ -239,7 +239,7 @@ CProxyWindow::~CProxyWindow() #endif
if (m_thumb) {
delete m_thumb;
- m_thumb = 0;
+ m_thumb = nullptr;
}
}
@@ -252,7 +252,7 @@ void CProxyWindow::verifyDwmState() if (!M.isDwmActive()) {
if (m_thumb) {
delete m_thumb;
- m_thumb = 0;
+ m_thumb = nullptr;
}
}
else {
@@ -273,7 +273,7 @@ void CProxyWindow::verifyDwmState() */
void CProxyWindow::sendThumb(LONG width, LONG height)
{
- if (0 == m_thumb) {
+ if (nullptr == m_thumb) {
m_width = width;
m_height = height;
m_thumb = m_dat->tabCreateThumb(this);
@@ -304,7 +304,7 @@ void CProxyWindow::sendPreview() if (!m_thumb || !dat_active)
return;
- FORMATRANGE fr = { 0 };
+ FORMATRANGE fr = {};
POINT pt = { 0 };
RECT rcContainer, rcTemp, rcRich, rcLog;
HDC hdc, dc;
@@ -580,7 +580,7 @@ CThumbBase::CThumbBase(const CProxyWindow* _p) : m_isValid(false)
{
m_pWnd = _p;
- m_hbmThumb = 0;
+ m_hbmThumb = nullptr;
renderBase();
}
@@ -591,7 +591,7 @@ CThumbBase::CThumbBase(const CProxyWindow* _p) : */
void CThumbBase::renderBase()
{
- HICON hIcon = 0;
+ HICON hIcon = nullptr;
HBRUSH brBack;
LONG lIconSize = 32;
@@ -599,7 +599,7 @@ void CThumbBase::renderBase() m_height = m_pWnd->getHeight();
m_dat = m_pWnd->getDat();
m_dtFlags = 0;
- m_hOldFont = 0;
+ m_hOldFont = nullptr;
#if defined(__LOGDEBUG_)
_DebugTraceW(L"refresh base (background) with %d, %d", m_width, m_height);
@@ -611,7 +611,7 @@ void CThumbBase::renderBase() if (m_hbmThumb) {
::DeleteObject(m_hbmThumb);
- m_hbmThumb = 0;
+ m_hbmThumb = nullptr;
}
HDC dc = ::GetDC(m_pWnd->getHwnd());
@@ -639,7 +639,7 @@ void CThumbBase::renderBase() setupRect();
hIcon = m_pWnd->getBigIcon();
- if (0 == hIcon) {
+ if (nullptr == hIcon) {
if (m_dat->m_dwUnread) {
if (PluginConfig.g_IconMsgEventBig)
hIcon = PluginConfig.g_IconMsgEventBig;
@@ -650,16 +650,16 @@ void CThumbBase::renderBase() }
else {
hIcon = reinterpret_cast<HICON>(Skin_LoadProtoIcon(m_dat->m_cache->getActiveProto(), m_dat->m_cache->getActiveStatus(), true));
- if (0 == hIcon || reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) == hIcon) {
+ if (nullptr == hIcon || reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) == hIcon) {
hIcon = reinterpret_cast<HICON>(Skin_LoadProtoIcon(m_dat->m_cache->getActiveProto(), m_dat->m_cache->getActiveStatus()));
lIconSize = 16;
}
}
}
- ::DrawIconEx(m_hdc, m_rcIcon.right / 2 - lIconSize / 2, m_rcIcon.top, hIcon, lIconSize, lIconSize, 0, 0, DI_NORMAL);
+ ::DrawIconEx(m_hdc, m_rcIcon.right / 2 - lIconSize / 2, m_rcIcon.top, hIcon, lIconSize, lIconSize, 0, nullptr, DI_NORMAL);
hIcon = m_pWnd->getOverlayIcon();
if (hIcon)
- ::DrawIconEx(m_hdc, m_rcIcon.right - 16, m_rcIcon.top + 16, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(m_hdc, m_rcIcon.right - 16, m_rcIcon.top + 16, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
m_rcIcon.top += (lIconSize + 3);
CSkin::RenderText(m_hdc, m_dat->m_hTheme, m_dat->m_wszStatus, &m_rcIcon, m_dtFlags | DT_CENTER | DT_WORD_ELLIPSIS, 10, 0, true);
@@ -710,7 +710,7 @@ CThumbBase::~CThumbBase() {
if (m_hbmThumb) {
::DeleteObject(m_hbmThumb);
- m_hbmThumb = 0;
+ m_hbmThumb = nullptr;
m_isValid = false;
}
#if defined(__LOGDEBUG_)
@@ -786,7 +786,7 @@ void CThumbIM::renderContent() m_rcBottom.bottom -= ((m_rcBottom.bottom - m_rcBottom.top) % m_sz.cy); // adjust to a multiple of line height
const wchar_t *tszStatusMsg = m_dat->m_cache->getStatusMsg();
- if (tszStatusMsg == 0)
+ if (tszStatusMsg == nullptr)
tszStatusMsg = TranslateT("No status message");
CSkin::RenderText(m_hdc, m_dat->m_hTheme, tszStatusMsg, &m_rcBottom, DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | m_dtFlags, 10, 0, true);
@@ -882,9 +882,9 @@ void CThumbMUC::renderContent() m_rcBottom.bottom -= ((m_rcBottom.bottom - m_rcBottom.top) % m_sz.cy); // adjust to a multiple of line height
- const wchar_t *szStatusMsg = 0;
+ const wchar_t *szStatusMsg = nullptr;
if (si->iType != GCW_SERVER) {
- if (0 == (szStatusMsg = si->ptszTopic))
+ if (nullptr == (szStatusMsg = si->ptszTopic))
szStatusMsg = TranslateT("no topic set.");
}
else if (mi) {
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 114186c985..0ab41c7c6e 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -155,7 +155,7 @@ void CTemplateEditDlg::OnInitDialog() m_hContact = db_find_first(); m_szProto = GetContactProto(m_hContact); - while (m_szProto == 0 && m_hContact != 0) { + while (m_szProto == nullptr && m_hContact != 0) { m_hContact = db_find_next(m_hContact); m_szProto = GetContactProto(m_hContact); } diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index c0ffbdb78c..5f7d4fb866 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -225,15 +225,15 @@ void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, CSrmmWindow *dat) WritePrivateProfileStringA("Message Log", "ExtraMicroLF", _itoa(M.GetByte("extramicrolf", 0), szBuf, 10), szIniFilename);
for (i = 0; i <= TMPL_ERRMSG; i++) {
- T2Utf szLTR((dat == 0) ? LTR_Active.szTemplates[i] : dat->m_pContainer->ltr_templates->szTemplates[i]);
+ T2Utf szLTR((dat == nullptr) ? LTR_Active.szTemplates[i] : dat->m_pContainer->ltr_templates->szTemplates[i]);
WritePrivateProfileStringA("Templates", TemplateNames[i], szLTR, szIniFilename);
- T2Utf szRTL((dat == 0) ? RTL_Active.szTemplates[i] : dat->m_pContainer->rtl_templates->szTemplates[i]);
+ T2Utf szRTL((dat == nullptr) ? RTL_Active.szTemplates[i] : dat->m_pContainer->rtl_templates->szTemplates[i]);
WritePrivateProfileStringA("RTLTemplates", TemplateNames[i], szRTL, szIniFilename);
}
for (i = 0; i < CUSTOM_COLORS; i++) {
mir_snprintf(szTemp, "cc%d", i + 1);
- if (dat == 0)
+ if (dat == nullptr)
WritePrivateProfileStringA("Custom Colors", szTemp, _itoa(M.GetDword(szTemp, 0), szBuf, 10), szIniFilename);
else
WritePrivateProfileStringA("Custom Colors", szTemp, _itoa(dat->m_pContainer->theme.custom_colors[i], szBuf, 10), szIniFilename);
@@ -259,7 +259,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, version = 1;
HDC hdc = GetDC(nullptr);
- if (dat == 0) {
+ if (dat == nullptr) {
while (fontBlocks[n].szModule && (dwFlags & THEME_READ_FONTS)) {
char *szModule = fontBlocks[n].szModule;
int firstIndex = fontBlocks[n].iFirst;
@@ -376,15 +376,15 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, if (version >= 3) {
if (!noAdvanced && dwFlags & THEME_READ_TEMPLATES) {
for (i = 0; i <= TMPL_ERRMSG; i++) {
- wchar_t *decoded = 0;
+ wchar_t *decoded = nullptr;
GetPrivateProfileStringA("Templates", TemplateNames[i], "[undef]", szTemplateBuffer, TEMPLATE_LENGTH * 3, szIniFilename);
if (mir_strcmp(szTemplateBuffer, "[undef]")) {
- if (dat == 0)
+ if (dat == nullptr)
db_set_utf(0, TEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer);
decoded = mir_utf8decodeW(szTemplateBuffer);
- if (dat == 0)
+ if (dat == nullptr)
wcsncpy_s(LTR_Active.szTemplates[i], decoded, _TRUNCATE);
else
wcsncpy_s(dat->ltr_templates->szTemplates[i], decoded, _TRUNCATE);
@@ -394,10 +394,10 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, GetPrivateProfileStringA("RTLTemplates", TemplateNames[i], "[undef]", szTemplateBuffer, TEMPLATE_LENGTH * 3, szIniFilename);
if (mir_strcmp(szTemplateBuffer, "[undef]")) {
- if (dat == 0)
+ if (dat == nullptr)
db_set_utf(0, RTLTEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer);
decoded = mir_utf8decodeW(szTemplateBuffer);
- if (dat == 0)
+ if (dat == nullptr)
wcsncpy_s(RTL_Active.szTemplates[i], decoded, _TRUNCATE);
else
wcsncpy_s(dat->rtl_templates->szTemplates[i], decoded, _TRUNCATE);
@@ -428,7 +428,7 @@ const wchar_t* TSAPI GetThemeFileName(int iMode) mir_snwprintf(filter, L"%s%c*.tabsrmm%c%c", TranslateT("TabSRMM themes"), 0, 0, 0);
ofn.lpstrFilter = filter;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = szFilename;
ofn.lpstrInitialDir = szInitialDir;
ofn.nMaxFile = MAX_PATH;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 884f952efa..5ed85aab29 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -36,7 +36,7 @@ static SKINDESC my_default_skin[] = { IDR_SKIN_LOGO, L"unknown.png"
};
-CSkin* Skin = 0;
+CSkin* Skin = nullptr;
static void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal,
@@ -49,7 +49,7 @@ static void __inline gradientHorizontal(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UINT nextButtonID;
-ButtonSet g_ButtonSet = { 0 };
+ButtonSet g_ButtonSet = {};
#define NR_MAXSKINICONS 100
@@ -81,34 +81,34 @@ char CSkin::m_realSkinnedFrame_caption = 0; int CSkin::m_titleBarLeftOff = 0, CSkin::m_titleButtonTopOff = 0, CSkin::m_captionOffset = 0, CSkin::m_captionPadding = 0,
CSkin::m_titleBarRightOff = 0, CSkin::m_sidebarTopOffset = 0, CSkin::m_sidebarBottomOffset = 0, CSkin::m_bRoundedCorner = 0;
-CImageItem *CSkin::m_switchBarItem = 0, *CSkin::m_tabTop = 0, *CSkin::m_tabBottom = 0, *CSkin::m_tabGlowTop = 0, *CSkin::m_tabGlowBottom = 0;
+CImageItem *CSkin::m_switchBarItem = nullptr, *CSkin::m_tabTop = nullptr, *CSkin::m_tabBottom = nullptr, *CSkin::m_tabGlowTop = nullptr, *CSkin::m_tabGlowBottom = nullptr;
bool CSkin::m_fAeroSkinsValid = false;
SIZE CSkin::m_titleBarButtonSize = { 0 };
COLORREF CSkin::m_ContainerColorKey = 0, CSkin::m_dwmColorRGB = 0, CSkin::m_DefaultFontColor = 0;
-HBRUSH CSkin::m_ContainerColorKeyBrush = 0, CSkin::m_MenuBGBrush = 0;
+HBRUSH CSkin::m_ContainerColorKeyBrush = nullptr, CSkin::m_MenuBGBrush = nullptr;
-HPEN CSkin::m_SkinLightShadowPen = 0, CSkin::m_SkinDarkShadowPen = 0;
+HPEN CSkin::m_SkinLightShadowPen = nullptr, CSkin::m_SkinDarkShadowPen = nullptr;
-HICON CSkin::m_closeIcon = 0, CSkin::m_maxIcon = 0, CSkin::m_minIcon = 0;
+HICON CSkin::m_closeIcon = nullptr, CSkin::m_maxIcon = nullptr, CSkin::m_minIcon = nullptr;
UINT CSkin::m_aeroEffect = 0;
DWORD CSkin::m_glowSize = 0;
-HBRUSH CSkin::m_BrushBack = 0, CSkin::m_BrushFill = 0;
+HBRUSH CSkin::m_BrushBack = nullptr, CSkin::m_BrushFill = nullptr;
-HBITMAP CSkin::m_tabCloseBitmap = 0, CSkin::m_tabCloseOldBitmap = 0;
-HDC CSkin::m_tabCloseHDC = 0;
+HBITMAP CSkin::m_tabCloseBitmap = nullptr, CSkin::m_tabCloseOldBitmap = nullptr;
+HDC CSkin::m_tabCloseHDC = nullptr;
// aero effects
AeroEffect CSkin::m_currentAeroEffect;
-AeroEffect *CSkin::m_pCurrentAeroEffect = 0;
+AeroEffect *CSkin::m_pCurrentAeroEffect = nullptr;
AeroEffect CSkin::m_aeroEffects[AERO_EFFECT_LAST] = {
{
- LPGENW("No effect"), 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0
+ LPGENW("No effect"), 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, nullptr
},
{
LPGENW("Milky Glass"),
@@ -285,11 +285,11 @@ CSkinItem SkinItems[] = { }, { L"InfoPanelBackground", "TSKIN_INFOPANELBG", ID_EXTBKINFOPANELBG,
8, CLCDEFAULT_CORNER,
0xf0f0f0, 0x42b1ff, 1, CLCDEFAULT_TEXTCOLOR, 40, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, nullptr
}, { L"Sidebar Background", "TSKIN_SIDEBARBG", ID_EXTBKSIDEBARBG,
CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
0xb2e1ff, 0xb2e1ff, 1, CLCDEFAULT_TEXTCOLOR, 40, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, nullptr
}
};
@@ -297,7 +297,7 @@ static CSkinItem _defInfoPanel = { L"InfoPanelBackground", "TSKIN_INFOPANELBG", ID_EXTBKINFOPANELBG,
8, CLCDEFAULT_CORNER,
0xf0f0f0, 0x62caff, 0, CLCDEFAULT_TEXTCOLOR, 255, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, nullptr
};
static BYTE __inline percent_to_byte(UINT32 percent)
@@ -474,7 +474,7 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de // TL+BL CORNER
hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0);
- if (hbitmap == 0 || pvBits == nullptr) {
+ if (hbitmap == nullptr || pvBits == nullptr) {
DeleteObject(BrMask);
DeleteDC(hdc);
return;
@@ -627,12 +627,12 @@ void __fastcall CImageItem::Render(const HDC hdc, const RECT *rc, bool fIgnoreGl LONG height = rc->bottom - rc->top;
BOOL isGlyph = ((m_dwFlags & IMAGE_GLYPH) && Skin->haveGlyphItem());
BOOL fCleanUp = TRUE;
- HDC hdcSrc = 0;
- HBITMAP hbmOld = 0;
+ HDC hdcSrc = nullptr;
+ HBITMAP hbmOld = nullptr;
LONG srcOrigX = isGlyph ? m_glyphMetrics[0] : 0;
LONG srcOrigY = isGlyph ? m_glyphMetrics[1] : 0;
- if (m_hdc == 0) {
+ if (m_hdc == nullptr) {
hdcSrc = CreateCompatibleDC(hdc);
hbmOld = (HBITMAP)SelectObject(hdcSrc, isGlyph ? Skin->getGlyphItem()->getHbm() : m_hbm);
}
@@ -755,9 +755,9 @@ void CImageItem::Create(const wchar_t *szImageFile) HBITMAP hbm = LoadPNG(szImageFile);
BITMAP bm;
- m_hdc = 0;
- m_hbmOld = 0;
- m_hbm = 0;
+ m_hdc = nullptr;
+ m_hbmOld = nullptr;
+ m_hbm = nullptr;
if (hbm) {
m_hbm = hbm;
@@ -778,7 +778,7 @@ void CImageItem::Create(const wchar_t *szImageFile) m_dwFlags |= IMAGE_FLAG_DIVIDED;
if (m_inner_height <= 0 || m_inner_width <= 0) {
DeleteObject(hbm);
- m_hbm = 0;
+ m_hbm = nullptr;
return;
}
}
@@ -799,7 +799,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) {
wchar_t buffer[501];
wchar_t szDrive[MAX_PATH], szPath[MAX_PATH];
- wchar_t *szFinalName = 0;
+ wchar_t *szFinalName = nullptr;
GetPrivateProfileString(m_szName, L"Glyph", L"None", buffer, 500, szFilename);
if (mir_wstrcmp(buffer, L"None")) {
@@ -821,7 +821,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) mir_snwprintf(szFinalName, MAX_PATH, L"%s\\%s%s", szDrive, szPath, buffer);
if (!PathFileExists(szFinalName)) {
delete[] szFinalName;
- szFinalName = 0;
+ szFinalName = nullptr;
}
m_alpha = GetPrivateProfileInt(m_szName, L"Alpha", 100, szFilename);
m_alpha = min(m_alpha, 100);
@@ -846,7 +846,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) if (m_inner_height <= 0 || m_inner_width <= 0) {
if (szFinalName) {
delete[] szFinalName;
- szFinalName = 0;
+ szFinalName = nullptr;
}
return(szFinalName);
}
@@ -858,7 +858,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) m_dwFlags |= IMAGE_FILLSOLID;
}
else
- m_fillBrush = 0;
+ m_fillBrush = nullptr;
GetPrivateProfileString(m_szName, L"Colorkey", L"None", buffer, 500, szFilename);
if (mir_wstrcmp(buffer, L"None")) {
CSkin::m_ContainerColorKey = CSkin::HexStringToLong(buffer);
@@ -873,13 +873,13 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) m_bStretch = IMAGE_STRETCH_V;
else if (buffer[0] == 'w' || buffer[0] == 'W')
m_bStretch = IMAGE_STRETCH_H;
- m_hbm = 0;
+ m_hbm = nullptr;
if (GetPrivateProfileInt(m_szName, L"Perpixel", 0, szFilename))
m_dwFlags |= IMAGE_PERPIXEL_ALPHA;
return(szFinalName);
}
- return 0;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1001,7 +1001,7 @@ void CImageItem::Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha HBITMAP TSAPI CImageItem::LoadPNG(const wchar_t *szFilename)
{
- HBITMAP hBitmap = 0;
+ HBITMAP hBitmap = nullptr;
hBitmap = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFilename, IMGL_WCHAR);
return hBitmap;
}
@@ -1030,7 +1030,7 @@ void CSkin::setFileName() void CSkin::Init(bool fStartup)
{
- m_ImageItems = 0;
+ m_ImageItems = nullptr;
m_SkinItems = ::SkinItems;
m_fLoadOnStartup = false;
m_skinEnabled = m_frameSkins = false;
@@ -1059,7 +1059,7 @@ bool CSkin::warnToClose() const if (::pFirstContainer == nullptr)
return true;
- if (MessageBox(0,
+ if (MessageBox(nullptr,
TranslateT("All message containers need to close before the skin can be changed\nProceed?"),
TranslateT("Change skin"), MB_YESNO | MB_ICONQUESTION) != IDYES)
return false;
@@ -1123,7 +1123,7 @@ void CSkin::Unload() tmp = nextItem;
}
- m_ImageItems = 0;
+ m_ImageItems = nullptr;
m_glyphItem.Free();
if (m_ContainerColorKeyBrush)
@@ -1133,20 +1133,20 @@ void CSkin::Unload() if (m_BrushBack)
::DeleteObject(m_BrushBack);
- m_ContainerColorKeyBrush = m_MenuBGBrush = 0;
+ m_ContainerColorKeyBrush = m_MenuBGBrush = nullptr;
if (m_SkinLightShadowPen)
::DeleteObject(m_SkinLightShadowPen);
- m_SkinLightShadowPen = 0;
+ m_SkinLightShadowPen = nullptr;
if (m_SkinDarkShadowPen)
::DeleteObject(m_SkinDarkShadowPen);
- m_SkinDarkShadowPen = 0;
+ m_SkinDarkShadowPen = nullptr;
if (m_SkinItems) {
for (int i = 0; i < ID_EXTBK_LAST; i++) {
m_SkinItems[i].IGNORED = 1;
- m_SkinItems[i].imageItem = 0;
+ m_SkinItems[i].imageItem = nullptr;
}
m_SkinItems[ID_EXTBKINFOPANELBG] = _defInfoPanel;
}
@@ -1165,7 +1165,7 @@ void CSkin::Unload() m_titleBarButtonSize.cx = m_titleBarButtonSize.cy = 0;
m_ContainerColorKey = 0;
- m_ContainerColorKeyBrush = m_MenuBGBrush = 0;
+ m_ContainerColorKeyBrush = m_MenuBGBrush = nullptr;
m_skinEnabled = m_frameSkins = false;
if (m_closeIcon)
@@ -1175,7 +1175,7 @@ void CSkin::Unload() if (m_minIcon)
::DestroyIcon(m_minIcon);
- m_closeIcon = m_maxIcon = m_minIcon = 0;
+ m_closeIcon = m_maxIcon = m_minIcon = nullptr;
for (int i = 0; i < m_nrSkinIcons; i++)
if (m_skinIcons[i].phIcon)
@@ -1197,7 +1197,7 @@ void CSkin::Unload() void CSkin::LoadIcon(const wchar_t *szSection, const wchar_t *name, HICON &hIcon)
{
- if (hIcon != 0)
+ if (hIcon != nullptr)
DestroyIcon(hIcon);
wchar_t buffer[512];
@@ -1209,7 +1209,7 @@ void CSkin::LoadIcon(const wchar_t *szSection, const wchar_t *name, HICON &hIcon _wsplitpath(m_tszFileName, szDrive, szDir, nullptr, nullptr);
mir_snwprintf(szImagePath, L"%s\\%s\\%s", szDrive, szDir, buffer);
- hIcon = (HICON)LoadImage(0, szImagePath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
+ hIcon = (HICON)LoadImage(nullptr, szImagePath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
}
else hIcon = nullptr;
}
@@ -1299,7 +1299,7 @@ void CSkin::ReadImageItem(const wchar_t *itemname) wchar_t *szImageFileName = tmpItem.Read(m_tszFileName);
- if (!mir_wstrcmpi(itemname, L"$glyphs") && szImageFileName != 0) { // the glyph item MUST have a valid image
+ if (!mir_wstrcmpi(itemname, L"$glyphs") && szImageFileName != nullptr) { // the glyph item MUST have a valid image
tmpItem.Create(szImageFileName);
if (tmpItem.getHbm()) {
m_glyphItem = tmpItem;
@@ -1334,7 +1334,7 @@ void CSkin::ReadImageItem(const wchar_t *itemname) else {
CImageItem *pItem = m_ImageItems;
- while (pItem->getNextItem() != 0)
+ while (pItem->getNextItem() != nullptr)
pItem = pItem->getNextItem();
pItem->setNextItem(newItem);
}
@@ -1478,7 +1478,7 @@ void CSkin::Load(void) _wsplitpath(m_tszFileName, szDrive, szPath, nullptr, nullptr);
mir_snwprintf(szFinalName, L"%s\\%s\\%s", szDrive, szPath, buffer);
if (PathFileExists(szFinalName)) {
- ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M.GetByte("skin_loadmode", 0));
+ ReadThemeFromINI(szFinalName, nullptr, FALSE, m_fLoadOnStartup ? 0 : M.GetByte("skin_loadmode", 0));
CacheLogFonts();
CacheMsgLogIcons();
}
@@ -1487,7 +1487,7 @@ void CSkin::Load(void) data = HexStringToLong(buffer);
if (m_MenuBGBrush) {
DeleteObject(m_MenuBGBrush);
- m_MenuBGBrush = 0;
+ m_MenuBGBrush = nullptr;
}
if (mir_wstrcmp(buffer, L"None"))
m_MenuBGBrush = CreateSolidBrush(data);
@@ -1524,7 +1524,7 @@ void CSkin::LoadItems() {
wchar_t *szSections = nullptr;
wchar_t *p, *p1;
- TIconDesc tmpIconDesc = { 0 };
+ TIconDesc tmpIconDesc = {};
if (m_skinIcons == nullptr)
m_skinIcons = (TIconDescW *)mir_calloc(sizeof(TIconDescW) * NR_MAXSKINICONS);
@@ -1628,7 +1628,7 @@ void CSkin::setupTabCloseBitmap(bool fDeleteOnly) ::FillRect(m_tabCloseHDC, &rc, ::GetSysColorBrush(COLOR_3DFACE));
::DrawFrameControl(m_tabCloseHDC, &rc, DFC_BUTTON, DFCS_BUTTONPUSH | DFCS_MONO);
}
- ::DrawIconEx(m_tabCloseHDC, 2, 2, PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL], 16, 16, 0, 0, DI_NORMAL);
+ ::DrawIconEx(m_tabCloseHDC, 2, 2, PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL], 16, 16, 0, nullptr, DI_NORMAL);
::SelectObject(m_tabCloseHDC, m_tabCloseOldBitmap);
HBITMAP hbmTemp = ResizeBitmap(m_tabCloseBitmap, 16, 16, fFree);
@@ -1671,15 +1671,15 @@ void CSkin::setupAeroSkins() mir_wstrcat(tszBasePath, L"\\");
// load unknown avatar..
- if (0 == PluginConfig.g_hbmUnknown) {
+ if (nullptr == PluginConfig.g_hbmUnknown) {
mir_snwprintf(tszFilename, L"%scustom_unknown.png", tszBasePath);
if (!PathFileExists(tszFilename))
mir_snwprintf(tszFilename, L"%sunknown.png", tszBasePath);
PluginConfig.g_hbmUnknown = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_WCHAR);
- if (PluginConfig.g_hbmUnknown == 0) {
- HDC dc = GetDC(0);
+ if (PluginConfig.g_hbmUnknown == nullptr) {
+ HDC dc = GetDC(nullptr);
PluginConfig.g_hbmUnknown = CreateCompatibleBitmap(dc, 20, 20);
- ReleaseDC(0, dc);
+ ReleaseDC(nullptr, dc);
}
}
@@ -1744,8 +1744,8 @@ void CSkin::setupAeroSkins() BITMAP bm;
GetObject(hbm, sizeof(bm), &bm);
- m_tabTop = new CImageItem(4, 4, 4, 4, 0, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
- 0, 255, 30, 80, 50, 100);
+ m_tabTop = new CImageItem(4, 4, 4, 4, nullptr, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
+ nullptr, 255, 30, 80, 50, 100);
m_tabTop->setAlphaFormat(AC_SRC_ALPHA, 255);
m_tabTop->setMetrics(bm.bmWidth, bm.bmHeight);
@@ -1763,8 +1763,8 @@ void CSkin::setupAeroSkins() FIF->FI_Unload(fib);
GetObject(hbm, sizeof(bm), &bm);
- m_tabBottom = new CImageItem(4, 4, 4, 4, 0, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
- 0, 255, 30, 80, 50, 100);
+ m_tabBottom = new CImageItem(4, 4, 4, 4, nullptr, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
+ nullptr, 255, 30, 80, 50, 100);
m_tabBottom->setAlphaFormat(AC_SRC_ALPHA, 255);
m_tabBottom->setMetrics(bm.bmWidth, bm.bmHeight);
@@ -1782,8 +1782,8 @@ void CSkin::setupAeroSkins() CImageItem::PreMultiply(hbm, 1);
GetObject(hbm, sizeof(bm), &bm);
- m_tabGlowTop = new CImageItem(4, 4, 4, 4, 0, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
- 0, 255, 30, 80, 50, 100);
+ m_tabGlowTop = new CImageItem(4, 4, 4, 4, nullptr, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
+ nullptr, 255, 30, 80, 50, 100);
m_tabGlowTop->setAlphaFormat(AC_SRC_ALPHA, 255);
m_tabGlowTop->setMetrics(bm.bmWidth, bm.bmHeight);
@@ -1796,8 +1796,8 @@ void CSkin::setupAeroSkins() FIF->FI_Unload(fib);
GetObject(hbm, sizeof(bm), &bm);
- m_tabGlowBottom = new CImageItem(4, 4, 4, 4, 0, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
- 0, 255, 30, 80, 50, 100);
+ m_tabGlowBottom = new CImageItem(4, 4, 4, 4, nullptr, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
+ nullptr, 255, 30, 80, 50, 100);
m_tabGlowBottom->setAlphaFormat(AC_SRC_ALPHA, 255);
m_tabGlowBottom->setMetrics(bm.bmWidth, bm.bmHeight);
@@ -1817,8 +1817,8 @@ void CSkin::setupAeroSkins() GetObject(hbm, sizeof(bm), &bm);
- m_switchBarItem = new CImageItem(4, 4, 4, 4, 0, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
- 0, 255, 2, 12, 10, 20);
+ m_switchBarItem = new CImageItem(4, 4, 4, 4, nullptr, hbm, IMAGE_FLAG_DIVIDED | IMAGE_PERPIXEL_ALPHA,
+ nullptr, 255, 2, 12, 10, 20);
m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, 255);
m_switchBarItem->setMetrics(bm.bmWidth, bm.bmHeight);
@@ -1904,10 +1904,10 @@ void CSkin::SkinDrawBGFromDC(HWND hwndClient, HWND hwnd, RECT *rcClient, HDC hdc void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON hIcon, BYTE alpha)
{
HDC dcMem = ::CreateCompatibleDC(hdc);
- HBITMAP hbm = ::CreateCompatibleBitmap(hdc, dx, dy), hbmOld = 0;
+ HBITMAP hbm = ::CreateCompatibleBitmap(hdc, dx, dy), hbmOld = nullptr;
hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(dcMem, hbm));
- ::DrawIconEx(dcMem, 0, 0, hIcon, dx, dy, 0, 0, DI_NORMAL);
+ ::DrawIconEx(dcMem, 0, 0, hIcon, dx, dy, 0, nullptr, DI_NORMAL);
m_default_bf.SourceConstantAlpha = alpha;
hbm = (HBITMAP)SelectObject(dcMem, hbmOld);
CImageItem::PreMultiply(hbm, 1); // for AlphaBlend()...
@@ -2241,7 +2241,7 @@ void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const rcCachedToolbar.right = cx;
rcCachedToolbar.bottom = cy;
- if (m_pContainer->cachedToolbarDC == 0)
+ if (m_pContainer->cachedToolbarDC == nullptr)
m_pContainer->cachedToolbarDC = ::CreateCompatibleDC(hdc);
if (m_pContainer->szOldToolbarSize.cx != cx || m_pContainer->szOldToolbarSize.cy != cy) {
@@ -2267,7 +2267,7 @@ void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const ((bAero && CSkin::m_pCurrentAeroEffect) ? CSkin::m_pCurrentAeroEffect->m_clrToolbar2 : ::GetSysColor(COLOR_3DFACE));
bAlphaOffset = PluginConfig.m_tbBackgroundHigh ? 40 : 0;
- ::DrawAlpha(m_pContainer->cachedToolbarDC, &rcCachedToolbar, CSkin::m_tmp_tb_high, 55 + bAlphaOffset, CSkin::m_tmp_tb_low, 0, 9, 0, 0, 0);
+ ::DrawAlpha(m_pContainer->cachedToolbarDC, &rcCachedToolbar, CSkin::m_tmp_tb_high, 55 + bAlphaOffset, CSkin::m_tmp_tb_low, 0, 9, 0, 0, nullptr);
}
::BitBlt(hdc, rcToolbar.left, rcToolbar.top, cx, cy, m_pContainer->cachedToolbarDC, 0, 0, SRCCOPY);
@@ -2314,7 +2314,7 @@ void CSkin::FinalizeBufferedPaint(HANDLE hbp, RECT *rc) void CSkin::ApplyAeroEffect(const HDC hdc, const RECT *rc, int iEffectArea)
{
- if (m_pCurrentAeroEffect == 0 || m_aeroEffect == AERO_EFFECT_NONE)
+ if (m_pCurrentAeroEffect == nullptr || m_aeroEffect == AERO_EFFECT_NONE)
return;
if (m_pCurrentAeroEffect->pfnEffectRenderer)
@@ -2334,7 +2334,7 @@ void CSkin::AeroEffectCallback_Milk(const HDC hdc, const RECT *rc, int iEffectAr DWORD corner = (iEffectArea == AERO_EFFECT_AREA_INFOPANEL) ? m_pCurrentAeroEffect->m_cornerRadius : 6;
DrawAlpha(hdc, const_cast<RECT *>(rc), m_pCurrentAeroEffect->m_baseColor, alpha, m_pCurrentAeroEffect->m_gradientColor,
- color2_trans, m_pCurrentAeroEffect->m_gradientType, m_pCurrentAeroEffect->m_cornerType, corner, 0);
+ color2_trans, m_pCurrentAeroEffect->m_gradientType, m_pCurrentAeroEffect->m_cornerType, corner, nullptr);
}
}
@@ -2343,7 +2343,7 @@ void CSkin::AeroEffectCallback_Carbon(const HDC hdc, const RECT *rc, int iEffect if (iEffectArea < 0x1000)
DrawAlpha(hdc, const_cast<RECT *>(rc), m_pCurrentAeroEffect->m_baseColor, m_pCurrentAeroEffect->m_baseAlpha,
m_pCurrentAeroEffect->m_gradientColor, 0, m_pCurrentAeroEffect->m_gradientType,
- m_pCurrentAeroEffect->m_cornerType, m_pCurrentAeroEffect->m_cornerRadius, 0);
+ m_pCurrentAeroEffect->m_cornerType, m_pCurrentAeroEffect->m_cornerRadius, nullptr);
}
void CSkin::AeroEffectCallback_Solid(const HDC hdc, const RECT *rc, int iEffectArea)
@@ -2352,17 +2352,17 @@ void CSkin::AeroEffectCallback_Solid(const HDC hdc, const RECT *rc, int iEffectA if (iEffectArea == AERO_EFFECT_AREA_SIDEBAR_LEFT)
::DrawAlpha(hdc, const_cast<RECT *>(rc), m_pCurrentAeroEffect->m_baseColor, m_pCurrentAeroEffect->m_baseAlpha,
m_pCurrentAeroEffect->m_gradientColor, 0, GRADIENT_TB + 1,
- 0, 2, 0);
+ 0, 2, nullptr);
else
::DrawAlpha(hdc, const_cast<RECT *>(rc), m_pCurrentAeroEffect->m_baseColor, m_pCurrentAeroEffect->m_baseAlpha,
m_pCurrentAeroEffect->m_gradientColor, 0, m_pCurrentAeroEffect->m_gradientType,
- m_pCurrentAeroEffect->m_cornerType, m_pCurrentAeroEffect->m_cornerRadius, 0);
+ m_pCurrentAeroEffect->m_cornerType, m_pCurrentAeroEffect->m_cornerRadius, nullptr);
}
else {
BYTE bGradient = (iEffectArea & AERO_EFFECT_AREA_TAB_BOTTOM ? GRADIENT_BT : GRADIENT_TB) + 1;
::DrawAlpha(hdc, const_cast<RECT *>(rc), m_pCurrentAeroEffect->m_baseColor, 70,
m_pCurrentAeroEffect->m_gradientColor, 1, bGradient,
- m_pCurrentAeroEffect->m_cornerType, m_pCurrentAeroEffect->m_cornerRadius, 0);
+ m_pCurrentAeroEffect->m_cornerType, m_pCurrentAeroEffect->m_cornerRadius, nullptr);
}
}
@@ -2370,7 +2370,7 @@ void CSkin::initAeroEffect() {
if (m_BrushBack) {
::DeleteObject(m_BrushBack);
- m_BrushBack = 0;
+ m_BrushBack = nullptr;
}
if (PluginConfig.m_bIsVista && m_aeroEffect > AERO_EFFECT_NONE && m_aeroEffect < AERO_EFFECT_LAST) {
m_currentAeroEffect = m_aeroEffects[m_aeroEffect];
@@ -2395,7 +2395,7 @@ void CSkin::initAeroEffect() m_BrushBack = ::CreateSolidBrush(m_pCurrentAeroEffect->m_clrBack);
}
else {
- m_pCurrentAeroEffect = 0;
+ m_pCurrentAeroEffect = nullptr;
m_glowSize = 10;
m_BrushBack = ::CreateSolidBrush(0);
}
@@ -2465,7 +2465,7 @@ void CTabBaseDlg::UpdateToolbarBG() if (M.isAero() || M.isDwmActive())
m_fLimitedUpdate = true; // skip unrelevant window updates when we have buffered paint avail
- ::RedrawWindow(m_hwnd, &rcUpdate, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
+ ::RedrawWindow(m_hwnd, &rcUpdate, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
BB_RedrawButtons();
m_fLimitedUpdate = false;
}
@@ -2479,7 +2479,7 @@ void CTabBaseDlg::UpdateToolbarBG() void CSkin::FillBack(const HDC hdc, RECT* rc)
{
- if (0 == CSkin::m_BrushFill) {
+ if (nullptr == CSkin::m_BrushFill) {
if (PluginConfig.m_fillColor)
CSkin::m_BrushFill = ::CreateSolidBrush(PluginConfig.m_fillColor);
}
diff --git a/plugins/TabSRMM/src/translator.cpp b/plugins/TabSRMM/src/translator.cpp index b4aa5d29f9..6c89f3b3c6 100644 --- a/plugins/TabSRMM/src/translator.cpp +++ b/plugins/TabSRMM/src/translator.cpp @@ -184,7 +184,7 @@ TOptionListItem* CTranslator::getTree(UINT id) case TREE_LOG: return m_lvItemsLog;
case TREE_TAB: return m_lvItemsTab;
}
- return 0;
+ return nullptr;
}
TOptionListGroup* CTranslator::getGroupTree(UINT id)
@@ -196,5 +196,5 @@ TOptionListGroup* CTranslator::getGroupTree(UINT id) case TREE_LOG: return m_lvGroupsLog;
case TREE_TAB: return m_lvGroupsTab;
}
- return 0;
+ return nullptr;
}
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index c538f898c1..1fcaff527c 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -29,9 +29,9 @@ #include "stdafx.h"
static BOOL isAnimThreadRunning = TRUE;
-static HANDLE hTrayAnimThread = 0;
-static HICON hIconTrayCurrent = 0;
-HANDLE g_hEvent = 0;
+static HANDLE hTrayAnimThread = nullptr;
+static HICON hIconTrayCurrent = nullptr;
+HANDLE g_hEvent = nullptr;
static wchar_t g_eventName[100];
@@ -75,7 +75,7 @@ static void TrayAnimThread(LPVOID) if (dwElapsed >= 600) {
PluginConfig.m_TrayFlashState = !PluginConfig.m_TrayFlashState;
dwElapsed = 0;
- FlashTrayIcon(PluginConfig.m_TrayFlashState ? 0 : hIconDefault); // restore default icon
+ FlashTrayIcon(PluginConfig.m_TrayFlashState ? nullptr : hIconDefault); // restore default icon
}
}
Sleep(200);
@@ -109,19 +109,19 @@ void TSAPI CreateTrayMenus(int mode) SetEvent(g_hEvent);
WaitForSingleObject(hTrayAnimThread, 5000);
CloseHandle(g_hEvent);
- g_hEvent = 0;
- hTrayAnimThread = 0;
- if (PluginConfig.g_hMenuTrayUnread != 0) {
+ g_hEvent = nullptr;
+ hTrayAnimThread = nullptr;
+ if (PluginConfig.g_hMenuTrayUnread != nullptr) {
DestroyMenu(PluginConfig.g_hMenuTrayUnread);
- PluginConfig.g_hMenuTrayUnread = 0;
+ PluginConfig.g_hMenuTrayUnread = nullptr;
}
- if (PluginConfig.g_hMenuFavorites != 0) {
+ if (PluginConfig.g_hMenuFavorites != nullptr) {
DestroyMenu(PluginConfig.g_hMenuFavorites);
- PluginConfig.g_hMenuFavorites = 0;
+ PluginConfig.g_hMenuFavorites = nullptr;
}
- if (PluginConfig.g_hMenuRecent != 0) {
+ if (PluginConfig.g_hMenuRecent != nullptr) {
DestroyMenu(PluginConfig.g_hMenuRecent);
- PluginConfig.g_hMenuRecent = 0;
+ PluginConfig.g_hMenuRecent = nullptr;
}
}
}
@@ -142,7 +142,7 @@ void TSAPI CreateSystrayIcon(int create) if (create && !nen_options.bTrayExist) {
Shell_NotifyIcon(NIM_ADD, &nim);
nen_options.bTrayExist = TRUE;
- hIconTrayCurrent = 0;
+ hIconTrayCurrent = nullptr;
SetEvent(g_hEvent);
}
else if (create == FALSE && nen_options.bTrayExist) {
@@ -206,7 +206,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c if (szStatus == nullptr)
szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
- if (hIcon == 0)
+ if (hIcon == nullptr)
hIcon = Skin_LoadProtoIcon(szProto, wStatus);
PROTOACCOUNT *acc = Proto_GetAccount(szProto);
@@ -289,7 +289,7 @@ void TSAPI LoadFavoritesAndRecent() for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (M.GetByte(hContact, "isFavorite", 0))
- AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, 0, 1, PluginConfig.g_hMenuFavorites);
+ AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuFavorites);
if ((dwRecent = M.GetDword(hContact, "isRecent", 0)) != 0 && iIndex < nen_options.wMaxRecent) {
recentEntries[iIndex].dwTimestamp = dwRecent;
recentEntries[iIndex++].hContact = hContact;
@@ -311,7 +311,7 @@ void TSAPI LoadFavoritesAndRecent() }
}
for (i = 0; i < iIndex; i++)
- AddContactToFavorites(recentEntries[i].hContact, nullptr, nullptr, nullptr, 0, 0, 1, PluginConfig.g_hMenuRecent);
+ AddContactToFavorites(recentEntries[i].hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuRecent);
delete[] recentEntries;
}
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 48da8a6311..fcef66e691 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -22,8 +22,8 @@ static BYTE newColorMode; static wchar_t szStart[128];
static wchar_t szStop[128];
-static HANDLE hntfStarted = 0;
-static HANDLE hntfStopped = 0;
+static HANDLE hntfStarted = nullptr;
+static HANDLE hntfStopped = nullptr;
struct
{
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 752d5d7c2d..72e81f3af3 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -132,7 +132,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_USER + 100:
- CSrmmWindow *dat = 0;
+ CSrmmWindow *dat = nullptr;
DWORD *pdwActionToTake = (DWORD *)lParam;
unsigned int iOldIEView = 0;
HWND hWnd = Srmm_FindWindow(hContact);
@@ -182,7 +182,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_ISFAVORITE)) {
if (!M.GetByte(hContact, "isFavorite", 0))
- AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, 0, 1, PluginConfig.g_hMenuFavorites);
+ AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuFavorites);
}
else DeleteMenu(PluginConfig.g_hMenuFavorites, hContact, MF_BYCOMMAND);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 8faf8bbce5..aa4110c804 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -34,7 +34,7 @@ OBJLIST<TRTFColorTable> Utils::rtf_clrs(10);
-MWindowList CWarning::hWindowList = 0;
+MWindowList CWarning::hWindowList = nullptr;
static wchar_t *w_bbcodes_begin[] = { L"[b]", L"[i]", L"[u]", L"[s]", L"[color=" };
static wchar_t *w_bbcodes_end[] = { L"[/b]", L"[/i]", L"[/u]", L"[/s]", L"[/color]" };
@@ -355,7 +355,7 @@ void Utils::DoubleAmpersands(wchar_t *pszText, size_t len) wchar_t* Utils::GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen)
{
size_t uRequired;
- wchar_t *p = 0, cSaved;
+ wchar_t *p = nullptr, cSaved;
bool fEllipsis = false;
if (mir_wstrlen(szText) <= iMaxLen) {
@@ -663,7 +663,7 @@ void Utils::scaleAvatarHeightLimited(const HBITMAP hBm, double& dNewWidth, doubl HICON CTabBaseDlg::IconFromAvatar() const
{
if (!ServiceExists(MS_AV_GETAVATARBITMAP))
- return 0;
+ return nullptr;
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, m_hContact, 0);
if (ace == nullptr || ace->hbmPic == nullptr)
@@ -698,7 +698,7 @@ HICON CTabBaseDlg::IconFromAvatar() const CSkin::m_default_bf.SourceConstantAlpha = 255;
::SelectObject(dc, hbmOld);
- ::ImageList_Add(hIml_c, hbmNew, 0);
+ ::ImageList_Add(hIml_c, hbmNew, nullptr);
::DeleteObject(hbmNew);
::DeleteDC(dc);
@@ -715,7 +715,7 @@ HICON CTabBaseDlg::IconFromAvatar() const AVATARCACHEENTRY* Utils::loadAvatarFromAVS(const MCONTACT hContact)
{
if (!ServiceExists(MS_AV_GETAVATARBITMAP))
- return 0;
+ return nullptr;
return (AVATARCACHEENTRY*)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
}
@@ -841,7 +841,7 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const wchar_t *tszN if (PathFileExists(szFilename))
return true;
- HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+ HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return false;
@@ -863,7 +863,7 @@ wchar_t* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich) CHARRANGE sel = { 0 };
::SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax)
- return 0;
+ return nullptr;
TEXTRANGE tr;
tr.chrg = _e->chrg;
@@ -888,7 +888,7 @@ void Utils::sanitizeFilename(wchar_t* tszFilename) static size_t forbiddenCharactersLen = mir_wstrlen(forbiddenCharacters);
for (size_t i = 0; i < forbiddenCharactersLen; i++) {
- wchar_t* szFound = 0;
+ wchar_t* szFound = nullptr;
while ((szFound = wcschr(tszFilename, (int)forbiddenCharacters[i])) != nullptr)
*szFound = ' ';
@@ -915,16 +915,16 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename) {
wchar_t sysPathName[MAX_PATH + 2];
if (0 == ::GetSystemDirectoryW(sysPathName, MAX_PATH))
- return 0;
+ return nullptr;
sysPathName[MAX_PATH - 1] = 0;
if (mir_wstrlen(sysPathName) + mir_wstrlen(szFilename) >= MAX_PATH)
- return 0;
+ return nullptr;
mir_wstrcat(sysPathName, szFilename);
HMODULE _h = LoadLibraryW(sysPathName);
- if (0 == _h)
- return 0;
+ if (nullptr == _h)
+ return nullptr;
return _h;
}
@@ -943,7 +943,7 @@ void Utils::setAvatarContact(HWND hWnd, MCONTACT hContact) size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner)
{
- if (!OpenClipboard(hwndOwner) || str == 0)
+ if (!OpenClipboard(hwndOwner) || str == nullptr)
return 0;
size_t i = sizeof(wchar_t) * (mir_wstrlen(str) + 1);
@@ -1025,7 +1025,7 @@ CWarning::CWarning(const wchar_t *tszTitle, const wchar_t *tszText, const UINT u m_szText(mir_wstrdup(tszText))
{
m_uId = uId;
- m_hFontCaption = 0;
+ m_hFontCaption = nullptr;
m_dwFlags = dwFlags;
m_fIsModal = ((m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL) ? true : false);
@@ -1040,11 +1040,11 @@ CWarning::~CWarning() LRESULT CWarning::ShowDialog() const
{
if (!m_fIsModal) {
- ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_WARNING), 0, stubDlgProc, LPARAM(this));
+ ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_WARNING), nullptr, stubDlgProc, LPARAM(this));
return 0;
}
- return ::DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_WARNING), 0, stubDlgProc, LPARAM(this));
+ return ::DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_WARNING), nullptr, stubDlgProc, LPARAM(this));
}
__int64 CWarning::getMask()
@@ -1077,10 +1077,10 @@ void CWarning::destroyAll() LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt)
{
- wchar_t* separator_pos = 0;
+ wchar_t* separator_pos = nullptr;
__int64 mask = 0, val = 0;
- if (0 == hWindowList)
+ if (nullptr == hWindowList)
hWindowList = WindowList_Create();
// don't open new warnings when shutdown was initiated (modal ones will otherwise
@@ -1102,12 +1102,12 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt) // is not well-formatted.
_s = TranslateW(warnings[uId]);
- if (mir_wstrlen(_s) < 3 || 0 == wcschr(_s, '|'))
+ if (mir_wstrlen(_s) < 3 || nullptr == wcschr(_s, '|'))
_s = TranslateW(warnings[uId]);
}
}
- if ((mir_wstrlen(_s) > 3) && ((separator_pos = wcschr(_s, '|')) != 0)) {
+ if ((mir_wstrlen(_s) > 3) && ((separator_pos = wcschr(_s, '|')) != nullptr)) {
if (uId >= 0) {
mask = getMask();
val = ((__int64)1L) << uId;
@@ -1162,7 +1162,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_INITDIALOG:
{
UINT uResId = 0;
- HICON hIcon = 0;
+ HICON hIcon = nullptr;
m_hwnd = hwnd;
@@ -1204,7 +1204,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP uResId = 32514;
if (uResId)
- hIcon = reinterpret_cast<HICON>(::LoadImage(0, MAKEINTRESOURCE(uResId), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
+ hIcon = reinterpret_cast<HICON>(::LoadImage(nullptr, MAKEINTRESOURCE(uResId), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
else
hIcon = ::Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
@@ -1220,7 +1220,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP {
HWND hwndChild = reinterpret_cast<HWND>(lParam);
UINT id = ::GetDlgCtrlID(hwndChild);
- if (0 == m_hFontCaption) {
+ if (nullptr == m_hFontCaption) {
HFONT hFont = reinterpret_cast<HFONT>(::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_GETFONT, 0, 0));
LOGFONT lf = { 0 };
diff --git a/plugins/TipperYM/src/bitmap_func.cpp b/plugins/TipperYM/src/bitmap_func.cpp index dcaf7b776c..e930980b5a 100644 --- a/plugins/TipperYM/src/bitmap_func.cpp +++ b/plugins/TipperYM/src/bitmap_func.cpp @@ -20,15 +20,15 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-TOOLTIPSKIN skin = {0};
+TOOLTIPSKIN skin = {};
HBITMAP CreateBitmapPart(FIBITMAP *fibSrc, int iSrcWidth, int iSrcHeight, int iDesWidth, int iDesHeight, TransformationMode transfMode)
{
- FIBITMAP *fibMem = NULL;
- HBITMAP hbmpDes = NULL;
+ FIBITMAP *fibMem = nullptr;
+ HBITMAP hbmpDes = nullptr;
if (!fibSrc)
- return NULL;
+ return nullptr;
switch (transfMode) {
case TM_NONE:
@@ -152,7 +152,7 @@ void CreateFromBitmaps(bool bServiceTip) wchar_t* tszFileName = opt.szImgFile[i];
if (tszFileName && *tszFileName != 0) {
- FIBITMAP *fib = NULL;
+ FIBITMAP *fib = nullptr;
if (!skin.bCached) {
FIBITMAP *fibLoad = (FIBITMAP *)CallService(MS_IMG_LOAD, (WPARAM)tszFileName, IMGL_WCHAR | IMGL_RETURNDIB);
if (!fibLoad) continue;
@@ -194,7 +194,7 @@ void CreateFromBitmaps(bool bServiceTip) iCentWidth = max(rcWidth - left - right, 0);
iCentHeight = max(rcHeight - top - bottom, 0);
- FIBITMAP *fibCentre = NULL, *fibMem = NULL;
+ FIBITMAP *fibCentre = nullptr, *fibMem = nullptr;
if (opt.margins[i].left || opt.margins[i].top || opt.margins[i].right || opt.margins[i].bottom) {
// create corners bitmaps
if (!skin.bCached) {
@@ -263,7 +263,7 @@ void CreateFromBitmaps(bool bServiceTip) }
}
- HDC hdcMem = CreateCompatibleDC(0);
+ HDC hdcMem = CreateCompatibleDC(nullptr);
RECT rc = {0};
if (skin.hbmpSkinParts[i][SP_CENTRE_AREA]) {
@@ -312,7 +312,7 @@ void CreateFromBitmaps(bool bServiceTip) for (int j = 0; j < SP_CORNER_TL; j++)
if (skin.hbmpSkinParts[i][j]) {
DeleteObject(skin.hbmpSkinParts[i][j]);
- skin.hbmpSkinParts[i][j] = NULL;
+ skin.hbmpSkinParts[i][j] = nullptr;
}
skin.bNeedLayerUpdate = true;
@@ -348,10 +348,10 @@ void CreateSkinBitmap(int iWidth, int iHeight, bool bServiceTip) if (skin.hBitmap) {
SelectObject(skin.hdc, skin.hOldBitmap);
DeleteObject(skin.hBitmap);
- skin.hBitmap = NULL;
+ skin.hBitmap = nullptr;
}
DeleteDC(skin.hdc);
- skin.hdc = NULL;
+ skin.hdc = nullptr;
}
skin.iWidth = iWidth;
@@ -365,11 +365,11 @@ void CreateSkinBitmap(int iWidth, int iHeight, bool bServiceTip) bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
- skin.hBitmap = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void **)&skin.colBits, 0, 0);
+ skin.hBitmap = (HBITMAP)CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, (void **)&skin.colBits, nullptr, 0);
if (!skin.hBitmap)
return;
- skin.hdc = CreateCompatibleDC(0);
+ skin.hdc = CreateCompatibleDC(nullptr);
skin.hOldBitmap = (HBITMAP)SelectObject(skin.hdc, skin.hBitmap);
if (opt.skinMode == SM_COLORFILL)
@@ -386,13 +386,13 @@ void DestroySkinBitmap() for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
if (skin.fib[i]) {
fii->FI_Unload(skin.fib[i]);
- skin.fib[i] = NULL;
+ skin.fib[i] = nullptr;
}
for (int j = SP_CORNER_TL; j < SKIN_PARTS_COUNT; j++) {
if (skin.hbmpSkinParts[i][j]) {
DeleteObject(skin.hbmpSkinParts[i][j]);
- skin.hbmpSkinParts[i][j] = NULL;
+ skin.hbmpSkinParts[i][j] = nullptr;
}
}
}
@@ -473,7 +473,7 @@ BOOL IsAlphaTransparent(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)mir_calloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return FALSE;
GetBitmapBits(hBitmap, dwLen, p);
@@ -615,7 +615,7 @@ void ColorizeBitmap() HRGN CreateOpaqueRgn(BYTE level, bool bOpaque)
{
if (!skin.colBits)
- return NULL;
+ return nullptr;
GdiFlush();
@@ -666,7 +666,7 @@ HRGN CreateOpaqueRgn(BYTE level, bool bOpaque) }
}
- HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
+ HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
free(pRgnData);
return hRgn;
}
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index 8fa62b1c8f..ffc5237068 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -22,8 +22,8 @@ Boston, MA 02111-1307, USA. #include <tchar.h>
-HMODULE hDwmapiDll = 0;
-HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind) = 0;
+HMODULE hDwmapiDll = nullptr;
+HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind) = nullptr;
unsigned int uintMessagePumpThreadId = 0;
POINT pt = {-1};
@@ -38,7 +38,7 @@ __inline bool IsContactTooltip(CLCINFOTIPEX *clc) void CALLBACK TimerProcWaitForContent(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(0, WaitForContentTimerID);
+ KillTimer(nullptr, WaitForContentTimerID);
WaitForContentTimerID = 0;
bStatusMsgReady = true;
bAvatarReady = true;
@@ -60,9 +60,9 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) if (CanRetrieveStatusMsg(hContact, szProto) && ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0))
{
if (WaitForContentTimerID)
- KillTimer(0, WaitForContentTimerID);
+ KillTimer(nullptr, WaitForContentTimerID);
- WaitForContentTimerID = SetTimer(NULL, 0, WAIT_TIMER_INTERVAL, TimerProcWaitForContent);
+ WaitForContentTimerID = SetTimer(nullptr, 0, WAIT_TIMER_INTERVAL, TimerProcWaitForContent);
bNeedWait = true;
}
}
@@ -79,9 +79,9 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) if (!ace)
{
if (WaitForContentTimerID)
- KillTimer(0, WaitForContentTimerID);
+ KillTimer(nullptr, WaitForContentTimerID);
- WaitForContentTimerID = SetTimer(NULL, 0, WAIT_TIMER_INTERVAL, TimerProcWaitForContent);
+ WaitForContentTimerID = SetTimer(nullptr, 0, WAIT_TIMER_INTERVAL, TimerProcWaitForContent);
bNeedWait = true;
}
else
@@ -105,12 +105,12 @@ unsigned int CALLBACK MessagePumpThread(void*) {
Thread_SetName("TipperYM: MessagePumpThread");
- HWND hwndTip = NULL;
- CLCINFOTIPEX *clcitex = NULL;
- MSG hwndMsg = {0};
+ HWND hwndTip = nullptr;
+ CLCINFOTIPEX *clcitex = nullptr;
+ MSG hwndMsg = {};
- while (GetMessage(&hwndMsg, NULL, 0, 0) > 0 && !Miranda_IsTerminated()) {
- if (hwndMsg.hwnd != NULL && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */
+ while (GetMessage(&hwndMsg, nullptr, 0, 0) > 0 && !Miranda_IsTerminated()) {
+ if (hwndMsg.hwnd != nullptr && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */
continue;
switch (hwndMsg.message) {
case MUM_CREATEPOPUP:
@@ -124,11 +124,11 @@ unsigned int CALLBACK MessagePumpThread(void*) if (!NeedWaitForContent(clcitex)) {
if (hwndTip)
MyDestroyWindow(hwndTip);
- hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)clcitex);
+ hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInst, (LPVOID)clcitex);
if (clcitex) {
mir_free(clcitex);
- clcitex = NULL;
+ clcitex = nullptr;
}
bStatusMsgReady = false;
@@ -138,12 +138,12 @@ unsigned int CALLBACK MessagePumpThread(void*) case MUM_DELETEPOPUP:
if (hwndTip) {
MyDestroyWindow(hwndTip);
- hwndTip = 0;
+ hwndTip = nullptr;
}
if (clcitex) {
mir_free(clcitex);
- clcitex = NULL;
+ clcitex = nullptr;
}
bStatusMsgReady = false;
@@ -156,7 +156,7 @@ unsigned int CALLBACK MessagePumpThread(void*) if (opt.bWaitForContent && !bStatusMsgReady && clcitex && clcitex->hItem == (HANDLE)hContact) {
if (WaitForContentTimerID) {
- KillTimer(0, WaitForContentTimerID);
+ KillTimer(nullptr, WaitForContentTimerID);
WaitForContentTimerID = 0;
}
@@ -183,7 +183,7 @@ unsigned int CALLBACK MessagePumpThread(void*) MCONTACT hContact = (MCONTACT)hwndMsg.wParam;
if (opt.bWaitForContent && !bAvatarReady && clcitex && clcitex->hItem == (HANDLE)hContact) {
if (WaitForContentTimerID) {
- KillTimer(0, WaitForContentTimerID);
+ KillTimer(nullptr, WaitForContentTimerID);
WaitForContentTimerID = 0;
}
@@ -215,7 +215,7 @@ void InitMessagePump() wcl.cbSize = sizeof(wcl);
wcl.lpfnWndProc = PopupWindowProc;
wcl.hInstance = hInst;
- wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcl.lpszClassName = POP_WIN_CLASS;
RegisterClassEx(&wcl);
@@ -224,7 +224,7 @@ void InitMessagePump() if (hDwmapiDll)
MyDwmEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow");
- CloseHandle(mir_forkthreadex(MessagePumpThread, NULL, &uintMessagePumpThreadId));
+ CloseHandle(mir_forkthreadex(MessagePumpThread, nullptr, &uintMessagePumpThreadId));
}
void DeinitMessagePump()
@@ -247,8 +247,8 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam) CLCINFOTIPEX *clcit2 = (CLCINFOTIPEX *)mir_alloc(sizeof(CLCINFOTIPEX));
memcpy(clcit2, clcit, sizeof(CLCINFOTIP));
clcit2->cbSize = sizeof(CLCINFOTIPEX);
- clcit2->szProto = NULL;
- clcit2->swzText = NULL;
+ clcit2->szProto = nullptr;
+ clcit2->swzText = nullptr;
if (wParam) // wParam is char pointer containing text - e.g. status bar tooltip
{
@@ -279,8 +279,8 @@ INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam) CLCINFOTIPEX *clcit2 = (CLCINFOTIPEX *)mir_alloc(sizeof(CLCINFOTIPEX));
memcpy(clcit2, clcit, sizeof(CLCINFOTIP));
clcit2->cbSize = sizeof(CLCINFOTIPEX);
- clcit2->szProto = NULL;
- clcit2->swzText = NULL;
+ clcit2->szProto = nullptr;
+ clcit2->swzText = nullptr;
if (wParam) // wParam is char pointer containing text - e.g. status bar tooltip
{
@@ -311,7 +311,7 @@ int HideTipHook(WPARAM wParam, LPARAM lParam) int ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if ((ack==NULL) || (ack->result != ACKRESULT_SUCCESS))
+ if ((ack==nullptr) || (ack->result != ACKRESULT_SUCCESS))
return 0;
if (ack->type == ACKTYPE_AWAYMSG) {
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index ed8ad1a0b4..1d7544eeda 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -39,7 +39,7 @@ int InitTipperSmileys() SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *protocol)
{
if (!(opt.iSmileyAddFlags & SMILEYADD_ENABLE))
- return NULL;
+ return nullptr;
if (nCount == -1)
nCount = (int)mir_wstrlen(lpString);
@@ -49,7 +49,7 @@ SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *proto if (!info->pieces) {
mir_free(info);
- return NULL;
+ return nullptr;
}
return info;
@@ -57,8 +57,8 @@ SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *proto void Smileys_FreeParse(SMILEYPARSEINFO parseInfo)
{
- if (parseInfo != NULL) {
- if (parseInfo->pieces != NULL)
+ if (parseInfo != nullptr) {
+ if (parseInfo->pieces != nullptr)
DestroySmileyList(parseInfo->pieces);
mir_free(parseInfo);
@@ -89,7 +89,7 @@ int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT // Draw
- if (parseInfo->pieces == NULL)
+ if (parseInfo->pieces == nullptr)
return DrawText(hDC, lpString, nCount, lpRect, uFormat);
RECT rc = *lpRect;
@@ -112,14 +112,14 @@ SIZE GetTextSize(HDC hdcMem, const wchar_t *szText, SMILEYPARSEINFO info, UINT u int text_height;
int row_count = 0, pos_x = 0;
- if (szText == NULL || wcslen(szText) == 0) {
+ if (szText == nullptr || wcslen(szText) == 0) {
text_size.cy = 0;
text_size.cx = 0;
}
else {
RECT text_rc = { 0, 0, 2048, 2048 };
- if (info->pieces == NULL) {
+ if (info->pieces == nullptr) {
DrawText(hdcMem, szText, -1, &text_rc, DT_CALCRECT | uTextFormat);
text_size.cx = text_rc.right - text_rc.left;
text_size.cy = text_rc.bottom - text_rc.top;
@@ -181,7 +181,7 @@ SIZE GetTextSize(HDC hdcMem, const wchar_t *szText, SMILEYPARSEINFO info, UINT u void DrawTextSmiley(HDC hdcMem, RECT free_rc, const wchar_t *szText, int len, SMILEYPARSEINFO info, UINT uTextFormat)
{
- if (szText == NULL)
+ if (szText == nullptr)
return;
uTextFormat &= ~DT_RIGHT;
@@ -276,7 +276,7 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const wchar_t *szText, int len, SM }
shift = (info->row_height[row_count] - (LONG)(piece->smiley_height * factor)) >> 1;
- DrawIconExAlpha(hdcMem, text_rc.left, text_rc.top + shift, piece->smiley, piece->smiley_width * factor, piece->smiley_height * factor, 0, NULL, DI_NORMAL, true);
+ DrawIconExAlpha(hdcMem, text_rc.left, text_rc.top + shift, piece->smiley, piece->smiley_width * factor, piece->smiley_height * factor, 0, nullptr, DI_NORMAL, true);
}
}
}
@@ -287,13 +287,13 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const wchar_t *szText, int len, SM void DestroySmileyList(SortedList* p_list)
{
- if (p_list == NULL)
+ if (p_list == nullptr)
return;
- if (p_list->items != NULL) {
+ if (p_list->items != nullptr) {
for (int i = 0; i < p_list->realCount; i++) {
TEXTPIECE *piece = (TEXTPIECE *)p_list->items[i];
- if (piece != NULL) {
+ if (piece != nullptr) {
if (piece->type == TEXT_PIECE_TYPE_SMILEY)
DestroyIcon(piece->smiley);
@@ -311,10 +311,10 @@ SortedList *ReplaceSmileys(const wchar_t *text, int text_size, const char *proto *max_smiley_height = 0;
if (!text || !text[0] || !ServiceExists(MS_SMILEYADD_BATCHPARSE))
- return NULL;
+ return nullptr;
char smileyProto[64];
- if (protocol == NULL)
+ if (protocol == nullptr)
strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1);
else if (mir_strcmp(protocol, META_PROTO) == 0)
strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1);
@@ -330,7 +330,7 @@ SortedList *ReplaceSmileys(const wchar_t *text, int text_size, const char *proto SMADD_BATCHPARSERES *spres = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
if (!spres) // Did not find a smiley
- return NULL;
+ return nullptr;
// Lets add smileys
SortedList *plText = List_Create(0, 10);
@@ -426,7 +426,7 @@ SortedList *ReplaceSmileys(const wchar_t *text, int text_size, const char *proto int DrawTextExt(HDC hdc, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, SMILEYPARSEINFO spi)
{
- if ((opt.iSmileyAddFlags & SMILEYADD_ENABLE) && spi != NULL) {
+ if ((opt.iSmileyAddFlags & SMILEYADD_ENABLE) && spi != nullptr) {
if (opt.iSmileyAddFlags & SMILEYADD_RESIZE)
uFormat |= DT_RESIZE_SMILEYS;
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 3ca7f1a096..3b4beff698 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -25,7 +25,7 @@ ICONSTATE exIcons[EXICONS_COUNT]; extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip)
{
- if (swzProto == NULL)
+ if (swzProto == nullptr)
return 0;
char szSetting[64];
@@ -60,11 +60,11 @@ void CreateDefaultItems() }
else {
PRESETITEM *item = GetPresetItemByName(defaultItemList[i].szName);
- if (item == NULL) continue;
+ if (item == nullptr) continue;
for (int j = 0; j < MAX_PRESET_SUBST_COUNT; j++) {
PRESETSUBST *subst = GetPresetSubstByName(item->szNeededSubst[j]);
- if (subst == NULL) continue;
+ if (subst == nullptr) continue;
DSListNode *ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode));
wcsncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN);
@@ -344,7 +344,7 @@ void LoadOptions() opt.bShowNoFocus = (db_get_b(0, MODULE, "ShowNoFocus", 1) == 1);
int i, real_count = 0;
- opt.dsList = 0;
+ opt.dsList = nullptr;
DSListNode *ds_node;
opt.iDsCount = db_get_w(0, MODULE_ITEMS, "DSNumValues", 0);
@@ -361,7 +361,7 @@ void LoadOptions() opt.iDsCount = real_count;
real_count = 0;
- opt.diList = 0;
+ opt.diList = nullptr;
DIListNode *di_node;
opt.bWaitForStatusMsg = false;
@@ -414,7 +414,7 @@ void LoadOptions() wcsncpy(di_node->di.swzLabel, L"Last message: (%sys:last_msg_reltime% ago)", LABEL_LEN);
wcsncpy(di_node->di.swzValue, L"%sys:last_msg%", VALUE_LEN);
di_node->di.bLineAbove = di_node->di.bValueNewline = true;
- di_node->next = 0;
+ di_node->next = nullptr;
opt.iDiCount++;
}
@@ -439,7 +439,7 @@ void LoadOptions() wcsncpy(di_node->di.swzLabel, L"Status message:", LABEL_LEN);
wcsncpy(di_node->di.swzValue, L"%sys:status_msg%", VALUE_LEN);
di_node->di.bLineAbove = di_node->di.bValueNewline = true;
- di_node->next = 0;
+ di_node->next = nullptr;
opt.iDiCount++;
}
@@ -609,9 +609,9 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_BTN_VARIABLE:
{
if (GetFocus() == GetDlgItem(hwndDlg, IDC_ED_LABEL))
- variables_showhelp(hwndDlg, IDC_ED_LABEL, VHF_FULLDLG, NULL, NULL);
+ variables_showhelp(hwndDlg, IDC_ED_LABEL, VHF_FULLDLG, nullptr, nullptr);
else
- variables_showhelp(hwndDlg, IDC_ED_VALUE, VHF_FULLDLG, NULL, NULL);
+ variables_showhelp(hwndDlg, IDC_ED_VALUE, VHF_FULLDLG, nullptr, nullptr);
return TRUE;
}
}
@@ -794,7 +794,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_CHECKBOXES);
{
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -888,7 +888,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di);
if (result == IDOK || (result >= IDPRESETITEM && result < (IDPRESETITEM + 100))) {
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
tvi.item.lParam = (LPARAM)di_value;
@@ -912,12 +912,12 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (int i = 0; i < MAX_PRESET_SUBST_COUNT; i++) {
PRESETSUBST *subst = GetPresetSubstByName(presetItems[result - IDPRESETITEM].szNeededSubst[i]);
- if (subst == NULL)
+ if (subst == nullptr)
break;
if (SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_FINDSTRING, -1, (LPARAM)subst->swzName) == LB_ERR) {
DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
memset(ds_value, 0, sizeof(DSListNode));
- ds_value->next = NULL;
+ ds_value->next = nullptr;
ds_value->ds.type = subst->type;
wcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1);
@@ -951,7 +951,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA di_value->di.bIsVisible = true;
di_value->di.bLineAbove = true;
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
tvi.item.lParam = (LPARAM)di_value;
@@ -1124,7 +1124,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM item = { 0 };
item.mask = TVIF_PARAM;
item.hItem = TreeView_GetLastVisible(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- while (item.hItem != NULL) {
+ while (item.hItem != nullptr) {
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
di_node = (DIListNode *)item.lParam;
di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
@@ -1208,7 +1208,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM tvi = { 0 };
tvi.mask = TVIF_PARAM;
- for (HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS)); hItem != NULL;
+ for (HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS)); hItem != nullptr;
hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem)) {
tvi.hItem = hItem;
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi)) {
@@ -1468,8 +1468,8 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- TVINSERTSTRUCT tvi = { 0 };
- tvi.hParent = 0;
+ TVINSERTSTRUCT tvi = {};
+ tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -1521,7 +1521,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS));
int i = 0;
- while (item.hItem != NULL) {
+ while (item.hItem != nullptr) {
item.mask = TVIF_HANDLE | TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
opt.exIconsOrder[i] = ((ICONSTATE *)item.lParam)->order;
@@ -1543,7 +1543,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM opt.bDisableIfInvisible = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEINVISIBLE) ? true : false;
opt.bRetrieveXstatus = IsDlgButtonChecked(hwndDlg, IDC_CHK_RETRIEVEXSTATUS) ? true : false;
opt.bLimitMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG) ? true : false;
- opt.iLimitCharCount = GetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, 0, FALSE);
+ opt.iLimitCharCount = GetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, nullptr, FALSE);
db_set_dw(0, MODULE, "SmileyAddFlags", opt.iSmileyAddFlags);
db_set_b(0, MODULE, "WaitForContent", opt.bWaitForContent ? 1 : 0);
@@ -1664,7 +1664,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.item.state = INDEXTOSTATEIMAGEMASK(((ICONSTATE *)item.lParam)->vis ? 2 : 1);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis.item);
TreeView_DeleteItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = hti.hItem;
TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis));
SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
@@ -1737,7 +1737,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CheckDlgButton(hwndDlg, IDC_CHK_LOADFONTS, opt.bLoadFonts ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHK_LOADPROPORTIONS, opt.bLoadProportions ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AEROGLASS), MyDwmEnableBlurBehindWindow != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AEROGLASS), MyDwmEnableBlurBehindWindow != nullptr);
SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("None"));
SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Animation"));
@@ -1808,7 +1808,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableControls(hwndDlg, true);
}
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PIC_PREVIEW), 0, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PIC_PREVIEW), nullptr, FALSE);
iLastSel = iSel;
}
}
@@ -1862,13 +1862,13 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_NOTIFY:
{
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
- opt.iOpacity = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, 0, 0);
+ opt.iOpacity = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, nullptr, 0);
opt.bDropShadow = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHADOW) ? true : false;
opt.bBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) ? true : false;
opt.bRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERS) ? true : false;
opt.bAeroGlass = IsDlgButtonChecked(hwndDlg, IDC_CHK_AEROGLASS) ? true : false;
opt.showEffect = (PopupShowEffect)SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_GETCURSEL, 0, 0);
- opt.iAnimateSpeed = GetDlgItemInt(hwndDlg, IDC_ED_SPEED, 0, 0);
+ opt.iAnimateSpeed = GetDlgItemInt(hwndDlg, IDC_ED_SPEED, nullptr, 0);
opt.bLoadFonts = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADFONTS) ? true : false;
opt.bLoadProportions = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADPROPORTIONS) ? true : false;
@@ -1963,8 +1963,8 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- TVINSERTSTRUCT tvi = { 0 };
- tvi.hParent = 0;
+ TVINSERTSTRUCT tvi = {};
+ tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
@@ -2021,7 +2021,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case IDC_BTN_FAVCONTACTS:
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FAVCONTACTS), 0, DlgProcFavouriteContacts);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_FAVCONTACTS), nullptr, DlgProcFavouriteContacts);
break;
}
@@ -2043,7 +2043,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.cchTextMax = _countof(buff);
item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE;
item.stateMask = TVIS_STATEIMAGEMASK;
- while (item.hItem != NULL) {
+ while (item.hItem != nullptr) {
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), &item);
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2) {
mir_wstrcat(swzProtos, buff);
@@ -2058,7 +2058,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA swzProtos[0] = 0;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS));
item.pszText = buff;
- while (item.hItem != NULL) {
+ while (item.hItem != nullptr) {
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), &item);
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2) {
mir_wstrcat(swzProtos, buff);
@@ -2075,7 +2075,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
item.mask = TVIF_HANDLE | TVIF_STATE;
item.stateMask = TVIS_STATEIMAGEMASK;
- while (item.hItem != NULL) {
+ while (item.hItem != nullptr) {
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
opt.iFirstItems |= (1 << count);
@@ -2087,7 +2087,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA count = 0;
opt.iSecondItems = 0;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS));
- while (item.hItem != NULL) {
+ while (item.hItem != nullptr) {
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), &item);
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
opt.iSecondItems |= (1 << count);
@@ -2100,7 +2100,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA opt.bHandleByTipper = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER) ? true : false;
opt.bExpandTraytip = IsDlgButtonChecked(hwndDlg, IDC_CHK_EXPAND) ? true : false;
opt.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? true : false;
- opt.iExpandTime = max(min(GetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, 0, FALSE), 5000), 10);
+ opt.iExpandTime = max(min(GetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, nullptr, FALSE), 5000), 10);
db_set_b(0, MODULE, "TrayTip", (opt.bTraytip ? 1 : 0));
db_set_b(0, MODULE, "ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 6e8cebc7eb..0a5b82200e 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -20,15 +20,15 @@ Boston, MA 02111-1307, USA. #include "stdafx.h" -__inline void AddRow(PopupWindowData *pwd, wchar_t *swzLabel, wchar_t *swzValue, char *szProto, bool bParseSmileys, bool bNewline, bool bLineAbove, bool bIsTitle = false, HICON hIcon = NULL) +__inline void AddRow(PopupWindowData *pwd, wchar_t *swzLabel, wchar_t *swzValue, char *szProto, bool bParseSmileys, bool bNewline, bool bLineAbove, bool bIsTitle = false, HICON hIcon = nullptr) { RowData *pRows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData) * (pwd->iRowCount + 1)); - if (pRows == NULL) + if (pRows == nullptr) return; pwd->rows = pRows; - pwd->rows[pwd->iRowCount].swzLabel = swzLabel ? mir_wstrdup(swzLabel) : NULL; - pwd->rows[pwd->iRowCount].swzValue = swzValue ? mir_wstrdup(swzValue) : NULL; - pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)mir_wstrlen(swzValue), szProto) : NULL; + pwd->rows[pwd->iRowCount].swzLabel = swzLabel ? mir_wstrdup(swzLabel) : nullptr; + pwd->rows[pwd->iRowCount].swzValue = swzValue ? mir_wstrdup(swzValue) : nullptr; + pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)mir_wstrlen(swzValue), szProto) : nullptr; pwd->rows[pwd->iRowCount].bValueNewline = bNewline; pwd->rows[pwd->iRowCount].bLineAbove = bLineAbove; pwd->rows[pwd->iRowCount].bIsTitle = bIsTitle; @@ -60,7 +60,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // work around bug hiding tips GetCursorPos(&pwd->ptCursorStartPos); - SetTimer(hwnd, ID_TIMER_CHECKMOUSE, CHECKMOUSE_ELAPSE, 0); + SetTimer(hwnd, ID_TIMER_CHECKMOUSE, CHECKMOUSE_ELAPSE, nullptr); // register copy menu hotkey (CTRL+C) pwd->iHotkeyId = GlobalAddAtom(L"Tipper"); @@ -100,7 +100,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t swzUid[256], swzUidName[256]; if (Uid(0, pwd->clcit.szProto, swzUid, 256) && UidName(pwd->clcit.szProto, swzUidName, 253)) { mir_wstrcat(swzUidName, L": "); - AddRow(pwd, swzUidName, swzUid, NULL, false, false, false); + AddRow(pwd, swzUidName, swzUid, nullptr, false, false, false); } // logon info @@ -108,7 +108,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (TimestampToTimeDifference(NULL, pwd->clcit.szProto, "LogonTS", swzLogon, 59)) { wchar_t ago[96]; mir_snwprintf(ago, TranslateT("%s ago"), swzLogon); - AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false); + AddRow(pwd, TranslateT("Log on:"), ago, nullptr, false, false, false); } // number of unread emails @@ -117,13 +117,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa int iCount = (int)CallProtoService(pwd->clcit.szProto, PS_GETUNREADEMAILCOUNT, 0, 0); if (iCount > 0) { _itow(iCount, swzEmailCount, 10); - AddRow(pwd, TranslateT("Unread emails:"), swzEmailCount, NULL, false, false, false); + AddRow(pwd, TranslateT("Unread emails:"), swzEmailCount, nullptr, false, false, false); } } wchar_t *swzText = pcli->pfnGetStatusModeDescription(wStatus, 0); if (swzText) - AddRow(pwd, TranslateT("Status:"), swzText, NULL, false, false, false); + AddRow(pwd, TranslateT("Status:"), swzText, nullptr, false, false, false); if (wStatus >= ID_STATUS_ONLINE && wStatus <= ID_STATUS_OUTTOLUNCH) { // status message @@ -189,7 +189,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa ptrW swzListening(GetListeningTo(pwd->clcit.szProto)); if (swzListening) { StripBBCodesInPlace(swzListening); - AddRow(pwd, TranslateT("Listening to:"), swzListening, NULL, false, true, true); + AddRow(pwd, TranslateT("Listening to:"), swzListening, nullptr, false, true, true); } } } @@ -214,7 +214,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SendMessage(hwnd, PUM_REFRESHTRAYTIP, 0, 0); if (opt.bExpandTraytip) - SetTimer(hwnd, ID_TIMER_TRAYTIP, opt.iExpandTime, 0); + SetTimer(hwnd, ID_TIMER_TRAYTIP, opt.iExpandTime, nullptr); } else { wchar_t buff[2048], *swzText = pwd->clcit.swzText; @@ -232,7 +232,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa buff[iBuffPos] = 0; if (iBuffPos) { - AddRow(pwd, L"", buff, NULL, false, true, false); + AddRow(pwd, L"", buff, nullptr, false, true, false); bTopMessage = true; } @@ -277,7 +277,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa buff[iBuffPos] = 0; pwd->rows[pwd->iRowCount].swzValue = mir_wstrdup(buff); - pwd->rows[pwd->iRowCount].spi = NULL; + pwd->rows[pwd->iRowCount].spi = nullptr; pwd->iRowCount++; } @@ -289,9 +289,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->iRowCount = 1; pwd->rows = (RowData *)mir_alloc(sizeof(RowData)); pwd->rows[0].bLineAbove = pwd->rows[0].bValueNewline = false; - pwd->rows[0].swzLabel = 0; + pwd->rows[0].swzLabel = nullptr; pwd->rows[0].swzValue = swzText; - pwd->rows[0].spi = NULL; + pwd->rows[0].spi = nullptr; } } } @@ -414,10 +414,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 0, LWA_ALPHA); if (opt.showEffect) - SetTimer(hwnd, ID_TIMER_ANIMATE, ANIM_ELAPSE, 0); + SetTimer(hwnd, ID_TIMER_ANIMATE, ANIM_ELAPSE, nullptr); ShowWindow(hwnd, SW_SHOWNOACTIVATE); - InvalidateRect(hwnd, 0, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); // since tipper win is topmost, this should put it at top of topmost windows SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -491,7 +491,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa rcAvatar.bottom = rcAvatar.top + pwd->iRealAvatarHeight; - AVATARCACHEENTRY *ace = 0; + AVATARCACHEENTRY *ace = nullptr; if (pwd->hContact) ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, pwd->hContact, 0); else @@ -507,7 +507,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa HBITMAP hbmpAvatar = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0); if (hbmpAvatar) { - HRGN hrgnAvatar = 0; + HRGN hrgnAvatar = nullptr; if (opt.bAvatarRound) { hrgnAvatar = CreateRoundRectRgn(rcAvatar.left, rcAvatar.top, rcAvatar.right + 1, rcAvatar.bottom + 1, 9, 9); SelectClipRgn(hdc, hrgnAvatar); @@ -535,7 +535,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } if (hrgnAvatar) { - SelectClipRgn(hdc, 0); + SelectClipRgn(hdc, nullptr); DeleteObject(hrgnAvatar); } @@ -566,7 +566,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa for (int i = 0; i < EXICONS_COUNT; i++) { if (pwd->extraIcons[i].hIcon) { - DrawIconExAlpha(hdc, iIconX, iIconY, pwd->extraIcons[i].hIcon, 16, 16, 0, NULL, DI_NORMAL, false); + DrawIconExAlpha(hdc, iIconX, iIconY, pwd->extraIcons[i].hIcon, 16, 16, 0, nullptr, DI_NORMAL, false); iIconY += 20; } } @@ -648,7 +648,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // status icon in tray tooltip if (opt.titleIconLayout != PTL_NOICON && pwd->bIsTrayTip && pwd->rows[i].hIcon) { - DrawIconExAlpha(hdc, opt.iPadding, tr.top + (pwd->rows[i].iLabelHeight - 16) / 2, pwd->rows[i].hIcon, 16, 16, 0, NULL, DI_NORMAL, false); + DrawIconExAlpha(hdc, opt.iPadding, tr.top + (pwd->rows[i].iLabelHeight - 16) / 2, pwd->rows[i].hIcon, 16, 16, 0, nullptr, DI_NORMAL, false); bIconPainted = true; } @@ -687,7 +687,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa tr.bottom = tr.top + iRowHeight; if (opt.titleIconLayout != PTL_NOICON && pwd->bIsTrayTip && pwd->rows[i].hIcon && !bIconPainted) - DrawIconExAlpha(hdc, opt.iPadding, tr.top + (pwd->rows[i].iValueHeight - 16) / 2, pwd->rows[i].hIcon, 16, 16, 0, NULL, DI_NORMAL, false); + DrawIconExAlpha(hdc, opt.iPadding, tr.top + (pwd->rows[i].iValueHeight - 16) / 2, pwd->rows[i].hIcon, 16, 16, 0, nullptr, DI_NORMAL, false); UINT uFormat = opt.iValueValign | opt.iValueHalign | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | DT_NOPREFIX; DrawTextExt(hdc, pwd->rows[i].swzValue, -1, &tr, uFormat, pwd->rows[i].spi); @@ -701,7 +701,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa POINT ptSrc = { 0, 0 }; SIZE szTip = { r.right - r.left, r.bottom - r.top }; blend.SourceConstantAlpha = pwd->iTrans; - UpdateLayeredWindow(hwnd, NULL, NULL, &szTip, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, nullptr, &szTip, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); if (opt.bAeroGlass && MyDwmEnableBlurBehindWindow) { DWM_BLURBEHIND bb = { 0 }; @@ -744,7 +744,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa AppendMenu(hMenu, MF_STRING, COPYMENU_ALLITEMS, LPGENW("Copy all items")); if (pwd->clcit.szProto || pwd->hContact) AppendMenu(hMenu, MF_STRING, COPYMENU_AVATAR, LPGENW("Copy avatar")); - AppendMenu(hMenu, MF_SEPARATOR, 2000, 0); + AppendMenu(hMenu, MF_SEPARATOR, 2000, nullptr); TranslateMenu(hMenu); SetMenuItemBitmaps(hMenu, COPYMENU_ALLITEMS_LABELS, MF_BYCOMMAND, hbmpAllItems, hbmpAllItems); @@ -776,13 +776,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa AppendMenu(hMenu, MF_STRING, i + 1, buff); // first id = 1, because no select have id = 0 SetMenuItemBitmaps(hMenu, i + 1, MF_BYCOMMAND, hbmpItem, hbmpItem); } - else AppendMenu(hMenu, MF_SEPARATOR, 0, 0); + else AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); } } GetCursorPos(&pt); SetForegroundWindow(hwnd); - int iSelItem = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, 0); + int iSelItem = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); DeleteObject(hbmpAllItems); DeleteObject(hbmpItem); DestroyMenu(hMenu); @@ -790,10 +790,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (iSelItem == 0) return 0; // no item was selected - if (OpenClipboard(NULL)) { + if (OpenClipboard(nullptr)) { EmptyClipboard(); if (iSelItem == COPYMENU_AVATAR) { // copy avatar - AVATARCACHEENTRY *ace = 0; + AVATARCACHEENTRY *ace = nullptr; if (pwd->hContact) ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, pwd->hContact, 0); else @@ -872,7 +872,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa blend.AlphaFormat = AC_SRC_ALPHA; while (blend.SourceConstantAlpha != 0) { - UpdateLayeredWindow(hwnd, NULL, NULL, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, nullptr, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); blend.SourceConstantAlpha = max(blend.SourceConstantAlpha - opt.iAnimateSpeed, 0); Sleep(ANIM_ELAPSE); } @@ -895,10 +895,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa DeleteObject(skin.hBitmap); if (skin.hdc) DeleteDC(skin.hdc); - skin.hBitmap = NULL; - skin.hdc = NULL; + skin.hBitmap = nullptr; + skin.hdc = nullptr; - if (pwd == NULL) + if (pwd == nullptr) break; // unregister hotkey UnregisterHotKey(hwnd, pwd->iHotkeyId); @@ -911,7 +911,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa Smileys_FreeParse(pwd->spiTitle); - for (int i = 0; i < pwd->iRowCount && pwd->rows != NULL; i++) { + for (int i = 0; i < pwd->iRowCount && pwd->rows != nullptr; i++) { mir_free(pwd->rows[i].swzLabel); mir_free(pwd->rows[i].swzValue); Smileys_FreeParse(pwd->rows[i].spi); @@ -920,7 +920,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // destroy icons for (int i = 0; i < EXICONS_COUNT; i++) { - if (pwd->extraIcons[i].hIcon == NULL) + if (pwd->extraIcons[i].hIcon == nullptr) continue; if (pwd->extraIcons[i].bDestroy) @@ -931,7 +931,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa mir_free(pwd->clcit.swzText); mir_free(pwd); - pwd = NULL; + pwd = nullptr; SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); break; @@ -967,7 +967,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->bIsPainted = false; pwd->bNeedRefresh = true; SendMessage(hwnd, PUM_REFRESH_VALUES, TRUE, 0); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } mir_free((void *)lParam); return TRUE; @@ -977,7 +977,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // in case we have retrieve xstatus pwd->bIsPainted = false; SendMessage(hwnd, PUM_REFRESH_VALUES, TRUE, 0); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } return TRUE; @@ -986,7 +986,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->bIsPainted = false; SendMessage(hwnd, PUM_GETHEIGHT, 0, 0); SendMessage(hwnd, PUM_CALCPOS, 0, 0); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } return TRUE; @@ -1003,25 +1003,25 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa blend.SourceConstantAlpha = 0; blend.AlphaFormat = AC_SRC_ALPHA; - UpdateLayeredWindow(hwnd, NULL, NULL, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, nullptr, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); } else SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 0, LWA_ALPHA); SendMessage(hwnd, PUM_REFRESHTRAYTIP, 1, 0); SendMessage(hwnd, PUM_GETHEIGHT, 0, 0); SendMessage(hwnd, PUM_CALCPOS, 0, 0); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); if (opt.showEffect) { KillTimer(hwnd, ID_TIMER_ANIMATE); - SetTimer(hwnd, ID_TIMER_ANIMATE, ANIM_ELAPSE, 0); + SetTimer(hwnd, ID_TIMER_ANIMATE, ANIM_ELAPSE, nullptr); pwd->iAnimStep = 0; pwd->iCurrentTrans = 0; } return TRUE; case PUM_REFRESH_VALUES: - if (pwd && pwd->clcit.szProto == 0 && !pwd->bIsTextTip) { + if (pwd && pwd->clcit.szProto == nullptr && !pwd->bIsTextTip) { for (int i = 0; i < pwd->iRowCount; i++) { mir_free(pwd->rows[i].swzLabel); mir_free(pwd->rows[i].swzValue); @@ -1029,7 +1029,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } mir_free(pwd->rows); - pwd->rows = NULL; + pwd->rows = nullptr; pwd->iRowCount = 0; DIListNode *node = opt.diList; @@ -1077,7 +1077,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->iRowCount == 0) { mir_free(pwd->rows); - pwd->rows = NULL; + pwd->rows = nullptr; } } @@ -1104,7 +1104,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // avatar height pwd->iAvatarHeight = 0; if (!pwd->bIsTextTip && opt.avatarLayout != PAV_NONE && ServiceExists(MS_AV_GETAVATARBITMAP)) { - AVATARCACHEENTRY *ace = 0; + AVATARCACHEENTRY *ace = nullptr; if (pwd->hContact) ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)pwd->hContact, 0); else ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)pwd->clcit.szProto); @@ -1152,7 +1152,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->hContact || pwd->clcit.szProto) { for (i = 0; i < EXICONS_COUNT; i++) { if ((INT_PTR)pwd->extraIcons[i].hIcon == CALLSERVICE_NOTFOUND) - pwd->extraIcons[i].hIcon = 0; + pwd->extraIcons[i].hIcon = nullptr; if (pwd->extraIcons[i].hIcon) iCount++; @@ -1262,10 +1262,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa GetWindowRect(hwnd, &rc); if (rc.right - rc.left != iWidth || rc.bottom - rc.top != iHeight) { - SetWindowPos(hwnd, 0, 0, 0, iWidth, iHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(hwnd, nullptr, 0, 0, iWidth, iHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); GetWindowRect(hwnd, &pwd->rcWindow); SendMessage(hwnd, PUM_UPDATERGN, 0, 0); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } if (pHeight) @@ -1301,7 +1301,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->iAnimStep = ANIM_STEPS; } - UpdateLayeredWindow(hwnd, NULL, NULL, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, nullptr, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); } else { @@ -1339,7 +1339,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa blend.SourceConstantAlpha = pwd->iTrans; blend.AlphaFormat = AC_SRC_ALPHA; - UpdateLayeredWindow(hwnd, NULL, &ptPos, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, &ptPos, &sz, skin.hdc, &ptSrc, 0xffffffff, &blend, LWA_ALPHA); } } @@ -1364,7 +1364,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (opt.bAeroGlass && MyDwmEnableBlurBehindWindow && pwd->iAnimStep > 5) { if (pwd->hrgnAeroGlass) { DeleteObject(pwd->hrgnAeroGlass); - pwd->hrgnAeroGlass = 0; + pwd->hrgnAeroGlass = nullptr; } pwd->hrgnAeroGlass = CreateOpaqueRgn(25, true); @@ -1433,7 +1433,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } } - SetWindowPos(hwnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); + SetWindowPos(hwnd, nullptr, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); GetWindowRect(hwnd, &pwd->rcWindow); } return TRUE; @@ -1446,7 +1446,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } mir_free(pwd->rows); - pwd->rows = NULL; + pwd->rows = nullptr; pwd->iRowCount = 0; DWORD dwItems = (wParam == 0) ? opt.iFirstItems : opt.iSecondItems; @@ -1458,12 +1458,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa Proto_EnumAccounts(&iProtoCount, &accs); for (int j = 0; j < iProtoCount; j++) { - PROTOACCOUNT *pa = NULL; + PROTOACCOUNT *pa = nullptr; for (int i = 0; i < iProtoCount; i++) - if (accs[i]->iOrder > oldOrder && (pa == NULL || accs[i]->iOrder < pa->iOrder)) + if (accs[i]->iOrder > oldOrder && (pa == nullptr || accs[i]->iOrder < pa->iOrder)) pa = accs[i]; - if (pa == NULL) + if (pa == nullptr) continue; oldOrder = pa->iOrder; @@ -1492,14 +1492,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (Proto_IsAccountLocked(pa)) mir_snwprintf(swzProto, TranslateT("%s (locked)"), pa->tszAccountName); - AddRow(pwd, swzProto, buff, NULL, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, wStatus)); + AddRow(pwd, swzProto, buff, nullptr, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, wStatus)); bFirstItem = false; if (dwItems & TRAYTIP_LOGON) { if (TimestampToTimeDifference(NULL, pa->szModuleName, "LogonTS", buff, 59)) { wchar_t ago[96]; mir_snwprintf(ago, TranslateT("%s ago"), buff); - AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false); + AddRow(pwd, TranslateT("Log on:"), ago, nullptr, false, false, false); } } @@ -1507,14 +1507,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa int iCount = (int)CallProtoService(pa->szModuleName, PS_GETUNREADEMAILCOUNT, 0, 0); if (iCount > 0) { _itow(iCount, buff, 10); - AddRow(pwd, TranslateT("Unread emails:"), buff, NULL, false, false, false); + AddRow(pwd, TranslateT("Unread emails:"), buff, nullptr, false, false, false); } } if (dwItems & TRAYTIP_STATUS) { wchar_t *swzText = pcli->pfnGetStatusModeDescription(wStatus, 0); if (swzText) - AddRow(pwd, TranslateT("Status:"), swzText, NULL, false, false, false); + AddRow(pwd, TranslateT("Status:"), swzText, nullptr, false, false, false); } if (wStatus >= ID_STATUS_ONLINE && wStatus <= ID_STATUS_OUTTOLUNCH) { @@ -1581,7 +1581,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t *swzListening = GetListeningTo(pa->szModuleName); if (swzListening) { StripBBCodesInPlace(swzListening); - AddRow(pwd, TranslateT("Listening to:"), swzListening, NULL, false, true, false); + AddRow(pwd, TranslateT("Listening to:"), swzListening, nullptr, false, true, false); mir_free(swzListening); } } @@ -1598,7 +1598,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_b(hContact, MODULE, "FavouriteContact", 0)) { char *proto = GetContactProto(hContact); - if (proto == NULL) + if (proto == nullptr) continue; WORD wStatus = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE); @@ -1611,7 +1611,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (!(opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE && wStatus == ID_STATUS_OFFLINE)) { if (!bTitlePainted) { - AddRow(pwd, TranslateT("Fav. contacts"), NULL, NULL, false, false, !bFirstItem, true, NULL); + AddRow(pwd, TranslateT("Fav. contacts"), nullptr, nullptr, false, false, !bFirstItem, true, nullptr); bFirstItem = false; bTitlePainted = true; } @@ -1624,7 +1624,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } else mir_wstrcpy(swzName, swzNick); - AddRow(pwd, swzName, swzStatus, NULL, false, false, false); + AddRow(pwd, swzName, swzStatus, nullptr, false, false, false); } } } @@ -1644,8 +1644,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_MIRANDA_UPTIME) { if (TimestampToTimeDifference(NULL, MODULE, "MirandaStartTS", buff, 64)) { - AddRow(pwd, TranslateT("Other"), L"", NULL, false, false, !bFirstItem, true, NULL); - AddRow(pwd, TranslateT("Miranda uptime:"), buff, NULL, false, false, false); + AddRow(pwd, TranslateT("Other"), L"", nullptr, false, false, !bFirstItem, true, nullptr); + AddRow(pwd, TranslateT("Miranda uptime:"), buff, nullptr, false, false, false); } } @@ -1657,7 +1657,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t swzText[256]; mir_wstrcpy(swzText, pwd->clcit.swzText); if (pchBr) swzText[pchBr - pwd->clcit.swzText] = 0; - AddRow(pwd, swzText, L"", NULL, false, true, false, true, Skin_LoadIcon(SKINICON_OTHER_FILLEDBLOB)); + AddRow(pwd, swzText, L"", nullptr, false, true, false, true, Skin_LoadIcon(SKINICON_OTHER_FILLEDBLOB)); } } diff --git a/plugins/TipperYM/src/preset_items.cpp b/plugins/TipperYM/src/preset_items.cpp index e29ca11708..459d5d8465 100644 --- a/plugins/TipperYM/src/preset_items.cpp +++ b/plugins/TipperYM/src/preset_items.cpp @@ -22,65 +22,65 @@ Boston, MA 02111-1307, USA. PRESETITEM presetItems[] =
{
- "account", LPGENW("Account"), LPGENW("Account:"), L"%sys:account%", 0, 0, 0,
+ "account", LPGENW("Account"), LPGENW("Account:"), L"%sys:account%", nullptr, nullptr, nullptr,
"birth", LPGENW("Birthday"), LPGENW("Birthday:"), L"%birthday_date% (%birthday_age%) @ Next: %birthday_next%", "birthdate", "birthage", "birthnext",
- "client", LPGENW("Client"), LPGENW("Client:"), L"%raw:/MirVer%", 0, 0, 0,
- "email", LPGENW("Email"), LPGENW("Email:"), L"%raw:/e-mail%", 0, 0, 0,
- "gender", LPGENW("Gender"), LPGENW("Gender:"), L"%gender%", 0, 0, 0,
- "homepage", LPGENW("Homepage"), LPGENW("Homepage:"), L"%raw:/Homepage%", 0, 0, 0,
- "id", LPGENW("Identifier"), L"%sys:uidname|UID^!MetaContacts%:", L"%sys:uid%", 0, 0, 0,
- "idle", LPGENW("Idle"), LPGENW("Idle:"), L"%idle% (%idle_diff% ago)", "idle", "idlediff", 0,
- "ip", L"IP", L"IP:", L"%ip%", "ip", 0, 0,
- "ipint", LPGENW("IP internal"), LPGENW("IP internal:"), L"%ip_internal%", "ipint", 0, 0,
- "lastmsg", LPGENW("Last message"), LPGENW("Last message: (%sys:last_msg_reltime% ago)"), L"%sys:last_msg%", 0, 0, 0,
- "listening", LPGENW("Listening to"), LPGENW("Listening to:"), L"%raw:/ListeningTo%", 0, 0, 0,
- "name", LPGENW("Name"), LPGENW("Name:"), L"%raw:/FirstName|% %raw:/LastName%", 0, 0, 0,
- "received", LPGENW("Number of received messages"), LPGENW("Number of msg [IN]:"), L"%sys:msg_count_in%", 0, 0, 0,
- "sended", LPGENW("Number of sent messages"), LPGENW("Number of msg [OUT]:"), L"%sys:msg_count_out%", 0, 0, 0,
- "status", LPGENW("Status"), LPGENW("Status:"), L"%Status%", "status", 0, 0,
- "statusmsg", LPGENW("Status message"), LPGENW("Status message:"), L"%sys:status_msg%", 0, 0, 0,
- "time", LPGENW("Contact time"), LPGENW("Time:"), L"%sys:time%", 0, 0, 0,
- "xtitle", LPGENW("xStatus title"), LPGENW("xStatus title:"), L"%xsname%", "xname", 0, 0,
- "xtext", LPGENW("xStatus text"), LPGENW("xStatus text:"), L"%raw:/XStatusMsg%", 0, 0, 0,
- "acttitle", LPGENW("[jabber.dll] Activity title"), LPGENW("Activity title:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/title%", 0, 0, 0,
- "acttext", LPGENW("[jabber.dll] Activity text"), LPGENW("Activity text:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/text%", 0, 0, 0,
- "lastseentime", LPGENW("[seenplugin.dll] Last seen time"), LPGENW("Last seen time:"), L"%lastseen_date% @ %lastseen_time%", "lsdate", "lstime", 0,
- "lastseenstatus", LPGENW("[seenplugin.dll] Last seen status"), LPGENW("Last seen status:"), L"%lastseen_status% (%lastseen_ago% ago)", "lsstatus", "lsago", 0,
- "cond", LPGENW("[weather.dll] Condition"), LPGENW("Condition:"), L"%raw:Current/Condition%", 0, 0, 0,
- "humidity", LPGENW("[weather.dll] Humidity"), LPGENW("Humidity:"), L"%raw:Current/Humidity%", 0, 0, 0,
- "minmaxtemp", LPGENW("[weather.dll] Max/Min temperature"), LPGENW("Max/Min:"), L"%raw:Current/High%/%raw:Current/Low%", 0, 0, 0,
- "moon", LPGENW("[weather.dll] Moon"), LPGENW("Moon:"), L"%raw:Current/Moon%", 0, 0, 0,
- "pressure", LPGENW("[weather.dll] Pressure"), LPGENW("Pressure:"), L"%raw:Current/Pressure% (%raw:Current/Pressure Tendency%)", 0, 0, 0,
- "sunrise", LPGENW("[weather.dll] Sunrise"), LPGENW("Sunrise:"), L"%raw:Current/Sunrise%", 0, 0, 0,
- "sunset", LPGENW("[weather.dll] Sunset"), LPGENW("Sunset:"), L"%raw:Current/Sunset%", 0, 0, 0,
- "temp", LPGENW("[weather.dll] Temperature"), LPGENW("Temperature:"), L"%raw:Current/Temperature%", 0, 0, 0,
- "uptime", LPGENW("[weather.dll] Update time"), LPGENW("Update time:"), L"%raw:Current/Update%", 0, 0, 0,
- "uvindex", LPGENW("[weather.dll] UV Index"), LPGENW("UV Index:"), L"%raw:Current/UV% - %raw:Current/UVI%", 0, 0, 0,
- "vis", LPGENW("[weather.dll] Visibility"), LPGENW("Visibility:"), L"%raw:Current/Visibility%", 0, 0, 0,
- "wind", LPGENW("[weather.dll] Wind"), LPGENW("Wind:"), L"%raw:Current/Wind Direction% (%raw:Current/Wind Direction DEG%)/%raw:Current/Wind Speed%", 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
+ "client", LPGENW("Client"), LPGENW("Client:"), L"%raw:/MirVer%", nullptr, nullptr, nullptr,
+ "email", LPGENW("Email"), LPGENW("Email:"), L"%raw:/e-mail%", nullptr, nullptr, nullptr,
+ "gender", LPGENW("Gender"), LPGENW("Gender:"), L"%gender%", nullptr, nullptr, nullptr,
+ "homepage", LPGENW("Homepage"), LPGENW("Homepage:"), L"%raw:/Homepage%", nullptr, nullptr, nullptr,
+ "id", LPGENW("Identifier"), L"%sys:uidname|UID^!MetaContacts%:", L"%sys:uid%", nullptr, nullptr, nullptr,
+ "idle", LPGENW("Idle"), LPGENW("Idle:"), L"%idle% (%idle_diff% ago)", "idle", "idlediff", nullptr,
+ "ip", L"IP", L"IP:", L"%ip%", "ip", nullptr, nullptr,
+ "ipint", LPGENW("IP internal"), LPGENW("IP internal:"), L"%ip_internal%", "ipint", nullptr, nullptr,
+ "lastmsg", LPGENW("Last message"), LPGENW("Last message: (%sys:last_msg_reltime% ago)"), L"%sys:last_msg%", nullptr, nullptr, nullptr,
+ "listening", LPGENW("Listening to"), LPGENW("Listening to:"), L"%raw:/ListeningTo%", nullptr, nullptr, nullptr,
+ "name", LPGENW("Name"), LPGENW("Name:"), L"%raw:/FirstName|% %raw:/LastName%", nullptr, nullptr, nullptr,
+ "received", LPGENW("Number of received messages"), LPGENW("Number of msg [IN]:"), L"%sys:msg_count_in%", nullptr, nullptr, nullptr,
+ "sended", LPGENW("Number of sent messages"), LPGENW("Number of msg [OUT]:"), L"%sys:msg_count_out%", nullptr, nullptr, nullptr,
+ "status", LPGENW("Status"), LPGENW("Status:"), L"%Status%", "status", nullptr, nullptr,
+ "statusmsg", LPGENW("Status message"), LPGENW("Status message:"), L"%sys:status_msg%", nullptr, nullptr, nullptr,
+ "time", LPGENW("Contact time"), LPGENW("Time:"), L"%sys:time%", nullptr, nullptr, nullptr,
+ "xtitle", LPGENW("xStatus title"), LPGENW("xStatus title:"), L"%xsname%", "xname", nullptr, nullptr,
+ "xtext", LPGENW("xStatus text"), LPGENW("xStatus text:"), L"%raw:/XStatusMsg%", nullptr, nullptr, nullptr,
+ "acttitle", LPGENW("[jabber.dll] Activity title"), LPGENW("Activity title:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/title%", nullptr, nullptr, nullptr,
+ "acttext", LPGENW("[jabber.dll] Activity text"), LPGENW("Activity text:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/text%", nullptr, nullptr, nullptr,
+ "lastseentime", LPGENW("[seenplugin.dll] Last seen time"), LPGENW("Last seen time:"), L"%lastseen_date% @ %lastseen_time%", "lsdate", "lstime", nullptr,
+ "lastseenstatus", LPGENW("[seenplugin.dll] Last seen status"), LPGENW("Last seen status:"), L"%lastseen_status% (%lastseen_ago% ago)", "lsstatus", "lsago", nullptr,
+ "cond", LPGENW("[weather.dll] Condition"), LPGENW("Condition:"), L"%raw:Current/Condition%", nullptr, nullptr, nullptr,
+ "humidity", LPGENW("[weather.dll] Humidity"), LPGENW("Humidity:"), L"%raw:Current/Humidity%", nullptr, nullptr, nullptr,
+ "minmaxtemp", LPGENW("[weather.dll] Max/Min temperature"), LPGENW("Max/Min:"), L"%raw:Current/High%/%raw:Current/Low%", nullptr, nullptr, nullptr,
+ "moon", LPGENW("[weather.dll] Moon"), LPGENW("Moon:"), L"%raw:Current/Moon%", nullptr, nullptr, nullptr,
+ "pressure", LPGENW("[weather.dll] Pressure"), LPGENW("Pressure:"), L"%raw:Current/Pressure% (%raw:Current/Pressure Tendency%)", nullptr, nullptr, nullptr,
+ "sunrise", LPGENW("[weather.dll] Sunrise"), LPGENW("Sunrise:"), L"%raw:Current/Sunrise%", nullptr, nullptr, nullptr,
+ "sunset", LPGENW("[weather.dll] Sunset"), LPGENW("Sunset:"), L"%raw:Current/Sunset%", nullptr, nullptr, nullptr,
+ "temp", LPGENW("[weather.dll] Temperature"), LPGENW("Temperature:"), L"%raw:Current/Temperature%", nullptr, nullptr, nullptr,
+ "uptime", LPGENW("[weather.dll] Update time"), LPGENW("Update time:"), L"%raw:Current/Update%", nullptr, nullptr, nullptr,
+ "uvindex", LPGENW("[weather.dll] UV Index"), LPGENW("UV Index:"), L"%raw:Current/UV% - %raw:Current/UVI%", nullptr, nullptr, nullptr,
+ "vis", LPGENW("[weather.dll] Visibility"), LPGENW("Visibility:"), L"%raw:Current/Visibility%", nullptr, nullptr, nullptr,
+ "wind", LPGENW("[weather.dll] Wind"), LPGENW("Wind:"), L"%raw:Current/Wind Direction% (%raw:Current/Wind Direction DEG%)/%raw:Current/Wind Speed%", nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
};
PRESETSUBST presetSubsts[] =
{
- "gender", L"gender", DVT_PROTODB, NULL, "Gender", 5,
- "status", L"Status", DVT_PROTODB, NULL, "Status", 1,
- "ip", L"ip", DVT_PROTODB, NULL, "IP", 7,
- "ipint", L"ip_internal", DVT_PROTODB, NULL, "RealIP", 7,
- "idle", L"idle", DVT_PROTODB, NULL, "IdleTS", 2,
- "idlediff", L"idle_diff", DVT_PROTODB, NULL, "IdleTS", 3,
- "xname", L"xsname", DVT_PROTODB, NULL, "XStatusName", 17,
- "lsdate", L"lastseen_date", DVT_DB, "SeenModule", NULL, 8,
- "lstime", L"lastseen_time", DVT_DB, "SeenModule", NULL, 10,
+ "gender", L"gender", DVT_PROTODB, nullptr, "Gender", 5,
+ "status", L"Status", DVT_PROTODB, nullptr, "Status", 1,
+ "ip", L"ip", DVT_PROTODB, nullptr, "IP", 7,
+ "ipint", L"ip_internal", DVT_PROTODB, nullptr, "RealIP", 7,
+ "idle", L"idle", DVT_PROTODB, nullptr, "IdleTS", 2,
+ "idlediff", L"idle_diff", DVT_PROTODB, nullptr, "IdleTS", 3,
+ "xname", L"xsname", DVT_PROTODB, nullptr, "XStatusName", 17,
+ "lsdate", L"lastseen_date", DVT_DB, "SeenModule", nullptr, 8,
+ "lstime", L"lastseen_time", DVT_DB, "SeenModule", nullptr, 10,
"lsstatus", L"lastseen_status", DVT_DB, "SeenModule", "OldStatus", 1,
"lsago", L"lastseen_ago", DVT_DB, "SeenModule", "seenTS", 3,
- "birthdate", L"birthday_date", DVT_PROTODB, NULL, "Birth", 8,
- "birthage", L"birthday_age", DVT_PROTODB, NULL, "Birth", 9,
- "birthnext", L"birthday_next", DVT_PROTODB, NULL, "Birth", 12,
- "logondate", L"logon_date", DVT_PROTODB, NULL, "LogonTS", 15,
- "logontime", L"logon_time", DVT_PROTODB, NULL, "LogonTS", 13,
- "logonago", L"logon_ago", DVT_PROTODB, NULL, "LogonTS", 3,
- 0, 0, DVT_DB, 0, 0, 0
+ "birthdate", L"birthday_date", DVT_PROTODB, nullptr, "Birth", 8,
+ "birthage", L"birthday_age", DVT_PROTODB, nullptr, "Birth", 9,
+ "birthnext", L"birthday_next", DVT_PROTODB, nullptr, "Birth", 12,
+ "logondate", L"logon_date", DVT_PROTODB, nullptr, "LogonTS", 15,
+ "logontime", L"logon_time", DVT_PROTODB, nullptr, "LogonTS", 13,
+ "logonago", L"logon_ago", DVT_PROTODB, nullptr, "LogonTS", 3,
+ nullptr, nullptr, DVT_DB, nullptr, nullptr, 0
};
DEFAULTITEM defaultItemList[] =
@@ -98,7 +98,7 @@ DEFAULTITEM defaultItemList[] = "time", false,
"id", false,
"status", false,
- 0,0
+ nullptr,0
};
PRESETITEM *GetPresetItemByName(char *szName)
@@ -109,18 +109,18 @@ PRESETITEM *GetPresetItemByName(char *szName) return &presetItems[i];
}
- return NULL;
+ return nullptr;
}
PRESETSUBST *GetPresetSubstByName(char *szName)
{
- if (!szName) return NULL;
+ if (!szName) return nullptr;
for (int i = 0; presetSubsts[i].szID; i++)
{
if (mir_strcmp(presetSubsts[i].szID, szName) == 0)
return &presetSubsts[i];
}
- return NULL;
+ return nullptr;
}
diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index 8aa9c4869c..403ae81ac7 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -58,7 +58,7 @@ int RefreshSkinList(HWND hwndDlg) bool FileExists(wchar_t *filename)
{
- HANDLE hFile = CreateFile(filename, 0, 0, 0, OPEN_EXISTING, 0, 0);
+ HANDLE hFile = CreateFile(filename, 0, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(hFile);
@@ -103,7 +103,7 @@ void ParseAboutPart(FILE *fp, wchar_t *buff, wchar_t *szSkinName) void ParseImagePart(FILE *fp, wchar_t *buff, int iPart)
{
- opt.szImgFile[iPart] = NULL;
+ opt.szImgFile[iPart] = nullptr;
opt.transfMode[iPart] = TM_NONE;
opt.margins[iPart].left = 0;
opt.margins[iPart].top = 0;
@@ -182,7 +182,7 @@ char *GetSettingName(wchar_t *szValue, char *szPostfix, char *buff, size_t buffs else if (wcsstr(szValue, L"divider"))
mir_snprintf(buff, buffsize, "Divider%s", szPostfix);
- return buff[0] ? buff : NULL;
+ return buff[0] ? buff : nullptr;
}
void ParseFontPart(FILE *fp, wchar_t *buff)
@@ -235,10 +235,10 @@ void ParseFontPart(FILE *fp, wchar_t *buff) {
if (GetSettingName(buff, "Size", szSetting, sizeof(szSetting) - 1))
{
- HDC hdc = GetDC(0);
+ HDC hdc = GetDC(nullptr);
int size = -MulDiv(_wtoi(pch), GetDeviceCaps(hdc, LOGPIXELSY), 72);
db_set_b(0, MODULE, szSetting, (BYTE)size);
- ReleaseDC(0, hdc);
+ ReleaseDC(nullptr, hdc);
}
}
else if (wcsstr(buff, L"effect"))
diff --git a/plugins/TipperYM/src/str_utils.cpp b/plugins/TipperYM/src/str_utils.cpp index 4d77c38c19..0752750d87 100644 --- a/plugins/TipperYM/src/str_utils.cpp +++ b/plugins/TipperYM/src/str_utils.cpp @@ -30,7 +30,7 @@ bool a2w(const char *as, wchar_t *buff, int bufflen) bool w2a(const wchar_t *ws, char *buff, int bufflen)
{
- if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, 0, 0);
+ if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, nullptr, nullptr);
return true;
}
@@ -42,7 +42,7 @@ bool utf2w(const char *us, wchar_t *buff, int bufflen) bool w2utf(const wchar_t *ws, char *buff, int bufflen)
{
- if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, 0, 0);
+ if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, nullptr, nullptr);
return true;
}
@@ -51,7 +51,7 @@ bool a2utf(const char *as, char *buff, int bufflen) if (!as) return false;
wchar_t *ws = a2w(as);
- if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, 0, 0);
+ if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, nullptr, nullptr);
mir_free(ws);
return true;
}
@@ -61,7 +61,7 @@ bool utf2a(const char *us, char *buff, int bufflen) if (!us) return false;
wchar_t *ws = utf2w(us);
- if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, 0, 0);
+ if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, nullptr, nullptr);
mir_free(ws);
return true;
}
@@ -103,14 +103,14 @@ wchar_t *utf2w(const char *us) {
if (us)
{
- int size = MultiByteToWideChar(CP_UTF8, 0, us, -1, 0, 0);
+ int size = MultiByteToWideChar(CP_UTF8, 0, us, -1, nullptr, 0);
wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, size);
return buff;
}
else
{
- return 0;
+ return nullptr;
}
}
@@ -118,20 +118,20 @@ char *w2utf(const wchar_t *ws) {
if (ws)
{
- int size = WideCharToMultiByte(CP_UTF8, 0, ws, -1, 0, 0, 0, 0);
+ int size = WideCharToMultiByte(CP_UTF8, 0, ws, -1, nullptr, 0, nullptr, nullptr);
char *buff = (char *)mir_alloc(size);
- WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, size, 0, 0);
+ WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, size, nullptr, nullptr);
return buff;
}
else
{
- return 0;
+ return nullptr;
}
}
wchar_t *a2w(const char *as)
{
- int size = MultiByteToWideChar(iCodePage, 0, as, -1, 0, 0);
+ int size = MultiByteToWideChar(iCodePage, 0, as, -1, nullptr, 0);
wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
MultiByteToWideChar(iCodePage, 0, as, -1, buff, size);
return buff;
@@ -139,9 +139,9 @@ wchar_t *a2w(const char *as) char *w2a(const wchar_t *ws)
{
- int size = WideCharToMultiByte(iCodePage, 0, ws, -1, 0, 0, 0, 0);
+ int size = WideCharToMultiByte(iCodePage, 0, ws, -1, nullptr, 0, nullptr, nullptr);
char *buff = (char *)mir_alloc(size);
- WideCharToMultiByte(iCodePage, 0, ws, -1, buff, size, 0, 0);
+ WideCharToMultiByte(iCodePage, 0, ws, -1, buff, size, nullptr, nullptr);
return buff;
}
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 67f668faf1..bc153af624 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -81,7 +81,7 @@ void StripBBCodesInPlace(wchar_t *ptszText) if (!db_get_b(0, MODULE, "StripBBCodes", 1)) return; - if (ptszText == 0) + if (ptszText == nullptr) return; size_t iRead = 0, iWrite = 0; @@ -170,8 +170,8 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) { dbei.pBlob = (BYTE *)alloca(dbei.cbBlob); db_event_get(hDbEvent, &dbei); - if (dbei.cbBlob == 0 || dbei.pBlob == 0) - return 0; + if (dbei.cbBlob == 0 || dbei.pBlob == nullptr) + return nullptr; wchar_t *buff = DbEvent_GetTextW( &dbei, CP_ACP ); wchar_t *swzMsg = mir_wstrdup(buff); @@ -182,7 +182,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) } } - return 0; + return nullptr; } bool CanRetrieveStatusMsg(MCONTACT hContact, char *szProto) @@ -208,7 +208,7 @@ bool CanRetrieveStatusMsg(MCONTACT hContact, char *szProto) wchar_t* GetStatusMessageText(MCONTACT hContact) { - wchar_t *swzMsg = NULL; + wchar_t *swzMsg = nullptr; DBVARIANT dbv; char *szProto = GetContactProto(hContact); @@ -218,7 +218,7 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) else { WORD wStatus = (int)CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (wStatus == ID_STATUS_OFFLINE) - return NULL; + return nullptr; if (!db_get_ws(hContact, MODULE, "TempStatusMsg", &dbv)) { if (mir_wstrlen(dbv.ptszVal) != 0) @@ -230,7 +230,7 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) if (!swzMsg) { if (CanRetrieveStatusMsg(hContact, szProto)) if (ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0)) - return NULL; + return nullptr; if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) { if (mir_wstrlen(dbv.ptszVal) != 0) @@ -251,7 +251,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int bool recv = false; if (!mir_wstrcmp(swzRawSpec, L"uid")) - return Uid(hContact, 0, buff, bufflen); + return Uid(hContact, nullptr, buff, bufflen); if (!mir_wstrcmp(swzRawSpec, L"proto")) { char *szProto = GetContactProto(hContact); @@ -314,7 +314,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int MCONTACT hSubContact = db_mc_getMostOnline(hContact); if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false; - return Uid(hSubContact, 0, buff, bufflen); + return Uid(hSubContact, nullptr, buff, bufflen); } else if (!mir_wstrcmp(swzRawSpec, L"meta_subproto")) { // get protocol of active subcontact @@ -338,7 +338,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg_reltime")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out_reltime")) { DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; - DWORD t = (DWORD)time(0); + DWORD t = (DWORD)time(nullptr); DWORD diff = (t - ts); int d = (diff / 60 / 60 / 24); int h = (diff - d * 60 * 60 * 24) / 60 / 60; @@ -366,7 +366,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int if (i > 0) hTmpContact = db_mc_getSub(hContact, i); dwRecountTs = db_get_dw(hTmpContact, MODULE, "LastCountTS", 0); - dwTime = (DWORD)time(0); + dwTime = (DWORD)time(nullptr); dwDiff = (dwTime - dwRecountTs); if (dwDiff > (60 * 60 * 24 * 3)) { db_set_dw(hTmpContact, MODULE, "LastCountTS", dwTime); @@ -420,7 +420,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int bool GetSubstText(MCONTACT hContact, const DISPLAYSUBST &ds, wchar_t *buff, int bufflen) { - TranslateFunc *transFunc = 0; + TranslateFunc *transFunc = nullptr; for (int i = 0; i < iTransFuncsCount; i++) if (translations[i].id == (DWORD)ds.iTranslateFuncId) { transFunc = translations[i].transFunc; @@ -432,13 +432,13 @@ bool GetSubstText(MCONTACT hContact, const DISPLAYSUBST &ds, wchar_t *buff, int switch (ds.type) { case DVT_DB: - return transFunc(hContact, ds.szModuleName, ds.szSettingName, buff, bufflen) != 0; + return transFunc(hContact, ds.szModuleName, ds.szSettingName, buff, bufflen) != nullptr; case DVT_PROTODB: char *szProto = GetContactProto(hContact); if (szProto) { - if (transFunc(hContact, szProto, ds.szSettingName, buff, bufflen) != 0) + if (transFunc(hContact, szProto, ds.szSettingName, buff, bufflen) != nullptr) return true; - return transFunc(hContact, "UserInfo", ds.szSettingName, buff, bufflen) != 0; + return transFunc(hContact, "UserInfo", ds.szSettingName, buff, bufflen) != nullptr; } break; } @@ -454,13 +454,13 @@ bool GetRawSubstText(MCONTACT hContact, char *szRawSpec, wchar_t *buff, int buff if (mir_strlen(szRawSpec) == 0) { char *szProto = GetContactProto(hContact); if (szProto) { - if (translations[0].transFunc(hContact, szProto, &szRawSpec[i + 1], buff, bufflen) != 0) + if (translations[0].transFunc(hContact, szProto, &szRawSpec[i + 1], buff, bufflen) != nullptr) return true; - return translations[0].transFunc(hContact, "UserInfo", &szRawSpec[i + 1], buff, bufflen) != 0; + return translations[0].transFunc(hContact, "UserInfo", &szRawSpec[i + 1], buff, bufflen) != nullptr; } return false; } - return translations[0].transFunc(hContact, szRawSpec, &szRawSpec[i + 1], buff, bufflen) != 0; + return translations[0].transFunc(hContact, szRawSpec, &szRawSpec[i + 1], buff, bufflen) != nullptr; } } return false; @@ -475,7 +475,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar } // pass to variables plugin if available - wchar_t *swzVarSrc = (parseTipperVarsFirst ? mir_wstrdup(swzSource) : variables_parsedup((wchar_t *)swzSource, 0, hContact)); + wchar_t *swzVarSrc = (parseTipperVarsFirst ? mir_wstrdup(swzSource) : variables_parsedup((wchar_t *)swzSource, nullptr, hContact)); size_t iSourceLen = mir_wstrlen(swzVarSrc); size_t si = 0, di = 0, v = 0; @@ -508,14 +508,14 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar p++; if (*p) { char *cp = GetContactProto(hContact); - if (cp != NULL) { + if (cp != nullptr) { PROTOACCOUNT *acc = Proto_GetAccount(cp); - if (acc != NULL) { + if (acc != nullptr) { cp = acc->szProtoName; } } - if (cp == NULL) + if (cp == nullptr) goto empty; bool negate = false; @@ -639,7 +639,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar swzDest[di] = 0; if (parseTipperVarsFirst) { - swzVarSrc = variables_parsedup(swzDest, 0, hContact); + swzVarSrc = variables_parsedup(swzDest, nullptr, hContact); wcsncpy(swzDest, swzVarSrc, iDestLen); mir_free(swzVarSrc); } @@ -687,18 +687,18 @@ void TruncateString(wchar_t *ptszText) wchar_t* GetProtoStatusMessage(char *szProto, WORD wStatus) { if (!szProto || wStatus == ID_STATUS_OFFLINE) - return NULL; + return nullptr; // check if protocol supports status message for status int flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0); if (!(flags & Proto_Status2Flag(wStatus))) - return NULL; + return nullptr; wchar_t *ptszText = (wchar_t *)CallProtoService(szProto, PS_GETMYAWAYMSG, 0, SGMA_UNICODE); if ((INT_PTR)ptszText == CALLSERVICE_NOTFOUND) ptszText = (wchar_t *)CallService(MS_AWAYMSG_GETSTATUSMSGW, wStatus, (LPARAM)szProto); - else if (ptszText == NULL) { + else if (ptszText == nullptr) { // try to use service without SGMA_TCHAR char *tmpMsg = (char *)CallProtoService(szProto, PS_GETMYAWAYMSG, 0, 0); if (tmpMsg && (INT_PTR)tmpMsg != CALLSERVICE_NOTFOUND) { @@ -710,7 +710,7 @@ wchar_t* GetProtoStatusMessage(char *szProto, WORD wStatus) if (ptszText && !ptszText[0]) { mir_free(ptszText); - ptszText = NULL; + ptszText = nullptr; } if (ptszText && opt.bLimitMsg) @@ -722,12 +722,12 @@ wchar_t* GetProtoStatusMessage(char *szProto, WORD wStatus) wchar_t* GetProtoExtraStatusTitle(char *szProto) { if (!szProto) - return NULL; + return nullptr; wchar_t *ptszText = db_get_wsa(0, szProto, "XStatusName"); if (!ptszText) { wchar_t buff[256]; - if (EmptyXStatusToDefaultName(0, szProto, 0, buff, 256)) + if (EmptyXStatusToDefaultName(0, szProto, nullptr, buff, 256)) ptszText = mir_wstrdup(buff); } @@ -740,11 +740,11 @@ wchar_t* GetProtoExtraStatusTitle(char *szProto) wchar_t* GetProtoExtraStatusMessage(char *szProto) { if (!szProto) - return NULL; + return nullptr; wchar_t *ptszText = db_get_wsa(0, szProto, "XStatusMsg"); - if (ptszText == NULL) - return NULL; + if (ptszText == nullptr) + return nullptr; if (ServiceExists(MS_VARS_FORMATSTRING)) { MCONTACT hContact = db_find_first(); @@ -759,7 +759,7 @@ wchar_t* GetProtoExtraStatusMessage(char *szProto) } } - wchar_t *tszParsed = variables_parse(ptszText, NULL, hContact); + wchar_t *tszParsed = variables_parse(ptszText, nullptr, hContact); if (tszParsed) { mir_free(ptszText); @@ -776,7 +776,7 @@ wchar_t* GetProtoExtraStatusMessage(char *szProto) wchar_t* GetListeningTo(char *szProto) { if (!szProto) - return NULL; + return nullptr; wchar_t *ptszText = db_get_wsa(0, szProto, "ListeningTo"); if (opt.bLimitMsg) @@ -788,7 +788,7 @@ wchar_t* GetListeningTo(char *szProto) wchar_t* GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szValue) { if (!szProto) - return NULL; + return nullptr; char szSetting[128]; mir_snprintf(szSetting, "%s/%s/%s", szProto, szSlot, szValue); @@ -802,10 +802,10 @@ wchar_t* GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *s HICON GetJabberActivityIcon(MCONTACT hContact, char *szProto) { if (!szProto) - return NULL; + return nullptr; char szSetting[128]; mir_snprintf(szSetting, "%s/%s/%s", szProto, "activity", "icon"); ptrA szIcon(db_get_sa(hContact, "AdvStatus", szSetting)); - return (szIcon != NULL) ? IcoLib_GetIcon(szIcon) : NULL; + return (szIcon != NULL) ? IcoLib_GetIcon(szIcon) : nullptr; } diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 98950da04b..a1e9c2a56d 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -29,13 +29,13 @@ HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; // hooked here so it's in the main thread
HANDLE hAvChangeEvent, hShowTipEvent, hHideTipEvent, hAckEvent, hFramesSBShow, hFramesSBHide;
HANDLE hSettingChangedEvent, hEventDeleted;
-HANDLE hReloadFonts = NULL;
+HANDLE hReloadFonts = nullptr;
HANDLE hFolderChanged, hSkinFolder;
wchar_t SKIN_FOLDER[256];
-CLIST_INTERFACE *pcli = NULL;
-FI_INTERFACE *fii = NULL;
+CLIST_INTERFACE *pcli = nullptr;
+FI_INTERFACE *fii = nullptr;
int hLangpack;
PLUGININFOEX pluginInfoEx =
@@ -268,7 +268,7 @@ int ModulesLoaded(WPARAM, LPARAM) CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
// set Miranda start timestamp
- db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(0));
+ db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(nullptr));
return 0;
}
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index c981322f81..c8f8d58e18 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
int iTransFuncsCount = 0;
-DBVTranslation *translations = 0;
+DBVTranslation *translations = nullptr;
DWORD dwNextFuncId;
HANDLE hServiceAdd;
@@ -29,7 +29,7 @@ HANDLE hServiceAdd; void AddTranslation(DBVTranslation *newTrans)
{
DBVTranslation *ptranslations = (DBVTranslation *)mir_realloc(translations, sizeof(DBVTranslation) * (iTransFuncsCount+1));
- if (ptranslations == NULL)
+ if (ptranslations == nullptr)
return;
translations = ptranslations;
iTransFuncsCount++;
@@ -67,14 +67,14 @@ wchar_t *NullTranslation(MCONTACT hContact, const char *szModuleName, const char {
if (DBGetContactSettingAsString(hContact, szModuleName, szSettingName, buff, bufflen))
return buff;
- return NULL;
+ return nullptr;
}
wchar_t* TimestampToShortDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
- return 0;
+ return nullptr;
return TimeZone_ToStringT(ts, L"d", buff, bufflen);
}
@@ -83,7 +83,7 @@ wchar_t* TimestampToLongDate(MCONTACT hContact, const char *szModuleName, const {
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
- return 0;
+ return nullptr;
return TimeZone_ToStringT(ts, L"D", buff, bufflen);
}
@@ -92,7 +92,7 @@ wchar_t* TimestampToTime(MCONTACT hContact, const char *szModuleName, const char {
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
- return 0;
+ return nullptr;
return TimeZone_ToStringT(ts, L"s", buff, bufflen);
}
@@ -101,7 +101,7 @@ wchar_t* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, cons {
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
- return 0;
+ return nullptr;
return TimeZone_ToStringT(ts, L"t", buff, bufflen);
}
@@ -109,8 +109,8 @@ wchar_t* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, cons wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
- DWORD t = (DWORD)time(0);
- if (ts == 0) return 0;
+ DWORD t = (DWORD)time(nullptr);
+ if (ts == 0) return nullptr;
DWORD diff = (ts > t) ? 0 : (t - ts);
int d = (diff / 60 / 60 / 24);
@@ -167,7 +167,7 @@ wchar_t *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *sz }
db_free(&dbv);
}
- return 0;
+ return nullptr;
}
wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
@@ -178,7 +178,7 @@ wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *s else if (val == 'M')
wcsncpy(buff, TranslateT("Male"), bufflen);
else
- return 0;
+ return nullptr;
buff[bufflen - 1] = 0;
return buff;
@@ -186,17 +186,17 @@ wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *s wchar_t *WordToCountry(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
- char *szCountryName = 0;
+ char *szCountryName = nullptr;
WORD cid = (WORD)db_get_w(hContact, szModuleName, szSettingName, (WORD)-1);
- if (cid != (WORD)-1 && ServiceExists(MS_UTILS_GETCOUNTRYBYNUMBER) && (szCountryName = (char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, cid, 0)) != 0)
+ if (cid != (WORD)-1 && ServiceExists(MS_UTILS_GETCOUNTRYBYNUMBER) && (szCountryName = (char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, cid, 0)) != nullptr)
{
if (mir_strcmp(szCountryName, "Unknown") == 0)
- return 0;
+ return nullptr;
a2t(szCountryName, buff, bufflen);
buff[bufflen - 1] = 0;
return buff;
}
- return 0;
+ return nullptr;
}
wchar_t *DwordToIp(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
@@ -207,7 +207,7 @@ wchar_t *DwordToIp(MCONTACT hContact, const char *szModuleName, const char *szSe mir_snwprintf(buff, bufflen, L"%u.%u.%u.%u", ipc[3], ipc[2], ipc[1], ipc[0]);
return buff;
}
- return 0;
+ return nullptr;
}
bool GetInt(const DBVARIANT &dbv, int *iVal)
@@ -271,7 +271,7 @@ wchar_t *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const c else
db_free(&dbv);
}
- return 0;
+ return nullptr;
}
wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
@@ -320,7 +320,7 @@ wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const ch else
db_free(&dbv);
}
- return 0;
+ return nullptr;
}
wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
@@ -354,7 +354,7 @@ wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, st.wMinute = minutes;
st.wSecond = seconds;
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, 0, buff, bufflen);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, nullptr, buff, bufflen);
return buff;
}
else
@@ -364,7 +364,7 @@ wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, else
db_free(&dbv);
}
- return 0;
+ return nullptr;
}
wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
@@ -390,7 +390,7 @@ wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const c st.wHour = hours;
st.wMinute = minutes;
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, 0, buff, bufflen);
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, buff, bufflen);
return buff;
}
else
@@ -400,7 +400,7 @@ wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const c else
db_free(&dbv);
}
- return 0;
+ return nullptr;
}
wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
@@ -502,7 +502,7 @@ wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const else
db_free(&dbv);
}
- return 0;
+ return nullptr;
}
wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
@@ -523,7 +523,7 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam if (GetInt(dbv, &month))
{
db_free(&dbv);
- time_t now = time(NULL);
+ time_t now = time(nullptr);
struct tm *ti = localtime(&now);
int yday_now = ti->tm_yday;
@@ -554,7 +554,7 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam db_free(&dbv);
}
}
- return 0;
+ return nullptr;
}
@@ -579,7 +579,7 @@ wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, return buff;
int status = db_get_b(hContact, szModuleName, "XStatusId", 0);
- if (!status) return 0;
+ if (!status) return nullptr;
if (ProtoServiceExists(szModuleName, PS_GETCUSTOMSTATUSEX))
{
@@ -588,21 +588,21 @@ wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, xstatus.ptszName = szDefaultName;
xstatus.wParam = (WPARAM *)&status;
if (CallProtoService(szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus))
- return 0;
+ return nullptr;
wcsncpy(buff, TranslateW(szDefaultName), bufflen);
buff[bufflen - 1] = 0;
return buff;
}
- return 0;
+ return nullptr;
}
wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
int timezone = db_get_b(hContact,szModuleName,szSettingName,256);
if (timezone==256 || (char)timezone==-100)
- return 0;
+ return nullptr;
TIME_ZONE_INFORMATION tzi;
FILETIME ft;
@@ -618,7 +618,7 @@ wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char lift.QuadPart -= (__int64)timezone * BIGI(30) * BIGI(60) * BIGI(10000000);
*(__int64*)&ft = lift.QuadPart;
FileTimeToSystemTime(&ft, &st);
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buff, bufflen);
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, buff, bufflen);
return buff;
}
@@ -633,7 +633,7 @@ wchar_t *ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSe return buff;
}
- return 0;
+ return nullptr;
}
wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
@@ -646,7 +646,7 @@ wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *sz return buff;
}
- return 0;
+ return nullptr;
}
wchar_t *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
@@ -665,7 +665,7 @@ wchar_t *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char }
}
- return 0;
+ return nullptr;
}
INT_PTR ServiceAddTranslation(WPARAM, LPARAM lParam)
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index d97bd34b37..fe4d45943e 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -29,8 +29,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) {
if (!IsWinVer8Plus())
{
- MessageBox(NULL, TranslateT("This plugin requires Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR);
- return NULL;
+ MessageBox(nullptr, TranslateT("This plugin requires Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR);
+ return nullptr;
}
return &pluginInfo;
}
@@ -54,7 +54,7 @@ extern "C" int __declspec(dllexport) Load(void) }
else
{
- MessageBox(NULL, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR);
}
return 0;
@@ -70,13 +70,13 @@ int OnPreShutdown(WPARAM, LPARAM) CleanupClasses();
SHFILEOPSTRUCT file_op = {
- NULL,
+ nullptr,
FO_DELETE,
wszTempDir,
L"",
FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION,
false,
- 0,
+ nullptr,
L""
};
SHFileOperation(&file_op);
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 95bfc49a8b..3d1dbd2040 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -99,7 +99,7 @@ static INT_PTR CreatePopup2(WPARAM wParam, LPARAM) title = mir_a2u(ppd->lpzTitle);
}
- ToastData *td = NULL;
+ ToastData *td = nullptr;
if (ppd->hbmAvatar)
td = new ToastData(ppd->lchContact, title, text, ppd->hbmAvatar);
@@ -132,7 +132,7 @@ static INT_PTR CreateClassPopup(WPARAM, LPARAM lParam) auto it = mp_Classes.find(ppc->pszClassName);
if (it != mp_Classes.end())
{
- ToastData *td = NULL;
+ ToastData *td = nullptr;
if (it->second->iFlags & PCF_TCHAR)
{
@@ -187,7 +187,7 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM) {
bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
if (enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 0);
- CallFunctionAsync(HideAllToasts, NULL);
+ CallFunctionAsync(HideAllToasts, nullptr);
return enabled;
}
case PUQS_GETSTATUS:
@@ -199,7 +199,7 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM) static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
switch (lParam)
{
case SM_WARNING:
@@ -213,7 +213,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) break;
}
- ToastData *td = new ToastData(NULL, NULL, (wchar_t*)wParam, hIcon);
+ ToastData *td = new ToastData(NULL, nullptr, (wchar_t*)wParam, hIcon);
CallFunctionAsync(ShowToastNotification, td);
return 0;
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index b815fd9e68..56eae765e6 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -39,23 +39,23 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml ComPtr<ABI::Windows::Data::Xml::Dom::IXmlDocumentIO> xmlDocument;
CHECKHR(Windows::Foundation::ActivateInstance(StringReferenceWrapper(RuntimeClass_Windows_Data_Xml_Dom_XmlDocument).Get(), &xmlDocument));
- HXML xmlToast = xmlCreateNode(L"toast", NULL, 0);
+ HXML xmlToast = xmlCreateNode(L"toast", nullptr, 0);
- HXML xmlAudioNode = xmlAddChild(xmlToast, L"audio", NULL);
+ HXML xmlAudioNode = xmlAddChild(xmlToast, L"audio", nullptr);
xmlAddAttr(xmlAudioNode, L"silent", L"true");
- HXML xmlVisualNode = xmlAddChild(xmlToast, L"visual", NULL);
+ HXML xmlVisualNode = xmlAddChild(xmlToast, L"visual", nullptr);
- HXML xmlBindingNode = xmlAddChild(xmlVisualNode, L"binding", NULL);
+ HXML xmlBindingNode = xmlAddChild(xmlVisualNode, L"binding", nullptr);
xmlAddAttr(xmlBindingNode, L"template", L"ToastImageAndText02");
if (_imagePath)
{
- HXML xmlImageNode = xmlAddChild(xmlBindingNode, L"image", NULL);
+ HXML xmlImageNode = xmlAddChild(xmlBindingNode, L"image", nullptr);
xmlAddAttr(xmlImageNode, L"id", L"1");
xmlAddAttr(xmlImageNode, L"src", CMStringW(FORMAT, L"file:///%s", _imagePath));
}
- HXML xmlTitleNode = xmlAddChild(xmlBindingNode, L"text", _caption != NULL ? _caption : L"Miranda NG");
+ HXML xmlTitleNode = xmlAddChild(xmlBindingNode, L"text", _caption != nullptr ? _caption : L"Miranda NG");
xmlAddAttr(xmlTitleNode, L"id", L"1");
if (_text)
{
diff --git a/plugins/Toaster/src/utils.cpp b/plugins/Toaster/src/utils.cpp index a46ea09cb4..7726eec8c5 100644 --- a/plugins/Toaster/src/utils.cpp +++ b/plugins/Toaster/src/utils.cpp @@ -15,7 +15,7 @@ wchar_t* GetShortcutPath() HRESULT InstallShortcut(_In_z_ wchar_t *shortcutPath)
{
wchar_t exePath[MAX_PATH];
- GetModuleFileName(NULL, exePath, MAX_PATH);
+ GetModuleFileName(nullptr, exePath, MAX_PATH);
ComPtr<IShellLink> shellLink;
CHECKHR(CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)));
diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp index 9289c34824..7552ec858d 100644 --- a/plugins/TooltipNotify/src/Tooltip.cpp +++ b/plugins/TooltipNotify/src/Tooltip.cpp @@ -14,13 +14,13 @@ CTooltip::CTooltip(CTooltipNotify *pTooltipNotify) {
m_pTooltipNotify = pTooltipNotify;
m_bLDblClick = DEF_SETTING_LDBLCLICK;
- m_hFont = 0;
- m_hWnd = 0;
- m_szText = 0;
+ m_hFont = nullptr;
+ m_hWnd = nullptr;
+ m_szText = nullptr;
- m_hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, s_szTooltipClass, 0,
- WS_POPUP|WS_BORDER, 100, 100, 50, 50, 0, 0,
- g_hInstDLL, NULL);
+ m_hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, s_szTooltipClass, nullptr,
+ WS_POPUP|WS_BORDER, 100, 100, 50, 50, nullptr, nullptr,
+ g_hInstDLL, nullptr);
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
}
@@ -148,7 +148,7 @@ void CTooltip::Validate() HDC hDC = GetDC(m_hWnd);
SelectObject(hDC, m_hFont);
GetTextExtentPoint32(hDC, m_szText, (int)mir_wstrlen(m_szText), &Size);
- SetWindowPos(m_hWnd, 0, 0, 0, Size.cx+6, Size.cy+4,
+ SetWindowPos(m_hWnd, nullptr, 0, 0, Size.cx+6, Size.cy+4,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW);
ReleaseDC(m_hWnd, hDC);
}
@@ -189,7 +189,7 @@ void CTooltip::get_Rect(RECT *Rect) const void CTooltip::set_Position(INT x, INT y)
{
- SetWindowPos(m_hWnd, 0, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(m_hWnd, nullptr, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
}
void CTooltip::set_Text(const wchar_t* szText)
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 9b17cb37e6..d68ba585f6 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -45,7 +45,7 @@ static FontEntry s_fontTable[] = 0, FONTSERV_OTHER, "OtherFont", "OtherBgColor",
};
-CTooltipNotify *CTooltipNotify::s_pInstance = 0;
+CTooltipNotify *CTooltipNotify::s_pInstance = nullptr;
const char *CTooltipNotify::s_szModuleNameOld = "ttntfmod";
//////////////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ const char *CTooltipNotify::s_szModuleNameOld = "ttntfmod"; CTooltipNotify::CTooltipNotify() :
m_bNt50(IsNt50())
{
- if (s_pInstance != 0)
+ if (s_pInstance != nullptr)
throw EAlreadyExists();
s_pInstance = this;
@@ -67,7 +67,7 @@ CTooltipNotify::~CTooltipNotify() {
EndNotifyAll();
CTooltip::Deinitialize();
- s_pInstance = 0;
+ s_pInstance = nullptr;
}
void CTooltipNotify::RegisterFonts()
@@ -105,13 +105,13 @@ void CTooltipNotify::RegisterFonts() void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg)
{
- wchar_t* fontName = 0;
+ wchar_t* fontName = nullptr;
for (int i = 0; i < _countof(s_fontTable); i++) {
if (s_fontTable[i].status == iStatus) {
fontName = s_fontTable[i].name;
}
}
- if (fontName == 0)
+ if (fontName == nullptr)
fontName = s_fontTable[_countof(s_fontTable) - 1].name;
// name and group only
@@ -167,7 +167,7 @@ int CTooltipNotify::ProtoContactIsTyping(WPARAM hContact, LPARAM lParam) int CTooltipNotify::ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if ((ack == NULL) || (ack->type != ACKTYPE_STATUS)) return 0;
+ if ((ack == nullptr) || (ack->type != ACKTYPE_STATUS)) return 0;
WORD wNewStatus = (WORD)ack->lParam;
WORD wOldStatus = (UINT_PTR)ack->hProcess;
@@ -182,7 +182,7 @@ int CTooltipNotify::ProtoAck(WPARAM, LPARAM lParam) }
else {
if (wOldStatus < ID_STATUS_ONLINE && wNewStatus > ID_STATUS_OFFLINE) {
- UINT_PTR idTimer = SetTimer(0, 0, m_sOptions.wStartupDelay * 1000, ConnectionTimerProcWrapper);
+ UINT_PTR idTimer = SetTimer(nullptr, 0, m_sOptions.wStartupDelay * 1000, ConnectionTimerProcWrapper);
ProtoData protoData = { _strdup(szProtocol), idTimer };
m_mapTimerIdProto.push_back(protoData);
}
@@ -294,7 +294,7 @@ CTooltip *CTooltipNotify::BeginNotify(STooltipData *pTooltipData) if (m_sOptions.bAutoPos || Utils_RestoreWindowPosition(pTooltip->GetHandle(), 0, MODULENAME, "toolwindow", RWPF_NOSIZE | RWPF_NOACTIVATE))
pTooltip->set_Position(WorkAreaRect.right - 10 - (TooltipRect.right - TooltipRect.left), WorkAreaRect.bottom - 2 - (TooltipRect.bottom - TooltipRect.top));
- UINT_PTR idTimer = SetTimer(0, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
+ UINT_PTR idTimer = SetTimer(nullptr, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
pTooltipData->idTimer = idTimer;
pTooltipData->pTooltip = pTooltip;
@@ -356,7 +356,7 @@ CTooltipNotify::MapTimerIdProtoIter CTooltipNotify::FindProtoByTimer(UINT idTime void CTooltipNotify::OnConnectionTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
{
- BOOL bSuccess = KillTimer(0, idEvent);
+ BOOL bSuccess = KillTimer(nullptr, idEvent);
assert(bSuccess);
MapTimerIdProtoIter iter = FindProtoByTimer(idEvent);
@@ -634,7 +634,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) // enum protocols currently running
int iProtoCount = 0;
- PROTOACCOUNT **ppProtos = 0;
+ PROTOACCOUNT **ppProtos = nullptr;
Proto_EnumAccounts(&iProtoCount, &ppProtos);
// and fill in the list
@@ -673,7 +673,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) char szMultiByteProto[128];
long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, (int)mir_wstrlen(szProto),
- szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL);
+ szMultiByteProto, sizeof(szMultiByteProto), nullptr, nullptr);
szMultiByteProto[lLen] = '\0';
BYTE bProtoState = db_get_b(NULL, MODULENAME, szMultiByteProto, ProtoUserBit | ProtoIntBit);
@@ -891,7 +891,7 @@ void CTooltipNotify::SuspendTimer(CTooltip *pTooltip) STooltipData* pTooltipData = *iter;
- BOOL bSuccess = KillTimer(0, pTooltipData->idTimer);
+ BOOL bSuccess = KillTimer(nullptr, pTooltipData->idTimer);
assert(bSuccess);
pTooltipData->idTimer = 0; // denote that the timer is inactive
}
@@ -904,7 +904,7 @@ void CTooltipNotify::ResumeTimer(CTooltip *pTooltip) STooltipData* pTooltipData = *iter;
- UINT_PTR idTimer = SetTimer(0, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
+ UINT_PTR idTimer = SetTimer(nullptr, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
pTooltipData->idTimer = idTimer;
}
diff --git a/plugins/TooltipNotify/src/main.cpp b/plugins/TooltipNotify/src/main.cpp index 55f777e104..7151d44a06 100644 --- a/plugins/TooltipNotify/src/main.cpp +++ b/plugins/TooltipNotify/src/main.cpp @@ -10,16 +10,16 @@ static int ContactSettingChanged(WPARAM wParam,LPARAM lParam); static int ProtoAck(WPARAM,LPARAM);
static int ProtoContactIsTyping(WPARAM wParam,LPARAM lParam);
-static HANDLE g_hContactSettingChanged = 0;
-static HANDLE g_hOptionsInitialize = 0;
-static HANDLE g_hModulesLoaded = 0;
-static HANDLE g_hProtoAck = 0;
-static HANDLE g_hProtoContactIsTyping = 0;
+static HANDLE g_hContactSettingChanged = nullptr;
+static HANDLE g_hOptionsInitialize = nullptr;
+static HANDLE g_hModulesLoaded = nullptr;
+static HANDLE g_hProtoAck = nullptr;
+static HANDLE g_hProtoContactIsTyping = nullptr;
-HINSTANCE g_hInstDLL = 0;
+HINSTANCE g_hInstDLL = nullptr;
// Main global object
-static CTooltipNotify *g_pTooltipNotify = 0;
+static CTooltipNotify *g_pTooltipNotify = nullptr;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -59,7 +59,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = Clist_GetInterface();
g_pTooltipNotify = new CTooltipNotify();
- assert(g_pTooltipNotify!=0);
+ assert(g_pTooltipNotify!=nullptr);
g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index 5855153e75..c4171d781d 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -13,7 +13,7 @@ HANDLE hMainMenu, hOptions, hAccManager, hFindAdd, hStatusMenu, hShowHideOffline int OnSettingChanging(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact != 0 || dbcws == NULL)
+ if (hContact != 0 || dbcws == nullptr)
return 0;
if (!strcmp(dbcws->szModule, "CList")) {
@@ -38,7 +38,7 @@ INT_PTR TTBInternalMainMenuButt(WPARAM, LPARAM) {
POINT pt;
GetCursorPos(&pt);
- TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr);
return 0;
}
@@ -46,7 +46,7 @@ INT_PTR TTBInternalStatusMenuButt(WPARAM, LPARAM) {
POINT pt;
GetCursorPos(&pt);
- TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr);
return 0;
}
@@ -67,7 +67,7 @@ void InitInternalButtons() CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt);
CreateServiceFunction(TTBI_STATUSMENUBUTT, TTBInternalStatusMenuButt);
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.name = LPGEN("Show main menu");
ttb.pszService = TTBI_MAINMENUBUTT;
ttb.dwFlags = TTBBF_INTERNAL | TTBBF_VISIBLE;
@@ -110,7 +110,7 @@ void InitInternalButtons() ttb.dwFlags = TTBBF_INTERNAL | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
ttb.pszTooltipDn = LPGEN("Show offline contacts");
ttb.pszTooltipUp = LPGEN("Hide offline contacts");
- ttb.hIconHandleDn = ttb.hIconHandleUp = NULL;
+ ttb.hIconHandleDn = ttb.hIconHandleUp = nullptr;
ttb.hIconUp = IcoLib_GetIconByHandle(iconList[1].hIcolib);
ttb.hIconDn = IcoLib_GetIconByHandle(iconList[2].hIcolib);
hShowHideOffline = TopToolbar_AddButton(&ttb);
@@ -147,8 +147,8 @@ void InitInternalButtons() ttb.dwFlags = TTBBF_INTERNAL | TTBBF_VISIBLE;
ttb.pszTooltipUp = LPGEN("Minimize contact list");
ttb.hIconHandleUp = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE);
- ttb.pszTooltipDn = NULL;
- ttb.hIconUp = ttb.hIconDn = NULL;
+ ttb.pszTooltipDn = nullptr;
+ ttb.hIconUp = ttb.hIconDn = nullptr;
hMinimize = TopToolbar_AddButton(&ttb);
ttb.name = LPGEN("Exit");
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 392cbe1fbe..2bf222f327 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -1,13 +1,13 @@ #include "stdafx.h"
-pfnCustomProc g_CustomProc = NULL;
+pfnCustomProc g_CustomProc = nullptr;
LPARAM g_CustomProcParam = 0;
-TTBCtrl *g_ctrl = NULL;
+TTBCtrl *g_ctrl = nullptr;
void CALLBACK OnEventFire();
-HWND hwndContactList = 0;
+HWND hwndContactList = nullptr;
int nextButtonId = 200;
@@ -34,13 +34,13 @@ TopButtonInt *idtopos(int id, int *pPos) if (pPos)
*pPos = -1;
- return NULL;
+ return nullptr;
}
//----- Service buttons -----
void InsertSBut(int i)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSBUTTON | TTBBF_INTERNAL;
@@ -65,7 +65,7 @@ INT_PTR LaunchService(WPARAM, LPARAM lParam) STARTUPINFO si = {0};
si.cb = sizeof(si);
- if (CreateProcess(NULL, Buttons[lParam]->ptszProgram, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ if (CreateProcess(nullptr, Buttons[lParam]->ptszProgram, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
@@ -75,7 +75,7 @@ INT_PTR LaunchService(WPARAM, LPARAM lParam) void InsertLBut(int i)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL;
ttb.name = LPGEN("Default");
@@ -95,7 +95,7 @@ void LoadAllLButs() //----- Separators -----
void InsertSeparator(int i)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL;
ttb.wParamDown = i;
TTBAddButton((WPARAM)&ttb, 0);
@@ -125,7 +125,7 @@ int SaveAllButtonsOptions() static bool nameexists(const char *name)
{
- if (name == NULL)
+ if (name == nullptr)
return false;
for (int i = 0; i < Buttons.getCount(); i++)
@@ -138,8 +138,8 @@ static bool nameexists(const char *name) static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsUp)
{
HANDLE hSrc = bIsUp ? but->hIconHandleUp : but->hIconHandleDn;
- if (hSrc == NULL) {
- hIcoLib = NULL, hIcon = NULL;
+ if (hSrc == nullptr) {
+ hIcoLib = nullptr, hIcon = nullptr;
return;
}
@@ -148,10 +148,10 @@ static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsU char buf[256];
mir_snprintf(buf, "toptoolbar_%s%s", but->name, bIsUp ? (but->hIconDn ? "%s_up" : "%s") : "%s_dn");
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.a = "Toolbar";
sid.pszName = buf;
- sid.defaultFile.a = NULL;
+ sid.defaultFile.a = nullptr;
mir_snprintf(buf, "%s%s", but->name, bIsUp ? "" : " (pressed)");
sid.description.a = buf;
sid.hDefaultIcon = bIsUp ? but->hIconUp : but->hIconDn;
@@ -181,7 +181,7 @@ TopButtonInt *CreateButton(TTBButton *but) b->pszService = mir_strdup(TTB_LAUNCHSERVICE);
}
else {
- b->ptszProgram = NULL;
+ b->ptszProgram = nullptr;
b->pszService = mir_strdup(but->pszService);
}
@@ -229,7 +229,7 @@ int ArrangeButtons() for (i = iFirstButtonId; i < Buttons.getCount(); i++) {
TopButtonInt *b = Buttons[i];
- if (b->hwnd == NULL)
+ if (b->hwnd == nullptr)
continue;
int width = 0;
@@ -245,7 +245,7 @@ int ArrangeButtons() for (i = iFirstButtonId; i < iLastButtonId; i++) {
TopButtonInt *b = Buttons[i];
- if (b->hwnd == NULL)
+ if (b->hwnd == nullptr)
continue;
bool bOldVisible = IsWindowVisible(b->hwnd) != 0;
@@ -253,15 +253,15 @@ int ArrangeButtons() g_ctrl->bOrderChanged = TRUE;
if (b->isVisible()) {
- if (NULL != b->hwnd) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, b->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
+ if (nullptr != b->hwnd) /* Wine fix. */
+ hdwp = DeferWindowPos(hdwp, b->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
if (b->isSep())
nextX += SEPWIDTH + 2;
else
nextX += g_ctrl->nButtonWidth + g_ctrl->nButtonSpace;
} else {
- if (NULL != Buttons[i]->hwnd) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
+ if (nullptr != Buttons[i]->hwnd) /* Wine fix. */
+ hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
}
}
@@ -276,8 +276,8 @@ int ArrangeButtons() } while (iFirstButtonId < Buttons.getCount() && y >= 0 && (g_ctrl->bAutoSize || (y + g_ctrl->nButtonHeight <= rcClient.bottom - rcClient.top)));
for (i = iLastButtonId; i < Buttons.getCount(); i++) {
- if (NULL != Buttons[i]->hwnd) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
+ if (nullptr != Buttons[i]->hwnd) /* Wine fix. */
+ hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
}
if (hdwp)
@@ -304,7 +304,7 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) b->hLangpack = (int)lParam;
b->LoadSettings();
b->CreateWnd();
- if (b->hwnd == NULL) {
+ if (b->hwnd == nullptr) {
delete b;
return -1;
}
@@ -325,7 +325,7 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM) int idx;
TopButtonInt *b = idtopos(wParam, &idx);
- if (b == NULL)
+ if (b == nullptr)
return -1;
RemoveFromOptions(b->id);
@@ -345,7 +345,7 @@ INT_PTR TTBSetState(WPARAM wParam, LPARAM lParam) mir_cslock lck(csButtonsHook);
TopButtonInt *b = idtopos(wParam);
- if (b == NULL)
+ if (b == nullptr)
return -1;
b->bPushed = (lParam & TTBST_PUSHED) != 0;
@@ -360,7 +360,7 @@ INT_PTR TTBGetState(WPARAM wParam, LPARAM) {
mir_cslock lck(csButtonsHook);
TopButtonInt *b = idtopos(wParam);
- if (b == NULL)
+ if (b == nullptr)
return -1;
return ((b->bPushed == TRUE) ? TTBST_PUSHED : 0);
@@ -370,7 +370,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) {
mir_cslock lck(csButtonsHook);
TopButtonInt *b = idtopos(wParam);
- if (b == NULL)
+ if (b == nullptr)
return -1;
switch (LOWORD(wParam)) {
@@ -417,7 +417,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) {
mir_cslock lck(csButtonsHook);
TopButtonInt *b = idtopos(HIWORD(wParam));
- if (b == NULL)
+ if (b == nullptr)
return -1;
switch (LOWORD(wParam)) {
@@ -431,7 +431,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) b->SetBitmap();
if (retval & TTBBF_VISIBLE) {
ArrangeButtons();
- b->SaveSettings(0, 0);
+ b->SaveSettings(nullptr, nullptr);
}
return 1;
@@ -463,7 +463,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) if (retval & TTBBF_VISIBLE) {
ArrangeButtons();
- b->SaveSettings(0, 0);
+ b->SaveSettings(nullptr, nullptr);
}
if (b->dwFlags & TTBBF_ISLBUTTON)
@@ -590,11 +590,11 @@ static int OnShutdown(WPARAM, LPARAM) if (g_ctrl) {
if (g_ctrl->hFrame) {
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)g_ctrl->hFrame, 0);
- g_ctrl->hFrame = 0;
+ g_ctrl->hFrame = nullptr;
}
if (g_ctrl->hWnd) {
DestroyWindow(g_ctrl->hWnd);
- g_ctrl->hWnd = NULL;
+ g_ctrl->hWnd = nullptr;
}
}
@@ -620,7 +620,7 @@ int LoadToolbarModule() {
if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
if (!db_get_b(NULL, TTB_OPTDIR, "WarningDone", 0))
- MessageBox(0, TranslateT("Frames service has not been found, so plugin will be disabled.\nTo run it you need to install and / or enable contact list plugin that supports it:\n- Modern contact list\n- Clist nicer\nYou can get them at https://wiki.miranda-ng.org/Download"), TranslateT("TopToolBar"), 0);
+ MessageBox(nullptr, TranslateT("Frames service has not been found, so plugin will be disabled.\nTo run it you need to install and / or enable contact list plugin that supports it:\n- Modern contact list\n- Clist nicer\nYou can get them at https://wiki.miranda-ng.org/Download"), TranslateT("TopToolBar"), 0);
db_set_b(NULL, TTB_OPTDIR, "WarningDone", 1);
return 1;
}
@@ -664,9 +664,9 @@ int LoadToolbarModule() wc.cbSize = sizeof(wc);
wc.lpszClassName = TTB_BUTTON_CLASS;
wc.lpfnWndProc = TTBButtonWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(void *);
- wc.hbrBackground = 0;
+ wc.hbrBackground = nullptr;
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
return 0;
diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 2a73eb86ad..40bc4cf571 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -12,7 +12,7 @@ static wchar_t pluginname[] = L"TopToolBar"; static void PaintToolbar(HWND hwnd)
{
- InvalidateRect(hwnd, 0, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
PAINTSTRUCT paintst;
HDC hdc = BeginPaint(hwnd, &paintst);
@@ -24,7 +24,7 @@ static void PaintToolbar(HWND hwnd) int yScroll = 0;
HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
+ HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr);
HBITMAP hOldBmp = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
SetBkMode(hdcMem, TRANSPARENT);
@@ -122,7 +122,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return FALSE;
case WM_DESTROY:
- g_ctrl->hWnd = NULL;
+ g_ctrl->hWnd = nullptr;
break;
case WM_MOVE:
@@ -178,7 +178,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (id != 0) {
mir_cslock lck(csButtonsHook);
TopButtonInt* b = idtopos(id);
- if (b == NULL || b->isSep())
+ if (b == nullptr || b->isSep())
return 0;
if (b->dwFlags & TTBBF_ASPUSHBUTTON)
@@ -186,11 +186,11 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (b->bPushed) { //Dn -> Up
if (!(b->dwFlags & TTBBF_ISLBUTTON)) // must be always true
- if (b->pszService != NULL)
+ if (b->pszService != nullptr)
CallService(b->pszService, b->wParamUp, b->lParamUp);
}
else { //Up -> Dn
- if (b->pszService != NULL)
+ if (b->pszService != nullptr)
CallService(b->pszService, b->wParamDown, b->lParamDown);
}
@@ -241,14 +241,14 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara void CALLBACK OnEventFire()
{
HWND parent = pcli->hwndContactList;
- if (parent == NULL) // no clist, no buttons
+ if (parent == nullptr) // no clist, no buttons
return;
WNDCLASS wndclass = {0};
wndclass.lpfnWndProc = TopToolBarProc;
wndclass.cbWndExtra = sizeof(void *);
wndclass.hInstance = hInst;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszClassName = pluginname;
RegisterClass(&wndclass);
@@ -256,7 +256,7 @@ void CALLBACK OnEventFire() g_ctrl->pButtonList = (SortedList *)&Buttons;
g_ctrl->hWnd = CreateWindow(pluginname, L"Toolbar",
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- 0, 0, 0, g_ctrl->nLastHeight, parent, NULL, hInst, NULL);
+ 0, 0, 0, g_ctrl->nLastHeight, parent, nullptr, hInst, nullptr);
SetWindowLongPtr(g_ctrl->hWnd, 0, (LONG_PTR)g_ctrl);
LoadBackgroundOptions();
@@ -268,7 +268,7 @@ void CALLBACK OnEventFire() InitInternalButtons();
// if there's no customized frames, create our own
- if (g_ctrl->hFrame == NULL) {
+ if (g_ctrl->hFrame == nullptr) {
CLISTFrame Frame = { sizeof(Frame) };
Frame.tname = L"Toolbar";
Frame.hWnd = g_ctrl->hWnd;
@@ -290,7 +290,7 @@ int LoadBackgroundOptions() bkColour = db_get_dw(NULL, TTB_OPTDIR, "BkColour", TTBDEFAULT_BKCOLOUR);
if (hBmpBackground) {
DeleteObject(hBmpBackground);
- hBmpBackground = NULL;
+ hBmpBackground = nullptr;
}
if (db_get_b(NULL, TTB_OPTDIR, "UseBitmap", TTBDEFAULT_USEBITMAP)) {
diff --git a/plugins/TopToolBar/src/topbutton.cpp b/plugins/TopToolBar/src/topbutton.cpp index 4faef0753d..b16bdd84f7 100644 --- a/plugins/TopToolBar/src/topbutton.cpp +++ b/plugins/TopToolBar/src/topbutton.cpp @@ -13,7 +13,7 @@ TopButtonInt::~TopButtonInt() if (dwFlags & TTBBF_ISLBUTTON) {
mir_free(ptszProgram);
}
- else if (pszService != NULL)
+ else if (pszService != nullptr)
mir_free(pszService);
mir_free(pszName);
@@ -53,7 +53,7 @@ DWORD TopButtonInt::CheckFlags(DWORD Flags) void TopButtonInt::CreateWnd()
{
if (!(dwFlags & TTBBF_ISSEPARATOR)) {
- hwnd = CreateWindow(TTB_BUTTON_CLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, this);
+ hwnd = CreateWindow(TTB_BUTTON_CLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, nullptr, hInst, this);
if (dwFlags & TTBBF_ASPUSHBUTTON)
SendMessage(hwnd, BUTTONSETASPUSHBTN, 1, 0);
@@ -65,7 +65,7 @@ void TopButtonInt::CreateWnd() }
// maybe SEPWIDTH, not g_ctrl->nButtonWidth?
else
- hwnd = CreateWindow(L"STATIC", L"", WS_CHILD | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, 0);
+ hwnd = CreateWindow(L"STATIC", L"", WS_CHILD | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, nullptr, hInst, nullptr);
SetWindowLongPtr(hwnd, GWLP_USERDATA, id);
SetBitmap();
diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index 4f0c2b3c93..843db24ac6 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -13,7 +13,7 @@ struct OrderData static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST il)
{
- TVINSERTSTRUCT tvis = { 0 };
+ TVINSERTSTRUCT tvis = {};
tvis.hInsertAfter = hItem;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
@@ -23,7 +23,7 @@ static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST if (b->dwFlags & TTBBF_ISSEPARATOR) {
tvis.item.pszText = L"------------------";
index = -1;
- tmp = 0;
+ tmp = nullptr;
}
else {
if (b->hIconHandleUp) {
@@ -77,7 +77,7 @@ static void SaveTree(HWND hwndDlg) LIST<TopButtonInt> tmpList(8);
- while(tvi.hItem != NULL) {
+ while(tvi.hItem != nullptr) {
TreeView_GetItem(hTree, &tvi);
TopButtonInt* btn = (TopButtonInt*)tvi.lParam;
@@ -110,7 +110,7 @@ void CancelProcess(HWND hwndDlg) TVITEM tvi = { 0 };
tvi.hItem = TreeView_GetRoot(hTree);
- while(tvi.hItem != NULL) {
+ while(tvi.hItem != nullptr) {
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hTree, &tvi);
@@ -165,7 +165,7 @@ void RemoveFromOptions(int id) tvi.mask = TVIF_PARAM | TVIF_HANDLE;
TopButtonInt* btn;
- while(tvi.hItem != NULL) {
+ while(tvi.hItem != nullptr) {
TreeView_GetItem(hTree, &tvi);
btn = (TopButtonInt*)tvi.lParam;
if (btn->id == id) {
@@ -245,8 +245,8 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetDlgItemText(hwndDlg, IDC_EPATH, str, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
- ofn.lpstrFilter = NULL;
+ ofn.hInstance = nullptr;
+ ofn.lpstrFilter = nullptr;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
ofn.nMaxFile = _countof(str);
@@ -265,7 +265,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_LBUTTONSET) {
TVITEM tvi ={0};
tvi.hItem = TreeView_GetSelection(hTree);
- if (tvi.hItem == NULL)
+ if (tvi.hItem == nullptr)
break;
tvi.mask = TVIF_PARAM;
@@ -277,11 +277,11 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (btn->dwFlags & TTBBF_ISLBUTTON) {
if (!(btn->dwFlags & TTBBF_OPTIONAL)) {
// create button
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL;
- ttb.name = NULL;
- ttb.program = NULL;
+ ttb.name = nullptr;
+ ttb.program = nullptr;
int id = btn->id;
btn = CreateButton(&ttb);
btn->id = id;
@@ -305,7 +305,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_ADDLBUTTON) {
// create button
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL;
ttb.name = LPGEN("Default");
@@ -327,7 +327,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_ADDSEP) {
// create button
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL | TTBBF_OPTIONAL;
TopButtonInt* b = CreateButton(&ttb);
@@ -345,7 +345,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_REMOVEBUTTON) {
TVITEM tvi = {0};
tvi.hItem = TreeView_GetSelection(hTree);
- if (tvi.hItem == NULL)
+ if (tvi.hItem == nullptr)
break;
tvi.mask = TVIF_PARAM;
@@ -373,9 +373,9 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- g_ctrl->nButtonHeight = GetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, NULL, FALSE);
- g_ctrl->nButtonWidth = GetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, NULL, FALSE);
- g_ctrl->nButtonSpace = GetDlgItemInt(hwndDlg, IDC_BUTTGAP, NULL, FALSE);
+ g_ctrl->nButtonHeight = GetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, nullptr, FALSE);
+ g_ctrl->nButtonWidth = GetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, nullptr, FALSE);
+ g_ctrl->nButtonSpace = GetDlgItemInt(hwndDlg, IDC_BUTTGAP, nullptr, FALSE);
g_ctrl->bFlatButtons = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USEFLAT);
g_ctrl->bAutoSize = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTORESIZE);
@@ -421,7 +421,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case TVN_SELCHANGED:
{
HTREEITEM hti = TreeView_GetSelection(hTree);
- if (hti == NULL)
+ if (hti == nullptr)
break;
TopButtonInt *btn = (TopButtonInt*)((LPNMTREEVIEW)lParam)->itemNew.lParam;
@@ -434,12 +434,12 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), enable);
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), enable);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), enable);
- if (btn->pszName != NULL)
+ if (btn->pszName != nullptr)
SetDlgItemTextA(hwndDlg, IDC_ENAME, btn->pszName);
else
SetDlgItemTextA(hwndDlg, IDC_ENAME, "");
- if (btn->ptszProgram != NULL)
+ if (btn->ptszProgram != nullptr)
SetDlgItemText(hwndDlg, IDC_EPATH, btn->ptszProgram);
else
SetDlgItemTextA(hwndDlg, IDC_EPATH, "");
@@ -518,7 +518,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TreeView_GetItem(hTree, &tvis.item);
TreeView_DeleteItem(hTree, dat->hDragItem);
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = hti.hItem;
TreeView_SelectItem(hTree, TreeView_InsertItem(hTree, &tvis));
@@ -532,7 +532,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ImageList_Destroy(dat->himlButtonIcons);
free(dat);
}
- OptionshWnd = NULL;
+ OptionshWnd = nullptr;
break;
}
return FALSE;
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index f4d9c3c188..ef7c33e8ca 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -67,13 +67,13 @@ unsigned short int Traffic_LineHeight; wchar_t Traffic_CounterFormat[512];
wchar_t Traffic_TooltipFormat[512];
//
-HANDLE Traffic_FrameID = NULL;
+HANDLE Traffic_FrameID = nullptr;
char Traffic_AdditionSpace;
-HFONT Traffic_h_font = NULL;
-HMENU TrafficPopupMenu = NULL;
-HGENMENU hTrafficMainMenuItem = NULL;
+HFONT Traffic_h_font = nullptr;
+HMENU TrafficPopupMenu = nullptr;
+HGENMENU hTrafficMainMenuItem = nullptr;
/*-------------------------------------------------------------------------------------------------------------------*/
//TIME COUNTER
@@ -149,7 +149,7 @@ extern "C" int __declspec(dllexport) Unload(void) // Óäàëÿåì øðèôò.
if (Traffic_h_font) {
DeleteObject(Traffic_h_font);
- Traffic_h_font = NULL;
+ Traffic_h_font = nullptr;
}
// Óáèâàåì âñå ðàáî÷èå äàííûå.
@@ -167,12 +167,12 @@ int TrafficCounterShutdown(WPARAM, LPARAM) // Óäàëÿåì ïóíêò ãëàâíîãî ìåíþ.
if (hTrafficMainMenuItem) {
Menu_RemoveItem(hTrafficMainMenuItem);
- hTrafficMainMenuItem = NULL;
+ hTrafficMainMenuItem = nullptr;
}
// Óäàëÿåì êîíòåêñòíîå ìåíþ.
if (TrafficPopupMenu) {
DestroyMenu(TrafficPopupMenu);
- TrafficPopupMenu = NULL;
+ TrafficPopupMenu = nullptr;
}
// Ðàçðåãèñòðèðóåì ïðîöåäóðó îòðèñîâêè ôðåéìà.
CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)TrafficHwnd, (LPARAM)NULL);
@@ -180,7 +180,7 @@ int TrafficCounterShutdown(WPARAM, LPARAM) // Óäàëÿåì ôðåéì.
if ((ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME)) && Traffic_FrameID) {
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)Traffic_FrameID, 0);
- Traffic_FrameID = NULL;
+ Traffic_FrameID = nullptr;
}
return 0;
}
@@ -378,7 +378,7 @@ int TrafficCounter_Draw(HWND hwnd, HDC hDC) if (GetParent(hwnd) == pcli->hwndContactList)
return PaintTrafficCounterWindow(hwnd, hDC);
else
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
return 0;
}
@@ -425,7 +425,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
RGB32BitsBITMAPINFO.bmiHeader.biCompression = BI_RGB;
- HBITMAP hbmp = CreateDIBSection(NULL, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, NULL, NULL, 0);
+ HBITMAP hbmp = CreateDIBSection(nullptr, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, nullptr, nullptr, 0);
HBITMAP oldbmp = (HBITMAP)SelectObject(hdc, hbmp);
HBRUSH b = CreateSolidBrush(Traffic_BkColor);
@@ -791,7 +791,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP p.x = GET_X_LPARAM(lParam);
p.y = GET_Y_LPARAM(lParam);
ClientToScreen(hwnd, &p);
- TrackPopupMenu(TrafficPopupMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, p.x, p.y, 0, hwnd, NULL);
+ TrackPopupMenu(TrafficPopupMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, p.x, p.y, 0, hwnd, nullptr);
break;
case WM_COMMAND:
@@ -827,7 +827,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP TooltipShowing = FALSE;
}
KillTimer(TrafficHwnd, TIMER_TOOLTIP);
- SetTimer(TrafficHwnd, TIMER_TOOLTIP, CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0), 0);
+ SetTimer(TrafficHwnd, TIMER_TOOLTIP, CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0), nullptr);
break;
}
@@ -958,7 +958,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP ti.rcItem.top = TooltipPosition.y - 10;
ti.rcItem.bottom = TooltipPosition.y + 10;
ti.cbSize = sizeof(ti);
- TooltipText = variables_parsedup(Traffic_TooltipFormat, NULL, NULL);
+ TooltipText = variables_parsedup(Traffic_TooltipFormat, nullptr, NULL);
CallService(MS_TIPPER_SHOWTIPW, (WPARAM)TooltipText, (LPARAM)&ti);
@@ -989,17 +989,17 @@ void CreateTrafficWindow(HWND hCluiWnd) wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInst;
- wcx.hIcon = NULL;
+ wcx.hIcon = nullptr;
wcx.hCursor = LoadCursor(hInst, IDC_ARROW);
- wcx.hbrBackground = 0;
- wcx.lpszMenuName = NULL;
+ wcx.hbrBackground = nullptr;
+ wcx.lpszMenuName = nullptr;
wcx.lpszClassName = TRAFFIC_COUNTER_WINDOW_CLASS;
- wcx.hIconSm = NULL;
+ wcx.hIconSm = nullptr;
RegisterClassEx(&wcx);
TrafficHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, TRAFFIC_COUNTER_WINDOW_CLASS,
TRAFFIC_COUNTER_WINDOW_CLASS,
WS_CHILDWINDOW | WS_CLIPCHILDREN,
- 0, 0, 0, 0, hCluiWnd, NULL, hInst, NULL);
+ 0, 0, 0, 0, hCluiWnd, nullptr, hInst, nullptr);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
// Ãîòîâèìñÿ ñîçäàâàòü ôðåéì
@@ -1017,14 +1017,14 @@ void CreateTrafficWindow(HWND hCluiWnd) }
// Ñîçäà¸ì òàéìåðû.
- SetTimer(TrafficHwnd, TIMER_REDRAW, 500, NULL);
+ SetTimer(TrafficHwnd, TIMER_REDRAW, 500, nullptr);
UpdateNotifyTimer();
}
INT_PTR MenuCommand_TrafficShowHide(WPARAM, LPARAM)
{
unOptions.FrameIsVisible = !unOptions.FrameIsVisible;
- if (Traffic_FrameID == NULL)
+ if (Traffic_FrameID == nullptr)
ShowWindow(TrafficHwnd, unOptions.FrameIsVisible ? SW_SHOW : SW_HIDE);
else
CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)Traffic_FrameID, 0);
@@ -1038,7 +1038,7 @@ void Traffic_AddMainMenuItem(void) CMenuItem mi;
SET_UID(mi, 0x7fe75b30, 0x3cf6, 0x4280, 0xb9, 0xd2, 0x88, 0x6b, 0xbb, 0x69, 0xa3, 0x7e);
mi.position = -0x7FFFFFFF;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.name.a = LPGEN("Toggle traffic counter");
mi.pszService = "TrafficCounter/ShowHide";
@@ -1051,7 +1051,7 @@ void UpdateNotifyTimer(void) if (!bPopupExists) return;
if (Traffic_Notify_time_value && unOptions.NotifyByTime)
- SetTimer(TrafficHwnd, TIMER_NOTIFY_TICK, Traffic_Notify_time_value * 1000 * 60, NULL);
+ SetTimer(TrafficHwnd, TIMER_NOTIFY_TICK, Traffic_Notify_time_value * 1000 * 60, nullptr);
else
KillTimer(TrafficHwnd, TIMER_NOTIFY_TICK);
}
@@ -1067,7 +1067,7 @@ void NotifyOnSend(void) mir_snwprintf(ppd.lptzText, TranslateT("%d kilobytes sent"), notify_send_size = OverallInfo.CurrentSentTraffic >> 10);
ppd.colorBack = Traffic_PopupBkColor;
ppd.colorText = Traffic_PopupFontColor;
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = (Traffic_PopupTimeoutDefault ? 0 : Traffic_PopupTimeoutValue);
PUAddPopupT(&ppd);
}
@@ -1083,7 +1083,7 @@ void NotifyOnRecv(void) mir_snwprintf(ppd.lptzText, TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10);
ppd.colorBack = Traffic_PopupBkColor;
ppd.colorText = Traffic_PopupFontColor;
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = (Traffic_PopupTimeoutDefault ? 0 : Traffic_PopupTimeoutValue);
PUAddPopupT(&ppd);
}
@@ -1179,7 +1179,7 @@ int UpdateFonts(WPARAM, LPARAM) void UpdateTrafficWindowSize(void)
{
- if (Traffic_FrameID != NULL)
+ if (Traffic_FrameID != nullptr)
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, Traffic_FrameID), TrafficWindowHeight());
}
diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index 240ba55aa1..f15a045250 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -149,7 +149,7 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, wchar_t *Buffer, size_t Size) }
mir_snwprintf(Str1, L"%d.%d", Value / Divider, Value % Divider);
- size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0);
+ size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, nullptr, 0);
if (!l) return 0;
l += mir_wstrlen(szUnit) + 1;
Res = (wchar_t*)malloc(l * sizeof(wchar_t));
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index c65d82e203..605f04767a 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -102,15 +102,15 @@ static INT_PTR CALLBACK DlgProcPopupsTraffic(HWND hwndDlg, UINT msg, WPARAM wPar case 0:
if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
unOptions.NotifyBySize = IsDlgButtonChecked(hwndDlg,IDC_NOTIFYSIZE);
- Traffic_Notify_size_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYSIZE,NULL,0);
+ Traffic_Notify_size_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYSIZE,nullptr,0);
unOptions.NotifyByTime = IsDlgButtonChecked(hwndDlg,IDC_NOTIFYTIME);
- Traffic_Notify_time_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYTIME,NULL,0);
+ Traffic_Notify_time_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYTIME,nullptr,0);
//
Traffic_PopupBkColor = SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_GETCOLOUR,0,0);
Traffic_PopupFontColor = SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_GETCOLOUR,0,0);
//
Traffic_PopupTimeoutDefault = IsDlgButtonChecked(hwndDlg,IDC_RADIO_FROMPOPUP);
- if (Traffic_PopupTimeoutDefault == 0) Traffic_PopupTimeoutValue = GetDlgItemInt(hwndDlg,IDC_POPUP_TIMEOUT,NULL,0);
+ if (Traffic_PopupTimeoutDefault == 0) Traffic_PopupTimeoutValue = GetDlgItemInt(hwndDlg,IDC_POPUP_TIMEOUT,nullptr,0);
//
UpdateNotifyTimer();
return TRUE;
@@ -126,51 +126,51 @@ static INT_PTR CALLBACK DlgProcPopupsTraffic(HWND hwndDlg, UINT msg, WPARAM wPar static OPTTREE_OPTION options[] =
{
- {0, LPGENW("Display") L"/" LPGENW("Icon"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoIcon"},
- {0, LPGENW("Display") L"/" LPGENW("Account name"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoName"},
- {0, LPGENW("Display") L"/" LPGENW("Current traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTraffic"},
- {0, LPGENW("Display") L"/" LPGENW("Total traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTraffic"},
- {0, LPGENW("Display") L"/" LPGENW("Current online"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTime"},
- {0, LPGENW("Display") L"/" LPGENW("Total online"),OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTime"},
- {0, LPGENW("General") L"/" LPGENW("Draw frame as skin element"), OPTTREE_CHECK, 1, NULL, "DrawFrmAsSkin"},
- {0, LPGENW("General") L"/" LPGENW("Show tooltip in traffic window"), OPTTREE_CHECK, 1, NULL, "ShowTooltip"},
- {0, LPGENW("General") L"/" LPGENW("\"Toggle traffic counter\" in main menu"), OPTTREE_CHECK, 1, NULL, "ShowMainMenuItem"},
+ {0, LPGENW("Display") L"/" LPGENW("Icon"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawProtoIcon"},
+ {0, LPGENW("Display") L"/" LPGENW("Account name"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawProtoName"},
+ {0, LPGENW("Display") L"/" LPGENW("Current traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawCurrentTraffic"},
+ {0, LPGENW("Display") L"/" LPGENW("Total traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawTotalTraffic"},
+ {0, LPGENW("Display") L"/" LPGENW("Current online"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawCurrentTime"},
+ {0, LPGENW("Display") L"/" LPGENW("Total online"),OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawTotalTime"},
+ {0, LPGENW("General") L"/" LPGENW("Draw frame as skin element"), OPTTREE_CHECK, 1, nullptr, "DrawFrmAsSkin"},
+ {0, LPGENW("General") L"/" LPGENW("Show tooltip in traffic window"), OPTTREE_CHECK, 1, nullptr, "ShowTooltip"},
+ {0, LPGENW("General") L"/" LPGENW("\"Toggle traffic counter\" in main menu"), OPTTREE_CHECK, 1, nullptr, "ShowMainMenuItem"},
// Ðåçåðâèðóåì ìåñòî ïîä àêòèâíûå è âèäèìûå ïðîòîêîëû
// Ìàêñèìóì 16 ïîçèöèé âèäèìûõ è 16 àêòèâíûõ
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, LPGENW("Visible accounts")L"/" LPGENW("Summary traffic for visible accounts"), OPTTREE_CHECK, 1, NULL, "ShowSummary"},
- {0, LPGENW("Visible accounts")L"/" LPGENW("Overall traffic"), OPTTREE_CHECK, 1, NULL, "ShowOverall"},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, LPGENW("Visible accounts")L"/" LPGENW("Summary traffic for visible accounts"), OPTTREE_CHECK, 1, nullptr, "ShowSummary"},
+ {0, LPGENW("Visible accounts")L"/" LPGENW("Overall traffic"), OPTTREE_CHECK, 1, nullptr, "ShowOverall"},
};
static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(15, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, NULL, FALSE));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, nullptr, FALSE));
//show/hide button
SetDlgItemText(hwndDlg,IDC_BSHOWHIDE,(IsWindowVisible(TrafficHwnd) != 0)? TranslateT("Hide now") : TranslateT("Show now"));
@@ -286,7 +286,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, unOptions.PeriodForShow = (char)SendDlgItemMessage(hwndDlg,IDC_COMBO_AUTO_CLEAR,CB_GETCURSEL,0,0);
// Èíòåðâàë ìåæäó ñòðîêàìè
- Traffic_AdditionSpace = GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, NULL, 0);
+ Traffic_AdditionSpace = GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, nullptr, 0);
// Íàñòðîéêè Appearance
unOptions.DrawProtoIcon = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawProtoIcon");
unOptions.DrawProtoName = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawProtoName");
@@ -325,7 +325,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (!unOptions.ShowMainMenuItem && hTrafficMainMenuItem)
{
Menu_RemoveItem(hTrafficMainMenuItem);
- hTrafficMainMenuItem = NULL;
+ hTrafficMainMenuItem = nullptr;
}
// Åñëè âêëþ÷àåòñÿ, òî ñîçäà¸ì.
if (unOptions.ShowMainMenuItem && !hTrafficMainMenuItem)
diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp index 1fb69b220e..c3d6cfdc7d 100644 --- a/plugins/TrafficCounter/src/opttree.cpp +++ b/plugins/TrafficCounter/src/opttree.cpp @@ -47,7 +47,7 @@ void OptTree_Translate(HWND hwndTree) HTREEITEM hItem = TreeView_GetRoot(hwndTree);
while (hItem)
{
- HTREEITEM hItemTmp = 0;
+ HTREEITEM hItemTmp = nullptr;
OptTree_TranslateItem(hwndTree, hItem);
if (hItemTmp = TreeView_GetChild(hwndTree, hItem))
@@ -98,7 +98,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wcha tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
- return NULL;
+ return nullptr;
}
HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconIndex)
@@ -108,7 +108,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconI wchar_t* sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL, result = NULL;
+ HTREEITEM hSection = nullptr, result = nullptr;
mir_wstrcpy(itemName, name);
sectionName = itemName;
@@ -130,7 +130,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconI {
if (!hItem)
{
- TVINSERTSTRUCT tvis = {0};
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
@@ -191,7 +191,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, wchar_t* sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL;
+ HTREEITEM hSection = nullptr;
if (options[indx].szOptionName)
mir_wstrcpy(itemName, options[indx].szOptionName);
else
@@ -218,7 +218,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, {
if (!hItem)
{
- TVINSERTSTRUCT tvis = {0};
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
@@ -254,7 +254,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, OptTree_Translate(hwndTree);
ShowWindow(hwndTree, SW_SHOW);
- TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, 0, NULL));
+ TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, nullptr, nullptr));
break;
}
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index 6eaef9b4c3..342b1d8fa2 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -37,9 +37,9 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // Ñîçäà¸ì ListBox c ïåðå÷íåì àêêàóíòîâ.
hListAccs = CreateWindowEx(WS_EX_CLIENTEDGE,
L"ListBox",
- NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NOTIFY,
+ nullptr, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NOTIFY,
2, 20, 246, 112,
- hwndDlg, NULL, NULL, NULL);
+ hwndDlg, nullptr, nullptr, nullptr);
SendMessage(hListAccs, WM_SETFONT, (WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT), 0);
for (i = 0; i < NumberOfAccounts; i++) {
// Ãîòîâèì ñïèñîê àêêàóíòîâ
@@ -135,7 +135,7 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA GetLocalTime(&stNow);
for (i = NumberOfAccounts; i--;)
if (0x01 & (Stat_SelAcc >> i)) {
- SetFilePointer(ProtoList[i].hFile, sizeof(HOURLYSTATS), NULL, FILE_BEGIN);
+ SetFilePointer(ProtoList[i].hFile, sizeof(HOURLYSTATS), nullptr, FILE_BEGIN);
SetEndOfFile(ProtoList[i].hFile); // Óñåêàåì ôàéë äî îäíîé çàïèñè.
ProtoList[i].NumberOfRecords = 1;
ProtoList[i].AllStatistics = (HOURLYSTATS*)mir_realloc(ProtoList[i].AllStatistics, sizeof(HOURLYSTATS));
@@ -186,30 +186,30 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA Index = Stat_GetStartIndex(EldestAcc, unOptions.Stat_Tab, pdi->item.iItem, &st);
switch (unOptions.Stat_Tab) {
case 0: // Hourly
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, szBufW, 32);
mir_snwprintf(pdi->item.pszText, 32, L"%s %02d:00 - %02d:59",
szBufW,
ProtoList[EldestAcc].AllStatistics[Index].Hour,
ProtoList[EldestAcc].AllStatistics[Index].Hour);
break;
case 1: // Dayly
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pdi->item.pszText, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, pdi->item.pszText, 32);
break;
case 2: // Weekly
// Óõîäèì ê ïåðâîìó ïîíåäåëüíèêó ñëåâà.
SystemTimeToVariantTime(&st, &vartime);
vartime -= DayOfWeek(st.wDay, st.wMonth, st.wYear) - 1;
VariantTimeToSystemTime(vartime, &st);
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pdi->item.pszText, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, pdi->item.pszText, 32);
// Òåïåðü ê âîñêðåñåíüþ.
SystemTimeToVariantTime(&st, &vartime);
vartime += 6;
VariantTimeToSystemTime(vartime, &st);
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, szBufW, 32);
mir_snwprintf(pdi->item.pszText, 32, L"%s - %s", pdi->item.pszText, szBufW);
break;
case 3: // Monthly
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_YEARMONTH, &st, NULL, pdi->item.pszText, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_YEARMONTH, &st, nullptr, pdi->item.pszText, 32);
break;
case 4: // Yearly
mir_snwprintf(pdi->item.pszText, 32, L"%d", st.wYear);
@@ -306,14 +306,14 @@ void Stat_ReadFile(BYTE n) mir_free(pszPath);
GetLocalTime(&stNow);
ProtoList[n].hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
GetFileSizeEx(ProtoList[n].hFile, &Size);
if (Size.QuadPart != 0) // Åñëè ôàéë ñî ñòàòèñòèêîé ñóùåñòâóåò è èìååò íåíóëåâîé ðàçìåð...
{
// ...òî ÷èòàåì ñòàòèñòèêó èç ôàéëà
ProtoList[n].NumberOfRecords = DWORD(Size.QuadPart / sizeof(HOURLYSTATS));
ProtoList[n].AllStatistics = (HOURLYSTATS*)mir_alloc(sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords);
- ReadFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[0], sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords, &BytesRead, NULL);
+ ReadFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[0], sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords, &BytesRead, nullptr);
if (!BytesRead) {
MessageBox(TrafficHwnd, TranslateT("Couldn't read statistics file"), TranslateT("Traffic Counter"), MB_OK);
return;
@@ -384,8 +384,8 @@ void Stat_CheckStatistics(BYTE n) // Åñëè òåêóùåå âðåìÿ ñîâïàäàåò ñî âðåìåíåì ïîñëåäíåé çàïèñè...
if (!d) {
// ...ñîõðàíÿåì çàïèñü â ôàéë è óõîäèì.
- SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), NULL, FILE_END);
- WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, NULL);
+ SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), nullptr, FILE_END);
+ WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, nullptr);
return;
}
@@ -412,8 +412,8 @@ void Stat_CheckStatistics(BYTE n) if (d > 0) {
// Ñîõðàíÿåì.
- SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), NULL, FILE_END);
- WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, NULL);
+ SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), nullptr, FILE_END);
+ WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, nullptr);
// Ïîñëåäíÿÿ çàïèñü èç ñòàòèñòèêè ïîíàäîáèòñÿ äëÿ âû÷èñëåíèÿ íîâûõ çàïèñåé, ïîýòîìó êîïèðóåì å¸ (êðîìå òðàôèêà è âðåìåíè).
memcpy(&htTmp, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1],
@@ -442,7 +442,7 @@ void Stat_CheckStatistics(BYTE n) stLast.wYear = htTmp.Year;
// Äîáàâëÿåì çàïèñè îäíîâðåìåííî â ÎÇÓ è â ôàéë.
- WriteFile(ProtoList[n].hFile, &htTmp, sizeof(HOURLYSTATS), &q, NULL);
+ WriteFile(ProtoList[n].hFile, &htTmp, sizeof(HOURLYSTATS), &q, nullptr);
memcpy(&ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], &htTmp, sizeof(HOURLYSTATS));
} while (TimeCompare(stNow, stLast));
diff --git a/plugins/TrafficCounter/src/vars.cpp b/plugins/TrafficCounter/src/vars.cpp index 989df08b21..b7df5fb1ba 100644 --- a/plugins/TrafficCounter/src/vars.cpp +++ b/plugins/TrafficCounter/src/vars.cpp @@ -28,7 +28,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) DWORD tmp, tmpsn = 0, tmprn = 0, tmpst = 0, tmprt = 0;
BYTE ed;
- if (ai->argc != 5) return NULL;
+ if (ai->argc != 5) return nullptr;
if (!mir_wstrcmp(ai->targv[1], L"overall"))
{
@@ -65,7 +65,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) }
mir_free(buf);
}
- if (tmp != 0xAA) return NULL;
+ if (tmp != 0xAA) return nullptr;
}
if (!mir_wstrcmp(ai->targv[2], L"now"))
@@ -75,7 +75,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprn;
else
if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprn + tmpsn;
- else return NULL;
+ else return nullptr;
}
else
if (!mir_wstrcmp(ai->targv[2], L"total"))
@@ -85,9 +85,9 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprt;
else
if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprt + tmpst;
- else return NULL;
+ else return nullptr;
}
- else return NULL;
+ else return nullptr;
if (!mir_wstrcmp(ai->targv[4], L"b")) ed = 0;
else
@@ -96,18 +96,18 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) if (!mir_wstrcmp(ai->targv[4], L"m")) ed = 2;
else
if (!mir_wstrcmp(ai->targv[4], L"d")) ed = 3;
- else return NULL;
+ else return nullptr;
// Ïîëó÷àåì ôîðìàòèðîâàííóþ ñòðîêó è âîçâðàùàåì óêàçàòåëü íà íå¸.
// Ñíà÷àëà óçíàåì ðàçìåð áóôåðà.
- size_t l = GetFormattedTraffic(tmp, ed, NULL, 0);
+ size_t l = GetFormattedTraffic(tmp, ed, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t));
- if (!res) return NULL;
+ if (!res) return nullptr;
if (GetFormattedTraffic(tmp, ed, res, l))
return res;
mir_free(res);
- return NULL;
+ return nullptr;
}
static wchar_t* GetTime(ARGUMENTSINFO *ai)
@@ -115,7 +115,7 @@ static wchar_t* GetTime(ARGUMENTSINFO *ai) BYTE ed, flag;
DWORD Duration;
- if (ai->argc != 4) return NULL;
+ if (ai->argc != 4) return nullptr;
// Èùåì èíäåêñ ïðîòîêîëà, ïåðåäàííîãî ïåðâûì àðãóìåíòîì
for (flag = ed = 0; ed < NumberOfAccounts; ed++)
@@ -145,13 +145,13 @@ static wchar_t* GetTime(ARGUMENTSINFO *ai) else flag = 0;
}
- if (flag != 0xAA) return NULL;
+ if (flag != 0xAA) return nullptr;
// Ïîëó÷àåì ôîðìàòèðîâàííóþ ñòðîêó è âîçâðàùàåì óêàçàòåëü íà íå¸.
// Ñíà÷àëà óçíàåì ðàçìåð áóôåðà.
- size_t l = GetDurationFormatM(Duration, ai->targv[3], NULL, 0);
+ size_t l = GetDurationFormatM(Duration, ai->targv[3], nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t));
- if (!res) return NULL;
+ if (!res) return nullptr;
GetDurationFormatM(Duration, ai->targv[3], res, l);
return res;
diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp index e36052669f..74fdc4f130 100644 --- a/plugins/TranslitSwitcher/src/Layoutproc.cpp +++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp @@ -20,13 +20,13 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
SMADD_BATCHPARSE2 smgp;
-SMADD_BATCHPARSERES *smileyPrs = NULL;
+SMADD_BATCHPARSERES *smileyPrs = nullptr;
bool isItSmiley(unsigned int position)
{
unsigned int j;
- if (smileyPrs == NULL)
+ if (smileyPrs == nullptr)
return false;
for (j = 0; j < smgp.numSmileys; j++) {
@@ -47,10 +47,10 @@ static DWORD CALLBACK StreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG wchar_t* Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags)
{
- if (hwndRtf == 0)
- return NULL;
+ if (hwndRtf == nullptr)
+ return nullptr;
- wchar_t *pszText = NULL;
+ wchar_t *pszText = nullptr;
EDITSTREAM stream = { 0 };
stream.pfnCallback = StreamOutCallback;
stream.dwCookie = (DWORD_PTR)&pszText;
@@ -365,13 +365,13 @@ void Invert(wchar_t *str) void SwitchLayout(bool lastword)
{
HWND hwnd = GetForegroundWindow();
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return;
DWORD dwProcessID;
DWORD dwThreadID = GetWindowThreadProcessId(hwnd, &dwProcessID);
HWND hwnd2 = GetFocus();
- if (hwnd2 == NULL)
+ if (hwnd2 == nullptr)
return;
wchar_t szClassName[MAX_PATH];
@@ -424,7 +424,7 @@ void SwitchLayout(bool lastword) }
}
- if (smileyPrs != NULL)
+ if (smileyPrs != nullptr)
CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smileyPrs);
POPUPDATAT pd = { 0 };
@@ -489,7 +489,7 @@ void SwitchLayout(bool lastword) }
}
- if (smileyPrs != NULL)
+ if (smileyPrs != nullptr)
CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smileyPrs);
if (somethingIsSelected)
@@ -506,11 +506,11 @@ void SwitchLayout(bool lastword) void TranslitLayout(bool lastword)
{
HWND hwnd = GetForegroundWindow();
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return;
HWND hwnd2 = GetFocus();
- if (hwnd2 == NULL)
+ if (hwnd2 == nullptr)
return;
wchar_t szClassName[16];
@@ -573,11 +573,11 @@ void TranslitLayout(bool lastword) void InvertCase(bool lastword)
{
HWND hwnd = GetForegroundWindow();
- if (hwnd == NULL)
+ if (hwnd == nullptr)
return;
HWND hwnd2 = GetFocus();
- if (hwnd2 == NULL)
+ if (hwnd2 == nullptr)
return;
wchar_t szClassName[16];
@@ -697,7 +697,7 @@ int OnButtonPressed(WPARAM, LPARAM lParam) sel[i] = tchr;
}
}
- if (smileyPrs != NULL)
+ if (smileyPrs != nullptr)
CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smileyPrs);
break;
}
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 5f529e3837..d61b374d12 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
int hLangpack;
diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 97641a2370..de77c75a9d 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -25,7 +25,7 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) wchar_t *ptszHelpFile = db_get_wsa(NULL, "UserGuide", "PathToHelpFile");
- if (ptszHelpFile==0)
+ if (ptszHelpFile==nullptr)
{
mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
mir_wstrcpy(pszFileName, L"UserGuide.chm");
@@ -40,7 +40,7 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) else
{
LPTSTR pszDivider = wcsrchr(ptszHelpFile, '\\');
- if (pszDivider == NULL)
+ if (pszDivider == nullptr)
{
mir_wstrcpy(pszDirName, L"");
wcsncpy(pszFileName, ptszHelpFile, mir_wstrlen(ptszHelpFile));
@@ -59,7 +59,7 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) pszDirNameEx = Utils_ReplaceVarsW(pszDirName);
mir_free(pszDirName);
- ShellExecute(NULL, L"open", pszFileName, NULL, pszDirNameEx, SW_SHOW);
+ ShellExecute(nullptr, L"open", pszFileName, nullptr, pszDirNameEx, SW_SHOW);
mir_free(pszFileName);
mir_free(pszDirNameEx);
return 0;
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 0960b61b54..431accf995 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -69,7 +69,7 @@ static void CALLBACK SetExtraImage(LPARAM lParam) {
/* get contact's country */
int countryNumber = ServiceDetectContactOriginCountry(lParam, 0);
- ExtraIcon_SetIcon(hExtraIconSvc, lParam, (countryNumber != 0xFFFF || g_bUseUnknownFlag) ? LoadFlagHandle(countryNumber) : NULL);
+ ExtraIcon_SetIcon(hExtraIconSvc, lParam, (countryNumber != 0xFFFF || g_bUseUnknownFlag) ? LoadFlagHandle(countryNumber) : nullptr);
}
static int OnCListApplyIcons(WPARAM wParam, LPARAM)
@@ -135,7 +135,7 @@ static int OnMsgWndEvent(WPARAM, LPARAM lParam) switch (msgwe->uType) {
case MSG_WINDOW_EVT_OPENING:
msgwnd = gMsgWndList.find((MsgWndData*)&msgwe->hContact);
- if (msgwnd == NULL) {
+ if (msgwnd == nullptr) {
msgwnd = new MsgWndData(msgwe->hwndWindow, msgwe->hContact);
gMsgWndList.insert(msgwnd);
}
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 056bb048c4..95c95a443b 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -123,13 +123,13 @@ static int CountryNumberToBitmapIndex(int countryNumber) /************************* Utils **********************************/
-static HANDLE *phIconHandles = NULL;
+static HANDLE *phIconHandles = nullptr;
HICON LoadFlag(int countryNumber)
{
/* create identifier */
char *szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0);
- if (szCountry == NULL)
+ if (szCountry == nullptr)
szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber=0xFFFF,0);
char szId[20];
@@ -139,8 +139,8 @@ HICON LoadFlag(int countryNumber) HANDLE LoadFlagHandle(int countryNumber)
{
- if (phIconHandles == NULL)
- return NULL;
+ if (phIconHandles == nullptr)
+ return nullptr;
return phIconHandles[ CountryNumberToIndex(countryNumber) ];
}
@@ -157,7 +157,7 @@ int CountryNumberToIndex(int countryNumber) FIBITMAP* ConvertTo(FIBITMAP* dib, UINT destBits, bool greyscale)
{
- FIBITMAP* dib_res = NULL;
+ FIBITMAP* dib_res = nullptr;
switch (destBits) {
case 8:
// convert to 8Bits
@@ -192,7 +192,7 @@ FIBITMAP* ConvertTo(FIBITMAP* dib, UINT destBits, bool greyscale) FIBITMAP* LoadResource(UINT ID, LPTSTR lpType)
{
- FIBITMAP *dib = NULL;
+ FIBITMAP *dib = nullptr;
if (lpType) {
HRSRC hResInfo = FindResource(ghInst,MAKEINTRESOURCE(ID),lpType);
DWORD ResSize = SizeofResource(ghInst,hResInfo);
@@ -215,7 +215,7 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType) }
else {
HBITMAP hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED);
- if (hScrBM == NULL)
+ if (hScrBM == nullptr)
return dib;
dib = FIP->FI_CreateDIBFromHBITMAP(hScrBM);
DeleteObject(hScrBM);
@@ -229,7 +229,7 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) {
/* return handle */
if ((BOOL)lParam) {
- if (phIconHandles==NULL) return NULL;
+ if (phIconHandles==nullptr) return NULL;
return (INT_PTR)phIconHandles[CountryNumberToIndex((int)wParam)];
}
/* return icon */
@@ -241,28 +241,28 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) //TODO: use freeimage to create merget icon and add RGB(A) support
ICONINFO icoi;
BITMAP bm;
- HICON hIcon=NULL;
+ HICON hIcon=nullptr;
/* load both icons */
HICON hLowerIcon=(HICON)ServiceLoadFlagIcon((WPARAM)lParam,0);
- if (hLowerIcon == NULL) return NULL;
+ if (hLowerIcon == nullptr) return NULL;
HICON hUpperIcon=(HICON)ServiceLoadFlagIcon(wParam,0);
/* merge them */
if (GetIconInfo(hLowerIcon,&icoi)) {
- if (hUpperIcon!=NULL && GetObject(icoi.hbmColor,sizeof(bm),&bm)) {
- HDC hdc=CreateCompatibleDC(NULL);
- if (hdc!=NULL) {
+ if (hUpperIcon!=nullptr && GetObject(icoi.hbmColor,sizeof(bm),&bm)) {
+ HDC hdc=CreateCompatibleDC(nullptr);
+ if (hdc!=nullptr) {
POINT aptTriangle[3];
memset(&aptTriangle, 0, sizeof(aptTriangle));
aptTriangle[1].y=bm.bmHeight-1;
aptTriangle[2].x=bm.bmWidth-1;
HRGN hrgn=CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING);
- if (hrgn!=NULL) {
+ if (hrgn!=nullptr) {
SelectClipRgn(hdc,hrgn);
HBITMAP hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor);
- if (hbmPrev!=NULL) { /* error on select? */
- if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) {
- if (SelectObject(hdc,icoi.hbmMask)!=NULL) /* error on select? */
- DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_MASK);
+ if (hbmPrev!=nullptr) { /* error on select? */
+ if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_IMAGE)) {
+ if (SelectObject(hdc,icoi.hbmMask)!=nullptr) /* error on select? */
+ DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_MASK);
}
SelectObject(hdc,hbmPrev);
}
@@ -285,16 +285,16 @@ void InitIcons() {
// all those flag icons storing in a large 24bit opaque bitmap to reduce file size
FIBITMAP *dib = LoadResource(IDB_FLAGSPNG, L"PNG");
- if (dib == NULL)
+ if (dib == nullptr)
return;
if (FIP->FI_GetBPP(dib) != ILC_COLOR32)
- if (NULL == (dib = ConvertTo(dib, ILC_COLOR32, 0)))
+ if (nullptr == (dib = ConvertTo(dib, ILC_COLOR32, 0)))
return;
// create new dib
FIBITMAP *dib_ico = FIP->FI_Allocate(FIP->FI_GetWidth(dib), 16, ILC_COLOR32, 0, 0, 0);
- if (dib_ico == NULL) {
+ if (dib_ico == nullptr) {
FIP->FI_Unload(dib);
return;
}
@@ -306,7 +306,7 @@ void InitIcons() // copy dib to new dib_ico (centered)
if (FIP->FI_Paste(dib_ico, dib, 0, t - 1, 255 + 1)) {
- FIP->FI_Unload(dib); dib = NULL;
+ FIP->FI_Unload(dib); dib = nullptr;
// Calculate the number of bytes per pixel (3 for 24-bit or 4 for 32-bit)
int bytespp = FIP->FI_GetLine(dib_ico) / w;
@@ -333,15 +333,15 @@ void InitIcons() // create ImageList
HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, nCountriesCount);
- ImageList_Add(himl, hScrBM, NULL);
+ ImageList_Add(himl, hScrBM, nullptr);
DeleteObject(hScrBM);
- hScrBM = NULL;
+ hScrBM = nullptr;
- if (himl != NULL) {
+ if (himl != nullptr) {
phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
- if (phIconHandles != NULL) {
+ if (phIconHandles != nullptr) {
char szId[20];
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.w = LPGENW("Country flags");
sid.pszName = szId; // name to refer to icon when playing and in db
sid.flags = SIDF_SORTED | SIDF_UNICODE;
@@ -356,9 +356,9 @@ void InitIcons() index = CountryNumberToIndex(countries[i].id);
phIconHandles[index] = IcoLib_AddIcon(&sid);
- if (sid.hDefaultIcon != NULL)
+ if (sid.hDefaultIcon != nullptr)
DestroyIcon(sid.hDefaultIcon);
- mir_free(sid.description.w); sid.description.w = NULL;
+ mir_free(sid.description.w); sid.description.w = nullptr;
}
}
ImageList_Destroy(himl);
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index c907d10ad7..796e247cb4 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -231,7 +231,7 @@ static zodiac[] = { { 1, 19, LPGENW("Capricorn"), ICO_ZOD_CAPRICORN }, // Steinbock
{ 20, 49, LPGENW("Aquarius"), ICO_ZOD_AQUARIUS }, // Wassermann
{ 50, 79, LPGENW("Pisces"), ICO_ZOD_PISCES }, // Fische
- { 0, 0, NULL, "" } // end of array
+ { 0, 0, nullptr, "" } // end of array
};
MZodiac MAnnivDate::Zodiac()
@@ -442,7 +442,7 @@ int MAnnivDate::DBGetDateStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSe **/
int MAnnivDate::DBWriteDateStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
- if (hContact == INVALID_CONTACT_ID || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0)
+ if (hContact == INVALID_CONTACT_ID || pszModule == nullptr || *pszModule == 0 || pszSetting == nullptr || *pszSetting == 0)
return 1;
DWORD dwStamp = DateStamp();
@@ -474,7 +474,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) SetFlags(MADF_HASCUSTOM);
}
// if pszProto is set to NULL, this will be scaned only incase the birthday date has not been found yet
- else if (pszProto || (pszProto = Proto_GetBaseAccountName(hContact)) != NULL)
+ else if (pszProto || (pszProto = Proto_GetBaseAccountName(hContact)) != nullptr)
{
// try to get birthday from basic protocol
if (!DBGetDate(hContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
@@ -487,7 +487,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) const int def = db_mc_getDefaultNum(hContact);
if (def > -1 && def < INT_MAX) {
MCONTACT hSubContact = db_mc_getSub(hContact, def);
- if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) {
+ if (hSubContact != NULL && !DBGetBirthDate(hSubContact, nullptr)) {
RemoveFlags(MADF_HASCUSTOM);
SetFlags(MADF_HASMETA);
}
@@ -501,7 +501,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) for (int i = 0; i < cnt; i++) {
if (i != def) {
MCONTACT hSubContact = db_mc_getSub(hContact, i);
- if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) {
+ if (hSubContact != NULL && !DBGetBirthDate(hSubContact, nullptr)) {
RemoveFlags(MADF_HASCUSTOM);
SetFlags(MADF_HASMETA);
break;
@@ -692,9 +692,9 @@ static WORD AskUser(MCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *p DB::Contact::DisplayName(hContact), szDate, szoldDate);
MB.cbSize = sizeof(MSGBOX);
- MB.hParent = NULL;
+ MB.hParent = nullptr;
MB.hiLogo = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY);
- MB.hiMsg = NULL;
+ MB.hiMsg = nullptr;
MB.uType = MB_YESALLNO|MB_ICON_QUESTION|MB_INFOBAR|MB_NOPOPUP;
MB.ptszTitle = LPGENW("Update custom birthday");
MB.ptszInfoText = LPGENW("Keeps your custom birthday up to date.");
@@ -719,7 +719,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo // This birthday is a protocol based or metasubcontact's anniversary and no custom information exist,
// so directly back it up under all circumstances!
if ( _wFlags & (MADF_HASPROTO | MADF_HASMETA)) {
- if (lastAnswer == NULL) {
+ if (lastAnswer == nullptr) {
DBWriteDateStamp(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED);
DBWriteBirthDate(hContact);
}
diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index cb3a485fad..a615733c21 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -326,7 +326,7 @@ WORD MTime::TimeFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat) {
if (!ptszTimeFormat || !cchTimeFormat)
return 0;
- if ((cchTimeFormat = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &_SysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) {
+ if ((cchTimeFormat = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &_SysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) {
*ptszTimeFormat = 0;
return 0;
}
@@ -337,7 +337,7 @@ WORD MTime::DateFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat) {
if (!ptszTimeFormat || !cchTimeFormat)
return 0;
- if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &_SysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) {
+ if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &_SysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) {
*ptszTimeFormat = 0;
return 0;
}
@@ -358,7 +358,7 @@ WORD MTime::DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat) mtNow.GetLocalTime();
AltSysTime.wYear=mtNow.Year();
- if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &AltSysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) {
+ if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &AltSysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) {
*ptszTimeFormat = 0;
return 0;
}
@@ -381,7 +381,7 @@ WORD MTime::DateFormatLong(LPTSTR ptszTimeFormat, WORD cchTimeFormat) {
if (!ptszTimeFormat || !cchTimeFormat)
return 0;
- if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &_SysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) {
+ if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &_SysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) {
*ptszTimeFormat = 0;
return 0;
}
@@ -458,7 +458,7 @@ void MTime::GetLocalTime(MCONTACT hContact) int MTime::DBGetStamp (MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
- if (hContact == INVALID_CONTACT_ID || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0) {
+ if (hContact == INVALID_CONTACT_ID || pszModule == nullptr || pszModule[0] == 0 || pszSetting == nullptr || pszSetting[0] == 0) {
ZeroDate();
return 1;
}
@@ -475,7 +475,7 @@ int MTime::DBGetStamp (MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) int MTime::DBWriteStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
- if (hContact == INVALID_CONTACT_ID || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0)
+ if (hContact == INVALID_CONTACT_ID || pszModule == nullptr || pszModule[0] == 0 || pszSetting == nullptr || pszSetting[0] == 0)
return 1;
return db_set_dw(hContact, pszModule, pszSetting, TimeStamp());
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index df14d06c57..30283b2b2b 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -34,15 +34,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ CPsTree::CPsTree(LPPS pPs) { - _hWndTree = NULL; - _hImages = NULL; + _hWndTree = nullptr; + _hImages = nullptr; - _pItems = NULL; + _pItems = nullptr; _numItems = 0; _curItem = -1; _dwFlags = 0; - _hLabelEdit = NULL; - _hDragItem = NULL; + _hLabelEdit = nullptr; + _hDragItem = nullptr; _isDragging = FALSE; _pPs = pPs; } @@ -58,7 +58,7 @@ CPsTree::~CPsTree() if (_hLabelEdit) { DestroyWindow(_hLabelEdit); - _hLabelEdit = NULL; + _hLabelEdit = nullptr; } if (_pItems) { @@ -67,15 +67,15 @@ CPsTree::~CPsTree() if (_pItems[i]) { delete _pItems[i]; - _pItems[i] = NULL; + _pItems[i] = nullptr; } } MIR_FREE(_pItems); - _pItems = NULL; + _pItems = nullptr; _numItems = NULL; } ImageList_Destroy(_hImages); - _hImages = NULL; + _hImages = nullptr; } /** @@ -177,7 +177,7 @@ BYTE CPsTree::InitTreeItems(LPWORD needWidth) // init the iParent member for all the items for (i = 0; i < _numItems; i++) { - if (_pItems[i] && (pszGroup = _pItems[i]->ParentItemName()) != NULL) + if (_pItems[i] && (pszGroup = _pItems[i]->ParentItemName()) != nullptr) { int iParent = FindItemIndexByName(pszGroup); @@ -266,7 +266,7 @@ CPsTreeItem* CPsTree::FindItemByHandle(HTREEITEM hItem) { return _pItems[i]; } - return NULL; + return nullptr; } /** @@ -284,7 +284,7 @@ CPsTreeItem* CPsTree::FindItemByName(LPCSTR pszName) { return _pItems[i]; } - return NULL; + return nullptr; } /** @@ -304,7 +304,7 @@ CPsTreeItem* CPsTree::FindItemByResource(HINSTANCE hInst, int idDlg) return _pItems[i]; } } - return NULL; + return nullptr; } @@ -323,7 +323,7 @@ HTREEITEM CPsTree::FindItemHandleByName(LPCSTR pszName) { return _pItems[i]->Hti(); } - return NULL; + return nullptr; } /*********************************************************************************************************** @@ -343,7 +343,7 @@ void CPsTree::HideItem(const int iPageIndex) if (IsIndexValid(iPageIndex)) { TreeView_DeleteItem(_hWndTree, _pItems[iPageIndex]->Hti()); - _pItems[iPageIndex]->Hti(0); + _pItems[iPageIndex]->Hti(nullptr); _dwFlags |= PSTVF_STATE_CHANGED; } } @@ -369,16 +369,16 @@ HTREEITEM CPsTree::ShowItem(const int iPageIndex, LPWORD needWidth) !pti->Label()) { MsgErr(GetParent(_hWndTree), LPGENW("Due to a parameter error, one of the treeitems can't be added!")); - return NULL; + return nullptr; } // item is visible at the moment - if ((tvii.itemex.hItem = pti->Hti()) == NULL) + if ((tvii.itemex.hItem = pti->Hti()) == nullptr) { RECT rc; const int iParent = pti->Parent(); // init the rest of the treeitem - tvii.hParent = IsIndexValid(iParent) ? ShowItem(iParent, needWidth) : NULL; + tvii.hParent = IsIndexValid(iParent) ? ShowItem(iParent, needWidth) : nullptr; tvii.hInsertAfter = (_dwFlags & PSTVF_SORTTREE) ? TVI_SORT : TVI_LAST; tvii.itemex.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE; tvii.itemex.pszText = pti->Label(); @@ -391,10 +391,10 @@ HTREEITEM CPsTree::ShowItem(const int iPageIndex, LPWORD needWidth) tvii.itemex.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; } // insert item into tree if set visible - if ((tvii.itemex.hItem = TreeView_InsertItem(_hWndTree, &tvii)) == NULL) + if ((tvii.itemex.hItem = TreeView_InsertItem(_hWndTree, &tvii)) == nullptr) { MsgErr(GetParent(_hWndTree), LPGENW("A fatal error occurred on adding a property sheet page!\nDialog creation aborted!")); - return NULL; + return nullptr; } pti->Hti(tvii.itemex.hItem); // calculate width of treeview @@ -423,7 +423,7 @@ HTREEITEM CPsTree::MoveItem(HTREEITEM hItem, HTREEITEM hInsertAfter, BYTE bAsChi int iItemIndex; if (!hItem || !hInsertAfter) - return NULL; + return nullptr; if (hItem == hInsertAfter) return hItem; @@ -658,9 +658,9 @@ int CPsTree::BeginLabelEdit(HTREEITEM hItem) rc.left, rc.top, rcTree.right - rc.left, rc.bottom - rc.top, _hWndTree, - NULL, + nullptr, ghInst, - NULL ); + nullptr ); if (_hLabelEdit) { _hDragItem = hItem; @@ -705,8 +705,8 @@ int CPsTree::EndLabelEdit(const BYTE bSave) } } DestroyWindow(_hLabelEdit); - _hLabelEdit = NULL; - _hDragItem = NULL; + _hLabelEdit = nullptr; + _hDragItem = nullptr; return 0; } @@ -785,7 +785,7 @@ void CPsTree::PopupMenu() InsertMenuItem(hPopup, ++i, TRUE, &mii); } // show the popup menu - iItem = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, _hWndTree, NULL); + iItem = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, _hWndTree, nullptr); DestroyMenu(hPopup); switch (iItem) { @@ -799,7 +799,7 @@ void CPsTree::PopupMenu() DBResetState(); break; default: // show a hidden item - if ((iItem -= 100) >= 0 && ShowItem(iItem, NULL)) + if ((iItem -= 100) >= 0 && ShowItem(iItem, nullptr)) AddFlags(PSTVF_STATE_CHANGED | PSTVF_POS_CHANGED); break; } @@ -839,7 +839,7 @@ BYTE CPsTree::OnInfoChanged() pshn.hdr.code = PSN_INFOCHANGED; for (int i = 0; i < _numItems; i++) { pshn.hdr.hwndFrom = _pItems[i]->Wnd(); - if (pshn.hdr.hwndFrom != NULL) { + if (pshn.hdr.hwndFrom != nullptr) { pshn.lParam = (LPARAM)_pItems[i]->hContact(); SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn); if (PSP_CHANGED == GetWindowLongPtr(pshn.hdr.hwndFrom, DWLP_MSGRESULT)) @@ -862,9 +862,9 @@ BYTE CPsTree::OnSelChanging() { CPsTreeItem *pti = CurrentItem(); - if (pti != NULL) { + if (pti != nullptr) { TreeView_SetItemState(_hWndTree, pti->Hti(), 0, TVIS_SELECTED); - if (pti->Wnd() != NULL) { + if (pti->Wnd() != nullptr) { PSHNOTIFY pshn; pshn.hdr.code = PSN_KILLACTIVE; @@ -894,12 +894,12 @@ void CPsTree::OnSelChanged(LPNMTREEVIEW lpnmtv) _curItem = (int)lpnmtv->itemNew.lParam; if (pti = CurrentItem()) { - if (pti->Wnd() == NULL) { + if (pti->Wnd() == nullptr) { pti->CreateWnd(_pPs); } } // hide old page even if new item has no valid one - if (oldPage && oldPage->Wnd() != NULL) + if (oldPage && oldPage->Wnd() != nullptr) ShowWindow(oldPage->Wnd(), SW_HIDE); if (pti) ShowWindow(pti->Wnd(), SW_SHOW); @@ -938,7 +938,7 @@ void CPsTree::OnCancel() int CPsTree::OnApply() { CPsTreeItem *pti = CurrentItem(); - if (pti == NULL) + if (pti == nullptr) return 1; PSHNOTIFY pshn; diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index b006a05789..56be6b3605 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -44,15 +44,15 @@ BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hWnd, LPARAM lParam) * odp - optiondialogpage structure with the info about the item to add
* return: nothing
**/
-CPsTreeItem::CPsTreeItem() : _idDlg(NULL), _pTemplate(NULL), _hInst(NULL), _pfnDlgProc(NULL), _hWnd(NULL), _dwFlags(NULL),
- _hItem(NULL), // handle to the treeview item
+CPsTreeItem::CPsTreeItem() : _idDlg(NULL), _pTemplate(nullptr), _hInst(nullptr), _pfnDlgProc(nullptr), _hWnd(nullptr), _dwFlags(NULL),
+ _hItem(nullptr), // handle to the treeview item
_iParent(-1), // index to the parent item
_iImage(-1), // index of treeview item's image
_bState(NULL), // initial state of this treeitem
- _pszName(NULL), // original name, given by plugin (not customized)
- _ptszLabel(NULL),
- _pszProto(NULL),
- _pszPrefix(NULL),
+ _pszName(nullptr), // original name, given by plugin (not customized)
+ _ptszLabel(nullptr),
+ _pszProto(nullptr),
+ _pszPrefix(nullptr),
_hContact(NULL),
_iPosition(0),
_initParam(0)
@@ -97,7 +97,7 @@ LPCSTR CPsTreeItem::PropertyKey(LPCSTR pszProperty) **/
LPCSTR CPsTreeItem::GlobalName()
{
- LPSTR pgn = NULL;
+ LPSTR pgn = nullptr;
if (_dwFlags & PSPF_PROTOPREPENDED) {
pgn = mir_strchr(_pszName, '\\');
@@ -137,7 +137,7 @@ LPCSTR CPsTreeItem::IconKey() mir_snprintf(pszSetting, MODNAME"_{%s}", pszIconName);
return pszSetting;
}
- return NULL;
+ return nullptr;
}
/**
@@ -159,7 +159,7 @@ LPSTR CPsTreeItem::ParentItemName() int cchGroup = p - _pszName + 1;
return mir_strncpy((LPSTR)mir_alloc(cchGroup), _pszName, cchGroup);
}
- return NULL;
+ return nullptr;
}
/**
@@ -186,7 +186,7 @@ int CPsTreeItem::Name(LPTSTR ptszTitle, const BYTE bIsUnicode) }
}
}
- return _pszName == NULL;
+ return _pszName == nullptr;
}
/**
@@ -245,7 +245,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) mir_free(_ptszLabel);
// try to get custom label from database
- if (!bReadDBValue || DB::Setting::GetTString(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), &dbv) || (_ptszLabel = dbv.ptszVal) == NULL) {
+ if (!bReadDBValue || DB::Setting::GetTString(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), &dbv) || (_ptszLabel = dbv.ptszVal) == nullptr) {
// extract the name
LPSTR pszName = mir_strrchr(_pszName, '\\');
if (pszName && pszName[1])
@@ -260,7 +260,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) }
}
// return nonezero if label is invalid
- return _ptszLabel == NULL;
+ return _ptszLabel == nullptr;
}
/**
@@ -273,7 +273,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) HICON CPsTreeItem::ProtoIcon()
{
if (!_pszName)
- return NULL;
+ return nullptr;
PROTOACCOUNT **pa;
int ProtoCount;
@@ -289,7 +289,7 @@ HICON CPsTreeItem::ProtoIcon() return hIco;
}
}
- return NULL;
+ return nullptr;
}
/**
@@ -316,7 +316,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn bool bNeedFree = false;
ptrW pwszSection(mir_a2u(SECT_TREE));
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.flags = SIDF_ALL_UNICODE;
sid.pszName = (LPSTR)pszIconName;
sid.description.w = _ptszLabel;
@@ -413,11 +413,11 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) }
// set the unique utf8 encoded name for the item
if (err = Name(szTitle, (_dwFlags & ODPF_UNICODE) == ODPF_UNICODE))
- MsgErr(NULL, LPGENW("Creating unique name for a page failed with %d and error code %d"), err, GetLastError());
+ MsgErr(nullptr, LPGENW("Creating unique name for a page failed with %d and error code %d"), err, GetLastError());
// read label from database or create it
else if (err = ItemLabel(TRUE))
- MsgErr(NULL, LPGENW("Creating the label for a page failed with %d and error code %d"), err, GetLastError());
+ MsgErr(nullptr, LPGENW("Creating the label for a page failed with %d and error code %d"), err, GetLastError());
else {
// load icon for the item
Icon(pPsh->_hImages, odp, (pPsh->_dwFlags & PSTVF_INITICONS) == PSTVF_INITICONS);
@@ -437,7 +437,7 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) // error for no longer supported dialog template type
if (((UINT_PTR)odp->pszTemplate & 0xFFFF0000))
- MsgErr(NULL, LPGENW("The dialog template type is no longer supported"));
+ MsgErr(nullptr, LPGENW("The dialog template type is no longer supported"));
else {
// fetch dialog resource id
_idDlg = (INT_PTR)odp->pszTemplate;
@@ -507,7 +507,7 @@ HWND CPsTreeItem::CreateWnd(LPPS pPs) {
if (pPs && !_hWnd && _pTemplate && _pfnDlgProc) {
_hWnd = CreateDialogIndirectParam(_hInst, _pTemplate, pPs->hDlg, _pfnDlgProc, (LPARAM)_hContact);
- if (_hWnd != NULL) {
+ if (_hWnd != nullptr) {
PSHNOTIFY pshn;
pshn.hdr.code = PSN_PARAMCHANGED;
pshn.hdr.hwndFrom = _hWnd;
@@ -535,7 +535,7 @@ HWND CPsTreeItem::CreateWnd(LPPS pPs) return _hWnd;
}
}
- return NULL;
+ return nullptr;
}
/***********************************************************************************************************
@@ -594,7 +594,7 @@ void CPsTreeItem::OnIconsChanged(CPsTree *pTree) RECT rc;
// update tree item icons
- if (pTree->ImageList() && (hIcon = IcoLib_GetIcon(IconKey())) != NULL) {
+ if (pTree->ImageList() && (hIcon = IcoLib_GetIcon(IconKey())) != nullptr) {
_iImage = (_iImage > 0)
? ImageList_ReplaceIcon(pTree->ImageList(), _iImage, hIcon)
: ImageList_AddIcon(pTree->ImageList(), hIcon);
diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 69488a542f..0bd406ea1e 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
// global:
-HINSTANCE ghInst = NULL;
-FI_INTERFACE *FIP = NULL; //freeimage interface
-CLIST_INTERFACE *pcli = NULL;
+HINSTANCE ghInst = nullptr;
+FI_INTERFACE *FIP = nullptr; //freeimage interface
+CLIST_INTERFACE *pcli = nullptr;
MGLOBAL myGlobals;
pfnDwmIsCompositionEnabled dwmIsCompositionEnabled;
@@ -134,7 +134,7 @@ unsigned int __fastcall hash_M2(const void * key, unsigned int len) unsigned int hashSettingW_M2(const char * key)
{
- if (key == NULL) return 0;
+ if (key == nullptr) return 0;
const unsigned int len = (unsigned int)mir_wstrlen((const wchar_t*)key);
char* buf = (char*)alloca(len + 1);
for (unsigned i = 0; i <= len ; ++i)
@@ -144,14 +144,14 @@ unsigned int hashSettingW_M2(const char * key) unsigned int hashSetting_M2(const char * key)
{
- if (key == NULL) return 0;
+ if (key == nullptr) return 0;
const unsigned int len = (unsigned int)mir_strlen((const char*)key);
return hash_M2(key, len);
}
unsigned int hashSetting_M2(const wchar_t * key)
{
- if (key == NULL) return 0;
+ if (key == nullptr) return 0;
const unsigned int len = (unsigned int)mir_wstrlen((const wchar_t*)key);
return hash_M2(key, len * sizeof(wchar_t));
}
diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp index 05828dfc61..0c6e34bd54 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp +++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CBaseCtrl* CAnnivEditCtrl::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting)
{
- CAnnivEditCtrl *ctrl = NULL;
+ CAnnivEditCtrl *ctrl = nullptr;
ctrl = new CAnnivEditCtrl(hDlg, idCtrl, pszSetting);
if (ctrl)
@@ -43,7 +43,7 @@ CAnnivEditCtrl::CAnnivEditCtrl(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) _hwndDate = GetDlgItem(hDlg, EDIT_ANNIVERSARY_DATE);
_ReminderEnabled = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
- _pDates = NULL;
+ _pDates = nullptr;
_curDate = 0;
_numDates = 0;
@@ -69,14 +69,14 @@ CAnnivEditCtrl::~CAnnivEditCtrl() {
WORD i;
- if (_pDates != NULL)
+ if (_pDates != nullptr)
{
for (i = 0; i < _numDates; i++)
{
delete _pDates[i];
}
mir_free(_pDates);
- _pDates = NULL;
+ _pDates = nullptr;
}
}
@@ -95,7 +95,7 @@ void CAnnivEditCtrl::Release() **/
BYTE CAnnivEditCtrl::ItemValid(WORD wIndex) const
{
- return (_pDates != NULL && wIndex < _numDates && _pDates[wIndex] != NULL);
+ return (_pDates != nullptr && wIndex < _numDates && _pDates[wIndex] != nullptr);
}
/**
@@ -168,14 +168,14 @@ MAnnivDate* CAnnivEditCtrl::FindDateById(const WORD wId) {
WORD i;
- if (_pDates != NULL) {
+ if (_pDates != nullptr) {
for (i = 0; i < _numDates; i++) {
if (_pDates[i]->Id() < ANID_NONE && _pDates[i]->Id() == wId) {
return _pDates[i];
}
}
}
- return NULL;
+ return nullptr;
}
/**
@@ -190,7 +190,7 @@ INT_PTR CAnnivEditCtrl::AddDate(MAnnivDate &mda) MAnnivDate *pmda, **pmd;
// if a date with wID exists, replace it
- if ((pmda = FindDateById(mda.Id())) != NULL) {
+ if ((pmda = FindDateById(mda.Id())) != nullptr) {
BYTE bChanged = pmda->IsChanged(),
bRemindChanged = pmda->IsReminderChanged();
@@ -321,7 +321,7 @@ INT_PTR CAnnivEditCtrl::DBWriteBirthDay(MCONTACT hContact) {
MAnnivDate *pmdb;
- if ((pmdb = FindDateById(ANID_BIRTHDAY)) == NULL)
+ if ((pmdb = FindDateById(ANID_BIRTHDAY)) == nullptr)
return 1;
if (pmdb->IsChanged()) {
@@ -354,7 +354,7 @@ INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(MCONTACT hContact) for (i = 0; i < _numDates; i++) {
if (
- _pDates[i] != NULL &&
+ _pDates[i] != nullptr &&
!_pDates[i]->DBWriteAnniversaryDate(hContact, wIndex) &&
!_pDates[i]->DBWriteReminderOpts(hContact)
)
@@ -454,7 +454,7 @@ void CAnnivEditCtrl::OnMenuPopup() }
ClientToScreen(_hBtnMenu, &pt);
GetClientRect(_hBtnMenu, &rc);
- i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, _hwndDlg, NULL);
+ i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, _hwndDlg, nullptr);
DestroyMenu(hMenu);
SendMessage(_hBtnMenu, BM_SETCHECK, NULL, NULL);
if (i >= WM_USER) SetCurSel(i - WM_USER);
@@ -506,7 +506,7 @@ void CAnnivEditCtrl::OnRemindEditChanged() if (pCurrent)
{
- UINT iVal = GetDlgItemInt(_hwndDlg, EDIT_REMIND, NULL, FALSE);
+ UINT iVal = GetDlgItemInt(_hwndDlg, EDIT_REMIND, nullptr, FALSE);
if (iVal != pCurrent->RemindOffset() && IsDlgButtonChecked(_hwndDlg, RADIO_REMIND2) == BST_CHECKED)
{
SendMessage(GetParent(_hwndDlg), PSM_CHANGED, NULL, NULL);
@@ -587,7 +587,7 @@ void CAnnivEditCtrl::SetZodiacAndAge(MAnnivDate *mt) MZodiac zod;
zod = mt->Zodiac();
- if (zod.pszName != NULL)
+ if (zod.pszName != nullptr)
{
ShowWindow(GetDlgItem(_hwndDlg, TEXT_ZODIAC), SW_SHOW);
SetDlgItemText(_hwndDlg, TEXT_ZODIAC, TranslateW(zod.pszName));
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index 38b8ef5fc3..534bf8edc2 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -46,7 +46,7 @@ typedef struct TMBCtrl{ // External theme methods and properties
static mir_cs csTips;
-static HWND hwndToolTips = NULL;
+static HWND hwndToolTips = nullptr;
/**
* name: DestroyTheme
@@ -57,11 +57,11 @@ static HWND hwndToolTips = NULL; static void __fastcall DestroyTheme(BTNCTRL *ctl) {
if (ctl->hThemeButton) {
CloseThemeData(ctl->hThemeButton);
- ctl->hThemeButton = NULL;
+ ctl->hThemeButton = nullptr;
}
if (ctl->hThemeToolbar) {
CloseThemeData(ctl->hThemeToolbar);
- ctl->hThemeToolbar = NULL;
+ ctl->hThemeToolbar = nullptr;
}
}
@@ -120,7 +120,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT OffsetRect(rcText, rcImage.right + 4, 0);
if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1);
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hIcon, 0,
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hIcon, 0,
rcImage.left, rcImage.top,
rcImage.right - rcImage.left, rcImage.bottom - rcImage.top,
IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED);
@@ -137,7 +137,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT rcImage.top = (rcClient->bottom - rcClient->top - rcImage.bottom) / 2;
if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1);
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0,
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0,
rcImage.left, rcImage.top,
rcImage.right - rcImage.left, rcImage.bottom - rcImage.top,
IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED);
@@ -205,7 +205,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien wszText,
ccText,
DST_PREFIXTEXT,
- NULL,
+ nullptr,
&sizeText);
if (ctl->cHot) {
@@ -218,7 +218,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien L"&",
1,
DST_PREFIXTEXT,
- NULL,
+ nullptr,
&rcHot);
sizeText.right -= (rcHot.right - rcHot.left);
@@ -259,7 +259,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) // Draw the flat button
if (ctl->dwStyle & MBS_FLAT) {
- HBRUSH hbr = NULL;
+ HBRUSH hbr = nullptr;
if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT)
hbr = GetSysColorBrush(COLOR_3DLIGHT);
@@ -338,7 +338,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) : GetSysColor(COLOR_BTNTEXT)
: GetSysColor(COLOR_GRAYTEXT));
- DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0,
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)szText, 0,
rcText.left, rcText.top, rcText.right - rcText.left, rcText.bottom - rcText.top,
IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
SelectObject(hdcMem, hOldFont);
@@ -393,7 +393,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L }
if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) {
DestroyWindow(hwndToolTips);
- hwndToolTips = NULL;
+ hwndToolTips = nullptr;
}
}
DestroyTheme(bct);
@@ -413,7 +413,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L }
tmp++;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
case WM_SYSKEYUP:
@@ -421,7 +421,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L if (bct->dwStyle & MBS_PUSHBUTTON) {
if (bct->pbState) bct->pbState = 0;
else bct->pbState = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
else
SetFocus(hwndBtn);
@@ -432,7 +432,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_THEMECHANGED:
// themed changed, reload theme object
LoadTheme(bct);
- InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it
+ InvalidateRect(bct->hwnd, nullptr, TRUE); // repaint it
break;
case WM_SETFONT: // remember the font so we can use it later
bct->hFont = (HFONT)wParam; // maybe we should redraw?
@@ -472,13 +472,13 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BM_SETIMAGE:
if (wParam == IMAGE_ICON) {
bct->hIcon = (HICON)lParam;
- bct->hBitmap = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ bct->hBitmap = nullptr;
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
else if (wParam == IMAGE_BITMAP) {
- bct->hIcon = NULL;
+ bct->hIcon = nullptr;
bct->hBitmap = (HBITMAP)lParam;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
case BM_SETCHECK:
@@ -491,20 +491,20 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L bct->pbState = 0;
bct->stateId = PBS_NORMAL;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BM_GETCHECK:
if (bct->dwStyle & MBS_PUSHBUTTON) return bct->pbState ? BST_CHECKED : BST_UNCHECKED;
return 0;
case BUTTONSETDEFAULT:
bct->defbutton = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONADDTOOLTIP:
if (wParam) {
mir_cslock lck(csTips);
if (!hwndToolTips)
- hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandleA("mir_app.mir"), NULL);
+ hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandleA("mir_app.mir"), nullptr);
if (lParam == MBBF_UNICODE) {
TOOLINFOW ti;
@@ -549,29 +549,29 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L break;
case WM_SETFOCUS: // set keybord bFocus and redraw
bct->bFocus = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_KILLFOCUS: // kill bFocus and redraw
bct->bFocus = 0;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_WINDOWPOSCHANGED:
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_ENABLE: // windows tells us to enable/disable
bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_MOUSELEAVE: // faked by the WM_TIMER
if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
case WM_LBUTTONDOWN:
if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_PRESSED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
case WM_LBUTTONUP:
@@ -587,16 +587,16 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L // Tell your daddy you got clicked, if mouse is still over the button.
if ((bct->dwStyle & MBS_PUSHBUTTON) || bPressed)
SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn);
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
case WM_MOUSEMOVE:
if (bct->stateId == PBS_NORMAL) {
bct->stateId = PBS_HOT;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
// Call timer, used to start cheesy TrackMouseEvent faker
- SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, NULL);
+ SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, nullptr);
break;
case WM_TIMER: // use a timer to check if they have did a mouseout
if (wParam == BUTTON_POLLID) {
@@ -630,7 +630,7 @@ void CtrlButtonLoadModule() wc.cbSize = sizeof(wc);
wc.lpszClassName = UINFOBUTTONCLASS;
wc.lpfnWndProc = Button_WndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(LPBTNCTRL);
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
diff --git a/plugins/UserInfoEx/src/ctrl_combo.cpp b/plugins/UserInfoEx/src/ctrl_combo.cpp index 8480e0f969..fb23e48f0c 100644 --- a/plugins/UserInfoEx/src/ctrl_combo.cpp +++ b/plugins/UserInfoEx/src/ctrl_combo.cpp @@ -144,7 +144,7 @@ void CCombo::Release() **/
BOOL CCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
{
- if (!_Flags.B.hasChanged && _pList != NULL) {
+ if (!_Flags.B.hasChanged && _pList != nullptr) {
DBVARIANT dbv;
int iVal = CB_ERR;
@@ -194,7 +194,7 @@ void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) LPIDSTRLIST pd;
pd = (LPIDSTRLIST)SendMessage(_hwnd, CB_GETITEMDATA, _curSel, 0);
- if (pd != NULL) {
+ if (pd != nullptr) {
switch (_bDataType) {
case DBVT_BYTE:
db_set_b(hContact, pszModule, _pszSetting, pd->nID);
@@ -221,7 +221,7 @@ void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) _Flags.B.hasChanged = false;
OnInfoChanged(hContact, pszProto);
}
- InvalidateRect(_hwnd, NULL, TRUE);
+ InvalidateRect(_hwnd, nullptr, TRUE);
}
}
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index f86c9be82c..35460aa35a 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -340,7 +340,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam if (noRecursion) break;
noRecursion = 1;
{
- wchar_t szText[MAXDATASIZE], *pText = 0, *pArea, *pNumber;
+ wchar_t szText[MAXDATASIZE], *pText = nullptr, *pArea, *pNumber;
bool isValid = true;
GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText));
if (szText[0] != '+')
@@ -447,8 +447,8 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L WS_VISIBLE|WS_CHILD|WS_TABSTOP, 0, 0,
wWidth, wHeight,
hwnd,
- NULL,
- cbex->hInstance, NULL))) {
+ nullptr,
+ cbex->hInstance, nullptr))) {
cbex->bLocked = 0;
return FALSE;
}
@@ -456,13 +456,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L wWidth = wHeight;
if (!(cbex->hBtnMenu = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
UINFOBUTTONCLASS,
- NULL,
+ nullptr,
WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_PUSHBUTTON|MBS_DOWNARROW,
x, 0,
wWidth, wHeight,
hwnd,
- NULL,
- cbex->hInstance, NULL))) {
+ nullptr,
+ cbex->hInstance, nullptr))) {
DestroyWindow(cbex->hBtnEdit);
cbex->bLocked = 0;
return FALSE;
@@ -471,13 +471,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L wWidth = (WORD)(cbex->rect.right - cbex->rect.left - x - (2 * (wHeight + 2)));
if (!(cbex->hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
L"Edit",
- NULL,
+ nullptr,
WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL,
x, 1,
wWidth, wHeight - 2,
hwnd,
- NULL,
- cbex->hInstance, NULL))) {
+ nullptr,
+ cbex->hInstance, nullptr))) {
DestroyWindow(cbex->hBtnEdit);
DestroyWindow(cbex->hBtnMenu);
cbex->bLocked = 0;
@@ -487,13 +487,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L wWidth = wHeight;
if (!(cbex->hBtnAdd = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
UINFOBUTTONCLASS,
- NULL,
+ nullptr,
WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT,
x, 0,
wWidth, wHeight,
hwnd,
- NULL,
- cbex->hInstance, NULL))) {
+ nullptr,
+ cbex->hInstance, nullptr))) {
DestroyWindow(cbex->hBtnEdit);
DestroyWindow(cbex->hBtnMenu);
DestroyWindow(cbex->hEdit);
@@ -503,13 +503,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L x += wWidth + 2;
if (!(cbex->hBtnDel = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
UINFOBUTTONCLASS,
- NULL,
+ nullptr,
WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT,
x, 0,
wWidth, wHeight,
hwnd,
- NULL,
- cbex->hInstance, NULL))) {
+ nullptr,
+ cbex->hInstance, nullptr))) {
DestroyWindow(cbex->hBtnEdit);
DestroyWindow(cbex->hBtnMenu);
DestroyWindow(cbex->hEdit);
@@ -641,7 +641,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L }
ClientToScreen((HWND)lParam, &pt);
GetClientRect((HWND)lParam, &rc);
- i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, NULL);
+ i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, nullptr);
SendMessage(cbex->hBtnMenu, BM_SETCHECK, NULL, NULL);
if (i >= CBEXM_MENIITEMFIRST && i < CBEXM_MENIITEMFIRST + cbex->numItems) {
CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, (WPARAM)i - CBEXM_MENIITEMFIRST, NULL);
@@ -870,7 +870,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED;
cbex->pItems[cbex->iSelectedItem].wFlags |= (hContact ? CTRLF_HASCUSTOM : CTRLF_HASPROTO);
cbex->bIsChanged = TRUE;
- InvalidateRect((HWND)lParam, NULL, TRUE);
+ InvalidateRect((HWND)lParam, nullptr, TRUE);
SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
}
return 0;
@@ -953,7 +953,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0])
cbex->pItems[cbex->numItems].pszVal = mir_wstrdup(pItem->pszVal);
else
- cbex->pItems[cbex->numItems].pszVal = NULL;
+ cbex->pItems[cbex->numItems].pszVal = nullptr;
// set icon
if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) {
cbex->pItems[cbex->numItems].pszIcon = pItem->pszIcon;
@@ -1107,7 +1107,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MIR_FREE(cbex->pItems[i].pszVal);
}
MIR_FREE(cbex->pItems);
- cbex->pItems = NULL;
+ cbex->pItems = nullptr;
}
cbex->numItems = 0;
cbex->iSelectedItem = -1;
@@ -1253,7 +1253,7 @@ int CtrlContactLoadModule() wc.cbSize = sizeof(wc);
wc.lpszClassName = UINFOCOMBOEXCLASS;
wc.lpfnWndProc = CtrlContactWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(LPCBEX);
wc.hbrBackground = (HBRUSH)GetStockObject(COLOR_WINDOW);
wc.style = CS_GLOBALCLASS;
@@ -1288,13 +1288,13 @@ int CtrlContactAddItemFromDB( DBVARIANT dbv;
CBEXITEM cbi;
- cbi.pszVal = NULL;
+ cbi.pszVal = nullptr;
cbi.dwID = hashSetting(szSettingVal);
cbi.wFlags = CBEXIF_CATREADONLY|DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, szSettingVal, &dbv);
if (dbv.type >= DBVT_WCHAR) {
// no value read from database
if (cbi.wFlags == CBEXIF_CATREADONLY)
- cbi.pszVal = NULL;
+ cbi.pszVal = nullptr;
else { // check the database value
cbi.pszVal = dbv.ptszVal;
if (LPTSTR sms = wcsstr(cbi.pszVal, L" SMS")) {
@@ -1357,7 +1357,7 @@ int CtrlContactAddMyItemsFromDB( cbi.dwID = hashSetting(pszSetting);
cbi.pszVal = dbv.ptszVal;
dbv.type = DBVT_DELETED;
- dbv.ptszVal = NULL;
+ dbv.ptszVal = nullptr;
// read category
if (SUCCEEDED(mir_snprintf(pszSetting, szFormatCat, i))) {
@@ -1374,7 +1374,7 @@ int CtrlContactAddMyItemsFromDB( if (dbv.type > DBVT_DELETED && dbv.ptszVal && *dbv.ptszVal) {
cbi.pszCat = dbv.ptszVal;
dbv.type = DBVT_DELETED;
- dbv.ptszVal = NULL;
+ dbv.ptszVal = nullptr;
}
}
if (sms = wcsstr(cbi.pszVal, L" SMS")) {
@@ -1387,11 +1387,11 @@ int CtrlContactAddMyItemsFromDB( bAnyItemIsChanged |= (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED;
if (cbi.pszCat) {
mir_free(cbi.pszCat);
- cbi.pszCat = NULL;
+ cbi.pszCat = nullptr;
}
if (cbi.pszVal) {
mir_free(cbi.pszVal);
- cbi.pszVal = NULL;
+ cbi.pszVal = nullptr;
}
}
SendMessage(hCtrl, CBEXM_SORT, NULL, NULL);
@@ -1435,7 +1435,7 @@ int CtrlContactWriteItemToDB( cbi.wFlags &= ~CTRLF_CHANGED;
cbi.wMask = CBEXIM_FLAGS;
CtrlContactWndProc(hCtrl, CBEXM_SETITEM, NULL, (LPARAM)&cbi);
- InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), nullptr, TRUE);
return 0;
}
@@ -1499,6 +1499,6 @@ int CtrlContactWriteMyItemsToDB( }
DB::Setting::DeleteArray(hContact, pszModule, szFormatCat, i);
DB::Setting::DeleteArray(hContact, pszModule, szFormatVal, i);
- InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), nullptr, TRUE);
return 0;
}
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index 3fb01c479b..1da43c143c 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -179,15 +179,15 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) dbv.type = _dbType; switch (_dbType) { case DBVT_BYTE: - dbv.bVal = (BYTE)wcstol(val, NULL, 10); + dbv.bVal = (BYTE)wcstol(val, nullptr, 10); break; case DBVT_WORD: - dbv.wVal = (WORD)wcstol(val, NULL, 10); + dbv.wVal = (WORD)wcstol(val, nullptr, 10); break; case DBVT_DWORD: - dbv.dVal = (DWORD)wcstol(val, NULL, 10); + dbv.dVal = (DWORD)wcstol(val, nullptr, 10); break; case DBVT_WCHAR: @@ -209,7 +209,7 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) // save new value MIR_FREE(_pszValue); _pszValue = val; - val = NULL; + val = nullptr; } } } @@ -223,7 +223,7 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) OnInfoChanged(hContact, pszProto); } - InvalidateRect(_hwnd, NULL, TRUE); + InvalidateRect(_hwnd, nullptr, TRUE); } } @@ -253,7 +253,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) need_free = 1; } - if (szText != NULL) { + if (szText != nullptr) { GetWindowText(_hwnd, szText, cch + 1); _Flags.B.hasChanged = mir_wstrcmp(_pszValue, szText) != 0; if (need_free) @@ -261,7 +261,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) } else _Flags.B.hasChanged = false; } - InvalidateRect(_hwnd, NULL, TRUE); + InvalidateRect(_hwnd, nullptr, TRUE); if (_Flags.B.hasChanged) SendMessage(GetParent(GetParent(_hwnd)), PSM_CHANGED, 0, 0); @@ -295,12 +295,12 @@ void CEditCtrl::OpenUrl() LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk) { - if (lnk == NULL) + if (lnk == nullptr) return FALSE; switch (lnk->msg) { case WM_SETCURSOR: - SetCursor(LoadCursor(NULL, IDC_HAND)); + SetCursor(LoadCursor(nullptr, IDC_HAND)); SetWindowLongPtr(GetParent(_hwnd), DWLP_MSGRESULT, TRUE); return TRUE; @@ -323,7 +323,7 @@ LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk) need_free = 1; } if (tr.lpstrText && (SendMessage(_hwnd, EM_GETTEXTRANGE, NULL, (LPARAM)&tr) > 0)) { - if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL) { + if (wcschr(tr.lpstrText, '@') != nullptr && wcschr(tr.lpstrText, ':') == nullptr && wcschr(tr.lpstrText, '/') == nullptr) { memmove(tr.lpstrText + 7, tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1)*sizeof(wchar_t)); memcpy(tr.lpstrText, L"mailto:", (7 * sizeof(wchar_t))); } diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index b92524006f..86c2b251fb 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -40,7 +40,7 @@ CBaseCtrl* CTzCombo::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) //set the adress of our timezone handle as itemdata
//caller can obtain the handle htz to extract all relevant information
ctrl->_curSel = 0;
- TimeZone_PrepareList(NULL, NULL, hCtrl, TZF_PLF_CB);
+ TimeZone_PrepareList(NULL, nullptr, hCtrl, TZF_PLF_CB);
}
return (ctrl);
}
@@ -133,7 +133,7 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) const char* pszModule = hContact ? USERINFO : pszProto;
if (_Flags.B.hasCustom || !hContact) {
//use new core tz interface
- TimeZone_StoreListResult(hContact, NULL, _hwnd, TZF_PLF_CB);
+ TimeZone_StoreListResult(hContact, nullptr, _hwnd, TZF_PLF_CB);
if (!hContact) {
_Flags.B.hasCustom = false;
_Flags.B.hasProto = true;
@@ -150,7 +150,7 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) _Flags.B.hasChanged = false;
OnInfoChanged(hContact, pszProto);
}
- InvalidateRect(_hwnd, NULL, TRUE);
+ InvalidateRect(_hwnd, nullptr, TRUE);
}
}
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index f999611d19..6c2d1e3c1f 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CAnnivList;
-static CAnnivList *gpDlg = NULL;
+static CAnnivList *gpDlg = nullptr;
/***********************************************************************************************************
* class CAnnivList
@@ -84,8 +84,8 @@ class CAnnivList {
wDaysBefore = (WORD)-1;
bFilterIndex = 0;
- pszProto = NULL;
- pszAnniv = NULL;
+ pszProto = nullptr;
+ pszAnniv = nullptr;
}
} _filter;
@@ -114,7 +114,7 @@ class CAnnivList _pDate->DBWriteReminderOpts(_hContact);
}
delete _pDate;
- _pDate = NULL;
+ _pDate = nullptr;
}
}
};
@@ -203,7 +203,7 @@ class CAnnivList {
if (!(_wndPos->flags & SWP_NOSIZE)) {
HWND hCtrl = GetDlgItem(_wndPos->hwnd, idCtrl);
- if (NULL != hCtrl) { /* Wine fix. */
+ if (nullptr != hCtrl) { /* Wine fix. */
RECT rcc = _CalcPos(hCtrl, anchors);
_hdWnds = DeferWindowPos(
_hdWnds, //HDWP hWinPosInfo
@@ -414,7 +414,7 @@ class CAnnivList if (hPopup) {
POINT pt;
GetCursorPos(&pt);
- TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, NULL);
+ TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, nullptr);
DestroyMenu(hPopup);
}
}
@@ -456,7 +456,7 @@ class CAnnivList // number of days to remind in advance is edited
case EDIT_REMIND:
if (pid && pDlg->_bRemindEnable && HIWORD(wParam) == EN_CHANGE) {
- WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE);
+ WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), nullptr, FALSE);
if (pid->_wReminderState == BST_CHECKED && pid->_wDaysBefore != wDaysBefore) {
pid->_wDaysBefore = wDaysBefore;
}
@@ -470,7 +470,7 @@ class CAnnivList BYTE isChecked = Button_GetCheck((HWND)lParam);
EnableWindow(GetDlgItem(hDlg, EDIT_DAYS), isChecked);
EnableWindow(GetDlgItem(hDlg, TXT_DAYS), isChecked);
- pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, NULL, FALSE) : (WORD)-1;
+ pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, nullptr, FALSE) : (WORD)-1;
pDlg->RebuildList();
}
break;
@@ -478,7 +478,7 @@ class CAnnivList // the number of days a contact must have an anniversary in advance to be displayed is edited
case EDIT_DAYS:
if (HIWORD(wParam) == EN_CHANGE) {
- WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE);
+ WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), nullptr, FALSE);
if (wNewDays != pDlg->_filter.wDaysBefore) {
pDlg->_filter.wDaysBefore = wNewDays;
pDlg->RebuildList();
@@ -816,7 +816,7 @@ class CAnnivList if (ListView_GetItem(_hList, &lvi) && PtrIsValid(lvi.lParam))
return (CItemData *)lvi.lParam;
}
- return NULL;
+ return nullptr;
}
// This method loads all filter settings from db
@@ -830,7 +830,7 @@ class CAnnivList void SaveFilter()
{
if (_hDlg) {
- db_set_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, NULL, FALSE));
+ db_set_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, nullptr, FALSE));
db_set_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYSENABLED, (BYTE)Button_GetCheck(GetDlgItem(_hDlg, CHECK_DAYS)));
db_set_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_INDEX, (BYTE)ComboBox_GetCurSel(GetDlgItem(_hDlg, EDIT_DAYS)));
}
@@ -841,7 +841,7 @@ public: // This is the default constructor.
CAnnivList()
{
- _hList = NULL;
+ _hList = nullptr;
_sortHeader = 0;
_sortOrder = 1;
_curSel = -1;
@@ -850,11 +850,11 @@ public: _rcWin.left = _rcWin.right = _rcWin.top = _rcWin.bottom = 0;
LoadFilter();
- _hDlg = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), NULL, DlgProc, (LPARAM)this);
+ _hDlg = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), nullptr, DlgProc, (LPARAM)this);
if (_hDlg)
_mHookExit = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, _hDlg, WM_CLOSE);
else {
- _mHookExit = NULL;
+ _mHookExit = nullptr;
delete this;
}
}
@@ -865,7 +865,7 @@ public: // delete the shutdown hook
if (_mHookExit) {
UnhookEvent(_mHookExit);
- _mHookExit = NULL;
+ _mHookExit = nullptr;
}
// close window if required
@@ -893,7 +893,7 @@ public: DestroyWindow(_hDlg);
}
}
- gpDlg = NULL;
+ gpDlg = nullptr;
}
/**
@@ -933,7 +933,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM) }
catch(...) {
delete gpDlg;
- gpDlg = NULL;
+ gpDlg = nullptr;
}
}
else
@@ -958,7 +958,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM) **/
void DlgAnniversaryListOnTopToolBarLoaded()
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_USERINFO_REMINDER_LIST;
ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_ANNIVERSARY);
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 8a83a0e286..3a5e3161b4 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -75,14 +75,14 @@ static HICON MsgLoadIcon(LPMSGBOX pMsgBox) case MB_ICON_WARNING:
case MB_ICON_INFO:
{
- LPCTSTR ico[] = { 0, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION };
- hIcon = LoadIcon(NULL, ico[MB_ICON_INDEX(pMsgBox->uType)]);
+ LPCTSTR ico[] = { nullptr, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION };
+ hIcon = LoadIcon(nullptr, ico[MB_ICON_INDEX(pMsgBox->uType)]);
}
break;
// no icon
default:
- hIcon = NULL;
+ hIcon = nullptr;
}
return hIcon;
}
@@ -671,7 +671,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI mb.cbSize = sizeof(MSGBOX);
mb.hParent = hParent;
mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN);
- mb.hiMsg = NULL;
+ mb.hiMsg = nullptr;
mb.ptszTitle = TranslateW(pszTitle);
mb.ptszInfoText = TranslateW(pszInfo);
mb.ptszMsg = tszMsg;
@@ -698,7 +698,7 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) mb.cbSize = sizeof(MSGBOX);
mb.hParent = hParent;
mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN);
- mb.hiMsg = NULL;
+ mb.hiMsg = nullptr;
mb.ptszTitle = tszTitle;
mb.ptszMsg = tszMsg;
mb.uType = MB_OK | MB_ICON_ERROR;
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 6e300df305..6324c74669 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -59,8 +59,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ***********************************************************************************************************/
static BYTE bInitIcons = INIT_ICONS_NONE;
-static MWindowList g_hWindowList = NULL;
-static HANDLE g_hDetailsInitEvent = NULL;
+static MWindowList g_hWindowList = nullptr;
+static HANDLE g_hDetailsInitEvent = nullptr;
static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -69,12 +69,12 @@ CPsHdr::CPsHdr() {
_dwSize = sizeof(*this);
_hContact = NULL;
- _pszProto = NULL;
- _pszPrefix = NULL;
- _pPages = NULL;
+ _pszProto = nullptr;
+ _pszPrefix = nullptr;
+ _pPages = nullptr;
_numPages = 0;
_dwFlags = 0;
- _hImages = NULL;
+ _hImages = nullptr;
}
CPsHdr::~CPsHdr()
@@ -139,7 +139,7 @@ private: EnableWindow(GetDlgItem(_pPs->hDlg, IDAPPLY), FALSE);
mir_snprintf(_pPs->szUpdating, "%s (%s)", Translate("Uploading"), (*_pPd)->szModuleName);
ShowWindow(GetDlgItem(_pPs->hDlg, TXT_UPDATING), SW_SHOW);
- SetTimer(_pPs->hDlg, TIMERID_UPDATING, 100, NULL);
+ SetTimer(_pPs->hDlg, TIMERID_UPDATING, 100, nullptr);
return 0;
}
}
@@ -158,9 +158,9 @@ public: CPsUpload(LPPS pPs, BYTE bExitAfter)
{
_pPs = pPs;
- _pPd = NULL;
+ _pPd = nullptr;
_numProto = 0;
- _hUploading = NULL;
+ _hUploading = nullptr;
_bExitAfterUploading = bExitAfter;
}
@@ -179,7 +179,7 @@ public: * @return nothing
**/
~CPsUpload()
- { _pPs->pUpload = NULL; }
+ { _pPs->pUpload = nullptr; }
/**
* @name Handle
@@ -267,8 +267,8 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) // create imagelist
metrics.x = GetSystemMetrics(SM_CXSMICON);
metrics.y = GetSystemMetrics(SM_CYSMICON);
- if ((psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) == NULL) {
- MsgErr(NULL, LPGENW("Creating the image list failed!"));
+ if ((psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) == nullptr) {
+ MsgErr(nullptr, LPGENW("Creating the image list failed!"));
return 1;
}
@@ -284,14 +284,14 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) if (psh._hContact == NULL) {
// mark owner icons as initiated
bInitIcons |= INIT_ICONS_OWNER;
- psh._pszProto = NULL;
- psh._pszPrefix = NULL;
+ psh._pszProto = nullptr;
+ psh._pszPrefix = nullptr;
}
else {
// get contact's protocol
psh._pszPrefix = psh._pszProto = Proto_GetBaseAccountName(wParam);
- if (psh._pszProto == NULL) {
- MsgErr(NULL, LPGENW("Could not find contact's protocol. Maybe it is not active!"));
+ if (psh._pszProto == nullptr) {
+ MsgErr(nullptr, LPGENW("Could not find contact's protocol. Maybe it is not active!"));
return 1;
}
// prepare scanning for metacontact's subcontact's pages
@@ -302,7 +302,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) // add the pages
NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, wParam);
if (!psh._pPages || !psh._numPages) {
- MsgErr(NULL, LPGENW("No pages have been added. Canceling dialog creation!"));
+ MsgErr(nullptr, LPGENW("No pages have been added. Canceling dialog creation!"));
return 1;
}
@@ -329,8 +329,8 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) qsort(psh._pPages, psh._numPages, sizeof(CPsTreeItem*), (int(*)(const void*, const void*))SortProc);
// create the dialog itself
- if (!CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProc, (LPARAM)&psh))
- MsgErr(NULL, LPGENW("Details dialog failed to be created. Returning error is %d."), GetLastError());
+ if (!CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_DETAILS), nullptr, DlgProc, (LPARAM)&psh))
+ MsgErr(nullptr, LPGENW("Details dialog failed to be created. Returning error is %d."), GetLastError());
return 0;
}
@@ -348,7 +348,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE *)lParam;
// check size of the handled structures
- if (pPsh == NULL || odp == NULL || pPsh->_dwSize != sizeof(CPsHdr))
+ if (pPsh == nullptr || odp == nullptr || pPsh->_dwSize != sizeof(CPsHdr))
return 1;
// try to check whether the flag member is initialized or not
@@ -382,7 +382,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) // resize the array
pPsh->_pPages = (CPsTreeItem **)mir_realloc(pPsh->_pPages, (pPsh->_numPages + 1) * sizeof(CPsTreeItem*));
- if (pPsh->_pPages != NULL) {
+ if (pPsh->_pPages != nullptr) {
pPsh->_pPages[pPsh->_numPages++] = pNew;
return 0;
}
@@ -400,7 +400,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) static int OnDeleteContact(WPARAM wParam, LPARAM)
{
HWND hWnd = WindowList_Find(g_hWindowList, wParam);
- if (hWnd != NULL)
+ if (hWnd != nullptr)
DestroyWindow(hWnd);
return 0;
}
@@ -426,7 +426,7 @@ static int OnShutdown(WPARAM, LPARAM) *
* @return 0
**/
-static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProto = NULL)
+static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProto = nullptr)
{
wchar_t szTitle[MAX_PATH];
const BYTE ofs = (pszProto) ? mir_snwprintf(szTitle, L"%S\\", pszProto) : 0;
@@ -587,7 +587,7 @@ void DlgContactInfoInitTreeIcons() // load all treeitems for owner contact
if (!(bInitIcons & INIT_ICONS_OWNER)) {
psh._hContact = NULL;
- psh._pszProto = NULL;
+ psh._pszProto = nullptr;
NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact);
if (psh._pPages) {
psh.Free_pPages();
@@ -863,7 +863,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case 0x031E: /*WM_DWMCOMPOSITIONCHANGED:*/
ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG), IsAeroMode());
- InvalidateRect(hDlg, NULL, TRUE);
+ InvalidateRect(hDlg, nullptr, TRUE);
break;
/**
@@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hBoldFont);
return TRUE;
}
- *(HFONT *)lParam = NULL;
+ *(HFONT *)lParam = nullptr;
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0);
break;
@@ -962,7 +962,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hContact);
return TRUE;
}
- *(HANDLE *)lParam = NULL;
+ *(HANDLE *)lParam = nullptr;
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, NULL);
}
break;
@@ -993,7 +993,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar return TRUE;
}
}
- *(LPCSTR *)lParam = NULL;
+ *(LPCSTR *)lParam = nullptr;
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0);
break;
@@ -1067,7 +1067,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case PSM_GETPAGEHWND:
if (CPsTreeItem *pti = pPs->pTree->FindItemByResource((HINSTANCE)lParam, wParam)) {
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->Wnd());
- return (pti->Wnd() != NULL);
+ return (pti->Wnd() != nullptr);
}
return FALSE;
@@ -1276,7 +1276,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (iSubContact < pPs->nSubContacts) {
// init the acks structure for a sub contact
- if (pPs->infosUpdated[iSubContact].acks == NULL) {
+ if (pPs->infosUpdated[iSubContact].acks == nullptr) {
pPs->infosUpdated[iSubContact].acks = (LPINT)mir_calloc(sizeof(int) * (int)(INT_PTR)ack->hProcess);
pPs->infosUpdated[iSubContact].count = (int)(INT_PTR)ack->hProcess;
}
@@ -1395,7 +1395,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ScreenToClient(pPs->pTree->Window(), &hti.pt);
TreeView_HitTest(pPs->pTree->Window(), &hti);
if ((hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) && hti.hItem == TreeView_GetSelection(pPs->pTree->Window()))
- SetTimer(hDlg, TIMERID_RENAME, 500, NULL);
+ SetTimer(hDlg, TIMERID_RENAME, 500, nullptr);
}
break;
@@ -1423,11 +1423,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar BYTE height = (BYTE)(rc.bottom - rc.top);
if (hti.pt.y - (height / 3) < rc.top) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
TreeView_SetInsertMark(pPs->pTree->Window(), hti.hItem, 0);
}
else if (hti.pt.y + (height / 3) > rc.bottom) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
TreeView_SetInsertMark(pPs->pTree->Window(), hti.hItem, 1);
}
else {
@@ -1452,7 +1452,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TreeView_SetInsertMark(pPs->pTree->Window(), NULL, 0);
ReleaseCapture();
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
TVHITTESTINFO hti;
hti.pt.x = (SHORT)LOWORD(lParam);
@@ -1552,7 +1552,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (ProtoServiceExists(Proto_GetBaseAccountName(hSubContact), PSS_GETINFO)) {
pPs->infosUpdated = (TAckInfo *)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1));
pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact;
- pPs->infosUpdated[pPs->nSubContacts].acks = NULL;
+ pPs->infosUpdated[pPs->nSubContacts].acks = nullptr;
pPs->infosUpdated[pPs->nSubContacts].count = 0;
pPs->nSubContacts++;
}
@@ -1570,7 +1570,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (bDo) {
EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE);
ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_SHOW);
- SetTimer(hDlg, TIMERID_UPDATING, 100, NULL);
+ SetTimer(hDlg, TIMERID_UPDATING, 100, nullptr);
}
}
}
@@ -1581,7 +1581,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE);
ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_SHOW);
- SetTimer(hDlg, TIMERID_UPDATING, 100, NULL);
+ SetTimer(hDlg, TIMERID_UPDATING, 100, nullptr);
}
}
break;
@@ -1624,16 +1624,16 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "DetailsDlg");
// save current tree and destroy it
- if (pPs->pTree != NULL) {
+ if (pPs->pTree != nullptr) {
// save tree's current look
pPs->pTree->SaveState();
delete pPs->pTree;
- pPs->pTree = NULL;
+ pPs->pTree = nullptr;
}
DeleteObject(pPs->hCaptionFont);
DeleteObject(pPs->hBoldFont);
- mir_free(pPs); pPs = NULL;
+ mir_free(pPs); pPs = nullptr;
}
return FALSE;
}
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 34eb007d36..af55004dc5 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -30,13 +30,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ CExImContactBase::CExImContactBase() { - _pszNick = NULL; - _pszDisp = NULL; - _pszGroup = NULL; - _pszProto = NULL; - _pszProtoOld = NULL; - _pszAMPro = NULL; - _pszUIDKey = NULL; + _pszNick = nullptr; + _pszDisp = nullptr; + _pszGroup = nullptr; + _pszProto = nullptr; + _pszProtoOld = nullptr; + _pszAMPro = nullptr; + _pszUIDKey = nullptr; _dbvUIDHash = NULL; memset(&_dbvUID, 0, sizeof(DBVARIANT)); _hContact = INVALID_CONTACT_ID; @@ -115,7 +115,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) else { uidSetting = (LPCSTR)CallProtoService(pszProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); // valid - if (uidSetting != NULL && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { + if (uidSetting != nullptr && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { _pszUIDKey = mir_strdup(uidSetting); if (!DB::Setting::GetAsIs(_hContact, pszProto, uidSetting, &_dbvUID)) { ret = TRUE; @@ -158,8 +158,8 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) **/ BYTE CExImContactBase::fromIni(LPSTR& row) { - LPSTR p1, p2 = NULL; - LPSTR pszUIDValue, pszUIDSetting, pszProto = NULL; + LPSTR p1, p2 = nullptr; + LPSTR pszUIDValue, pszUIDSetting, pszProto = nullptr; LPSTR pszBuf = &row[0]; size_t cchBuf = mir_strlen(row); @@ -230,7 +230,7 @@ MCONTACT CExImContactBase::toDB() // create new contact if none exists if (_hContact == INVALID_CONTACT_ID && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { PROTOACCOUNT *pszAccount = Proto_GetAccount(_pszProto); - if (pszAccount == NULL) { + if (pszAccount == nullptr) { //account does not exist return _hContact = INVALID_CONTACT_ID; } @@ -279,7 +279,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) if (_hContact){ int loaded = _pszUIDKey ? 1 : 0; - if (_pszProto == NULL || !loaded) { + if (_pszProto == nullptr || !loaded) { if (_pszProto){ if (_pszNick) mir_snprintf(name,"%s (%s)", _pszNick, _pszProto); @@ -384,8 +384,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) break; case DBVT_WCHAR: //'u' pwszVal is valid r = mir_utf8encodeW(_dbvUID.pwszVal); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; if (bPrependType == FALSE) return r; *ptr++ = 'u'; @@ -399,8 +399,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) break; case DBVT_ASCIIZ: r = mir_utf8encode(_dbvUID.pszVal); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; if (bPrependType == FALSE) return r; *ptr++ = 's'; @@ -411,8 +411,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) if (bPrependType) { //True = XML baselen = mir_base64_encode_bufsize(_dbvUID.cpbVal); r = (LPSTR)mir_alloc((baselen + 8)); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; memset((r + baselen), 0, 8); ptr = r; if (bPrependType) { // Allways true. @@ -421,15 +421,15 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) } if (!mir_base64_encodebuf(_dbvUID.pbVal, _dbvUID.cpbVal, ptr, baselen)) { mir_free(r); - return NULL; + return nullptr; } return r; } else { //FALSE = INI baselen = ((_dbvUID.cpbVal * 3) + 8); r = (LPSTR)mir_alloc(baselen); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; memset(r, 0, baselen); ptr = r; for (SIZE_T j = 0; j < _dbvUID.cpbVal; j ++, ptr += 3) { @@ -439,7 +439,7 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) } break; default: - return NULL; + return nullptr; } return mir_strdup(szUID); } @@ -460,7 +460,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) // compare protocols pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto == NULL || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) + if (pszProto == nullptr || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) return FALSE; // compare uids @@ -477,7 +477,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal,_pszNick)) { LPTSTR ptszNick = mir_utf8decodeW(_pszNick); LPTSTR ptszProto = mir_a2u(_pszProto); - int ans = MsgBox(NULL, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), + int ans = MsgBox(nullptr, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), LPGENW("The contact %s(%s) has no unique ID in the vCard,\nbut there is a contact in your contact list with the same nick and protocol.\nDo you wish to use this contact?"), ptszNick, ptszProto); MIR_FREE(ptszNick); diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index de3135c5b4..f01d6a66fb 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -49,7 +49,7 @@ static int SortProc(const LPDWORD item1, const LPDWORD item2) CExImContactXML::CExImContactXML(CFileXml *pXmlFile)
: CExImContactBase()
{
- _xmlNode = NULL;
+ _xmlNode = nullptr;
_pXmlFile = pXmlFile;
_hEvent = NULL;
}
@@ -84,7 +84,7 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey) char buf[MAXSETTING];
// convert to hash and make bsearch as it is much faster then working with strings
const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, _countof(buf))));
- return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL;
+ return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != nullptr;
}
return FALSE;
}
@@ -131,7 +131,7 @@ TiXmlElement* CExImContactXML::CreateXmlElement() }
}
}
- else _xmlNode = NULL;
+ else _xmlNode = nullptr;
}
else _xmlNode = new TiXmlElement(XKEY_OWNER);
@@ -238,14 +238,14 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) // add xContact to document
if (_xmlNode->NoChildren()) {
delete _xmlNode;
- _xmlNode = NULL;
+ _xmlNode = nullptr;
return ERROR_NOT_ADDED;
}
_xmlNode->Print(xmlfile, 1);
fputc('\n', xmlfile);
delete _xmlNode;
- _xmlNode = NULL;
+ _xmlNode = nullptr;
return ERROR_OK;
}
@@ -294,10 +294,10 @@ int CExImContactXML::ExportModule(LPCSTR pszModule) int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LPCSTR pszSetting)
{
- TiXmlElement *xmlEntry = NULL;
- TiXmlText *xmlValue = NULL;
+ TiXmlElement *xmlEntry = nullptr;
+ TiXmlText *xmlValue = nullptr;
CHAR buf[32];
- LPSTR str = NULL;
+ LPSTR str = nullptr;
DBVARIANT dbv;
if (DB::Setting::GetAsIs(_hContact, pszModule, pszSetting, &dbv))
@@ -353,7 +353,7 @@ int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LP // new buffer for base64 encoded data
INT_PTR baselen = mir_base64_encode_bufsize(dbv.cpbVal);
str = (LPSTR)mir_alloc(baselen + 6);
- assert(str != NULL);
+ assert(str != nullptr);
// encode data
if ( mir_base64_encodebuf(dbv.pbVal, dbv.cpbVal, str+1, baselen)) {
str[baselen+1] = 0;
@@ -420,7 +420,7 @@ BYTE CExImContactXML::ExportEvents() // find module
TiXmlNode *xmlModule;
- for (xmlModule = _xmlNode->FirstChild(); xmlModule != NULL; xmlModule = xmlModule->NextSibling())
+ for (xmlModule = _xmlNode->FirstChild(); xmlModule != nullptr; xmlModule = xmlModule->NextSibling())
if (!mir_strcmpi(((TiXmlElement*)xmlModule)->Attribute("key"), dbei.szModule))
break;
@@ -458,10 +458,10 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents) numSettings = numEvents = 0;
for (TiXmlNode *xmod = _xmlNode->FirstChild();
- xmod != NULL;
+ xmod != nullptr;
xmod = xmod->NextSibling(XKEY_MOD)) {
for (TiXmlNode *xkey = xmod->FirstChild();
- xkey != NULL;
+ xkey != nullptr;
xkey = xkey->NextSibling()) {
if (!mir_strcmpi(xkey->Value(), XKEY_SET))
numSettings++;
@@ -481,7 +481,7 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents) int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact)
{
- if (xContact == NULL)
+ if (xContact == nullptr)
return ERROR_INVALID_PARAMS;
// delete last contact
@@ -504,7 +504,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) // meta contact must be uniquelly identified by its subcontacts
// the metaID may change during an export or import call
- for(xSub = xContact->FirstChildElement(XKEY_CONTACT); xSub != NULL; xSub = xSub->NextSiblingElement(XKEY_CONTACT)) {
+ for(xSub = xContact->FirstChildElement(XKEY_CONTACT); xSub != nullptr; xSub = xSub->NextSiblingElement(XKEY_CONTACT)) {
CExImContactXML vSub(_pXmlFile);
if (vSub = xSub) {
// identify metacontact by the first valid subcontact in xmlfile
@@ -536,9 +536,9 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) if (_pszUIDKey && mir_strcmp("#NV", _pszUIDKey) != 0) {
LPCSTR pUID = xContact->Attribute("uidv");
- if (pUID != NULL) {
+ if (pUID != nullptr) {
unsigned valLen;
- PBYTE pbVal = NULL;
+ PBYTE pbVal = nullptr;
switch (*(pUID++)) {
case 'b':
@@ -559,11 +559,11 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) break;
case 'n':
pbVal = (PBYTE)mir_base64_decode(pUID, &valLen);
- if (pbVal != NULL)
+ if (pbVal != nullptr)
uidn(pbVal, valLen);
break;
default:
- uidu((LPCSTR)NULL);
+ uidu((LPCSTR)nullptr);
break;
}
}
@@ -597,12 +597,12 @@ int CExImContactXML::ImportContact() _pXmlFile->_numEventsTodo += numEvents;
// import all modules
- for (TiXmlNode *xmod = _xmlNode->FirstChild(); xmod != NULL; xmod = xmod->NextSibling(XKEY_MOD)) {
+ for (TiXmlNode *xmod = _xmlNode->FirstChild(); xmod != nullptr; xmod = xmod->NextSibling(XKEY_MOD)) {
// import module
if (ImportModule(xmod) == ERROR_ABORTED) {
// ask to delete new incomplete contact
if (_isNewContact && _hContact != NULL) {
- int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING,
+ int result = MsgBox(nullptr, MB_YESNO|MB_ICONWARNING,
LPGENW("Question"),
LPGENW("Importing a new contact was aborted!"),
LPGENW("You aborted import of a new contact.\nSome information may be missing for this contact.\n\nDo you want to delete the incomplete contact?"));
@@ -741,7 +741,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) if (_isNewContact && _hContact != NULL) {
LPTSTR ptszNick = mir_utf8decodeW(_pszNick);
LPTSTR ptszMetaNick = mir_utf8decodeW(pMetaContact->_pszNick);
- int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING,
+ int result = MsgBox(nullptr, MB_YESNO|MB_ICONWARNING,
LPGENW("Question"),
LPGENW("Importing a new meta subcontact failed!"),
LPGENW("The newly created meta subcontact '%s'\ncould not be added to metacontact '%s'!\n\nDo you want to delete this contact?"),
@@ -789,7 +789,7 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule) if (!mir_strcmpi(pszModule, "Protocol"))
return ERROR_OK;
- for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != NULL; xKey = xKey->NextSiblingElement()) {
+ for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != nullptr; xKey = xKey->NextSiblingElement()) {
// import setting
if (!mir_strcmpi(xKey->Value(), XKEY_SET)) {
// check if the module to import is the contact's protocol module
@@ -892,7 +892,7 @@ int CExImContactXML::ImportSetting(LPCSTR pszModule, TiXmlElement *xmlEntry) case 'n':
dbv.type = DBVT_BLOB;
dbv.pbVal = (PBYTE)mir_base64_decode(value + 1, &baselen);
- if (dbv.pbVal != NULL)
+ if (dbv.pbVal != nullptr)
dbv.cpbVal = baselen;
else {
mir_free(dbv.pbVal);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 13d8558ec7..35b5b31444 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -85,20 +85,20 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) TVITEMA tvi;
CHAR szBuf[128];
- if (!pszText || !*pszText) return NULL;
+ if (!pszText || !*pszText) return nullptr;
tvi.mask = TVIF_TEXT;
tvi.pszText = szBuf;
tvi.cchTextMax = _countof(szBuf);
for (tvi.hItem = TreeView_GetChild(hTree, hParent);
- tvi.hItem != NULL;
+ tvi.hItem != nullptr;
tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem))
{
if (SendMessageA(hTree, TVM_GETITEMA, NULL, (LPARAM)&tvi) && !mir_strcmpi(tvi.pszText, pszText))
return tvi.hItem;
}
- return NULL;
+ return nullptr;
}
/**
@@ -114,7 +114,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE bUseImages, BYTE bState)
{
TVINSERTSTRUCTA tvii;
- HTREEITEM hItem = NULL;
+ HTREEITEM hItem = nullptr;
tvii.hParent = hParent;
tvii.hInsertAfter = TVI_SORT;
@@ -176,13 +176,13 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar if (GetVersionEx(&osvi)) {
HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),
((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16)|ILC_MASK,0, 1);
- if (hImages != NULL)
+ if (hImages != nullptr)
{
SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages);
HICON hIcon;
- bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon))
- && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon)));
+ bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != nullptr) && 0 == ImageList_AddIcon(hImages, hIcon))
+ && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != nullptr) && 1 == ImageList_AddIcon(hImages, hIcon)));
}
}
}
@@ -195,7 +195,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar }
// Set the Window Title and description
{
- LPCTSTR name = NULL;
+ LPCTSTR name = nullptr;
wchar_t oldTitle[MAXDATASIZE],
newTitle[MAXDATASIZE];
switch (pDat->ExImContact->Typ) {
@@ -236,7 +236,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar pszProto = (pDat->ExImContact->Typ == EXIM_CONTACT && pDat->ExImContact->hContact != NULL)
? (LPSTR)Proto_GetBaseAccountName(pDat->ExImContact->hContact)
- : NULL;
+ : nullptr;
// add items that are always exported
tviiT.hParent = TVI_ROOT;
@@ -369,7 +369,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // search the tree item of optional items
for (hParent = TreeView_GetRoot(hTree);
- hParent != NULL;
+ hParent != nullptr;
hParent = TreeView_GetNextSibling(hTree, hParent))
{
ExportTree_AppendModuleList(hTree, hParent, pDat->pModules);
@@ -393,7 +393,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // search the tree item of optional items
for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL);
- tvi.hItem != NULL && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi);
+ tvi.hItem != nullptr && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi);
tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem))
{
if (!mir_strcmpi(tvi.pszText, pszRoot)) {
@@ -402,7 +402,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar tvi.stateMask = TVIS_STATEIMAGEMASK;
for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)tvi.hItem);
- tvi.hItem != NULL;
+ tvi.hItem != nullptr;
tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem))
{
SendMessageA(hTree, TVM_SETITEMA, NULL, (LPARAM)&tvi);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 466ad2a89c..8cf1ef0cc9 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -90,7 +90,7 @@ static void InitAlteredPlacesBar() **/
static void ResetAlteredPlaceBars()
{
- RegOverridePredefKey(HKEY_CURRENT_USER, NULL);
+ RegOverridePredefKey(HKEY_CURRENT_USER, nullptr);
SHDeleteKey(HKEY_CURRENT_USER, HKEY_MIRANDA_PLACESBAR);
}
@@ -174,7 +174,7 @@ static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM, LP HWND hPlacesBar = GetDlgItem(GetParent(hDlg), ctl1);
// we have a places bar?
- if (hPlacesBar != NULL) {
+ if (hPlacesBar != nullptr) {
InitAlteredPlacesBar();
// finally subclass the places bar
mir_subclassWindow(hPlacesBar, PlacesBarSubclassProc);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index aaf300bc55..67b1f7a288 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -89,7 +89,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar CProgress::CProgress()
{
_dwStartTime = GetTickCount();
- _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress);
+ _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
}
/**
@@ -167,7 +167,7 @@ BYTE CProgress::Update() UpdateWindow(_hDlg);
while (PeekMessage(&msg, _hDlg, 0, 0, PM_REMOVE) != 0) {
- if (_hDlg == NULL || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */
+ if (_hDlg == nullptr || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -184,7 +184,7 @@ BYTE CProgress::Update() **/
BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...)
{
- if (_hDlg != NULL) {
+ if (_hDlg != nullptr) {
HWND hProg = GetDlgItem(_hDlg, IDC_PROGRESS2);
if (pszFormat) {
wchar_t buf[MAX_PATH];
@@ -210,7 +210,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) **/
BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...)
{
- if (_hDlg != NULL) {
+ if (_hDlg != nullptr) {
HWND hProg = GetDlgItem(_hDlg, IDC_PROGRESS);
if (pszFormat) {
wchar_t buf[MAX_PATH];
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index dfc1499a08..8dc1e60c31 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -165,19 +165,19 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) { DB::CEnumList Modules; - if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) + if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) { FILE *file; errno_t err = fopen_s(&file, pszFileName, "wt"); if (err != NULL) { - MsgErr(NULL, + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor saving contact information could not be opened."), pszFileName); return 1; } - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); // write header SYSTEMTIME now; @@ -208,7 +208,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) ExportContact(ExImContact->hContact, &Modules, file); fclose(file); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } return 0; } @@ -226,7 +226,7 @@ LPSTR strnrchr(LPSTR string, int ch, DWORD len) while (--string != start && *string != (CHAR)ch); if (*string == (CHAR)ch) /* char found ? */ return ((LPSTR)string); - return(NULL); + return(nullptr); } /** @@ -327,7 +327,7 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) // check Module and filter "Protocol" if (!pszModule || !*pszModule || mir_strncmp(pszModule, "Protocol", 8) == 0) return 1; - if ((end = value = mir_strchr(pszLine, '=')) == NULL) + if ((end = value = mir_strchr(pszLine, '=')) == nullptr) return 1; // truncate setting string if it has spaces at the end @@ -407,8 +407,8 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) dbv.pbVal = (PBYTE)value; for ( dest = dbv.pbVal, value = strtok(value, " "); value && *value; - value = strtok(NULL, " ")) - *(dest++) = (BYTE)strtol(value, NULL, 16); + value = strtok(nullptr, " ")) + *(dest++) = (BYTE)strtol(value, nullptr, 16); *dest = 0; break; } @@ -439,7 +439,7 @@ int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) numContactsAdded = 0; // number of contacts, that were added to the database CHAR *strBuf = (CHAR *) mir_alloc(1); *strBuf = 0; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); while (ImportreadLine(file, strBuf)) { numLines++; @@ -495,23 +495,23 @@ int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) } //end while fclose(file); mir_free(strBuf); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // the contact was not found in the file if (numContactsInFile > 0 && !numContactsAdded) { - MsgErr(NULL, + MsgErr(nullptr, LPGENW("None of the %d contacts, stored in the ini-file, match the selected contact!\nNothing will be imported"), numContactsInFile); } // Import complete else{ - MsgBox(NULL, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), + MsgBox(nullptr, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), LPGENW("Added %d of %d contacts stored in the ini-file."), numContactsAdded, numContactsInFile); } return 0; } - MsgErr(NULL, + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor reading contact information could not be opened."), pszFileName); return 1; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index ca7fdc4a25..1231a72c84 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -42,7 +42,7 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) PBYTE s = (PBYTE)pBuffer;
BYTE bIsUTF = 0;
- if (s == NULL) return 1;
+ if (s == nullptr) return 1;
while ((c = *s++) != 0) {
if (c < 0x80) continue;
if (!pcbBuffer) return 0;
@@ -68,8 +68,8 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) **/
CLineBuffer::CLineBuffer()
{
- _pVal = NULL;
- _pTok = NULL;
+ _pVal = nullptr;
+ _pTok = nullptr;
_cbVal = 0;
_cbUsed = 0;
}
@@ -458,7 +458,7 @@ int CLineBuffer::fgetEncoded(FILE *inFile) case '=':
if (_resizeBuf(1)) {
fread(hex, 2, 1, inFile);
- *(_pVal + _cbUsed++) = (BYTE)strtol(hex, NULL, 16);
+ *(_pVal + _cbUsed++) = (BYTE)strtol(hex, nullptr, 16);
wAdd++;
}
break;
@@ -502,7 +502,7 @@ size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok;
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? NULL : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -537,7 +537,7 @@ size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok;
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? NULL : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -572,7 +572,7 @@ int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, con iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok);
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? NULL : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -608,7 +608,7 @@ int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, cons iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok);
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? NULL : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -647,9 +647,9 @@ int CLineBuffer::DBWriteSettingString(MCONTACT hContact, const CHAR* pszModule, **/
CVCardFileVCF::CVCardFileVCF()
{
- _pFile = NULL;
+ _pFile = nullptr;
_hContact = INVALID_CONTACT_ID;
- _pszBaseProto = NULL;
+ _pszBaseProto = nullptr;
_hasUtf8 = 0;
_useUtf8 = FALSE;
_cbRew = 0;
@@ -690,12 +690,12 @@ size_t CVCardFileVCF::packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *c BYTE CVCardFileVCF::GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv)
{
int type = _useUtf8 ? DBVT_UTF8 : DBVT_ASCIIZ;
- dbv->pszVal = NULL;
+ dbv->pszVal = nullptr;
if (!pszModule || db_get_s(_hContact, pszModule, pszSetting, dbv, type) || (dbv->type == DBVT_ASCIIZ && !dbv->pszVal && !*dbv->pszVal))
if (!_pszBaseProto || db_get_s(_hContact, _pszBaseProto, pszSetting, dbv) || (dbv->type == DBVT_ASCIIZ && !dbv->pszVal && !*dbv->pszVal))
return DBVT_DELETED;
- _hasUtf8 += _useUtf8 && !IsUSASCII(dbv->pszVal, NULL);
+ _hasUtf8 += _useUtf8 && !IsUSASCII(dbv->pszVal, nullptr);
return dbv->type;
}
@@ -869,9 +869,9 @@ void CVCardFileVCF::Close(void) {
if (_pFile)
fclose(_pFile);
- _pFile = NULL;
+ _pFile = nullptr;
_hContact = INVALID_CONTACT_ID;
- _pszBaseProto = NULL;
+ _pszBaseProto = nullptr;
}
/**
@@ -1055,7 +1055,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) {
MAnnivDate mdb;
- if (!mdb.DBGetBirthDate(_hContact, NULL))
+ if (!mdb.DBGetBirthDate(_hContact, nullptr))
fprintf(_pFile, "BDAY:%d%02d%02d\n", mdb.Year(), mdb.Month(), mdb.Day());
}
@@ -1165,8 +1165,8 @@ BYTE CVCardFileVCF::Import() if (!mir_strcmp(szEnt, "ADR")) {
if (!pszParam) continue;
if (!mir_strcmp(pszParam, "HOME")) {
- _clVal.GetTokenFirst(';', NULL);
- _clVal.GetTokenNext(';', NULL);
+ _clVal.GetTokenFirst(';', nullptr);
+ _clVal.GetTokenNext(';', nullptr);
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STREET, ';');
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_CITY, ';');
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STATE, ';');
@@ -1175,7 +1175,7 @@ BYTE CVCardFileVCF::Import() continue;
}
if (!mir_strcmp(pszParam, "WORK")) {
- _clVal.GetTokenFirst(';', NULL);
+ _clVal.GetTokenFirst(';', nullptr);
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_OFFICE, ';');
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STREET, ';');
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_CITY, ';');
@@ -1185,8 +1185,8 @@ BYTE CVCardFileVCF::Import() continue;
}
if (!mir_strcmp(pszParam, "POSTAL")) {
- _clVal.GetTokenFirst(';', NULL);
- _clVal.GetTokenNext(';', NULL);
+ _clVal.GetTokenFirst(';', nullptr);
+ _clVal.GetTokenNext(';', nullptr);
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STREET, ';');
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_CITY, ';');
_clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STATE, ';');
@@ -1203,13 +1203,13 @@ BYTE CVCardFileVCF::Import() memcpy(buf, _clVal.GetBuffer(), 4);
buf[4] = 0;
- db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, NULL, 10));
+ db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, nullptr, 10));
memcpy(buf, _clVal.GetBuffer() + 4, 2);
buf[2] = 0;
- db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, NULL, 10));
+ db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, nullptr, 10));
memcpy(buf, _clVal.GetBuffer() + 6, 2);
buf[2] = 0;
- db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, NULL, 10));
+ db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, nullptr, 10));
}
}
continue;
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index aee6a83b5f..170b39329f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -92,7 +92,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) DWORD result = (DWORD) DialogBox(ghInst,
MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY),
- NULL, DlgProc_DataHistory);
+ nullptr, DlgProc_DataHistory);
if (LOWORD(result) != IDOK)
{
return 0;
@@ -101,13 +101,13 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // show dialog to enable user to select modules for export
if (!(_wExport & EXPORT_DATA) ||
- !DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL))
+ !DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr))
{
FILE *xmlfile = fopen(pszFileName, "wt");
if (!xmlfile)
{
- MsgErr(NULL, LPGENW("Can't create xml file!\n%S"), pszFileName);
+ MsgErr(nullptr, LPGENW("Can't create xml file!\n%S"), pszFileName);
return 1;
}
@@ -183,7 +183,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) } // *end for
#ifdef _DEBUG
QueryPerformanceCounter(&t2);
- MsgErr(NULL, LPGENW("Export took %f ms"),
+ MsgErr(nullptr, LPGENW("Export took %f ms"),
(long double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.);
#endif
}// *end other export mode
@@ -250,7 +250,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) CExImContactXML vContact(this);
// import contacts
- for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) {
+ for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != nullptr; xContact = xContact->NextSiblingElement()) {
if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT)) {
// update progressbar and abort if user clicked cancel
LPTSTR pszNick = mir_utf8decodeW(xContact->Attribute("nick"));
@@ -271,7 +271,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED;
#ifdef _DEBUG
default:
- MsgErr(NULL, LPGENW("Importing %s caused error %d"), pszNick, result);
+ MsgErr(nullptr, LPGENW("Importing %s caused error %d"), pszNick, result);
break;
#endif
}
@@ -282,7 +282,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED;
#ifdef _DEBUG
default:
- MsgErr(NULL, LPGENW("Loading contact %s from xml failed with error %d"), pszNick, result);
+ MsgErr(nullptr, LPGENW("Loading contact %s from xml failed with error %d"), pszNick, result);
break;
#endif
}
@@ -300,7 +300,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED;
#ifdef _DEBUG
default:
- MsgErr(NULL, LPGENW("Importing Owner caused error %d"), result);
+ MsgErr(nullptr, LPGENW("Importing Owner caused error %d"), result);
#endif
}
}
@@ -319,7 +319,7 @@ DWORD CFileXml::CountContacts(TiXmlElement* xmlParent) try {
DWORD dwCount = 0;
// count contacts in file for progress bar
- for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != NULL; xContact = xContact->NextSibling())
+ for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != nullptr; xContact = xContact->NextSibling())
if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT) || !mir_strcmpi(xContact->Value(), XKEY_OWNER))
dwCount += CountContacts(xContact->ToElement()) + 1;
@@ -345,19 +345,19 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) // load xml file
TiXmlDocument doc;
if (!doc.LoadFile(pszFileName)) {
- MsgErr(NULL, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"),
+ MsgErr(nullptr, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"),
pszFileName, doc.ErrorId(), doc.ErrorDesc());
return 1;
}
// is xmlfile a XMLCard ?
TiXmlElement *xmlCard = doc.FirstChildElement("XMLCard");
- if (xmlCard == NULL) {
- MsgErr(NULL, LPGENW("The selected file is no valid XMLCard"));
+ if (xmlCard == nullptr) {
+ MsgErr(nullptr, LPGENW("The selected file is no valid XMLCard"));
return 1;
}
// check version
if (mir_strcmp(xmlCard->Attribute("ver"), XMLCARD_VERSION)) {
- MsgErr(NULL, LPGENW("The version of the XMLCard is not supported by UserInfoEx"));
+ MsgErr(nullptr, LPGENW("The version of the XMLCard is not supported by UserInfoEx"));
return 1;
}
@@ -373,13 +373,13 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) db_set_safety_mode(1);
if (!ret) {
- MsgBox(NULL, MB_ICONINFORMATION,
+ MsgBox(nullptr, MB_ICONINFORMATION,
LPGENW("Complete"),
LPGENW("Import complete"),
LPGENW("Owner contact successfully imported."));
return 0;
} else {
- MsgErr(NULL, LPGENW("Selected XMLCard does not contain an owner contact!"));
+ MsgErr(nullptr, LPGENW("Selected XMLCard does not contain an owner contact!"));
return 1;
}
}
@@ -406,11 +406,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) #ifdef _DEBUG
QueryPerformanceCounter(&t2);
- MsgErr(NULL, LPGENW("Import took %f ms"),
+ MsgErr(nullptr, LPGENW("Import took %f ms"),
(long double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.);
#endif
// show results
- MsgBox(NULL, MB_ICONINFORMATION, LPGENW("Import complete"), LPGENW("Some basic statistics"),
+ MsgBox(nullptr, MB_ICONINFORMATION, LPGENW("Import complete"), LPGENW("Some basic statistics"),
LPGENW("added contacts: %u / %u\nadded settings: %u / %u\nadded events %u / %u\nduplicated events: %u"),
_numContactsDone, _numContactsTodo,
_numSettingsDone, _numSettingsTodo,
@@ -421,7 +421,7 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) return 0;
}
catch(...) {
- MsgErr(NULL, LPGENW("FATAL: An exception was thrown while importing contacts from xmlCard!"));
+ MsgErr(nullptr, LPGENW("FATAL: An exception was thrown while importing contacts from xmlCard!"));
return 1;
}
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index f18d2a2d1b..4d6d2fc829 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -35,8 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/
static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WORD cchFileName)
{
- LPCSTR disp = 0;
- LPSTR temp = 0;
+ LPCSTR disp = nullptr;
+ LPSTR temp = nullptr;
cchFileName--;
pszFileName[0] = 0;
@@ -88,7 +88,7 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO LPCSTR FilterString(lpExImParam ExImContact)
{
- LPCSTR pszFilter = 0;
+ LPCSTR pszFilter = nullptr;
switch (ExImContact->Typ) {
case EXIM_SUBGROUP:
case EXIM_ACCOUNT:
@@ -135,12 +135,12 @@ INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent) case 3: // .vcf
{
CVCardFileVCF vcfFile;
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
if (vcfFile.Open(ExImContact->hContact, szFileName, "wt")) {
vcfFile.Export(FALSE);
vcfFile.Close();
}
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
return 0;
}
}
@@ -184,10 +184,10 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent) case 3:
CVCardFileVCF vcfFile;
if (vcfFile.Open(ExImContact->hContact, szFileName, "rt")) {
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
vcfFile.Import();
vcfFile.Close();
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
return 0;
}
diff --git a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp index 61342c94fe..be5292e438 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp @@ -148,19 +148,19 @@ TiXmlBase::StringToBuffer::~StringToBuffer() TiXmlNode::TiXmlNode(NodeType _type) : TiXmlBase()
{
- parent = 0;
+ parent = nullptr;
type = _type;
- firstChild = 0;
- lastChild = 0;
- prev = 0;
- next = 0;
+ firstChild = nullptr;
+ lastChild = nullptr;
+ prev = nullptr;
+ next = nullptr;
}
TiXmlNode::~TiXmlNode()
{
TiXmlNode* node = firstChild;
- TiXmlNode* temp = 0;
+ TiXmlNode* temp = nullptr;
while (node)
{
@@ -182,7 +182,7 @@ void TiXmlNode::CopyTo(TiXmlNode* target) const void TiXmlNode::Clear()
{
TiXmlNode* node = firstChild;
- TiXmlNode* temp = 0;
+ TiXmlNode* temp = nullptr;
while (node)
{
@@ -191,27 +191,27 @@ void TiXmlNode::Clear() delete temp;
}
- firstChild = 0;
- lastChild = 0;
+ firstChild = nullptr;
+ lastChild = nullptr;
}
TiXmlNode* TiXmlNode::LinkEndChild(TiXmlNode* node)
{
- assert(node->parent == 0 || node->parent == this);
- assert(node->GetDocument() == 0 || node->GetDocument() == this->GetDocument());
+ assert(node->parent == nullptr || node->parent == this);
+ assert(node->GetDocument() == nullptr || node->GetDocument() == this->GetDocument());
if (node->Type() == TiXmlNode::DOCUMENT)
{
delete node;
- if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
node->parent = this;
node->prev = lastChild;
- node->next = 0;
+ node->next = nullptr;
if (lastChild)
lastChild->next = node;
@@ -227,12 +227,12 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) {
if (addThis.Type() == TiXmlNode::DOCUMENT)
{
- if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
TiXmlNode* node = addThis.Clone();
if (!node)
- return 0;
+ return nullptr;
return LinkEndChild(node);
}
@@ -241,17 +241,17 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& addThis)
{
if (!beforeThis || beforeThis->parent != this) {
- return 0;
+ return nullptr;
}
if (addThis.Type() == TiXmlNode::DOCUMENT)
{
- if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
TiXmlNode* node = addThis.Clone();
if (!node)
- return 0;
+ return nullptr;
node->parent = this;
node->next = beforeThis;
@@ -273,17 +273,17 @@ TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis)
{
if (!afterThis || afterThis->parent != this) {
- return 0;
+ return nullptr;
}
if (addThis.Type() == TiXmlNode::DOCUMENT)
{
- if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
TiXmlNode* node = addThis.Clone();
if (!node)
- return 0;
+ return nullptr;
node->parent = this;
node->prev = afterThis;
@@ -305,11 +305,11 @@ TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& ad TiXmlNode* TiXmlNode::ReplaceChild(TiXmlNode* replaceThis, const TiXmlNode& withThis)
{
if (replaceThis->parent != this)
- return 0;
+ return nullptr;
TiXmlNode* node = withThis.Clone();
if (!node)
- return 0;
+ return nullptr;
node->next = replaceThis->next;
node->prev = replaceThis->prev;
@@ -360,7 +360,7 @@ const TiXmlNode* TiXmlNode::FirstChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
@@ -372,7 +372,7 @@ TiXmlNode* TiXmlNode::FirstChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
@@ -384,7 +384,7 @@ const TiXmlNode* TiXmlNode::LastChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
TiXmlNode* TiXmlNode::LastChild(const char * _value)
@@ -395,7 +395,7 @@ TiXmlNode* TiXmlNode::LastChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
const TiXmlNode* TiXmlNode::IterateChildren(const TiXmlNode* previous) const
@@ -458,7 +458,7 @@ const TiXmlNode* TiXmlNode::NextSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
TiXmlNode* TiXmlNode::NextSibling(const char * _value)
@@ -469,7 +469,7 @@ TiXmlNode* TiXmlNode::NextSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const
@@ -480,7 +480,7 @@ const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
TiXmlNode* TiXmlNode::PreviousSibling(const char * _value)
@@ -491,7 +491,7 @@ TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0)
return node;
}
- return 0;
+ return nullptr;
}
void TiXmlElement::RemoveAttribute(const char * name)
@@ -516,7 +516,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement() const if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
TiXmlElement* TiXmlNode::FirstChildElement()
@@ -530,7 +530,7 @@ TiXmlElement* TiXmlNode::FirstChildElement() if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const
@@ -544,7 +544,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
TiXmlElement* TiXmlNode::FirstChildElement(const char * _value)
@@ -558,7 +558,7 @@ TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
const TiXmlElement* TiXmlNode::NextSiblingElement() const
@@ -572,7 +572,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement() const if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
TiXmlElement* TiXmlNode::NextSiblingElement()
@@ -586,7 +586,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement() if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const
@@ -600,7 +600,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value)
@@ -614,7 +614,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) if (node->ToElement())
return node->ToElement();
}
- return 0;
+ return nullptr;
}
@@ -627,7 +627,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const if (node->ToDocument())
return node->ToDocument();
}
- return 0;
+ return nullptr;
}
TiXmlDocument* TiXmlNode::GetDocument()
@@ -639,13 +639,13 @@ TiXmlDocument* TiXmlNode::GetDocument() if (node->ToDocument())
return node->ToDocument();
}
- return 0;
+ return nullptr;
}
TiXmlElement::TiXmlElement (const char * _value)
: TiXmlNode(TiXmlNode::ELEMENT)
{
- firstChild = lastChild = 0;
+ firstChild = lastChild = nullptr;
value = _value;
}
@@ -663,7 +663,7 @@ TiXmlElement::TiXmlElement(const std::string& _value) TiXmlElement::TiXmlElement(const TiXmlElement& copy)
: TiXmlNode(TiXmlNode::ELEMENT)
{
- firstChild = lastChild = 0;
+ firstChild = lastChild = nullptr;
copy.CopyTo(this);
}
@@ -701,7 +701,7 @@ const char * TiXmlElement::Attribute(const char * name) const if (node)
return node->Value();
- return 0;
+ return nullptr;
}
@@ -801,7 +801,7 @@ void TiXmlElement::SetAttribute(const char * cname, const char * cvalue) else
{
TiXmlDocument* document = GetDocument();
- if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN);
+ if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
}
}
@@ -965,7 +965,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const // Element class:
// Clone the attributes, then clone the children.
- const TiXmlAttribute* attribute = 0;
+ const TiXmlAttribute* attribute = nullptr;
for ( attribute = attributeSet.First();
attribute;
attribute = attribute->Next())
@@ -973,7 +973,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const target->SetAttribute(attribute->Name(), attribute->Value());
}
- TiXmlNode* node = 0;
+ TiXmlNode* node = nullptr;
for (node = firstChild; node; node = node->NextSibling())
{
target->LinkEndChild(node->Clone());
@@ -985,7 +985,7 @@ TiXmlNode* TiXmlElement::Clone() const {
TiXmlElement* clone = new TiXmlElement(Value());
if (!clone)
- return 0;
+ return nullptr;
CopyTo(clone);
return clone;
@@ -1001,7 +1001,7 @@ const char* TiXmlElement::GetText() const return childText->Value();
}
}
- return 0;
+ return nullptr;
}
@@ -1120,7 +1120,7 @@ bool TiXmlDocument::LoadFile(const char* filename, TiXmlEncoding encoding) }
else
{
- SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
+ SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
return false;
}
}
@@ -1129,7 +1129,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) {
if (!file)
{
- SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
+ SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
return false;
}
@@ -1146,7 +1146,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) // Strange case, but good to handle up front.
if (length == 0)
{
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
return false;
}
@@ -1181,7 +1181,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) if (fread(buf, length, 1, file) != 1) {
delete [] buf;
- SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
+ SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
return false;
}
@@ -1229,9 +1229,9 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) data.append(lastPos, p-lastPos);
}
delete [] buf;
- buf = 0;
+ buf = nullptr;
- Parse(data.c_str(), 0, encoding);
+ Parse(data.c_str(), nullptr, encoding);
if ( Error())
return false;
@@ -1278,7 +1278,7 @@ void TiXmlDocument::CopyTo(TiXmlDocument* target) const target->error = error;
target->errorDesc = errorDesc.c_str ();
- TiXmlNode* node = 0;
+ TiXmlNode* node = nullptr;
for (node = firstChild; node; node = node->NextSibling())
{
target->LinkEndChild(node->Clone());
@@ -1290,7 +1290,7 @@ TiXmlNode* TiXmlDocument::Clone() const {
TiXmlDocument* clone = new TiXmlDocument();
if (!clone)
- return 0;
+ return nullptr;
CopyTo(clone);
return clone;
@@ -1342,7 +1342,7 @@ const TiXmlAttribute* TiXmlAttribute::Next() const // We are using knowledge of the sentinel. The sentinel
// have a value or name.
if (next->value.empty() && next->name.empty())
- return 0;
+ return nullptr;
return next;
}
@@ -1351,7 +1351,7 @@ TiXmlAttribute* TiXmlAttribute::Next() // We are using knowledge of the sentinel. The sentinel
// have a value or name.
if (next->value.empty() && next->name.empty())
- return 0;
+ return nullptr;
return next;
}
@@ -1360,7 +1360,7 @@ const TiXmlAttribute* TiXmlAttribute::Previous() const // We are using knowledge of the sentinel. The sentinel
// have a value or name.
if (prev->value.empty() && prev->name.empty())
- return 0;
+ return nullptr;
return prev;
}
@@ -1369,7 +1369,7 @@ TiXmlAttribute* TiXmlAttribute::Previous() // We are using knowledge of the sentinel. The sentinel
// have a value or name.
if (prev->value.empty() && prev->name.empty())
- return 0;
+ return nullptr;
return prev;
}
@@ -1494,7 +1494,7 @@ TiXmlNode* TiXmlComment::Clone() const TiXmlComment* clone = new TiXmlComment();
if (!clone)
- return 0;
+ return nullptr;
CopyTo(clone);
return clone;
@@ -1558,11 +1558,11 @@ void TiXmlText::CopyTo(TiXmlText* target) const TiXmlNode* TiXmlText::Clone() const
{
- TiXmlText* clone = 0;
+ TiXmlText* clone = nullptr;
clone = new TiXmlText("");
if (!clone)
- return 0;
+ return nullptr;
CopyTo(clone);
return clone;
@@ -1667,7 +1667,7 @@ TiXmlNode* TiXmlDeclaration::Clone() const TiXmlDeclaration* clone = new TiXmlDeclaration();
if (!clone)
- return 0;
+ return nullptr;
CopyTo(clone);
return clone;
@@ -1704,7 +1704,7 @@ TiXmlNode* TiXmlUnknown::Clone() const TiXmlUnknown* clone = new TiXmlUnknown();
if (!clone)
- return 0;
+ return nullptr;
CopyTo(clone);
return clone;
@@ -1746,8 +1746,8 @@ void TiXmlAttributeSet::Remove(TiXmlAttribute* removeMe) {
node->prev->next = node->next;
node->next->prev = node->prev;
- node->next = 0;
- node->prev = 0;
+ node->next = nullptr;
+ node->prev = nullptr;
return;
}
}
@@ -1763,7 +1763,7 @@ const TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) const if (node->name == name)
return node;
}
- return 0;
+ return nullptr;
}
TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name)
@@ -1775,7 +1775,7 @@ TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) if (node->name == name)
return node;
}
- return 0;
+ return nullptr;
}
#ifdef TIXML_USE_STL
@@ -1818,7 +1818,7 @@ TiXmlHandle TiXmlHandle::FirstChild() const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1830,7 +1830,7 @@ TiXmlHandle TiXmlHandle::FirstChild(const char * value) const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1842,7 +1842,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1854,7 +1854,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement(const char * value) const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1873,7 +1873,7 @@ TiXmlHandle TiXmlHandle::Child(int count) const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1892,7 +1892,7 @@ TiXmlHandle TiXmlHandle::Child(const char* value, int count) const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1911,7 +1911,7 @@ TiXmlHandle TiXmlHandle::ChildElement(int count) const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
@@ -1930,5 +1930,5 @@ TiXmlHandle TiXmlHandle::ChildElement(const char* value, int count) const if (child)
return TiXmlHandle(child);
}
- return TiXmlHandle(0);
+ return TiXmlHandle(nullptr);
}
diff --git a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp index 2c7a65bec9..eb5e97134e 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp @@ -303,7 +303,7 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding) const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding)
{
if (!p || !*p) {
- return 0;
+ return nullptr;
}
if (encoding == TIXML_ENCODING_UTF8) {
while (*p) {
@@ -400,7 +400,7 @@ const char* TiXmlBase::ReadName(const char* p, TIXML_STRING * name, TiXmlEncodin }
return p;
}
- return 0;
+ return nullptr;
}
const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlEncoding encoding)
@@ -417,12 +417,12 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*(p + 2) == 'x') {
// Hexadecimal.
- if (!*(p + 3)) return 0;
+ if (!*(p + 3)) return nullptr;
const char* q = p + 3;
q = strchr(q, ';');
- if (!q || !*q) return 0;
+ if (!q || !*q) return nullptr;
delta = q - p;
--q;
@@ -435,19 +435,19 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE else if (*q >= 'A' && *q <= 'F')
ucs += mult * (*q - 'A' + 10);
else
- return 0;
+ return nullptr;
mult *= 16;
--q;
}
}
else {
// Decimal.
- if (!*(p + 2)) return 0;
+ if (!*(p + 2)) return nullptr;
const char* q = p + 2;
q = strchr(q, ';');
- if (!q || !*q) return 0;
+ if (!q || !*q) return nullptr;
delta = q - p;
--q;
@@ -456,7 +456,7 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*q >= '0' && *q <= '9')
ucs += mult * (*q - '0');
else
- return 0;
+ return nullptr;
mult *= 10;
--q;
}
@@ -646,8 +646,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // contains nothing but other tags, most of what happens
// here is skipping white space.
if (!p || !*p) {
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
// Note that, for a document, this needs to come
@@ -678,8 +678,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm p = SkipWhiteSpace(p, encoding);
if (!p) {
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
- return 0;
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
+ return nullptr;
}
while (p && *p) {
@@ -714,8 +714,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // Was this empty?
if (!firstChild) {
- SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding);
- return 0;
+ SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, encoding);
+ return nullptr;
}
// All is well.
@@ -743,18 +743,18 @@ void TiXmlDocument::SetError(int err, const char* pError, TiXmlParsingData* data TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding)
{
- TiXmlNode* returnNode = 0;
+ TiXmlNode* returnNode = nullptr;
p = SkipWhiteSpace(p, encoding);
if (!p || !*p || *p != '<') {
- return 0;
+ return nullptr;
}
TiXmlDocument* doc = GetDocument();
p = SkipWhiteSpace(p, encoding);
if (!p || !*p) {
- return 0;
+ return nullptr;
}
// What is this thing?
@@ -815,7 +815,7 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding) }
else {
if (doc)
- doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN);
+ doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN);
}
return returnNode;
}
@@ -944,8 +944,8 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlDocument* document = GetDocument();
if (!p || !*p) {
- if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding);
- return 0;
+ if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, nullptr, nullptr, encoding);
+ return nullptr;
}
if (data) {
@@ -955,7 +955,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (*p != '<') {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, p, data, encoding);
- return 0;
+ return nullptr;
}
p = SkipWhiteSpace(p + 1, encoding);
@@ -966,7 +966,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco p = ReadName(p, &value, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding);
- return 0;
+ return nullptr;
}
TIXML_STRING endTag("</");
@@ -980,14 +980,14 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco p = SkipWhiteSpace(p, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
- return 0;
+ return nullptr;
}
if (*p == '/') {
++p;
// Empty tag.
if (*p != '>') {
if (document) document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding);
- return 0;
+ return nullptr;
}
return (p + 1);
}
@@ -998,7 +998,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco ++p;
p = ReadValue(p, data, encoding); // Note this is an Element method, and will set the error if one happens.
if (!p || !*p)
- return 0;
+ return nullptr;
// We should find the end tag now
if (StringEqual(p, endTag.c_str(), false, encoding)) {
@@ -1007,7 +1007,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco }
else {
if (document) document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding);
- return 0;
+ return nullptr;
}
}
else {
@@ -1015,7 +1015,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlAttribute* attrib = new TiXmlAttribute();
if (!attrib) {
if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding);
- return 0;
+ return nullptr;
}
attrib->SetDocument(document);
@@ -1025,7 +1025,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding);
delete attrib;
- return 0;
+ return nullptr;
}
// Handle the strange case of double attributes:
@@ -1033,7 +1033,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (node) {
node->SetValue(attrib->Value());
delete attrib;
- return 0;
+ return nullptr;
}
attributeSet.Add(attrib);
@@ -1057,8 +1057,8 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml TiXmlText* textNode = new TiXmlText("");
if (!textNode) {
- if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding);
- return 0;
+ if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, encoding);
+ return nullptr;
}
if (TiXmlBase::IsWhiteSpaceCondensed()) {
@@ -1089,7 +1089,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml LinkEndChild(node);
}
else {
- return 0;
+ return nullptr;
}
}
}
@@ -1098,7 +1098,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml }
if (!p) {
- if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding);
+ if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, nullptr, nullptr, encoding);
}
return p;
}
@@ -1137,7 +1137,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco }
if (!p || !*p || *p != '<') {
if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding);
- return 0;
+ return nullptr;
}
++p;
value = "";
@@ -1148,7 +1148,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco }
if (!p) {
- if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding);
+ if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, nullptr, nullptr, encoding);
}
if (*p == '>')
return p + 1;
@@ -1196,7 +1196,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!StringEqual(p, startTag, false, encoding)) {
document->SetError(TIXML_ERROR_PARSING_COMMENT, p, data, encoding);
- return 0;
+ return nullptr;
}
p += mir_strlen(startTag);
p = ReadText(p, &value, false, endTag, false, encoding);
@@ -1207,7 +1207,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding)
{
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p) return 0;
+ if (!p || !*p) return nullptr;
// int tabsize = 4;
// if (document)
@@ -1222,19 +1222,19 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn p = ReadName(p, &name, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
- return 0;
+ return nullptr;
}
p = SkipWhiteSpace(p, encoding);
if (!p || !*p || *p != '=') {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
- return 0;
+ return nullptr;
}
++p; // skip '='
p = SkipWhiteSpace(p, encoding);
if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
- return 0;
+ return nullptr;
}
const char* end;
@@ -1265,7 +1265,7 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn // We did not have an opening quote but seem to have a
// closing one. Give up and throw an error.
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
- return 0;
+ return nullptr;
}
value += *p;
++p;
@@ -1332,7 +1332,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin if (!StringEqual(p, startTag, false, encoding)) {
document->SetError(TIXML_ERROR_PARSING_CDATA, p, data, encoding);
- return 0;
+ return nullptr;
}
p += mir_strlen(startTag);
@@ -1355,7 +1355,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin p = ReadText(p, &value, ignoreWhite, end, false, encoding);
if (p)
return p - 1; // don't truncate the '<'
- return 0;
+ return nullptr;
}
}
@@ -1387,8 +1387,8 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml // the stuff in-between.
TiXmlDocument* document = GetDocument();
if (!p || !*p || !StringEqual(p, "<?xml", true, _encoding)) {
- if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding);
- return 0;
+ if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, nullptr, nullptr, _encoding);
+ return nullptr;
}
if (data) {
data->Stamp(p, _encoding);
@@ -1428,7 +1428,7 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml ++p;
}
}
- return 0;
+ return nullptr;
}
bool TiXmlText::Blank() const
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index f02b3c4eb3..b44a98ca60 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -175,8 +175,8 @@ extern "C" int __declspec(dllexport) Load(void) if (ServiceExists(MS_IMG_GETINTERFACE))
result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
- if (FIP == NULL || result != S_OK) {
- MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags module will be disabled."), L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
+ if (FIP == nullptr || result != S_OK) {
+ MessageBoxEx(nullptr, TranslateT("Fatal error, image services not found. Flags module will be disabled."), L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
return 1;
}
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp index f0d8c23a62..8353ecb9ce 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.cpp +++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp @@ -35,7 +35,7 @@ static int QueueSortItems(const CQueueItem *i1, const CQueueItem *i2) CContactQueue::CContactQueue(int initialSize) :
_queue(initialSize, QueueSortItems)
{
- _hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ _hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
_status = RUNNING;
mir_forkthread((pThreadFunc)CContactQueue::ThreadProc, this);
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 00deddc966..9d3525b342 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -162,7 +162,7 @@ LPSTR GetAString(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) db_free(&dbv);
}
- return NULL;
+ return nullptr;
}
/**
@@ -183,7 +183,7 @@ LPWSTR GetWString(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) db_free(&dbv);
}
- return NULL;
+ return nullptr;
}
/**
@@ -268,7 +268,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps if (def > -1 && def < INT_MAX) {
hSubContact = db_mc_getSub(hContact, def);
if (hSubContact != NULL) {
- wFlags = GetCtrl(hSubContact, pszSubModule, NULL, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType);
+ wFlags = GetCtrl(hSubContact, pszSubModule, nullptr, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType);
if (wFlags != 0) {
wFlags &= ~CTRLF_HASCUSTOM;
wFlags |= CTRLF_HASMETA;
@@ -283,7 +283,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps if (i != def) {
hSubContact = db_mc_getSub(hContact, i);
if (hSubContact != NULL) {
- wFlags = GetCtrl(hSubContact, pszSubModule, NULL, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType);
+ wFlags = GetCtrl(hSubContact, pszSubModule, nullptr, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType);
if (wFlags != 0) {
wFlags &= ~CTRLF_HASCUSTOM;
wFlags |= CTRLF_HASMETA;
@@ -350,7 +350,7 @@ namespace Variant { BYTE ConvertString(DBVARIANT* dbv, const BYTE destType)
{
- if (dbv == NULL)
+ if (dbv == nullptr)
return 1;
switch (dbv->type) {
@@ -381,13 +381,13 @@ BYTE ConvertString(DBVARIANT* dbv, const BYTE destType) switch (destType) {
// destination type is "ascii"
case DBVT_ASCIIZ:
- mir_utf8decode(dbv->pszVal, NULL);
+ mir_utf8decode(dbv->pszVal, nullptr);
dbv->type = (dbv->pszVal) ? destType : DBVT_DELETED;
break;
// destination type is "wchar"
case DBVT_WCHAR:
LPSTR savePtr = dbv->pszVal;
- dbv->pszVal = NULL;
+ dbv->pszVal = nullptr;
mir_utf8decode(savePtr, &dbv->pwszVal);
mir_free(savePtr);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
@@ -430,7 +430,7 @@ BYTE ConvertString(DBVARIANT* dbv, const BYTE destType) BYTE dbv2String(DBVARIANT* dbv, const BYTE destType)
{
- if (dbv == NULL)
+ if (dbv == nullptr)
return 1;
WCHAR wbuf[32];
@@ -514,7 +514,7 @@ namespace Event { bool GetInfo(MEVENT hEvent, DBEVENTINFO *dbei)
{
dbei->cbBlob = 0;
- dbei->pBlob = NULL;
+ dbei->pBlob = nullptr;
return db_event_get(hEvent, dbei) != 0;
}
@@ -536,15 +536,15 @@ bool GetInfoWithData(MEVENT hEvent, DBEVENTINFO *dbei) }
if (dbei->cbBlob) {
dbei->pBlob = (PBYTE) mir_alloc(dbei->cbBlob);
- if (dbei->pBlob == NULL)
+ if (dbei->pBlob == nullptr)
dbei->cbBlob = 0;
}
- else dbei->pBlob = NULL;
+ else dbei->pBlob = nullptr;
bool result = db_event_get(hEvent, dbei) != 0;
if (result && dbei->pBlob) {
mir_free(dbei->pBlob);
- dbei->pBlob = NULL;
+ dbei->pBlob = nullptr;
}
return result;
}
@@ -713,7 +713,7 @@ LPSTR CEnumList::Insert(LPCSTR str) LPSTR p = mir_strdup(str);
if (p && !insert(p)) {
mir_free(p);
- p = NULL;
+ p = nullptr;
}
return p;
}
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index e836756b0d..542d31d12d 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -30,7 +30,7 @@ typedef struct _ICODESC BYTE size;
} ICODESC;
-HICON ghDefIcon = NULL;
+HICON ghDefIcon = nullptr;
static ICODESC icoDesc[] = {
// common
@@ -139,7 +139,7 @@ LPTSTR IcoLib_GetDefaultIconFileName() if (PathFileExists(absolute))
return path[i];
}
- return NULL;
+ return nullptr;
}
/**
@@ -165,12 +165,12 @@ static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack) if (!LoadStringA(hIconDll, IDS_ICOPACKVERSION, szFileVersion, sizeof(szFileVersion))
|| mir_strcmp(szFileVersion, "__UserInfoEx_IconPack_1.2__"))
- MsgErr(NULL, LPGENW("Warning: Your current IconPack's version differs from the one UserInfoEx is designed for.\nSome icons may not be displayed correctly"));
+ MsgErr(nullptr, LPGENW("Warning: Your current IconPack's version differs from the one UserInfoEx is designed for.\nSome icons may not be displayed correctly"));
FreeLibrary(hIconDll);
}
}
else
- MsgErr(NULL, LPGENW("Warning: No IconPack found in one of the following directories: 'customize\\icons', 'icons' or 'plugins'!"));
+ MsgErr(nullptr, LPGENW("Warning: No IconPack found in one of the following directories: 'customize\\icons', 'icons' or 'plugins'!"));
}
}
@@ -223,10 +223,10 @@ void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL *pCtrl, BYTE numCtrls) **/
static HANDLE IcoLib_RegisterIconHandleEx(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, LPTSTR szDefaultFile, int idIcon, int Size, HICON hDefIcon)
{
- HANDLE hIconHandle = NULL;
+ HANDLE hIconHandle = nullptr;
if (szIconID && szDescription && szSection) {
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.flags = SIDF_ALL_UNICODE;
sid.pszName = szIconID;
sid.description.w = mir_a2u(szDescription);
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 6cf37d3060..4aa17f387f 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -28,8 +28,8 @@ enum ECascadeType { MCAS_NOTINITIATED = 128
};
-HGENMENU hMenuItemRefresh = NULL;
-HGENMENU *hMenuItemAccount = NULL;
+HGENMENU hMenuItemRefresh = nullptr;
+HGENMENU *hMenuItemAccount = nullptr;
/**
* Helper function to remove all menu items backward (first item second group).
@@ -48,7 +48,7 @@ INT_PTR RemoveMenuItems(HGENMENU *pItems, int Count) while (Count--) {
if (pItems[Count]) {
Menu_RemoveItem(pItems[Count]);
- pItems[Count] = NULL;
+ pItems[Count] = nullptr;
}
}
return 0;
@@ -65,9 +65,9 @@ INT_PTR RemoveMenuItems(HGENMENU *pItems, int Count) **/
void RebuildContact()
{
- HGENMENU mhRoot = NULL;
- HGENMENU mhExIm = NULL;
- static HGENMENU hMenuItem[4] = { NULL, NULL, NULL, NULL };
+ HGENMENU mhRoot = nullptr;
+ HGENMENU mhExIm = nullptr;
+ static HGENMENU hMenuItem[4] = { nullptr, nullptr, nullptr, nullptr };
SvcEMailRebuildMenu();
SvcHomepageRebuildMenu();
@@ -89,8 +89,8 @@ void RebuildContact() switch (flag) {
case 3:
//cascade off
- mhRoot = mhExIm = NULL;
- hMenuItem[0] = NULL;
+ mhRoot = mhExIm = nullptr;
+ hMenuItem[0] = nullptr;
break;
case 5:
//cascade all
@@ -110,7 +110,7 @@ void RebuildContact() mi.name.a = LPGEN("Export/import contact");
mhExIm = Menu_AddContactMenuItem(&mi);
hMenuItem[0] = mhExIm;
- mhRoot = NULL;
+ mhRoot = nullptr;
break;
default:
//disable Menu
@@ -161,9 +161,9 @@ void RebuildMain() {
BYTE item = 0;
- HGENMENU mhRoot = NULL;
- HGENMENU mhExIm = NULL;
- static HGENMENU hMenuItem[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ HGENMENU mhRoot = nullptr;
+ HGENMENU mhExIm = nullptr;
+ static HGENMENU hMenuItem[8] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
// load options
int flag = db_get_b(NULL, MODNAME, SET_MI_MAIN, MCAS_NOTINITIATED);
@@ -181,8 +181,8 @@ void RebuildMain() switch (flag) {
case 3:
//cascade off
- mhRoot = mhExIm = NULL;
- hMenuItem[item++] = NULL;
+ mhRoot = mhExIm = nullptr;
+ hMenuItem[item++] = nullptr;
break;
case 5:
//cascade all
@@ -202,7 +202,7 @@ void RebuildMain() mi.name.a = LPGEN("Export/import contact");
mhExIm = Menu_AddMainMenuItem(&mi);
hMenuItem[item++] = mhExIm;
- mhRoot = NULL;
+ mhRoot = nullptr;
break;
default:
//disable Menue
@@ -260,8 +260,8 @@ void RebuildMain() hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
else {
- hMenuItem[item++] = NULL;
- hMenuItem[item++] = NULL;
+ hMenuItem[item++] = nullptr;
+ hMenuItem[item++] = nullptr;
}
// Refresh Contact Details
@@ -295,9 +295,9 @@ void RebuildGroup() int flag = 0;
BYTE item = 0;
- HGENMENU mhRoot = NULL;
- HGENMENU mhExIm = NULL;
- static HGENMENU hMenuItem[3] = { NULL, NULL, NULL };
+ HGENMENU mhRoot = nullptr;
+ HGENMENU mhExIm = nullptr;
+ static HGENMENU hMenuItem[3] = { nullptr, nullptr, nullptr };
// load options
flag = db_get_b(NULL, MODNAME, SET_MI_GROUP, MCAS_NOTINITIATED);
@@ -319,8 +319,8 @@ void RebuildGroup() switch (flag) {
case 3:
//cascade off
- mhRoot = mhExIm = NULL;
- hMenuItem[item++] = NULL;
+ mhRoot = mhExIm = nullptr;
+ hMenuItem[item++] = nullptr;
break;
case 5:
//cascade all
@@ -340,7 +340,7 @@ void RebuildGroup() mi.name.a = LPGEN("Export/import contact");
mhExIm = Menu_AddGroupMenuItem(&mi);
hMenuItem[item++] = mhExIm;
- mhRoot = NULL;
+ mhRoot = nullptr;
break;
default:
//disable Menue
@@ -386,9 +386,9 @@ void RebuildSubGroup() BYTE item = 0;
GroupMenuParam gmp = { 0 };
- HGENMENU mhRoot = NULL;
- HGENMENU mhExIm = NULL;
- static HGENMENU hMenuItem[3] = { NULL, NULL, NULL };
+ HGENMENU mhRoot = nullptr;
+ HGENMENU mhExIm = nullptr;
+ static HGENMENU hMenuItem[3] = { nullptr, nullptr, nullptr };
// load options
flag = db_get_b(NULL, MODNAME, SET_MI_SUBGROUP, MCAS_NOTINITIATED);
@@ -411,8 +411,8 @@ void RebuildSubGroup() switch (flag) {
case 3:
//cascade off
- mhRoot = mhExIm = NULL;
- hMenuItem[item++] = NULL;
+ mhRoot = mhExIm = nullptr;
+ hMenuItem[item++] = nullptr;
break;
case 5:
//cascade all
@@ -432,7 +432,7 @@ void RebuildSubGroup() mi.name.a = LPGEN("Export/import group");
mhExIm = Menu_AddSubGroupMenuItem(&mi);
hMenuItem[item++] = mhExIm;
- mhRoot = NULL;
+ mhRoot = nullptr;
break;
default:
//disable Menue
@@ -510,7 +510,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) item = 0;
HGENMENU mhRoot = pcli->menuProtos[i].pMenu, mhExIm;
- if (mhRoot == NULL)
+ if (mhRoot == nullptr)
break;
PROTOACCOUNT *pa = Proto_GetAccount(pcli->menuProtos[i].szProto);
diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp index b483b0fdb9..da3d819fa7 100644 --- a/plugins/UserInfoEx/src/mir_string.cpp +++ b/plugins/UserInfoEx/src/mir_string.cpp @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char* mir_strncat_c(char *pszDest, const char cSrc) { size_t size = 2; - if (pszDest != NULL) + if (pszDest != nullptr) size += mir_strlen(pszDest); //cSrc = 1 + 1 forNULL temination char *pszRet = (char *)mir_realloc(pszDest, (sizeof(char) * size)); - if (pszRet == NULL) - return NULL; + if (pszRet == nullptr) + return nullptr; pszRet[size - 2] = cSrc; pszRet[size - 1] = 0; @@ -39,12 +39,12 @@ char* mir_strncat_c(char *pszDest, const char cSrc) wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc) { size_t size = 2; - if (pwszDest != NULL) + if (pwszDest != nullptr) size += mir_wstrlen(pwszDest); //cSrc = 1 + 1 forNULL temination wchar_t *pwszRet = (wchar_t *)mir_realloc(pwszDest, (sizeof(wchar_t) * size)); - if (pwszRet == NULL) - return NULL; + if (pwszRet == nullptr) + return nullptr; pwszRet[size - 2] = wcSrc; pwszRet[size - 1] = 0; @@ -53,7 +53,7 @@ wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc) char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo) { - char *pszReturn = NULL; + char *pszReturn = nullptr; size_t sizeNew = 0, sizeLen = mir_strlen(pszDest); if (sizeFrom < sizeLen && sizeTo <= sizeLen && sizeFrom < sizeTo) { sizeNew = sizeLen - (sizeTo - sizeFrom); @@ -72,7 +72,7 @@ char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo) int mir_IsEmptyA(char *str) { - if (str == NULL || str[0] == 0) + if (str == nullptr || str[0] == 0) return 1; int i = 0; @@ -88,7 +88,7 @@ int mir_IsEmptyA(char *str) int mir_IsEmptyW(wchar_t *str) { - if (str == NULL || str[0] == 0) + if (str == nullptr || str[0] == 0) return 1; int i = 0; diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index 5ce0033301..205bf80add 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -78,7 +78,7 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w LPTSTR pszText;
if (len == 0
- || (pszText = (LPTSTR)_alloca((len + 1) * sizeof(wchar_t))) == NULL
+ || (pszText = (LPTSTR)_alloca((len + 1) * sizeof(wchar_t))) == nullptr
|| !Edit_GetText(hEdit, pszText, len + 1))
{
MsgErr(hDlg, LPGENW("Please enter a valid description first!"));
@@ -126,7 +126,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM TranslateDialogDefault(hDlg);
pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_AGE, SET_CONTACT_AGE, DBVT_BYTE));
- pCtrlList->insert(CAnnivEditCtrl::CreateObj(hDlg, EDIT_ANNIVERSARY_DATE, NULL));
+ pCtrlList->insert(CAnnivEditCtrl::CreateObj(hDlg, EDIT_ANNIVERSARY_DATE, nullptr));
// hContact == NULL or reminder disabled
CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE)->EnableReminderCtrl(lParam != NULL);
@@ -164,7 +164,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case DTN_DROPDOWN:
HWND hMonthCal = DateTime_GetMonthCal(lpNmhdr->hwndFrom);
SetWindowLongPtr(hMonthCal, GWL_STYLE, GetWindowLongPtr(hMonthCal, GWL_STYLE) | MCS_WEEKNUMBERS);
- InvalidateRect(hMonthCal, NULL, TRUE);
+ InvalidateRect(hMonthCal, nullptr, TRUE);
}
}
return FALSE;
@@ -232,7 +232,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) {
MAnnivDate *pCurrent = pDateCtrl->Current();
if (pCurrent) {
- int rc = MsgBox(hDlg, MB_YESNO | MB_ICON_QUESTION | MB_NOPOPUP, LPGENW("Delete"), NULL,
+ int rc = MsgBox(hDlg, MB_YESNO | MB_ICON_QUESTION | MB_NOPOPUP, LPGENW("Delete"), nullptr,
LPGENW("Do you really want to delete the %s?"), pCurrent->Description());
if (rc == IDYES)
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index b8a979296a..0bab0f9a8d 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -870,7 +870,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR else if (IsDlgButtonChecked(hDlg, RADIO_OPT_POPUP_CUSTOM)) {
wchar_t szDelay[4];
GetDlgItemText(hDlg, EDIT_DELAY, szDelay, _countof(szDelay));
- db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)wcstol(szDelay, NULL, 10));
+ db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)wcstol(szDelay, nullptr, 10));
}
else
db_unset(NULL, MODNAME, SET_POPUP_DELAY);
diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 5c696c90b4..cf18c2aa90 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -46,7 +46,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);
TranslateDialogDefault(hDlg);
- SetTimer(hDlg, 1, 5000, NULL);
+ SetTimer(hDlg, 1, 5000, nullptr);
pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_ORIGIN_STREET, DBVT_WCHAR));
pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ORIGIN_ZIP, DBVT_WCHAR));
@@ -56,7 +56,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetCountryList(&nList, &pList);
pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_ORIGIN_COUNTRY, DBVT_WORD, pList, nList));
- pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, NULL));
+ pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, nullptr));
}
}
break;
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index 85a0c98b08..f1ce019d2e 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -134,11 +134,11 @@ static LPLCITEM ProfileList_GetItemData(HWND hList, int iItem) LVITEM lvi;
if (iItem < 0)
- return NULL;
+ return nullptr;
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = iItem;
- return (SendMessage(hList, LVM_GETITEM, NULL, (LPARAM)&lvi)) ? (LPLCITEM)lvi.lParam : NULL;
+ return (SendMessage(hList, LVM_GETITEM, NULL, (LPARAM)&lvi)) ? (LPLCITEM)lvi.lParam : nullptr;
}
/**
@@ -205,11 +205,11 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) return 1;
// set hEdit NULL to indicate the endlabeledit call and prevent other calls
hEdit = pList->labelEdit.hEdit;
- pList->labelEdit.hEdit = NULL;
+ pList->labelEdit.hEdit = nullptr;
if (bSave != FALSE && pList->labelEdit.pItem) {
WORD ccText;
- LPTSTR szEdit = NULL;
+ LPTSTR szEdit = nullptr;
BYTE bChanged = FALSE;
// an list element was selected
@@ -217,7 +217,7 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) pList->labelEdit.pItem->iListItem = pList->labelEdit.dropDown.iItem;
if (pList->labelEdit.pItem->pszText[0]) {
mir_free(pList->labelEdit.pItem->pszText[0]);
- pList->labelEdit.pItem->pszText[0] = NULL;
+ pList->labelEdit.pItem->pszText[0] = nullptr;
}
bChanged = TRUE;
}
@@ -278,7 +278,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem RECT rcList;
if (!PtrIsValid(pList))
- return NULL;
+ return nullptr;
if (pList->labelEdit.hEdit)
ProfileList_EndLabelEdit(pList, FALSE);
@@ -288,7 +288,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem lvi.iSubItem = iSubItem;
if (!ListView_GetItem(pList->hList, &lvi))
- return NULL;
+ return nullptr;
pItem = (LPLCITEM)lvi.lParam;
@@ -296,7 +296,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem // do not edit deviders or protocol based contact information
if (!(lvi.state & LVIS_SELECTED) || !PtrIsValid(pItem) || (hContact && (pItem->wFlags & CTRLF_HASPROTO)))
- return NULL;
+ return nullptr;
ListView_EnsureVisible(pList->hList, iItem, FALSE);
ListView_GetSubItemRect(pList->hList, iItem, iSubItem, LVIR_BOUNDS, &pList->labelEdit.rcCombo);
@@ -314,11 +314,11 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem // create the button control for the combobox
if (!iSubItem && pItem->idstrList) {
- pList->labelEdit.hBtn = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, NULL, WS_VISIBLE | WS_CHILD | MBS_DOWNARROW,
+ pList->labelEdit.hBtn = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, nullptr, WS_VISIBLE | WS_CHILD | MBS_DOWNARROW,
pList->labelEdit.rcCombo.right - (pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top), pList->labelEdit.rcCombo.top,
pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top,
pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top,
- pList->hList, NULL, ghInst, NULL);
+ pList->hList, nullptr, ghInst, nullptr);
if (pList->labelEdit.hBtn) {
SetWindowLongPtr(pList->labelEdit.hBtn, GWLP_ID, BTN_EDIT);
pList->labelEdit.rcCombo.right -= pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top;
@@ -341,9 +341,9 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.top,
pList->labelEdit.rcCombo.right - pList->labelEdit.rcCombo.left,
pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top,
- pList->hList, NULL, ghInst, NULL);
+ pList->hList, nullptr, ghInst, nullptr);
if (!pList->labelEdit.hEdit)
- return NULL;
+ return nullptr;
SendMessage(pList->labelEdit.hEdit, WM_SETFONT, (WPARAM)(pList->hFont), 0);
SendMessage(pList->labelEdit.hEdit, EM_SETSEL, 0, (LPARAM)-1);
SetUserData(pList->labelEdit.hEdit, pList);
@@ -430,8 +430,8 @@ static BYTE ProfileList_AddNewItem(HWND hDlg, LPLISTCTRL pList, const PROFILEENT pItem->nType = CTRL_LIST_ITEM;
pItem->wFlags = hContact ? CTRLF_HASCUSTOM : 0;
pItem->iListItem = 0;
- pItem->pszText[0] = NULL;
- pItem->pszText[1] = NULL;
+ pItem->pszText[0] = nullptr;
+ pItem->pszText[1] = nullptr;
// get category list
pEntry->GetList((WPARAM)&pItem->idstrListCount, (LPARAM)&pItem->idstrList);
@@ -505,13 +505,13 @@ static int ProfileList_AddItemlistFromDB( pItem->idstrList = idList;
pItem->idstrListCount = nList;
pItem->iListItem = 0;
- pItem->pszText[0] = NULL;
+ pItem->pszText[0] = nullptr;
pItem->pszText[1] = dbvVal.ptszVal;
pItem->wFlags = wFlags;
lvi.lParam = (LPARAM)pItem;
// get id-str-list-item for the category string
- if (idList != NULL) {
+ if (idList != nullptr) {
for (j = 0; j < nList; j++) {
switch (dbvCat.type) {
case DBVT_BYTE:
@@ -536,7 +536,7 @@ static int ProfileList_AddItemlistFromDB( }
}
// item not found in the predefined category list?
- if ((idList == NULL || j == nList) && dbvCat.type == DBVT_ASCIIZ) {
+ if ((idList == nullptr || j == nList) && dbvCat.type == DBVT_ASCIIZ) {
pItem->pszText[0] = mir_a2u(dbvCat.pszVal);
db_free(&dbvCat);
}
@@ -661,7 +661,7 @@ static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_WANTRETURN && !(GetKeyState(VK_CONTROL) & 0x8000))
break;
if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
- bEditNext = !pList->labelEdit.iSubItem && !ProfileList_GetItemText(pList->hList, pList->labelEdit.iItem, 1, NULL, NULL);
+ bEditNext = !pList->labelEdit.iSubItem && !ProfileList_GetItemText(pList->hList, pList->labelEdit.iItem, 1, nullptr, NULL);
iItem = pList->labelEdit.iItem;
ProfileList_EndLabelEdit(pList->hList, TRUE);
if (bEditNext) ProfileList_BeginLabelEdit(pList->hList, pList->labelEdit.iItem, 1);
@@ -824,7 +824,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa // calculate size of text on the screen
HDC hDC = GetDC(GetParent(hwnd));
- if (hDC != NULL) {
+ if (hDC != nullptr) {
SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL));
GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], (int)mir_wstrlen(pItem->pszText[hi.iSubItem]), &textSize);
ReleaseDC(GetParent(hwnd), hDC);
@@ -850,7 +850,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa ? pItem->pszText[0]
: TranslateT("<empty>"))
);
- InvalidateRect(pList->hTip, NULL, TRUE);
+ InvalidateRect(pList->hTip, nullptr, TRUE);
}
else
SendMessage(pList->hTip, TTM_SETTITLE, 0, (LPARAM)"");
@@ -914,7 +914,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa GetWindowText(pList->labelEdit.hEdit, szEdit, _countof(szEdit));
// need to create the dropdown list?
- if (pList->labelEdit.dropDown.hDrop == NULL) {
+ if (pList->labelEdit.dropDown.hDrop == nullptr) {
const int listHeight = 120;
RECT rc, rcList;
int add;
@@ -933,10 +933,10 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa rc.bottom = rc.top + listHeight;
}
- pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, L"LISTBOX", NULL,
+ pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, L"LISTBOX", nullptr,
WS_CHILD | WS_BORDER | WS_VSCROLL | LBS_COMBOBOX | LBS_HASSTRINGS,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
- hwnd, NULL, ghInst, NULL);
+ hwnd, nullptr, ghInst, nullptr);
if (!pList->labelEdit.dropDown.hDrop)
return FALSE;
SetUserData(pList->labelEdit.dropDown.hDrop, pList);
@@ -1073,8 +1073,8 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR rc.right -= GetSystemMetrics(SM_CXVSCROLL);
// initiate the tooltips
- pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, NULL, ghInst, NULL);
+ pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, nullptr, ghInst, nullptr);
if (pList->hTip) {
SetWindowPos(pList->hTip, HWND_TOPMOST, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
@@ -1307,7 +1307,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR mii.dwTypeData = TranslateT("Delete");
InsertMenuItem(hMenu, 7, TRUE, &mii);
}
- TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDlg, 0);
+ TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDlg, nullptr);
DestroyMenu(hMenu);
}
return 0;
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index 48a619d79d..88e593c5b9 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -25,7 +25,7 @@ namespace NServices {
namespace NAvatar
{
- static HANDLE ghChangedHook = NULL;
+ static HANDLE ghChangedHook = nullptr;
static int GetContactAvatarFileName(LPCWSTR zodiac, LPWSTR szFileName, int cchFileName)
{
@@ -141,7 +141,7 @@ namespace NServices }
else if (!bEnable && ghChangedHook) {
UnhookEvent(ghChangedHook);
- ghChangedHook = NULL;
+ ghChangedHook = nullptr;
// walk through all the contacts stored in the DB
for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
diff --git a/plugins/UserInfoEx/src/svc_constants.cpp b/plugins/UserInfoEx/src/svc_constants.cpp index 2b89416c5e..2ab6f5fa40 100644 --- a/plugins/UserInfoEx/src/svc_constants.cpp +++ b/plugins/UserInfoEx/src/svc_constants.cpp @@ -22,226 +22,226 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
static IDSTRLIST TmplLanguages[] = {
- { 0, LPGEN("Unspecified"), 0},
- {55, LPGEN("Afrikaans"), 0},
- {58, LPGEN("Albanian"), 0},
- { 1, LPGEN("Arabic"), 0},
- {59, LPGEN("Armenian"), 0},
- {68, LPGEN("Azerbaijani"), 0},
- {72, LPGEN("Belorussian"), 0},
- { 2, LPGEN("Bhojpuri"), 0},
- {56, LPGEN("Bosnian"), 0},
- { 3, LPGEN("Bulgarian"), 0},
- { 4, LPGEN("Burmese"), 0},
- { 5, LPGEN("Cantonese"), 0},
- { 6, LPGEN("Catalan"), 0},
- {61, LPGEN("Chamorro"), 0},
- { 7, LPGEN("Chinese"), 0},
- { 8, LPGEN("Croatian"), 0},
- { 9, LPGEN("Czech"), 0},
- {10, LPGEN("Danish"), 0},
- {11, LPGEN("Dutch"), 0},
- {12, LPGEN("English"), 0},
- {13, LPGEN("Esperanto"), 0},
- {14, LPGEN("Estonian"), 0},
- {15, LPGEN("Farsi"), 0},
- {16, LPGEN("Finnish"), 0},
- {17, LPGEN("French"), 0},
- {18, LPGEN("Gaelic"), 0},
- {19, LPGEN("German"), 0},
- {20, LPGEN("Greek"), 0},
- {70, LPGEN("Gujarati"), 0},
- {21, LPGEN("Hebrew"), 0},
- {22, LPGEN("Hindi"), 0},
- {23, LPGEN("Hungarian"), 0},
- {24, LPGEN("Icelandic"), 0},
- {25, LPGEN("Indonesian"), 0},
- {26, LPGEN("Italian"), 0},
- {27, LPGEN("Japanese"), 0},
- {28, LPGEN("Khmer"), 0},
- {29, LPGEN("Korean"), 0},
- {69, LPGEN("Kurdish"), 0},
- {30, LPGEN("Lao"), 0},
- {31, LPGEN("Latvian"), 0},
- {32, LPGEN("Lithuanian"), 0},
- {65, LPGEN("Macedonian"), 0},
- {33, LPGEN("Malay"), 0},
- {63, LPGEN("Mandarin"), 0},
- {62, LPGEN("Mongolian"), 0},
- {34, LPGEN("Norwegian"), 0},
- {57, LPGEN("Persian"), 0},
- {35, LPGEN("Polish"), 0},
- {36, LPGEN("Portuguese"), 0},
- {60, LPGEN("Punjabi"), 0},
- {37, LPGEN("Romanian"), 0},
- {38, LPGEN("Russian"), 0},
- {39, LPGEN("Serbo-Croatian"), 0},
- {66, LPGEN("Sindhi"), 0},
- {40, LPGEN("Slovak"), 0},
- {41, LPGEN("Slovenian"), 0},
- {42, LPGEN("Somali"), 0},
- {43, LPGEN("Spanish"), 0},
- {44, LPGEN("Swahili"), 0},
- {45, LPGEN("Swedish"), 0},
- {46, LPGEN("Tagalog"), 0},
- {64, LPGEN("Taiwanese"), 0},
- {71, LPGEN("Tamil"), 0},
- {47, LPGEN("Tatar"), 0},
- {48, LPGEN("Thai"), 0},
- {49, LPGEN("Turkish"), 0},
- {50, LPGEN("Ukrainian"), 0},
- {51, LPGEN("Urdu"), 0},
- {52, LPGEN("Vietnamese"), 0},
- {67, LPGEN("Welsh"), 0},
- {53, LPGEN("Yiddish"), 0},
- {54, LPGEN("Yoruba"), 0},
+ { 0, LPGEN("Unspecified"), nullptr},
+ {55, LPGEN("Afrikaans"), nullptr},
+ {58, LPGEN("Albanian"), nullptr},
+ { 1, LPGEN("Arabic"), nullptr},
+ {59, LPGEN("Armenian"), nullptr},
+ {68, LPGEN("Azerbaijani"), nullptr},
+ {72, LPGEN("Belorussian"), nullptr},
+ { 2, LPGEN("Bhojpuri"), nullptr},
+ {56, LPGEN("Bosnian"), nullptr},
+ { 3, LPGEN("Bulgarian"), nullptr},
+ { 4, LPGEN("Burmese"), nullptr},
+ { 5, LPGEN("Cantonese"), nullptr},
+ { 6, LPGEN("Catalan"), nullptr},
+ {61, LPGEN("Chamorro"), nullptr},
+ { 7, LPGEN("Chinese"), nullptr},
+ { 8, LPGEN("Croatian"), nullptr},
+ { 9, LPGEN("Czech"), nullptr},
+ {10, LPGEN("Danish"), nullptr},
+ {11, LPGEN("Dutch"), nullptr},
+ {12, LPGEN("English"), nullptr},
+ {13, LPGEN("Esperanto"), nullptr},
+ {14, LPGEN("Estonian"), nullptr},
+ {15, LPGEN("Farsi"), nullptr},
+ {16, LPGEN("Finnish"), nullptr},
+ {17, LPGEN("French"), nullptr},
+ {18, LPGEN("Gaelic"), nullptr},
+ {19, LPGEN("German"), nullptr},
+ {20, LPGEN("Greek"), nullptr},
+ {70, LPGEN("Gujarati"), nullptr},
+ {21, LPGEN("Hebrew"), nullptr},
+ {22, LPGEN("Hindi"), nullptr},
+ {23, LPGEN("Hungarian"), nullptr},
+ {24, LPGEN("Icelandic"), nullptr},
+ {25, LPGEN("Indonesian"), nullptr},
+ {26, LPGEN("Italian"), nullptr},
+ {27, LPGEN("Japanese"), nullptr},
+ {28, LPGEN("Khmer"), nullptr},
+ {29, LPGEN("Korean"), nullptr},
+ {69, LPGEN("Kurdish"), nullptr},
+ {30, LPGEN("Lao"), nullptr},
+ {31, LPGEN("Latvian"), nullptr},
+ {32, LPGEN("Lithuanian"), nullptr},
+ {65, LPGEN("Macedonian"), nullptr},
+ {33, LPGEN("Malay"), nullptr},
+ {63, LPGEN("Mandarin"), nullptr},
+ {62, LPGEN("Mongolian"), nullptr},
+ {34, LPGEN("Norwegian"), nullptr},
+ {57, LPGEN("Persian"), nullptr},
+ {35, LPGEN("Polish"), nullptr},
+ {36, LPGEN("Portuguese"), nullptr},
+ {60, LPGEN("Punjabi"), nullptr},
+ {37, LPGEN("Romanian"), nullptr},
+ {38, LPGEN("Russian"), nullptr},
+ {39, LPGEN("Serbo-Croatian"), nullptr},
+ {66, LPGEN("Sindhi"), nullptr},
+ {40, LPGEN("Slovak"), nullptr},
+ {41, LPGEN("Slovenian"), nullptr},
+ {42, LPGEN("Somali"), nullptr},
+ {43, LPGEN("Spanish"), nullptr},
+ {44, LPGEN("Swahili"), nullptr},
+ {45, LPGEN("Swedish"), nullptr},
+ {46, LPGEN("Tagalog"), nullptr},
+ {64, LPGEN("Taiwanese"), nullptr},
+ {71, LPGEN("Tamil"), nullptr},
+ {47, LPGEN("Tatar"), nullptr},
+ {48, LPGEN("Thai"), nullptr},
+ {49, LPGEN("Turkish"), nullptr},
+ {50, LPGEN("Ukrainian"), nullptr},
+ {51, LPGEN("Urdu"), nullptr},
+ {52, LPGEN("Vietnamese"), nullptr},
+ {67, LPGEN("Welsh"), nullptr},
+ {53, LPGEN("Yiddish"), nullptr},
+ {54, LPGEN("Yoruba"), nullptr},
};
static IDSTRLIST TmplOccupations[] = {
- { 0, LPGEN("Unspecified"), 0},
- { 1, LPGEN("Academic"), 0},
- { 2, LPGEN("Administrative"), 0},
- { 3, LPGEN("Art/Entertainment"), 0},
- { 4, LPGEN("College Student"), 0},
- { 5, LPGEN("Computers"), 0},
- { 6, LPGEN("Community & Social"), 0},
- { 7, LPGEN("Education"), 0},
- { 8, LPGEN("Engineering"), 0},
- { 9, LPGEN("Financial Services"), 0},
- {10, LPGEN("Government"), 0},
- {11, LPGEN("High School Student"), 0},
- {12, LPGEN("Home"), 0},
- {13, LPGEN("ICQ - Providing Help"), 0},
- {14, LPGEN("Law"), 0},
- {15, LPGEN("Managerial"), 0},
- {16, LPGEN("Manufacturing"), 0},
- {17, LPGEN("Medical/Health"), 0},
- {18, LPGEN("Military"), 0},
- {19, LPGEN("Non-Government Organization"), 0},
- {20, LPGEN("Professional"), 0},
- {21, LPGEN("Retail"), 0},
- {22, LPGEN("Retired"), 0},
- {23, LPGEN("Science & Research"), 0},
- {24, LPGEN("Sports"), 0},
- {25, LPGEN("Technical"), 0},
- {26, LPGEN("University Student"), 0},
- {27, LPGEN("Web Building"), 0},
- {99, LPGEN("Other Services"), 0}
+ { 0, LPGEN("Unspecified"), nullptr},
+ { 1, LPGEN("Academic"), nullptr},
+ { 2, LPGEN("Administrative"), nullptr},
+ { 3, LPGEN("Art/Entertainment"), nullptr},
+ { 4, LPGEN("College Student"), nullptr},
+ { 5, LPGEN("Computers"), nullptr},
+ { 6, LPGEN("Community & Social"), nullptr},
+ { 7, LPGEN("Education"), nullptr},
+ { 8, LPGEN("Engineering"), nullptr},
+ { 9, LPGEN("Financial Services"), nullptr},
+ {10, LPGEN("Government"), nullptr},
+ {11, LPGEN("High School Student"), nullptr},
+ {12, LPGEN("Home"), nullptr},
+ {13, LPGEN("ICQ - Providing Help"), nullptr},
+ {14, LPGEN("Law"), nullptr},
+ {15, LPGEN("Managerial"), nullptr},
+ {16, LPGEN("Manufacturing"), nullptr},
+ {17, LPGEN("Medical/Health"), nullptr},
+ {18, LPGEN("Military"), nullptr},
+ {19, LPGEN("Non-Government Organization"), nullptr},
+ {20, LPGEN("Professional"), nullptr},
+ {21, LPGEN("Retail"), nullptr},
+ {22, LPGEN("Retired"), nullptr},
+ {23, LPGEN("Science & Research"), nullptr},
+ {24, LPGEN("Sports"), nullptr},
+ {25, LPGEN("Technical"), nullptr},
+ {26, LPGEN("University Student"), nullptr},
+ {27, LPGEN("Web Building"), nullptr},
+ {99, LPGEN("Other Services"), nullptr}
};
static IDSTRLIST TmplInterests[] = {
- { 0, LPGEN("Unspecified"), 0},
- {100, LPGEN("Art"), 0},
- {101, LPGEN("Cars"), 0},
- {102, LPGEN("Celebrity Fans"), 0},
- {103, LPGEN("Collections"), 0},
- {104, LPGEN("Computers"), 0},
- {105, LPGEN("Culture & Literature"), 0},
- {106, LPGEN("Fitness"), 0},
- {107, LPGEN("Games"), 0},
- {108, LPGEN("Hobbies"), 0},
- {109, LPGEN("ICQ - Providing Help"), 0},
- {110, LPGEN("Internet"), 0},
- {111, LPGEN("Lifestyle"), 0},
- {112, LPGEN("Movies/TV"), 0},
- {113, LPGEN("Music"), 0},
- {114, LPGEN("Outdoor Activities"), 0},
- {115, LPGEN("Parenting"), 0},
- {116, LPGEN("Pets/Animals"), 0},
- {117, LPGEN("Religion"), 0},
- {118, LPGEN("Science/Technology"), 0},
- {119, LPGEN("Skills"), 0},
- {120, LPGEN("Sports"), 0},
- {121, LPGEN("Web Design"), 0},
- {122, LPGEN("Nature and Environment"), 0},
- {123, LPGEN("News & Media"), 0},
- {124, LPGEN("Government"), 0},
- {125, LPGEN("Business & Economy"), 0},
- {126, LPGEN("Mystics"), 0},
- {127, LPGEN("Travel"), 0},
- {128, LPGEN("Astronomy"), 0},
- {129, LPGEN("Space"), 0},
- {130, LPGEN("Clothing"), 0},
- {131, LPGEN("Parties"), 0},
- {132, LPGEN("Women"), 0},
- {133, LPGEN("Social science"), 0},
- {134, LPGEN("60's"), 0},
- {135, LPGEN("70's"), 0},
- {136, LPGEN("80's"), 0},
- {137, LPGEN("50's"), 0},
- {138, LPGEN("Finance and corporate"), 0},
- {139, LPGEN("Entertainment"), 0},
- {140, LPGEN("Consumer electronics"), 0},
- {141, LPGEN("Retail stores"), 0},
- {142, LPGEN("Health and beauty"), 0},
- {143, LPGEN("Media"), 0},
- {144, LPGEN("Household products"), 0},
- {145, LPGEN("Mail order catalog"), 0},
- {146, LPGEN("Business services"), 0},
- {147, LPGEN("Audio and visual"), 0},
- {148, LPGEN("Sporting and athletic"), 0},
- {149, LPGEN("Publishing"), 0},
- {150, LPGEN("Home automation"), 0}
+ { 0, LPGEN("Unspecified"), nullptr},
+ {100, LPGEN("Art"), nullptr},
+ {101, LPGEN("Cars"), nullptr},
+ {102, LPGEN("Celebrity Fans"), nullptr},
+ {103, LPGEN("Collections"), nullptr},
+ {104, LPGEN("Computers"), nullptr},
+ {105, LPGEN("Culture & Literature"), nullptr},
+ {106, LPGEN("Fitness"), nullptr},
+ {107, LPGEN("Games"), nullptr},
+ {108, LPGEN("Hobbies"), nullptr},
+ {109, LPGEN("ICQ - Providing Help"), nullptr},
+ {110, LPGEN("Internet"), nullptr},
+ {111, LPGEN("Lifestyle"), nullptr},
+ {112, LPGEN("Movies/TV"), nullptr},
+ {113, LPGEN("Music"), nullptr},
+ {114, LPGEN("Outdoor Activities"), nullptr},
+ {115, LPGEN("Parenting"), nullptr},
+ {116, LPGEN("Pets/Animals"), nullptr},
+ {117, LPGEN("Religion"), nullptr},
+ {118, LPGEN("Science/Technology"), nullptr},
+ {119, LPGEN("Skills"), nullptr},
+ {120, LPGEN("Sports"), nullptr},
+ {121, LPGEN("Web Design"), nullptr},
+ {122, LPGEN("Nature and Environment"), nullptr},
+ {123, LPGEN("News & Media"), nullptr},
+ {124, LPGEN("Government"), nullptr},
+ {125, LPGEN("Business & Economy"), nullptr},
+ {126, LPGEN("Mystics"), nullptr},
+ {127, LPGEN("Travel"), nullptr},
+ {128, LPGEN("Astronomy"), nullptr},
+ {129, LPGEN("Space"), nullptr},
+ {130, LPGEN("Clothing"), nullptr},
+ {131, LPGEN("Parties"), nullptr},
+ {132, LPGEN("Women"), nullptr},
+ {133, LPGEN("Social science"), nullptr},
+ {134, LPGEN("60's"), nullptr},
+ {135, LPGEN("70's"), nullptr},
+ {136, LPGEN("80's"), nullptr},
+ {137, LPGEN("50's"), nullptr},
+ {138, LPGEN("Finance and corporate"), nullptr},
+ {139, LPGEN("Entertainment"), nullptr},
+ {140, LPGEN("Consumer electronics"), nullptr},
+ {141, LPGEN("Retail stores"), nullptr},
+ {142, LPGEN("Health and beauty"), nullptr},
+ {143, LPGEN("Media"), nullptr},
+ {144, LPGEN("Household products"), nullptr},
+ {145, LPGEN("Mail order catalog"), nullptr},
+ {146, LPGEN("Business services"), nullptr},
+ {147, LPGEN("Audio and visual"), nullptr},
+ {148, LPGEN("Sporting and athletic"), nullptr},
+ {149, LPGEN("Publishing"), nullptr},
+ {150, LPGEN("Home automation"), nullptr}
};
static IDSTRLIST TmplAffiliations[] = {
- { 0, LPGEN("Unspecified"), 0},
- {200, LPGEN("Alumni Org."), 0},
- {201, LPGEN("Charity Org."), 0},
- {202, LPGEN("Club/Social Org."), 0},
- {203, LPGEN("Community Org."), 0},
- {204, LPGEN("Cultural Org."), 0},
- {205, LPGEN("Fan Clubs"), 0},
- {206, LPGEN("Fraternity/Sorority"), 0},
- {207, LPGEN("Hobbyists Org."), 0},
- {208, LPGEN("International Org."), 0},
- {209, LPGEN("Nature and Environment Org."), 0},
- {210, LPGEN("Professional Org."), 0},
- {211, LPGEN("Scientific/Technical Org."), 0},
- {212, LPGEN("Self Improvement Group"), 0},
- {213, LPGEN("Spiritual/Religious Org."), 0},
- {214, LPGEN("Sports Org."), 0},
- {215, LPGEN("Support Org."), 0},
- {216, LPGEN("Trade and Business Org."), 0},
- {217, LPGEN("Union"), 0},
- {218, LPGEN("Volunteer Org."), 0},
- {299, LPGEN("Other"), 0},
+ { 0, LPGEN("Unspecified"), nullptr},
+ {200, LPGEN("Alumni Org."), nullptr},
+ {201, LPGEN("Charity Org."), nullptr},
+ {202, LPGEN("Club/Social Org."), nullptr},
+ {203, LPGEN("Community Org."), nullptr},
+ {204, LPGEN("Cultural Org."), nullptr},
+ {205, LPGEN("Fan Clubs"), nullptr},
+ {206, LPGEN("Fraternity/Sorority"), nullptr},
+ {207, LPGEN("Hobbyists Org."), nullptr},
+ {208, LPGEN("International Org."), nullptr},
+ {209, LPGEN("Nature and Environment Org."), nullptr},
+ {210, LPGEN("Professional Org."), nullptr},
+ {211, LPGEN("Scientific/Technical Org."), nullptr},
+ {212, LPGEN("Self Improvement Group"), nullptr},
+ {213, LPGEN("Spiritual/Religious Org."), nullptr},
+ {214, LPGEN("Sports Org."), nullptr},
+ {215, LPGEN("Support Org."), nullptr},
+ {216, LPGEN("Trade and Business Org."), nullptr},
+ {217, LPGEN("Union"), nullptr},
+ {218, LPGEN("Volunteer Org."), nullptr},
+ {299, LPGEN("Other"), nullptr},
};
static IDSTRLIST TmplPast[] = {
- { 0, LPGEN("Unspecified"), 0},
- {300, LPGEN("Elementary School"), 0},
- {301, LPGEN("High School"), 0},
- {302, LPGEN("College"), 0},
- {303, LPGEN("University"), 0},
- {304, LPGEN("Military"), 0},
- {305, LPGEN("TmplPast Work Place"), 0},
- {306, LPGEN("TmplPast Organization"), 0},
- {399, LPGEN("Other"), 0}
+ { 0, LPGEN("Unspecified"), nullptr},
+ {300, LPGEN("Elementary School"), nullptr},
+ {301, LPGEN("High School"), nullptr},
+ {302, LPGEN("College"), nullptr},
+ {303, LPGEN("University"), nullptr},
+ {304, LPGEN("Military"), nullptr},
+ {305, LPGEN("TmplPast Work Place"), nullptr},
+ {306, LPGEN("TmplPast Organization"), nullptr},
+ {399, LPGEN("Other"), nullptr}
};
static IDSTRLIST TmplMarital[]={
- { 0, LPGEN("Unspecified"), 0},
- {10, LPGEN("Single"), 0},
- {11, LPGEN("Close relationships"), 0},
- {12, LPGEN("Engaged"), 0},
- {20, LPGEN("Married"), 0},
- {30, LPGEN("Divorced"), 0},
- {31, LPGEN("Separated"), 0},
- {40, LPGEN("Widowed"), 0},
- {50, LPGEN("Actively searching"), 0 },
- {60, LPGEN("In love"), 0 },
- {70, LPGEN("It's complicated"), 0 },
- {80, LPGEN("In a civil union"), 0 }
+ { 0, LPGEN("Unspecified"), nullptr},
+ {10, LPGEN("Single"), nullptr},
+ {11, LPGEN("Close relationships"), nullptr},
+ {12, LPGEN("Engaged"), nullptr},
+ {20, LPGEN("Married"), nullptr},
+ {30, LPGEN("Divorced"), nullptr},
+ {31, LPGEN("Separated"), nullptr},
+ {40, LPGEN("Widowed"), nullptr},
+ {50, LPGEN("Actively searching"), nullptr },
+ {60, LPGEN("In love"), nullptr },
+ {70, LPGEN("It's complicated"), nullptr },
+ {80, LPGEN("In a civil union"), nullptr }
};
static IDSTRLIST TmplPrefixes[]={
- { 0, LPGEN("Unspecified"), 0},
- {'j', LPGEN("jun."), 0},
- {'s', LPGEN("sen."), 0}
+ { 0, LPGEN("Unspecified"), nullptr},
+ {'j', LPGEN("jun."), nullptr},
+ {'s', LPGEN("sen."), nullptr}
};
-static IDSTRLIST *MyCountries = NULL;
+static IDSTRLIST *MyCountries = nullptr;
static UINT MyCountriesCount = 0;
/**
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 949a6cee5a..ba70f83a50 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -21,12 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-static HGENMENU ghMenuItem = NULL;
+static HGENMENU ghMenuItem = nullptr;
static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE;
static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE;
-static HANDLE hChangedHook = NULL;
-static HANDLE hApplyIconHook = NULL;
+static HANDLE hChangedHook = nullptr;
+static HANDLE hApplyIconHook = nullptr;
bool g_eiEmail = false;
@@ -45,7 +45,7 @@ static LPSTR Get(MCONTACT hContact) if (hContact != NULL) {
LPCSTR pszProto = Proto_GetBaseAccountName(hContact);
- if (pszProto != NULL) {
+ if (pszProto != nullptr) {
LPCSTR e[2][4] = {
{ SET_CONTACT_EMAIL, SET_CONTACT_EMAIL0, SET_CONTACT_EMAIL1, "Mye-mail0"},
{ SET_CONTACT_COMPANY_EMAIL, SET_CONTACT_COMPANY_EMAIL0, SET_CONTACT_COMPANY_EMAIL1, "MyCompanye-mail0"}
@@ -64,7 +64,7 @@ static LPSTR Get(MCONTACT hContact) }
}
}
- return NULL;
+ return nullptr;
}
/**
@@ -80,7 +80,7 @@ static LPSTR Get(MCONTACT hContact) static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam)
{
int result = 0;
- LPSTR val = NULL;
+ LPSTR val = nullptr;
__try
{
@@ -100,7 +100,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) }
else {
result = 1;
- MsgBox((HWND)lParam, MB_OK, LPGENW("Send e-mail"), NULL, LPGENW("Memory allocation error!"));
+ MsgBox((HWND)lParam, MB_OK, LPGENW("Send e-mail"), nullptr, LPGENW("Memory allocation error!"));
}
}
__except(GetExceptionCode()==EXCEPTION_ACCESS_VIOLATION ?
@@ -127,7 +127,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) static int OnCListApplyIcons(WPARAM wParam, LPARAM)
{
LPSTR val = Get(wParam);
- ExtraIcon_SetIconByName(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : 0);
+ ExtraIcon_SetIconByName(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : nullptr);
mir_free(val);
return 0;
}
@@ -164,7 +164,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb static int OnPreBuildMenu(WPARAM wParam, LPARAM)
{
LPSTR val = Get(wParam);
- Menu_ShowItem(ghMenuItem, val != NULL);
+ Menu_ShowItem(ghMenuItem, val != nullptr);
mir_free(val);
return 0;
}
@@ -175,7 +175,7 @@ static int OnPreBuildMenu(WPARAM wParam, LPARAM) void SvcEMailRebuildMenu()
{
- static HANDLE hPrebuildMenuHook = NULL;
+ static HANDLE hPrebuildMenuHook = nullptr;
if (db_get_b(NULL, MODNAME, SET_EXTENDED_EMAILSERVICE, TRUE)) {
if (!hPrebuildMenuHook)
@@ -198,7 +198,7 @@ void SvcEMailRebuildMenu() if (ghMenuItem) {
Menu_RemoveItem(ghMenuItem);
- ghMenuItem = NULL;
+ ghMenuItem = nullptr;
}
}
}
@@ -222,10 +222,10 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) if (g_eiEmail) { // E-mail checked
// hook events
- if (hChangedHook == NULL)
+ if (hChangedHook == nullptr)
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- if (hApplyIconHook == NULL)
+ if (hApplyIconHook == nullptr)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
@@ -234,11 +234,11 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) else { // E-mail uncheckt
if (hChangedHook) {
UnhookEvent(hChangedHook);
- hChangedHook = NULL;
+ hChangedHook = nullptr;
}
if (hApplyIconHook) {
UnhookEvent(hApplyIconHook);
- hApplyIconHook = NULL;
+ hApplyIconHook = nullptr;
}
}
@@ -270,6 +270,6 @@ void SvcEMailLoadModule() void SvcEMailUnloadModule()
{
// unhook event handlers
- UnhookEvent(hChangedHook); hChangedHook = NULL;
- UnhookEvent(hApplyIconHook); hApplyIconHook = NULL;
+ UnhookEvent(hChangedHook); hChangedHook = nullptr;
+ UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr;
}
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index 6045376bdb..122af6582b 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -25,8 +25,8 @@ static HANDLE ghExtraIconF = INVALID_HANDLE_VALUE; static HANDLE ghExtraIconM = INVALID_HANDLE_VALUE;
static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE;
-static HANDLE hChangedHook = NULL;
-static HANDLE hApplyIconHook = NULL;
+static HANDLE hChangedHook = nullptr;
+static HANDLE hApplyIconHook = nullptr;
bool g_eiGender = false;
@@ -76,7 +76,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) switch (GenderOf(hContact)) {
case 'M': icoName = ICO_COMMON_MALE; break;
case 'F': icoName = ICO_COMMON_FEMALE; break;
- default: icoName = NULL;
+ default: icoName = nullptr;
}
ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName);
}
@@ -120,20 +120,20 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) ghExtraIconSvc = ExtraIcon_RegisterIcolib("gender", LPGEN("Gender (UInfoEx)"), ICO_COMMON_MALE);
// hook events
- if (hChangedHook == NULL)
+ if (hChangedHook == nullptr)
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- if (hApplyIconHook == NULL)
+ if (hApplyIconHook == nullptr)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
}
else {
if (hChangedHook) {
UnhookEvent(hChangedHook);
- hChangedHook = NULL;
+ hChangedHook = nullptr;
}
if (hApplyIconHook) {
UnhookEvent(hApplyIconHook);
- hApplyIconHook = NULL;
+ hApplyIconHook = nullptr;
}
}
return bChanged;
@@ -150,6 +150,6 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) void SvcGenderUnloadModule()
{
// unhook event handlers
- UnhookEvent(hChangedHook); hChangedHook = NULL;
- UnhookEvent(hApplyIconHook); hApplyIconHook = NULL;
+ UnhookEvent(hChangedHook); hChangedHook = nullptr;
+ UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr;
}
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 4e7394514b..867d663c88 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -21,12 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-static HGENMENU ghMenuItem = NULL;
+static HGENMENU ghMenuItem = nullptr;
static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE;
static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE;
-static HANDLE hChangedHook = NULL;
-static HANDLE hApplyIconHook = NULL;
+static HANDLE hChangedHook = nullptr;
+static HANDLE hApplyIconHook = nullptr;
bool g_eiHome = false;
@@ -44,7 +44,7 @@ static LPSTR Get(MCONTACT hContact) // ignore owner
if (hContact != NULL) {
LPCSTR pszProto = Proto_GetBaseAccountName(hContact);
- if (pszProto != NULL) {
+ if (pszProto != nullptr) {
LPCSTR e[2] = { SET_CONTACT_HOMEPAGE, SET_CONTACT_COMPANY_HOMEPAGE };
for (int i = 0; i < 2; i++) {
LPSTR pszHomepage = DB::Setting::GetAStringEx(hContact, USERINFO, pszProto, e[i]);
@@ -53,7 +53,7 @@ static LPSTR Get(MCONTACT hContact) }
}
}
- return NULL;
+ return nullptr;
}
/**
@@ -93,7 +93,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) {
LPSTR val = Get(hContact);
if (ghExtraIconSvc != INVALID_HANDLE_VALUE)
- ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : NULL);
+ ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : nullptr);
MIR_FREE(val);
return 0;
}
@@ -128,7 +128,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb static int OnPreBuildMenu(WPARAM wParam, LPARAM)
{
LPSTR val = Get(wParam);
- Menu_ShowItem(ghMenuItem, val != 0);
+ Menu_ShowItem(ghMenuItem, val != nullptr);
mir_free(val);
return 0;
}
@@ -146,7 +146,7 @@ static int OnPreBuildMenu(WPARAM wParam, LPARAM) void SvcHomepageRebuildMenu()
{
- static HANDLE hPrebuildMenuHook = NULL;
+ static HANDLE hPrebuildMenuHook = nullptr;
if (!hPrebuildMenuHook)
hPrebuildMenuHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildMenu);
@@ -182,10 +182,10 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) if (g_eiHome) {
// hook events
- if (hChangedHook == NULL)
+ if (hChangedHook == nullptr)
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- if (hApplyIconHook == NULL)
+ if (hApplyIconHook == nullptr)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
@@ -194,11 +194,11 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) else {
if (hChangedHook) {
UnhookEvent(hChangedHook);
- hChangedHook = NULL;
+ hChangedHook = nullptr;
}
if (hApplyIconHook) {
UnhookEvent(hApplyIconHook);
- hApplyIconHook = NULL;
+ hApplyIconHook = nullptr;
}
}
return bChanged;
@@ -227,6 +227,6 @@ void SvcHomepageLoadModule() void SvcHomepageUnloadModule()
{
// unhook event handlers
- UnhookEvent(hChangedHook); hChangedHook = NULL;
- UnhookEvent(hApplyIconHook); hApplyIconHook = NULL;
+ UnhookEvent(hChangedHook); hChangedHook = nullptr;
+ UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr;
}
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index e18bacef16..daae9f022a 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -28,12 +28,12 @@ enum EPhoneType PHONE_SMS
};
-static HANDLE ghMenuItem = NULL;
+static HANDLE ghMenuItem = nullptr;
static HANDLE ghExtraIconDef[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE;
-static HANDLE hChangedHook = NULL;
-static HANDLE hApplyIconHook = NULL;
+static HANDLE hChangedHook = nullptr;
+static HANDLE hApplyIconHook = nullptr;
bool g_eiPhone = false;
@@ -54,7 +54,7 @@ static INT_PTR Get(MCONTACT hContact) // ignore owner
if (hContact != NULL) {
LPCSTR pszProto = Proto_GetBaseAccountName(hContact);
- if (pszProto != NULL) {
+ if (pszProto != nullptr) {
LPCSTR e[2][4] = {
{ SET_CONTACT_CELLULAR, SET_CONTACT_PHONE, "MyPhone0" },
{ SET_CONTACT_COMPANY_CELLULAR, SET_CONTACT_COMPANY_PHONE, "MyCompanyPhone0" }
@@ -92,7 +92,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) switch (Get(hContact)) {
case PHONE_NORMAL: icoName = ICO_BTN_PHONE; break;
case PHONE_SMS: icoName = ICO_BTN_CELLULAR; break;
- default: icoName = NULL;
+ default: icoName = nullptr;
}
ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName);
return 0;
@@ -139,10 +139,10 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) // force module enabled, if extraicon plugin was found
if (g_eiPhone) {
// hook events
- if (hChangedHook == NULL)
+ if (hChangedHook == nullptr)
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- if (hApplyIconHook == NULL)
+ if (hApplyIconHook == nullptr)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
@@ -151,11 +151,11 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) else {
if (hChangedHook) {
UnhookEvent(hChangedHook);
- hChangedHook = NULL;
+ hChangedHook = nullptr;
}
if (hApplyIconHook) {
UnhookEvent(hApplyIconHook);
- hApplyIconHook = NULL;
+ hApplyIconHook = nullptr;
}
}
return bChanged;
@@ -172,6 +172,6 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) void SvcPhoneUnloadModule()
{
// unhook event handlers
- UnhookEvent(hChangedHook); hChangedHook = NULL;
- UnhookEvent(hApplyIconHook); hApplyIconHook = NULL;
+ UnhookEvent(hChangedHook); hChangedHook = nullptr;
+ UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr;
}
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 4b26516ad1..1edda986a4 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -96,7 +96,7 @@ public: BYTE IsVisible() const
{
- return _hWnd != NULL;
+ return _hWnd != nullptr;
}
/**
*
@@ -195,9 +195,9 @@ public: **/
CUpdProgress()
{
- _hWnd = NULL;
- _pFnCallBack = NULL;
- _pData = NULL;
+ _hWnd = nullptr;
+ _pFnCallBack = nullptr;
+ _pData = nullptr;
_bIsCanceled = FALSE;
_bBBCode = FALSE;
}
@@ -208,8 +208,8 @@ public: **/
CUpdProgress(void *data)
{
- _hWnd = NULL;
- _pFnCallBack = NULL;
+ _hWnd = nullptr;
+ _pFnCallBack = nullptr;
_pData = data;
_bIsCanceled = FALSE;
_bBBCode = FALSE;
@@ -283,7 +283,7 @@ public: _pFnCallBack = pFnCallBack;
_hWnd = CreateDialogParam(ghInst,
MAKEINTRESOURCE(IDD_REFRESHDETAILS),
- 0,
+ nullptr,
CDlgUpdProgress::WndProc,
(LPARAM) this);
if (_hWnd)
@@ -304,7 +304,7 @@ public: {
SetUserData(_hWnd, NULL);
EndDialog(_hWnd, IDOK);
- _hWnd = NULL;
+ _hWnd = nullptr;
}
}
@@ -389,7 +389,7 @@ public: CPopupUpdProgress(void *data)
: CUpdProgress(data)
{
- _szText = NULL;
+ _szText = nullptr;
_bBBCode = db_get_b(NULL, "Popup", "UseMText", FALSE);
_popupButtons[0].cbSize = sizeof(POPUPACTION);
@@ -443,7 +443,7 @@ public: if (_hWnd)
{
PUDeletePopup(_hWnd);
- _hWnd = NULL;
+ _hWnd = nullptr;
}
MIR_FREE(_szText);
}
@@ -583,7 +583,7 @@ class CContactUpdater : public CContactQueue if (_hProtoAckEvent)
{
UnhookEvent(_hProtoAckEvent);
- _hProtoAckEvent = NULL;
+ _hProtoAckEvent = nullptr;
}
// free up last ackresult array
@@ -597,7 +597,7 @@ class CContactUpdater : public CContactQueue _pProgress->Destroy();
delete _pProgress;
- _pProgress = NULL;
+ _pProgress = nullptr;
}
// reset menu
@@ -653,11 +653,11 @@ public: **/
CContactUpdater() : CContactQueue()
{
- _hContactAcks = NULL;
+ _hContactAcks = nullptr;
_nContactAcks = 0;
_hContact = NULL;
- _pProgress = NULL;
- _hProtoAckEvent = NULL;
+ _pProgress = nullptr;
+ _hProtoAckEvent = nullptr;
}
/**
@@ -728,7 +728,7 @@ public: };
-static CContactUpdater *ContactUpdater = NULL;
+static CContactUpdater *ContactUpdater = nullptr;
/***********************************************************************************************************
* common helper functions
@@ -785,7 +785,7 @@ static INT_PTR RefreshService(WPARAM, LPARAM) {
ContactUpdater->RefreshAll();
}
- else if (IDYES == MsgBox(NULL, MB_YESNO|MB_ICON_QUESTION, LPGENW("Refresh contact details"), NULL,
+ else if (IDYES == MsgBox(nullptr, MB_YESNO|MB_ICON_QUESTION, LPGENW("Refresh contact details"), nullptr,
LPGENW("Do you want to cancel the current refresh procedure?")))
{
ContactUpdater->Cancel();
@@ -793,12 +793,12 @@ static INT_PTR RefreshService(WPARAM, LPARAM) }
else
{
- MsgErr(NULL, LPGENW("Miranda must be online for refreshing contact information!"));
+ MsgErr(nullptr, LPGENW("Miranda must be online for refreshing contact information!"));
}
}
catch(...)
{
- MsgErr(NULL, LPGENW("The function caused an exception!"));
+ MsgErr(nullptr, LPGENW("The function caused an exception!"));
}
return 0;
}
@@ -838,7 +838,7 @@ static int OnContactAdded(WPARAM hContact, LPARAM) }
catch(...)
{
- MsgErr(NULL, LPGENW("The function caused an exception!"));
+ MsgErr(nullptr, LPGENW("The function caused an exception!"));
}
return 0;
}
@@ -856,7 +856,7 @@ static int OnPreShutdown(WPARAM, LPARAM) {
if (ContactUpdater) {
delete ContactUpdater;
- ContactUpdater = 0;
+ ContactUpdater = nullptr;
}
//MIR_DELETE(ContactUpdater);
return 0;
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 151b3a7bfb..a48187a13f 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -57,9 +57,9 @@ REMINDEROPTIONS, *LPREMINDEROPTIONS; static HANDLE ExtraIcon = INVALID_HANDLE_VALUE;
-static HANDLE ghCListIA = NULL;
-static HANDLE ghCListIR = NULL;
-static HANDLE ghSettingsChanged = NULL;
+static HANDLE ghCListIA = nullptr;
+static HANDLE ghCListIR = nullptr;
+static HANDLE ghSettingsChanged = nullptr;
static UINT_PTR ghRemindTimer = 0;
static UINT_PTR ghRemindDateChangeTimer = 0;
@@ -139,7 +139,7 @@ BYTE CEvent::operator << (const CEvent& evt) static HICON GetAnnivIcon(const CEvent &evt)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
CHAR szIcon[MAXSETTING];
@@ -461,7 +461,7 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti // make backup of each protocol based birthday
if (db_get_b(NULL, MODNAME, SET_REMIND_SECUREBIRTHDAY, TRUE))
- mtb.BackupBirthday(hContact, NULL, 0, LastAnwer);
+ mtb.BackupBirthday(hContact, nullptr, 0, LastAnwer);
if (mtb.RemindOption() != BST_UNCHECKED) {
WORD wDaysEarlier = (mtb.RemindOption() == BST_CHECKED) ? mtb.RemindOffset() : -1;
@@ -530,7 +530,7 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti * @return nothing
**/
-static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = 0)
+static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = nullptr)
{
// ignore meta subcontacts here as their birthday information are collected explicitly
if (hContact && (!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) && !db_mc_isSub(hContact)) {
@@ -576,7 +576,7 @@ void SvcReminderCheckAll(const ENotify notify) DlgAnniversaryListShow(0, 0);
if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV)
- NotifyWithPopup(NULL, CEvent::NONE, 0, NULL, TranslateT("No anniversaries to remind of"));
+ NotifyWithPopup(NULL, CEvent::NONE, 0, nullptr, TranslateT("No anniversaries to remind of"));
}
UpdateTimer(FALSE);
}
@@ -659,7 +659,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb WORD LastAnswer = IDNONE;
CheckContact(hContact, now, evt, FALSE, &LastAnswer);
}
- else CheckContact(hContact, now, evt, FALSE, 0);
+ else CheckContact(hContact, now, evt, FALSE, nullptr);
}
return 0;
}
@@ -678,7 +678,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb void SvcReminderOnTopToolBarLoaded()
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_USERINFO_REMINDER_CHECK;
ttb.name = ttb.pszTooltipUp = LPGEN("Check anniversaries");
@@ -721,7 +721,7 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) if (hContact) {
if (!mdb.DBGetBirthDate(hContact))
- mdb.BackupBirthday(hContact, NULL, TRUE);
+ mdb.BackupBirthday(hContact, nullptr, TRUE);
}
else {
WORD a1 = 0;
@@ -729,13 +729,13 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) //walk through all the contacts stored in the DB
for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
if (!db_mc_isSub(hContact) && !mdb.DBGetBirthDate(hContact))
- mdb.BackupBirthday(hContact, NULL, TRUE, &a1);
+ mdb.BackupBirthday(hContact, nullptr, TRUE, &a1);
}
if (lParam != TRUE) {
MSGBOX mBox;
mBox.cbSize = sizeof(MSGBOX);
- mBox.hParent = NULL;
+ mBox.hParent = nullptr;
mBox.hiLogo = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY);
mBox.uType = MB_ICON_INFO;
mBox.ptszTitle = TranslateT("Update custom birthday");
@@ -823,13 +823,13 @@ static void UpdateTimer(BYTE bStartup) else
wNotifyInterval -= now.Compare(last);
- ghRemindDateChangeTimer = SetTimer(0, 0, 1000 * 60 * 5, (TIMERPROC)TimerProc_DateChanged);
+ ghRemindDateChangeTimer = SetTimer(nullptr, 0, 1000 * 60 * 5, (TIMERPROC)TimerProc_DateChanged);
}
else now.DBWriteStamp(NULL, MODNAME, SET_REMIND_LASTCHECK);
// wait at least 5 seconds before checking at startup, to give miranda a better chance to load faster
- KillTimer(0, ghRemindTimer);
- ghRemindTimer = SetTimer(0, 0, 1000 * wNotifyInterval, TimerProc_Check);
+ KillTimer(nullptr, ghRemindTimer);
+ ghRemindTimer = SetTimer(nullptr, 0, 1000 * wNotifyInterval, TimerProc_Check);
}
/***********************************************************************************************************
@@ -924,16 +924,16 @@ void SvcReminderLoadModule(void) void SvcReminderUnloadModule(void)
{
// kill timers
- KillTimer(0, ghRemindTimer);
+ KillTimer(nullptr, ghRemindTimer);
ghRemindTimer = 0;
- KillTimer(0, ghRemindDateChangeTimer);
+ KillTimer(nullptr, ghRemindDateChangeTimer);
ghRemindDateChangeTimer = 0;
// unhook event handlers
UnhookEvent(ghCListIR);
- ghCListIR = 0;
+ ghCListIR = nullptr;
UnhookEvent(ghCListIA);
- ghCListIA = 0;
+ ghCListIA = nullptr;
UnhookEvent(ghSettingsChanged);
- ghSettingsChanged = 0;
+ ghSettingsChanged = nullptr;
}
diff --git a/plugins/UserInfoEx/src/svc_timezone.cpp b/plugins/UserInfoEx/src/svc_timezone.cpp index 76954c6d17..ebff28999f 100644 --- a/plugins/UserInfoEx/src/svc_timezone.cpp +++ b/plugins/UserInfoEx/src/svc_timezone.cpp @@ -42,8 +42,8 @@ INT_PTR GetContactTimeZoneInformation(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return (1); //use new core tz interface - LPTIME_ZONE_INFORMATION pTimeZoneInformation = TimeZone_GetInfo(TimeZone_CreateByContact(wParam, 0, 0)); - if (pTimeZoneInformation == NULL) + LPTIME_ZONE_INFORMATION pTimeZoneInformation = TimeZone_GetInfo(TimeZone_CreateByContact(wParam, nullptr, 0)); + if (pTimeZoneInformation == nullptr) return (1); memcpy((void *)lParam, pTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); return (0); diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 471502da27..c9a5785f16 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -96,7 +96,7 @@ static mir_cs csContactCache; // converts a string into a CNF_ type
BYTE getContactInfoType(wchar_t* type)
{
- if (type == NULL || mir_wstrlen(type) == 0)
+ if (type == nullptr || mir_wstrlen(type) == 0)
return 0;
for (int i = 0; i < _countof(builtinCnfs); i++)
@@ -111,13 +111,13 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact) {
/* returns dynamic allocated buffer with info, or NULL if failed */
if (hContact == NULL)
- return NULL;
+ return nullptr;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
switch (type) {
case CCNF_PROTOID:
return mir_a2u(szProto);
@@ -125,13 +125,13 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact) case CCNF_ACCOUNT:
{
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- return pa ? mir_wstrdup(pa->tszAccountName) : NULL;
+ return pa ? mir_wstrdup(pa->tszAccountName) : nullptr;
}
case CCNF_PROTOCOL:
char protoname[128];
if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
- return NULL;
+ return nullptr;
return mir_a2u(protoname);
case CCNF_STATUS:
@@ -147,17 +147,17 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact) return mir_a2u(inet_ntoa(in));
}
}
- return NULL;
+ return nullptr;
case CCNF_GROUP:
- if ((res = db_get_wsa(hContact, "CList", "Group")) != NULL)
+ if ((res = db_get_wsa(hContact, "CList", "Group")) != nullptr)
return res;
break;
case CNF_UNIQUEID:
//UID for ChatRoom
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
- if ((res = db_get_wsa(hContact, szProto, "ChatRoomID")) != NULL)
+ if ((res = db_get_wsa(hContact, szProto, "ChatRoomID")) != nullptr)
return res;
//UID for other contact
@@ -171,7 +171,7 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact) MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMatch)
{
/* service to retrieve a contact's HANDLE from a given string */
- if (tszContact == NULL || *tszContact == 0)
+ if (tszContact == nullptr || *tszContact == 0)
return INVALID_CONTACT_ID;
bool bReturnCount;
@@ -187,7 +187,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat mir_cslock lck(csContactCache);
CONTACTCE *p = arContactCache.find(&tmp);
- if (p != NULL)
+ if (p != nullptr)
return (bReturnCount) ? 1 : p->hContact; // found in cache
}
@@ -203,7 +203,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat bool bMatch = (tmp == tszContact);
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
continue;
// <proto:id> (exact)
@@ -304,7 +304,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam) DBCONTACTWRITESETTING *dbw = (DBCONTACTWRITESETTING*)lParam;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return 0;
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -314,7 +314,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam) bool isLastName = !strcmp(dbw->szSetting, "LastName");
bool isEmail = !strcmp(dbw->szSetting, "e-mail");
bool isMyHandle = !strcmp(dbw->szSetting, "MyHandle");
- bool isUid = (((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!strcmp(dbw->szSetting, uid));
+ bool isUid = (((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != nullptr)) && (!strcmp(dbw->szSetting, uid));
mir_cslock lck(csContactCache);
for (int i = 0; i < arContactCache.getCount(); i++) {
@@ -358,12 +358,12 @@ int deinitContactModule() wchar_t* encodeContactToString(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
wchar_t *tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact);
- if (tszUniqueId == NULL)
- return NULL;
+ if (tszUniqueId == nullptr)
+ return nullptr;
size_t size = mir_wstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
wchar_t *tszResult = (wchar_t *)mir_calloc(size * sizeof(wchar_t));
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index c32efb2dcb..a605833839 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -33,9 +33,9 @@ extern HINSTANCE hInst; extern HCURSOR hCurSplitNS; -static HWND hwndHelpDialog = NULL; +static HWND hwndHelpDialog = nullptr; -static HICON hHelpIcon = NULL; +static HICON hHelpIcon = nullptr; static int defaultHelpDialogResize(HWND, LPARAM, UTILRESIZECONTROL *urc) { @@ -131,7 +131,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM if (hContact == INVALID_CONTACT_ID) { wchar_t *tszContact = db_get_wsa(NULL, MODULENAME, SETTING_SUBJECT); log_debugA("VARM_SETSUBJECT: %s", tszContact); - if (tszContact != NULL) { + if (tszContact != nullptr) { hContact = getContactFromString(tszContact, CI_PROTOID); log_debugA("VARM_SETSUBJECT decoded: %u", hContact); mir_free(tszContact); @@ -203,7 +203,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM MCONTACT hContact = (MCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); if (hContact != NULL) { wchar_t *tszContact = encodeContactToString(hContact); - if (tszContact != NULL) { + if (tszContact != nullptr) { db_set_ws(NULL, MODULENAME, SETTING_SUBJECT, tszContact); mir_free(tszContact); } } @@ -215,12 +215,12 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM // dialog box for the tokens static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) { - if (tr == NULL) { - return NULL; + if (tr == nullptr) { + return nullptr; } char *helpText = mir_strdup(tr->szHelpText); - if (helpText == NULL) { - return NULL; + if (helpText == nullptr) { + return nullptr; } char *cur = helpText; while (*cur != 0) { @@ -243,8 +243,8 @@ static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) { static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) { - if (tr == NULL) - return NULL; + if (tr == nullptr) + return nullptr; char *cur = tr->szHelpText + mir_strlen(tr->szHelpText); while (cur > tr->szHelpText) { @@ -265,49 +265,49 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) static wchar_t *getTokenDescription(TOKENREGISTEREX *tr) { - if (tr == NULL) - return NULL; + if (tr == nullptr) + return nullptr; - if (tr->szHelpText == NULL) + if (tr->szHelpText == nullptr) return mir_wstrdup(tr->tszTokenString); char *helpText = mir_strdup(tr->szHelpText); - if (helpText == NULL) - return NULL; + if (helpText == nullptr) + return nullptr; char *cur = helpText; - wchar_t *tArgs = NULL; - char *args = NULL, *first = NULL, *second = NULL; + wchar_t *tArgs = nullptr; + char *args = nullptr, *first = nullptr, *second = nullptr; while (*cur != 0) { if (*cur == '\t') { - if (first == NULL) + if (first == nullptr) first = cur; - else if (second == NULL) + else if (second == nullptr) second = cur; } cur++; } - if ((first != NULL) && (second != NULL)) { + if ((first != nullptr) && (second != nullptr)) { *second = 0; args = first+1; } - else args = NULL; + else args = nullptr; - size_t len = mir_wstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; + size_t len = mir_wstrlen(tr->tszTokenString) + (args!=nullptr?mir_strlen(args):0) + 3; wchar_t *desc = (wchar_t*)mir_calloc(len * sizeof(wchar_t)); - if (desc == NULL) { + if (desc == nullptr) { mir_free(helpText); - return NULL; + return nullptr; } if (tr->flags&TRF_FIELD) mir_snwprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR); else { - if (args != NULL) + if (args != nullptr) tArgs = mir_a2u(args); - mir_snwprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=NULL?tArgs:L"")); + mir_snwprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=nullptr?tArgs:L"")); } mir_free(tArgs); @@ -319,7 +319,7 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM) { TOKENREGISTEREX *tr1 = (TOKENREGISTEREX *)lParam1; TOKENREGISTEREX *tr2 = (TOKENREGISTEREX *)lParam2; - if (tr1 == NULL || tr2 == NULL) + if (tr1 == nullptr || tr2 == nullptr) return 0; ptrW cat1(getTokenCategory(tr1)); @@ -331,7 +331,7 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM) if (res != 0) return res; - if (tr1->tszTokenString == NULL || tr2->tszTokenString == NULL) + if (tr1->tszTokenString == nullptr || tr2->tszTokenString == nullptr) return 0; return mir_wstrcmp(tr1->tszTokenString, tr2->tszTokenString); @@ -361,24 +361,24 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA int i = -1; do { i++; - tszHelpDesc = tszTokenDesc = NULL; + tszHelpDesc = tszTokenDesc = nullptr; tr = getTokenRegister(i); - if ((tr == NULL) || (tr->tszTokenString == NULL)) + if ((tr == nullptr) || (tr->tszTokenString == nullptr)) continue; - else if (hdd != NULL) { + else if (hdd != nullptr) { if (!mir_wstrcmp(tr->tszTokenString, SUBJECT)) { if (hdd->vhs->flags&VHF_HIDESUBJECTTOKEN) continue; - if (hdd->vhs->szSubjectDesc != NULL) + if (hdd->vhs->szSubjectDesc != nullptr) tszHelpDesc = mir_a2u(hdd->vhs->szSubjectDesc); } if (!mir_wstrcmp(tr->tszTokenString, MIR_EXTRATEXT)) { if (hdd->vhs->flags & VHF_HIDEEXTRATEXTTOKEN) continue; - if (hdd->vhs->szExtraTextDesc != NULL) + if (hdd->vhs->szExtraTextDesc != nullptr) tszHelpDesc = mir_a2u(hdd->vhs->szExtraTextDesc); } } @@ -388,7 +388,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA lvItem.iItem = ListView_GetItemCount(hList); lvItem.lParam = (LPARAM)tr; tszTokenDesc = getTokenDescription(tr); - if (tszTokenDesc == NULL) + if (tszTokenDesc == nullptr) continue; lvItem.pszText = tszTokenDesc; @@ -396,10 +396,10 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA mir_free(tszTokenDesc); lvItem.mask = LVIF_TEXT; - if (tszHelpDesc == NULL) + if (tszHelpDesc == nullptr) tszHelpDesc = getHelpDescription(tr); - if (tszHelpDesc == NULL) + if (tszHelpDesc == nullptr) tszHelpDesc = mir_wstrdup(L"unknown"); lvItem.iSubItem = 1; @@ -407,12 +407,12 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA ListView_SetItem(hList, &lvItem); mir_free(tszHelpDesc); } - while (tr != NULL); + while (tr != nullptr); ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE); ListView_SetColumnWidth(hList, 1, LVSCW_AUTOSIZE); ListView_SortItems(hList, compareTokenHelp, 0); - last = text = NULL; + last = text = nullptr; for (i = 0; i < ListView_GetItemCount(hList); i++) { LVITEM lvItem = { 0 }; lvItem.mask = LVIF_PARAM; @@ -421,17 +421,17 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA continue; cat = getTokenCategory((TOKENREGISTEREX *)lvItem.lParam); - if (cat != NULL) { + if (cat != nullptr) { text = mir_wstrdup(TranslateW(cat)); mir_free(cat); } - else text = NULL; + else text = nullptr; - if (text != NULL && (last == NULL || mir_wstrcmpi(last, text))) { + if (text != nullptr && (last == nullptr || mir_wstrcmpi(last, text))) { lvItem.mask = LVIF_TEXT; lvItem.pszText = text; ListView_InsertItem(hList, &lvItem); - if (last != NULL) { + if (last != nullptr) { mir_free(last); lvItem.iSubItem = 0; lvItem.pszText = L""; @@ -448,7 +448,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA case WM_NOTIFY: if ((((NMHDR*)lParam)->idFrom == IDC_TOKENLIST) && (((NMHDR*)lParam)->code == NM_DBLCLK)) { HWND hwndInputDlg = (HWND)SendMessage(GetParent(hwndDlg), VARM_GETDIALOG, (WPARAM)VHF_INPUT, 0); - if (hwndInputDlg == NULL) + if (hwndInputDlg == nullptr) break; HWND hList = GetDlgItem(hwndDlg, IDC_TOKENLIST); @@ -461,12 +461,12 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA break; TOKENREGISTER *tr = (TOKENREGISTER *)lvItem.lParam; - if (tr == NULL) + if (tr == nullptr) break; size_t len = mir_wstrlen(tr->tszTokenString) + 2; wchar_t *tokenString = (wchar_t*)mir_alloc((len+1)*sizeof(wchar_t)); - if (tokenString == NULL) + if (tokenString == nullptr) break; memset(tokenString, 0, ((len + 1) * sizeof(wchar_t))); @@ -611,7 +611,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM dat->hwndHelpDlg = GetParent(hwndDlg); SendMessage(hwndDlg, VARM_PARSE, 0, 0); - SetTimer(hwndDlg, IDT_PARSE, 1000, NULL); + SetTimer(hwndDlg, IDT_PARSE, 1000, nullptr); SetFocus(GetDlgItem(hwndDlg, IDC_TESTSTRING)); break; @@ -679,17 +679,17 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM extraText = (wchar_t*)mir_calloc((len + 1)* sizeof(wchar_t)); SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXT, (WPARAM)len + 1, (LPARAM)extraText); } - else extraText = NULL; + else extraText = nullptr; - if (string != NULL) { + if (string != nullptr) { wchar_t *newString = variables_parsedup(string, extraText, (MCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0)); - if (newString != NULL) { + if (newString != nullptr) { wchar_t *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT); - if (oldString == NULL || mir_wstrcmp(oldString, newString)) + if (oldString == nullptr || mir_wstrcmp(oldString, newString)) SetDlgItemText(hwndDlg, IDC_RESULT, newString); mir_free(newString); - if (oldString != NULL) + if (oldString != nullptr) mir_free(oldString); } mir_free(string); @@ -718,7 +718,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case WM_DESTROY: KillTimer(hwndDlg, IDT_PARSE); - if (dat == NULL) + if (dat == nullptr) break; db_set_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, dat->splitterPos); mir_free(dat); @@ -781,7 +781,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l GetWindowRect(hwndDlg, &rcParent); TCITEM tci = { 0 }; - HWND hPage, hShow = 0; + HWND hPage, hShow = nullptr; if (dat->vhs->flags&VHF_TOKENS) { // token tab tci.mask = TCIF_TEXT | TCIF_PARAM; @@ -793,7 +793,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE); ShowWindow(hPage, SW_HIDE); TabCtrl_InsertItem(hTab, tabCount++, &tci); - hShow = hShow == 0 ? hPage : hShow; + hShow = hShow == nullptr ? hPage : hShow; } if (dat->vhs->flags&VHF_INPUT) { // input tab @@ -806,8 +806,8 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE); ShowWindow(hPage, SW_HIDE); TabCtrl_InsertItem(hTab, tabCount++, &tci); - hShow = hShow == 0 ? hPage : hShow; - if ((dat->vhs->fi != NULL) && (dat->vhs->fi->szFormat != NULL)) { + hShow = hShow == nullptr ? hPage : hShow; + if ((dat->vhs->fi != nullptr) && (dat->vhs->fi->szFormat != nullptr)) { if (dat->vhs->fi->flags & FIF_UNICODE) SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->tszFormat); else { @@ -818,20 +818,20 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l } } - else if (dat->vhs->hwndCtrl != NULL) { + else if (dat->vhs->hwndCtrl != nullptr) { wchar_t *tszText = Hlp_GetWindowText(dat->vhs->hwndCtrl); - if (tszText != NULL) { + if (tszText != nullptr) { SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)tszText); mir_free(tszText); } } - if (dat->vhs->fi != NULL || dat->vhs->hwndCtrl != NULL) { + if (dat->vhs->fi != nullptr || dat->vhs->hwndCtrl != nullptr) { SetDlgItemText(hwndDlg, IDC_CANCEL, TranslateT("Cancel")); ShowWindow(GetDlgItem(hwndDlg, IDC_OK), SW_SHOW); } } if ((dat->vhs->flags&VHF_SUBJECT) || - ((dat->vhs->flags&VHF_INPUT) && (((dat->vhs->fi != NULL) && (dat->vhs->fi->hContact != NULL)) || (dat->vhs->flags&VHF_SETLASTSUBJECT)))) { + ((dat->vhs->flags&VHF_INPUT) && (((dat->vhs->fi != nullptr) && (dat->vhs->fi->hContact != NULL)) || (dat->vhs->flags&VHF_SETLASTSUBJECT)))) { // subject window is created, but not necessarily shown dat->hwndSubjectDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CLIST_DIALOG), hwndDlg, clistDlgProc, (LPARAM)GetParent(hwndDlg)); EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); @@ -839,7 +839,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE); ShowWindow(hPage, SW_HIDE); - if ((dat->vhs->fi != NULL) && (dat->vhs->fi->hContact != NULL)) + if ((dat->vhs->fi != nullptr) && (dat->vhs->fi->hContact != NULL)) SendMessage(hwndDlg, VARM_SETSUBJECT, (WPARAM)dat->vhs->fi->hContact, 0); else if (dat->vhs->flags&VHF_SETLASTSUBJECT) SendMessage(hwndDlg, VARM_SETSUBJECT, (WPARAM)INVALID_HANDLE_VALUE, 0); @@ -850,18 +850,18 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l tci.mask = TCIF_TEXT | TCIF_PARAM; tci.pszText = TranslateT("%subject%"); TabCtrl_InsertItem(hTab, tabCount++, &tci); - hShow = hShow == 0 ? hPage : hShow; + hShow = hShow == nullptr ? hPage : hShow; } } if ((dat->vhs->flags&VHF_EXTRATEXT) || - ((dat->vhs->flags&VHF_INPUT) && (dat->vhs->fi != NULL) && (dat->vhs->fi->tszExtraText != NULL))) { + ((dat->vhs->flags&VHF_INPUT) && (dat->vhs->fi != nullptr) && (dat->vhs->fi->tszExtraText != nullptr))) { // extratext window is created, but not necessarily shown dat->hwndExtraTextDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EXTRATEXT_DIALOG), hwndDlg, extratextDlgProc, (LPARAM)GetParent(hwndDlg)); EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE); ShowWindow(hPage, SW_HIDE); - if ((dat->vhs->fi != NULL) && (dat->vhs->fi->tszExtraText != NULL)) { + if ((dat->vhs->fi != nullptr) && (dat->vhs->fi->tszExtraText != nullptr)) { if (dat->vhs->fi->flags & FIF_UNICODE) SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->tszExtraText); else { @@ -878,7 +878,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l tci.pszText = TranslateT("%extratext%"); tci.lParam = (LPARAM)hPage; TabCtrl_InsertItem(hTab, tabCount++, &tci); - hShow = hShow == 0 ? hPage : hShow; + hShow = hShow == nullptr ? hPage : hShow; } } if (dat->vhs->flags&VHF_HELP) { @@ -892,7 +892,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE); ShowWindow(hPage, SW_HIDE); TabCtrl_InsertItem(hTab, tabCount++, &tci); - hShow = hShow == 0 ? hPage : hShow; + hShow = hShow == nullptr ? hPage : hShow; } Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, MODULENAME, "help"); SetWindowText(hwndDlg, TranslateT("Variables Help")); @@ -903,10 +903,10 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_OK: - if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) { + if ((dat->vhs->fi != nullptr) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) { int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0); if (len > 0) { - if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) { + if ((dat->vhs->fi != nullptr) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) { if (dat->vhs->fi->flags&FIF_UNICODE) { dat->vhs->fi->tszFormat = (wchar_t*)mir_calloc((len + 1)*sizeof(WCHAR)); SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len + 1, (LPARAM)dat->vhs->fi->tszFormat); @@ -919,13 +919,13 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l } } - if (dat->vhs->hwndCtrl != NULL) { + if (dat->vhs->hwndCtrl != nullptr) { int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0); if (len > 0) { wchar_t *tszText; tszText = (wchar_t*)mir_calloc((len + 1)*sizeof(wchar_t)); - if (tszText != NULL) { + if (tszText != nullptr) { SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len + 1, (LPARAM)tszText); SetWindowText(dat->vhs->hwndCtrl, tszText); mir_free(tszText); @@ -938,7 +938,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l (LPARAM)dat->vhs->hwndCtrl); } - if ((dat->vhs->flags&VHF_FULLFILLSTRUCT) && (dat->vhs->fi != NULL)) { + if ((dat->vhs->flags&VHF_FULLFILLSTRUCT) && (dat->vhs->fi != nullptr)) { int len = SendMessage(hwndDlg, VARM_GETEXTRATEXTLENGTH, 0, 0); if (len > 0) { if (dat->vhs->fi->flags&FIF_UNICODE) { @@ -955,7 +955,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l // fall through case IDC_CANCEL: - if (GetParent(hwndDlg) == NULL) + if (GetParent(hwndDlg) == nullptr) DestroyWindow(hwndDlg); else EndDialog(hwndDlg, 0); @@ -1077,7 +1077,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l break; case WM_CLOSE: - if (GetParent(hwndDlg) == NULL) + if (GetParent(hwndDlg) == nullptr) DestroyWindow(hwndDlg); else EndDialog(hwndDlg, 0); @@ -1105,7 +1105,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l DestroyWindow(dat->hwndExtraTextDlg); mir_free(dat); - dat = NULL; + dat = nullptr; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); break; } @@ -1128,23 +1128,23 @@ INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam) if (wParam) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), (HWND)wParam, helpDlgProc, (LPARAM)lParam); else - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), NULL, helpDlgProc, (LPARAM)lParam); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), nullptr, helpDlgProc, (LPARAM)lParam); return 0; } INT_PTR showHelpService(WPARAM wParam, LPARAM lParam) { - static VARHELPINFO *vhs = NULL; - static FORMATINFO *fi = NULL; + static VARHELPINFO *vhs = nullptr; + static FORMATINFO *fi = nullptr; - if (fi == NULL) + if (fi == nullptr) fi = (FORMATINFO*)mir_alloc(sizeof(FORMATINFO)); memset(fi, 0, sizeof(FORMATINFO)); fi->cbSize = sizeof(FORMATINFO); fi->szFormat = (char *)lParam; - if (vhs == NULL) + if (vhs == nullptr) vhs = (VARHELPINFO*)mir_alloc(sizeof(VARHELPINFO)); memset(vhs, 0, sizeof(VARHELPINFO)); @@ -1164,7 +1164,7 @@ INT_PTR getSkinItemService(WPARAM, LPARAM lParam) switch (item) { case VSI_HELPICON: - if (hHelpIcon == NULL) + if (hHelpIcon == nullptr) hHelpIcon = IcoLib_GetIcon("vars_help"); return (INT_PTR)hHelpIcon; @@ -1177,6 +1177,6 @@ INT_PTR getSkinItemService(WPARAM, LPARAM lParam) int iconsChanged(WPARAM, LPARAM) { - hHelpIcon = NULL; + hHelpIcon = nullptr; return 0; } diff --git a/plugins/Variables/src/lookup3.cpp b/plugins/Variables/src/lookup3.cpp index 7f28ed0498..ecc39f1352 100644 --- a/plugins/Variables/src/lookup3.cpp +++ b/plugins/Variables/src/lookup3.cpp @@ -221,7 +221,7 @@ uint32 hashlittle( void *key, size_t length, uint32 initval) /* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32)length) + initval;
- if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) {
+ if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x3)) {
uint32 *k = ( uint32 *)key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@@ -253,7 +253,7 @@ uint32 hashlittle( void *key, size_t length, uint32 initval) case 0 : return c; /* zero length strings require no mixing */
}
- } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x1)) {
+ } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x1)) {
uint16 *k = (uint16 *)key; /* read 16-bit chunks */
/*--------------- all but last block: aligned reads and different mixing */
@@ -360,7 +360,7 @@ uint32 hashbig( void *key, size_t length, uint32 initval) /* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32)length) + initval;
- if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) {
+ if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x3)) {
uint32 *k = (uint32 *)key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index 4c917a55f0..48e04098f9 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -65,13 +65,13 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case IDC_AUTOPARSE:
SendMessage(hwndDlg, VARM_PARSE, 0, 0);
if (IsDlgButtonChecked( hwndDlg, IDC_AUTOPARSE ))
- SetTimer(hwndDlg, IDT_PARSE, 1000, NULL);
+ SetTimer(hwndDlg, IDT_PARSE, 1000, nullptr);
else
KillTimer(hwndDlg, IDT_PARSE);
break;
case IDC_SHOWHELP:
- variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
+ variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, nullptr, nullptr);
break;
case IDC_STRIPALL:
@@ -86,7 +86,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA int len = SendDlgItemMessage(hwndDlg, IDC_FORMATTEXT, WM_GETTEXTLENGTH, 0, 0);
if (len >= 0) {
wchar_t *szFormatText = (wchar_t*)mir_calloc((len+1)* sizeof(wchar_t));
- if (szFormatText == NULL)
+ if (szFormatText == nullptr)
break;
if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len+1) != 0)
@@ -104,9 +104,9 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case VARM_PARSE:
{
wchar_t *string = Hlp_GetDlgItemText(hwndDlg, IDC_FORMATTEXT);
- if (string != NULL) {
- wchar_t *newString = variables_parsedup(string, NULL, NULL);
- if (newString != NULL) {
+ if (string != nullptr) {
+ wchar_t *newString = variables_parsedup(string, nullptr, NULL);
+ if (newString != nullptr) {
SetDlgItemText(hwndDlg, IDC_RESULT, newString);
mir_free(newString);
}
@@ -120,7 +120,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA break;
case WM_DESTROY:
- setParseOptions(NULL);
+ setParseOptions(nullptr);
break;
}
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 0c3f1a8060..e90595a68e 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -32,15 +32,15 @@ static mir_cs csAliasRegister; static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias)
{
- if (szAlias == NULL || *szAlias == 0)
- return NULL;
+ if (szAlias == nullptr || *szAlias == 0)
+ return nullptr;
mir_cslock lck(csAliasRegister);
for (int i = 0; i < arAliases.getCount(); i++)
if (!mir_wstrcmp(arAliases[i]->szAlias, szAlias))
return arAliases[i];
- return NULL;
+ return nullptr;
}
static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
@@ -58,8 +58,8 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg) if (((signed int)mir_wstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_wstrlen(tArg)))) {
if (mir_wstrlen(rArg) > mir_wstrlen(tArg)) {
res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + (mir_wstrlen(rArg) - mir_wstrlen(tArg)) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
}
memmove(res + ecur + (mir_wstrlen(rArg) - mir_wstrlen(tArg)), res + ecur, (mir_wstrlen(res + ecur) + 1)*sizeof(wchar_t));
wcsncpy(res + cur, rArg, mir_wstrlen(rArg));
@@ -74,14 +74,14 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg) static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
{
ALIASREGISTER *areg = searchAliasRegister(ai->targv[0]);
- if (areg == NULL || areg->argc != ai->argc - 1)
- return NULL;
+ if (areg == nullptr || areg->argc != ai->argc - 1)
+ return nullptr;
wchar_t *res = mir_wstrdup(areg->szTranslation);
for (unsigned i = 0; i < areg->argc; i++) {
res = replaceArguments(res, areg->argv[i], ai->targv[i + 1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
}
return res;
@@ -89,7 +89,7 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai) static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** argv, wchar_t *szTranslation)
{
- if (szAlias == NULL || szTranslation == NULL || mir_wstrlen(szAlias) == 0)
+ if (szAlias == nullptr || szTranslation == nullptr || mir_wstrlen(szAlias) == 0)
return -1;
mir_cslock lck(csAliasRegister);
@@ -105,19 +105,19 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg p->argc = argc;
p->argv = (wchar_t**)mir_realloc(p->argv, argc * sizeof(wchar_t*));
- if (p->argv == NULL)
+ if (p->argv == nullptr)
return -1;
for (unsigned j = 0; j < argc; j++) {
- if (argv[j] != NULL)
+ if (argv[j] != nullptr)
p->argv[j] = mir_wstrdup(argv[j]);
else
- p->argv[j] = NULL;
+ p->argv[j] = nullptr;
}
return 0;
}
wchar_t **pargv = (wchar_t**)mir_alloc(argc * sizeof(wchar_t*));
- if (pargv == NULL)
+ if (pargv == nullptr)
return -1;
ALIASREGISTER *p = new ALIASREGISTER;
@@ -127,10 +127,10 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg p->argv = pargv;
for (unsigned j = 0; j < p->argc; j++) {
- if (argv[j] != NULL)
+ if (argv[j] != nullptr)
p->argv[j] = mir_wstrdup(argv[j]);
else
- p->argv[j] = NULL;
+ p->argv[j] = nullptr;
}
arAliases.insert(p);
return 0;
@@ -139,7 +139,7 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
char *szHelp, *szArgsA;
wchar_t *cur = ai->targv[1];
@@ -153,7 +153,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) deRegisterToken(alias);
addToAliasRegister(alias, argv.getCount(), argv.getArray(), ai->targv[2]);
- wchar_t *szArgs = NULL;
+ wchar_t *szArgs = nullptr;
for (int i = 0; i < argv.getCount(); i++) {
if (i == 0)
szArgs = (wchar_t*)mir_calloc((mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
@@ -165,7 +165,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) mir_wstrcat(szArgs, L",");
}
int res;
- if (szArgs != NULL && argv.getCount() > 0) {
+ if (szArgs != nullptr && argv.getCount() > 0) {
szArgsA = mir_u2a(szArgs);
size_t size = 32 + mir_strlen(szArgsA);
@@ -184,7 +184,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) mir_free(szArgs);
mir_free(szHelp);
argv.destroy();
- return (res == 0) ? mir_wstrdup(L"") : NULL;
+ return (res == 0) ? mir_wstrdup(L"") : nullptr;
}
void registerAliasTokens()
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 820b4a01ee..10de3d36cb 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -21,26 +21,26 @@ static wchar_t *getFullWinampTitleText()
{
- HWND hwndWinamp = FindWindow(L"STUDIO", NULL);
- if (hwndWinamp == NULL)
- hwndWinamp = FindWindow(L"Winamp v1.x", NULL);
+ HWND hwndWinamp = FindWindow(L"STUDIO", nullptr);
+ if (hwndWinamp == nullptr)
+ hwndWinamp = FindWindow(L"Winamp v1.x", nullptr);
- if (hwndWinamp == NULL)
- return NULL;
+ if (hwndWinamp == nullptr)
+ return nullptr;
SIZE_T dwWinTextLength = (GetWindowTextLength(hwndWinamp) + 1);
wchar_t *szWinText = (wchar_t*)mir_alloc(dwWinTextLength * sizeof(wchar_t));
- if (szWinText == NULL)
- return NULL;
+ if (szWinText == nullptr)
+ return nullptr;
if (GetWindowText(hwndWinamp, szWinText, dwWinTextLength) == 0) {
mir_free(szWinText);
- return NULL;
+ return nullptr;
}
wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_wstrlen(szWinText) + 1)*sizeof(wchar_t));
- if (szTitle == NULL) {
+ if (szTitle == nullptr) {
mir_free(szWinText);
- return NULL;
+ return nullptr;
}
mir_wstrcpy(szTitle, szWinText);
mir_wstrcpy(szTitle + mir_wstrlen(szTitle), szWinText);
@@ -52,18 +52,18 @@ static wchar_t *getFullWinampTitleText() static wchar_t *parseWinampSong(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
wchar_t *szTitle = getFullWinampTitleText();
- if (szTitle == NULL)
- return NULL;
+ if (szTitle == nullptr)
+ return nullptr;
wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
- if ((scur == NULL) || ((cur = wcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_wstrlen(szTitle) - 2)) || (cur > (szTitle + mir_wstrlen(szTitle)))) {
+ if ((scur == nullptr) || ((cur = wcsstr(scur, L" - Winamp")) == nullptr) || (scur >= cur) || (scur > (szTitle + mir_wstrlen(szTitle) - 2)) || (cur > (szTitle + mir_wstrlen(szTitle)))) {
mir_free(szTitle);
- return NULL;
+ return nullptr;
}
scur++;
scur++;
@@ -78,16 +78,16 @@ static wchar_t *parseWinampSong(ARGUMENTSINFO *ai) static wchar_t *parseWinampState(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
wchar_t *szTitle = getFullWinampTitleText();
- if (szTitle == NULL)
- return NULL;
+ if (szTitle == nullptr)
+ return nullptr;
wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
- if (scur == NULL || (cur = wcsstr(scur, L" - Winamp")) == NULL)
+ if (scur == nullptr || (cur = wcsstr(scur, L" - Winamp")) == nullptr)
res = mir_wstrdup(TranslateT("Stopped"));
else if ((!wcsncmp(cur + 10, L"[Stopped]", 9)))
res = mir_wstrdup(TranslateT("Stopped"));
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index cd927fb98b..d4c00aad23 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -22,11 +22,11 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
char *res = mir_u2a(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
size_t cur = 0;
while (cur < mir_strlen(res)) {
@@ -35,8 +35,8 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai) continue;
}
res = (char*)mir_realloc(res, mir_strlen(res) + 4);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
char hex[8];
memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1);
@@ -53,11 +53,11 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai) static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
char *res = mir_u2a(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
unsigned int cur = 0;
while (cur < mir_strlen(res)) {
@@ -65,7 +65,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai) char hex[8];
memset(hex, '\0', sizeof(hex));
strncpy(hex, res + cur + 1, 2);
- *(res + cur) = (char)strtol(hex, NULL, 16);
+ *(res + cur) = (char)strtol(hex, nullptr, 16);
memmove(res + cur + 1, res + cur + 3, mir_strlen(res + cur + 3) + 1);
}
cur++;
@@ -80,7 +80,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai) static wchar_t *parseNToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
struct in_addr in;
in.s_addr = ttoi(ai->targv[1]);
@@ -90,7 +90,7 @@ static wchar_t *parseNToA(ARGUMENTSINFO *ai) static wchar_t *parseHToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
struct in_addr in;
in.s_addr = htonl(ttoi(ai->targv[1]));
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 02378ee230..2c234b9890 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -22,7 +22,7 @@ static wchar_t *parseAnd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -42,7 +42,7 @@ static wchar_t *parseAnd(ARGUMENTSINFO *ai) static wchar_t *parseFalse(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_FALSE;
return mir_wstrdup(L"");
@@ -51,7 +51,7 @@ static wchar_t *parseFalse(ARGUMENTSINFO *ai) static wchar_t *parseIf(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -65,7 +65,7 @@ static wchar_t *parseIf(ARGUMENTSINFO *ai) static wchar_t *parseIf2(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -93,13 +93,13 @@ static wchar_t *parseIf3(ARGUMENTSINFO *ai) mir_free(szCondition);
}
- return NULL;
+ return nullptr;
}
static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -108,7 +108,7 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai) fi.szFormat = ai->argv[2];
ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
- return NULL;
+ return nullptr;
if (ttoi(tszFirst) == ttoi(tszSecond))
return mir_wstrdup(ai->targv[3]);
@@ -119,7 +119,7 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai) static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -128,7 +128,7 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai) fi.szFormat = ai->argv[2];
ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
- return NULL;
+ return nullptr;
if (ttoi(tszFirst) > ttoi(tszSecond))
return mir_wstrdup(ai->targv[3]);
@@ -139,7 +139,7 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai) static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -148,7 +148,7 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai) fi.szFormat = ai->argv[2];
ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
- return NULL;
+ return nullptr;
if (mir_wstrlen(tszFirst) > mir_wstrlen(tszSecond))
return mir_wstrdup(ai->targv[3]);
@@ -164,7 +164,7 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai) static wchar_t *parseFor(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(L"");
@@ -178,12 +178,12 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai) while (fi.eCount == 0) {
fi.tszFormat = ai->targv[4];
wchar_t *parsed = formatString(&fi);
- if (parsed != NULL) {
- if (res == NULL) {
+ if (parsed != nullptr) {
+ if (res == nullptr) {
res = (wchar_t*)mir_alloc(mir_wstrlen(parsed) + 1 * sizeof(wchar_t));
- if (res == NULL) {
+ if (res == nullptr) {
mir_free(parsed);
- return NULL;
+ return nullptr;
}
}
else res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(parsed) + 1)*sizeof(wchar_t));
@@ -204,7 +204,7 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai) static wchar_t *parseEqual(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (ttoi(ai->targv[1]) != ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -215,7 +215,7 @@ static wchar_t *parseEqual(ARGUMENTSINFO *ai) static wchar_t *parseGreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (ttoi(ai->targv[1]) <= ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -226,7 +226,7 @@ static wchar_t *parseGreater(ARGUMENTSINFO *ai) static wchar_t *parseLonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (mir_wstrlen(ai->targv[1]) <= mir_wstrlen(ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -237,7 +237,7 @@ static wchar_t *parseLonger(ARGUMENTSINFO *ai) static wchar_t *parseNot(ARGUMENTSINFO *ai)
{
if (ai->argc != 2) {
- return NULL;
+ return nullptr;
}
FORMATINFO fi;
@@ -254,7 +254,7 @@ static wchar_t *parseNot(ARGUMENTSINFO *ai) static wchar_t *parseOr(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -273,13 +273,13 @@ static wchar_t *parseOr(ARGUMENTSINFO *ai) static wchar_t *parseTrue(ARGUMENTSINFO *ai)
{
- return (ai->argc != 1) ? NULL : mir_wstrdup(L"");
+ return (ai->argc != 1) ? nullptr : mir_wstrdup(L"");
}
static wchar_t *parseXor(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index cd028d3651..7bb12ada35 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -22,7 +22,7 @@ static wchar_t *parseAdd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int result = 0;
for (unsigned int i = 1; i < ai->argc; i++)
@@ -34,12 +34,12 @@ static wchar_t *parseAdd(ARGUMENTSINFO *ai) static wchar_t *parseDiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val1 = ttoi(ai->targv[1]);
int val2 = ttoi(ai->targv[2]);
if (val2 == 0)
- return NULL;
+ return nullptr;
return itot(val1 / val2);
}
@@ -50,15 +50,15 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai) wchar_t szVal[34];
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
mir_snwprintf(szVal, L"%x", val);
unsigned int zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 3)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((zeros + mir_wstrlen(szVal) + 3) * sizeof(wchar_t)));
mir_wstrcpy(res, L"0x");
@@ -72,12 +72,12 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai) static wchar_t *parseMod(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val1 = ttoi(ai->targv[1]);
int val2 = ttoi(ai->targv[2]);
if (val2 == 0)
- return NULL;
+ return nullptr;
return itot(val1 % val2);
}
@@ -85,7 +85,7 @@ static wchar_t *parseMod(ARGUMENTSINFO *ai) static wchar_t *parseMul(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int result = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
@@ -97,10 +97,10 @@ static wchar_t *parseMul(ARGUMENTSINFO *ai) static wchar_t *parseMuldiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
if (ttoi(ai->targv[3]) == 0)
- return NULL;
+ return nullptr;
return itot((ttoi(ai->targv[1])*ttoi(ai->targv[2])) / ttoi(ai->targv[3]));
}
@@ -108,7 +108,7 @@ static wchar_t *parseMuldiv(ARGUMENTSINFO *ai) static wchar_t *parseMin(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
int minVal = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
@@ -120,7 +120,7 @@ static wchar_t *parseMin(ARGUMENTSINFO *ai) static wchar_t *parseMax(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
int maxVal = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
@@ -132,19 +132,19 @@ static wchar_t *parseMax(ARGUMENTSINFO *ai) static wchar_t *parseNum(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
wchar_t *szVal = itot(val);
- if (szVal == NULL)
- return NULL;
+ if (szVal == nullptr)
+ return nullptr;
unsigned zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 1)*sizeof(wchar_t));
- if (res == NULL) {
+ if (res == nullptr) {
mir_free(szVal);
- return NULL;
+ return nullptr;
}
memset(res, 0, ((zeros + mir_wstrlen(szVal) + 1) * sizeof(wchar_t)));
@@ -166,7 +166,7 @@ static wchar_t *parseRand(ARGUMENTSINFO *) static wchar_t *parseSub(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int result = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 9fc394c6f9..b071cd4c25 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -22,19 +22,19 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
hContact = db_mc_getMeta(hContact);
if (hContact == NULL)
- return NULL;
+ return nullptr;
ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
@@ -50,19 +50,19 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai) static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
hContact = db_mc_getDefault(hContact);
if (hContact == NULL)
- return NULL;
+ return nullptr;
ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
@@ -78,19 +78,19 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai) static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
hContact = db_mc_getMostOnline(hContact);
if (hContact == NULL)
- return NULL;
+ return nullptr;
ptrW szUniqueID;
char *szProto = GetContactProto(hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 0c3c2af113..e6280737d5 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -22,14 +22,14 @@ static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
unsigned int status = ttoi(ai->targv[1]);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- if (szStatus != NULL)
+ if (szStatus != nullptr)
return mir_wstrdup(szStatus);
- return NULL;
+ return nullptr;
}
static int getContactInfoFlags(wchar_t *tszDesc)
@@ -77,7 +77,7 @@ static int getContactInfoFlags(wchar_t *tszDesc) static wchar_t* parseContact(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
- return NULL;
+ return nullptr;
int n = 0;
if (ai->argc == 4) {
@@ -89,7 +89,7 @@ static wchar_t* parseContact(ARGUMENTSINFO *ai) MCONTACT hContact = getContactFromString(ai->targv[1], getContactInfoFlags(ai->targv[2]), n);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
log_debugA("contact: %x", hContact);
return encodeContactToString(hContact);
@@ -98,7 +98,7 @@ static wchar_t* parseContact(ARGUMENTSINFO *ai) static wchar_t* parseContactCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int count = getContactFromString(ai->targv[1], CI_NEEDCOUNT | getContactInfoFlags(ai->targv[2]));
return itot(count);
@@ -107,15 +107,15 @@ static wchar_t* parseContactCount(ARGUMENTSINFO *ai) static wchar_t* parseContactInfo(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
BYTE type = getContactInfoType(ai->targv[2]);
if (type == 0)
- return NULL;
+ return nullptr;
return getContactInfoT(type, hContact);
}
@@ -123,11 +123,11 @@ static wchar_t* parseContactInfo(ARGUMENTSINFO *ai) static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
wchar_t name[MAX_PATH];
if (Profile_GetNameW(_countof(name), name))
- return NULL;
+ return nullptr;
return mir_wstrdup(name);
}
@@ -135,7 +135,7 @@ static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai) static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
wchar_t path[MAX_PATH];
Profile_GetPathW(_countof(path), path);
@@ -148,7 +148,7 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch if (db_get_s(hContact, module, setting, &dbv, 0))
return defaultValue;
- wchar_t *var = NULL;
+ wchar_t *var = nullptr;
switch (dbv.type) {
case DBVT_BYTE:
var = itot(dbv.bVal);
@@ -177,26 +177,26 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch static wchar_t* parseDBSetting(ARGUMENTSINFO *ai)
{
if (ai->argc < 4)
- return NULL;
+ return nullptr;
MCONTACT hContact = NULL;
if (mir_wstrlen(ai->targv[1]) > 0) {
hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
}
char *szModule = mir_u2a(ai->targv[2]);
- if (szModule == NULL)
- return NULL;
+ if (szModule == nullptr)
+ return nullptr;
char *szSetting = mir_u2a(ai->targv[3]);
- if (szSetting == NULL) {
+ if (szSetting == nullptr) {
mir_free(szModule);
- return NULL;
+ return nullptr;
}
- wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : NULL);
+ wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : nullptr);
wchar_t *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
@@ -207,15 +207,15 @@ static wchar_t* parseDBSetting(ARGUMENTSINFO *ai) static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
wchar_t *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
@@ -223,7 +223,7 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai) char *szModule = SEEN_MODULE;
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
if (lsTime.wYear == 0)
- return NULL;
+ return nullptr;
lsTime.wMilliseconds = 0;
lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0);
@@ -233,14 +233,14 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai) lsTime.wDayOfWeek = db_get_w(hContact, szModule, "WeekDay", 0);
lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
- int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
+ int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -249,15 +249,15 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai) static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
wchar_t *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
@@ -265,7 +265,7 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai) char *szModule = SEEN_MODULE;
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
if (lsTime.wYear == 0)
- return NULL;
+ return nullptr;
lsTime.wMilliseconds = 0;
lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0);
@@ -276,14 +276,14 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai) lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
- int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
+ int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -292,33 +292,33 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai) static wchar_t* parseLastSeenStatus(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
char *szModule = SEEN_MODULE;
int status = db_get_w(hContact, szModule, "Status", 0);
if (status == 0)
- return NULL;
+ return nullptr;
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- if (szStatus != NULL)
+ if (szStatus != nullptr)
return mir_wstrdup(szStatus);
- return NULL;
+ return nullptr;
}
static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t path[MAX_PATH];
- if (GetModuleFileName(NULL, path, _countof(path)) == 0)
- return NULL;
+ if (GetModuleFileName(nullptr, path, _countof(path)) == 0)
+ return nullptr;
return mir_wstrdup(path);
}
@@ -326,7 +326,7 @@ static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai) static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
{
if (ai->argc > 2)
- return NULL;
+ return nullptr;
int status;
if (ai->argc == 1 || mir_wstrlen(ai->targv[1]) == 0)
@@ -335,16 +335,16 @@ static wchar_t* parseMyStatus(ARGUMENTSINFO *ai) status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- return (szStatus != NULL) ? mir_wstrdup(szStatus) : NULL;
+ return (szStatus != nullptr) ? mir_wstrdup(szStatus) : nullptr;
}
static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
- char *szRes = NULL;
- wchar_t *tszRes = NULL;
+ char *szRes = nullptr;
+ wchar_t *tszRes = nullptr;
ptrA szProto(mir_u2a(ai->targv[1]));
if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME)))
@@ -352,20 +352,20 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai) else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
- return NULL;
+ return nullptr;
}
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
- return NULL;
+ return nullptr;
}
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK)))
tszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
- if (szRes == NULL && tszRes == NULL)
- return NULL;
+ if (szRes == nullptr && tszRes == nullptr)
+ return nullptr;
- if (szRes != NULL && tszRes == NULL)
+ if (szRes != nullptr && tszRes == nullptr)
tszRes = mir_a2u(szRes);
return tszRes;
@@ -374,24 +374,24 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai) static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
ptrW szUniqueID;
char *szProto = GetContactProto(ai->fi->hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, ai->fi->hContact);
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
szUniqueID = (wchar_t*)mir_alloc(40);
if (szUniqueID == NULL)
- return NULL;
+ return nullptr;
mir_snwprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
}
if (szUniqueID == NULL)
- return NULL;
+ return nullptr;
return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
}
@@ -524,7 +524,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
int flags = DBE_MESSAGE;
switch (*ai->targv[2]) {
@@ -560,18 +560,18 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai) MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
MEVENT hDbEvent = findDbEvent(hContact, NULL, flags);
if (hDbEvent == NULL)
- return NULL;
+ return nullptr;
DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hDbEvent);
dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob);
if (db_event_get(hDbEvent, &dbe)) {
mir_free(dbe.pBlob);
- return NULL;
+ return nullptr;
}
wchar_t *res = DbEvent_GetTextW(&dbe, CP_ACP);
@@ -582,16 +582,16 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai) static wchar_t* parseTranslate(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = TranslateW(ai->targv[1]);
- return (res == NULL) ? NULL : mir_wstrdup(res);
+ return (res == nullptr) ? nullptr : mir_wstrdup(res);
}
static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
char versionString[128];
@@ -602,28 +602,28 @@ static wchar_t* parseVersionString(ARGUMENTSINFO *ai) static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t *ret = (wchar_t*)pcli->pfnGetContactDisplayName(ai->fi->hContact, 0);
- return (ret == NULL) ? NULL : mir_wstrdup(ret);
+ return (ret == nullptr) ? nullptr : mir_wstrdup(ret);
}
static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t ret[128];
- return mir_wstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
+ return mir_wstrdup(TimeZone_ToStringT(time(nullptr), L"d s", ret, _countof(ret)));
}
static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
@@ -635,7 +635,7 @@ static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai) static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
if (!ServiceExists(_T2A(ai->targv[1])))
ai->flags |= AIF_FALSE;
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index 7031fc4cc6..b401d15aae 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -30,13 +30,13 @@ static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai) int offsets[99];
if (ai->argc != 3)
- return NULL;
+ return nullptr;
ai->flags = AIF_FALSE;
- pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, NULL);
- if (ppat == NULL)
- return NULL;
+ pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, nullptr);
+ if (ppat == nullptr)
+ return nullptr;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
@@ -60,16 +60,16 @@ static wchar_t *parseRegExpSubstr(ARGUMENTSINFO *ai) int offsets[99];
if (ai->argc != 4)
- return NULL;
+ return nullptr;
number = _wtoi(ai->targv[3]);
if (number < 0)
- return NULL;
+ return nullptr;
ai->flags = AIF_FALSE;
- pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, NULL);
- if (ppat == NULL)
- return NULL;
+ pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, nullptr);
+ if (ppat == nullptr)
+ return nullptr;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 5779f13dc1..81207853b1 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -22,7 +22,7 @@ static wchar_t *parseCaps(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
@@ -47,7 +47,7 @@ static wchar_t *parseCaps(ARGUMENTSINFO *ai) static wchar_t *parseCaps2(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
@@ -73,13 +73,13 @@ static wchar_t *parseCrlf(ARGUMENTSINFO *ai) static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
do {
cur = wcschr(cur, '\n');
- if ((cur == NULL) || ((cur > res) && (*(cur - 1) == '\r')))
+ if ((cur == nullptr) || ((cur > res) && (*(cur - 1) == '\r')))
continue;
log_debug(cur);
@@ -90,7 +90,7 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai) memcpy(cur, L"\r\n", 2 * sizeof(wchar_t));
cur += 2;
}
- while (cur != NULL);
+ while (cur != nullptr);
return res;
}
@@ -103,7 +103,7 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai) else if (ai->argc == 3)
szReplacement = ai->targv[2];
else
- return NULL;
+ return nullptr;
wchar_t *cur = ai->targv[1];
while (mir_wstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
@@ -114,7 +114,7 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai) cur--;
wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_wstrlen(szReplacement) + 1)*sizeof(wchar_t));
- if (res == NULL)
+ if (res == nullptr)
return res;
memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(wchar_t)));
@@ -129,20 +129,20 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai) switch (ai->argc) {
case 2: szReplacement = L" "; break;
case 3: szReplacement = ai->targv[2]; break;
- default: return NULL;
+ default: return nullptr;
}
wchar_t *res = mir_wstrdup(ai->targv[1]);
for (size_t pos = 0; pos < mir_wstrlen(res); pos++) {
wchar_t *cur = res + pos;
- wchar_t *szEol = NULL;
+ wchar_t *szEol = nullptr;
if (!wcsncmp(cur, L"\r\n", mir_wstrlen(L"\r\n")))
szEol = L"\r\n";
if (*cur == '\n')
szEol = L"\n";
- if (szEol != NULL) {
+ if (szEol != nullptr) {
if (mir_wstrlen(szReplacement) > mir_wstrlen(szEol)) {
res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szReplacement) - mir_wstrlen(szEol) + 1)*sizeof(wchar_t));
cur = res + pos;
@@ -158,15 +158,15 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai) static wchar_t *parseInsert(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
unsigned int pos = ttoi(ai->targv[3]);
if (pos > mir_wstrlen(ai->targv[1]))
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], pos);
@@ -178,16 +178,16 @@ static wchar_t *parseInsert(ARGUMENTSINFO *ai) static wchar_t *parseLeft(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int len = ttoi(ai->targv[2]);
if (len < 0)
- return NULL;
+ return nullptr;
len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((len + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], len);
@@ -197,7 +197,7 @@ static wchar_t *parseLeft(ARGUMENTSINFO *ai) static wchar_t *parseLen(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
return itot((int)mir_wstrlen(ai->targv[1]));
}
@@ -205,7 +205,7 @@ static wchar_t *parseLen(ARGUMENTSINFO *ai) static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
int count = 1;
wchar_t *cur = ai->targv[1];
@@ -226,11 +226,11 @@ static wchar_t *parseLineCount(ARGUMENTSINFO *ai) static wchar_t *parseLower(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
return CharLower(res);
}
@@ -238,7 +238,7 @@ static wchar_t *parseLower(ARGUMENTSINFO *ai) static wchar_t *parseLongest(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
unsigned int iLong = 1;
for (unsigned int i = 2; i < ai->argc; i++)
@@ -251,7 +251,7 @@ static wchar_t *parseLongest(ARGUMENTSINFO *ai) static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
return mir_wstrdup(ai->targv[1]);
}
@@ -262,17 +262,17 @@ static wchar_t *parsePad(ARGUMENTSINFO *ai) switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
@@ -289,17 +289,17 @@ static wchar_t *parsePadright(ARGUMENTSINFO *ai) switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
mir_wstrcpy(res, ai->targv[1]);
@@ -316,17 +316,17 @@ static wchar_t *parsePadcut(ARGUMENTSINFO *ai) switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((padding + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
@@ -345,17 +345,17 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai) switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((padding + 1) * sizeof(wchar_t)));
wchar_t *cur = res + padding - addcount;
@@ -371,15 +371,15 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai) static wchar_t *parseRepeat(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int count = ttoi(ai->targv[2]);
if (count < 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((count * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((count * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
for (int i = 0; i < count; i++)
@@ -391,7 +391,7 @@ static wchar_t *parseRepeat(ARGUMENTSINFO *ai) static wchar_t *parseReplace(ARGUMENTSINFO *ai)
{
if ((ai->argc < 4) || (ai->argc % 2 != 0))
- return NULL;
+ return nullptr;
wchar_t *cur;
@@ -422,16 +422,16 @@ static wchar_t *parseReplace(ARGUMENTSINFO *ai) static wchar_t *parseRight(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int len = ttoi(ai->targv[2]);
if (len < 0)
- return NULL;
+ return nullptr;
len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((len + 1)*sizeof(wchar_t)));
wcsncpy(res, ai->targv[1] + mir_wstrlen(ai->targv[1]) - len, len);
@@ -444,7 +444,7 @@ static wchar_t *parseRight(ARGUMENTSINFO *ai) static wchar_t *parseScroll(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
if (mir_wstrlen(ai->targv[1]) == 0)
return mir_wstrdup(ai->targv[1]);
@@ -455,8 +455,8 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai) display = (unsigned)mir_wstrlen(ai->targv[1]);
wchar_t *res = (wchar_t*)mir_alloc((2 * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((2 * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
mir_wstrcpy(res, ai->targv[1]);
@@ -471,7 +471,7 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai) static wchar_t *parseShortest(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
int iShort = 1;
for (unsigned i = 2; i < ai->argc; i++)
@@ -484,12 +484,12 @@ static wchar_t *parseShortest(ARGUMENTSINFO *ai) static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
char *szVal[34];
memset(szVal, 0, sizeof(szVal));
wchar_t *c = wcschr(ai->targv[1], *ai->targv[2]);
- if (c == NULL || *c == 0)
+ if (c == nullptr || *c == 0)
return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
@@ -498,7 +498,7 @@ static wchar_t *parseStrchr(ARGUMENTSINFO *ai) static wchar_t *parseStrcmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (mir_wstrcmp(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -509,7 +509,7 @@ static wchar_t *parseStrcmp(ARGUMENTSINFO *ai) static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
ai->flags |= AIF_FALSE;
for (unsigned i = 2; i < ai->argc; i++) {
@@ -525,11 +525,11 @@ static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai) static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
int n = ttoi(ai->targv[3]);
if (n <= 0)
- return NULL;
+ return nullptr;
if (wcsncmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
@@ -540,7 +540,7 @@ static wchar_t *parseStrncmp(ARGUMENTSINFO *ai) static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (mir_wstrcmpi(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -551,11 +551,11 @@ static wchar_t *parseStricmp(ARGUMENTSINFO *ai) static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
int n = ttoi(ai->targv[3]);
if (n <= 0)
- return NULL;
+ return nullptr;
if (wcsnicmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
@@ -566,10 +566,10 @@ static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai) static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
wchar_t *c = wcsrchr(ai->targv[1], *ai->targv[2]);
- if ((c == NULL) || (*c == 0))
+ if ((c == nullptr) || (*c == 0))
return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
@@ -578,10 +578,10 @@ static wchar_t *parseStrrchr(ARGUMENTSINFO *ai) static wchar_t *parseStrstr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
wchar_t *c = wcsstr(ai->targv[1], ai->targv[2]);
- if ((c == NULL) || (*c == 0))
+ if ((c == nullptr) || (*c == 0))
return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
@@ -590,7 +590,7 @@ static wchar_t *parseStrstr(ARGUMENTSINFO *ai) static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int to, from = max(ttoi(ai->targv[2]) - 1, 0);
if (ai->argc > 3)
@@ -599,7 +599,7 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai) to = (int)mir_wstrlen(ai->targv[1]);
if (to < from)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((to - from + 1)*sizeof(wchar_t));
memset(res, 0, ((to - from + 1) * sizeof(wchar_t)));
@@ -610,11 +610,11 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai) static wchar_t *parseSelect(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
int n = ttoi(ai->targv[1]);
if ((n > (signed int)ai->argc - 2) || n <= 0)
- return NULL;
+ return nullptr;
return mir_wstrdup(ai->targv[n + 1]);
}
@@ -622,19 +622,19 @@ static wchar_t *parseSelect(ARGUMENTSINFO *ai) static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
{
if (ai->argc % 2 != 0)
- return NULL;
+ return nullptr;
for (unsigned i = 2; i < ai->argc; i += 2)
if (!mir_wstrcmp(ai->targv[1], ai->targv[i]))
return mir_wstrdup(ai->targv[i + 1]);
- return NULL;
+ return nullptr;
}
static wchar_t *parseTrim(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *scur = ai->targv[1];
while (*scur == ' ')
@@ -648,8 +648,8 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 2)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((ecur - scur + 2) * sizeof(wchar_t)));
wcsncpy(res, scur, ecur - scur + 1);
@@ -664,11 +664,11 @@ static wchar_t *parseTab(ARGUMENTSINFO *ai) count = ttoi(ai->targv[1]);
if (count < 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((count + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, (count + 1)*sizeof(wchar_t));
wchar_t *cur = res;
@@ -681,19 +681,19 @@ static wchar_t *parseTab(ARGUMENTSINFO *ai) static wchar_t *parseUpper(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
return CharUpper(res);
}
static wchar_t *getNthWord(wchar_t *szString, int w)
{
- if (szString == NULL)
- return NULL;
+ if (szString == nullptr)
+ return nullptr;
int count = 0;
wchar_t *scur = szString;
@@ -712,15 +712,15 @@ static wchar_t *getNthWord(wchar_t *szString, int w) scur++;
}
if (count != w)
- return NULL;
+ return nullptr;
wchar_t *ecur = scur;
while ((*ecur != ' ') && (*ecur != 0))
ecur++;
wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((ecur - scur + 1) * sizeof(wchar_t)));
wcsncpy(res, scur, ecur - scur);
@@ -730,9 +730,9 @@ static wchar_t *getNthWord(wchar_t *szString, int w) static wchar_t *parseWord(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
- return NULL;
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
int to, from = ttoi(ai->targv[2]);
if (ai->argc == 4) {
if (mir_wstrlen(ai->targv[3]) > 0)
@@ -743,16 +743,16 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai) else to = from;
if ((from == 0) || (to == 0) || (from > to))
- return NULL;
+ return nullptr;
for (int i = from; i <= to; i++) {
wchar_t *szWord = getNthWord(ai->targv[1], i);
- if (szWord == NULL)
+ if (szWord == nullptr)
return res;
- if (res != NULL) {
+ if (res != nullptr) {
wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szWord) + 2)*sizeof(wchar_t));
- if (pres != NULL) {
+ if (pres != nullptr) {
res = pres;
mir_wstrcat(res, L" ");
mir_wstrcat(res, szWord);
@@ -768,13 +768,13 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai) static wchar_t *parseExtratext(ARGUMENTSINFO *ai)
{
if (ai->argc > 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
- if (ai->fi->szExtraText != NULL)
+ if (ai->fi->szExtraText != nullptr)
return mir_wstrdup(ai->fi->tszExtraText);
- return NULL;
+ return nullptr;
}
void registerStrTokens()
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 947a6b33e4..02bfdd4407 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -22,17 +22,17 @@ static wchar_t *parseComputerName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
DWORD len = MAX_COMPUTERNAME_LENGTH;
wchar_t *res = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (!GetComputerName(res, &len)) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
}
@@ -49,40 +49,40 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai) wchar_t *szCounter, szVal[32];
if (ai->argc != 2)
- return NULL;
+ return nullptr;
if (mir_wstrlen(ai->targv[1]) == 0)
szCounter = mir_wstrdup(L"\\Processor(_Total)\\% Processor Time");
else {
int size = (int)mir_wstrlen(ai->targv[1]) + 32;
szCounter = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
- if (szCounter == NULL)
- return NULL;
+ if (szCounter == nullptr)
+ return nullptr;
mir_snwprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->targv[1]);
}
PDH_STATUS pdhStatus = PdhValidatePath(szCounter);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
- return NULL;
+ return nullptr;
}
- pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);
+ pdhStatus = PdhOpenQuery(nullptr, 0, &hQuery);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
- return NULL;
+ return nullptr;
}
pdhStatus = PdhAddCounter(hQuery, szCounter, 0, &hCounter);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
Sleep(100);
pdhStatus = PdhCollectQueryData(hQuery);
@@ -90,20 +90,20 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai) mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
- pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, (LPDWORD)NULL, &cValue);
+ pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, (LPDWORD)nullptr, &cValue);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
if (cValue.CStatus != ERROR_SUCCESS) {
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
mir_snwprintf(szVal, L"%.0f", cValue.doubleValue);
//PdhRemoveCounter(*hCounter);
@@ -117,18 +117,18 @@ static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai) {
wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1 && mir_wstrlen(ai->targv[1]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[1];
- int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
+ int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
- if (GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, res, len) == 0) {
+ if (GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -138,18 +138,18 @@ static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai) {
wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1) && (mir_wstrlen(ai->targv[1]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[1];
- int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
+ int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
- if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, res, len) == 0) {
+ if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -158,7 +158,7 @@ static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai) static wchar_t *parseDirectory(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
- return NULL;
+ return nullptr;
int depth = 0;
if (ai->argc == 3)
@@ -194,14 +194,14 @@ static wchar_t *parseDirectory(ARGUMENTSINFO *ai) static wchar_t *parseDirectory2(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
- return NULL;
+ return nullptr;
int depth = 1;
if (ai->argc == 3)
depth = ttoi(ai->targv[2]);
if (depth <= 0)
- return NULL;
+ return nullptr;
wchar_t *ecur = ai->targv[1] + mir_wstrlen(ai->targv[1]);
while (depth > 0) {
@@ -209,14 +209,14 @@ static wchar_t *parseDirectory2(ARGUMENTSINFO *ai) ecur--;
if (*ecur != '\\')
- return NULL;
+ return nullptr;
depth -= 1;
ecur--;
}
wchar_t *res = (wchar_t*)mir_calloc((ecur - ai->targv[1] + 2) * sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
wcsncpy(res, ai->targv[1], (ecur - ai->targv[1]) + 1);
return res;
@@ -271,15 +271,15 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai) double diff;
if (ai->argc != 3)
- return NULL;
+ return nullptr;
memset(&t0, 0, sizeof(t0));
memset(&t1, 0, sizeof(t1));
if (getTime(ai->targv[1], &t0) != 0)
- return NULL;
+ return nullptr;
if (getTime(ai->targv[2], &t1) != 0)
- return NULL;
+ return nullptr;
diff = difftime(mktime(&t1), mktime(&t0));
mir_snwprintf(szTime, L"%.0f", diff);
@@ -290,9 +290,9 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai) static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
ai->flags |= AIF_FALSE;
else
@@ -304,20 +304,20 @@ static wchar_t *parseDirExists(ARGUMENTSINFO *ai) static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- DWORD len = ExpandEnvironmentStrings(ai->targv[1], NULL, 0);
+ DWORD len = ExpandEnvironmentStrings(ai->targv[1], nullptr, 0);
if (len <= 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((len + 1) * sizeof(wchar_t)));
if (ExpandEnvironmentStrings(ai->targv[1], res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
}
@@ -325,9 +325,9 @@ static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai) static wchar_t *parseFileExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
ai->flags |= AIF_FALSE;
else
@@ -339,15 +339,15 @@ static wchar_t *parseFileExists(ARGUMENTSINFO *ai) static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- HWND hWin = FindWindow(ai->targv[1], NULL);
- if (hWin == NULL)
- return NULL;
+ HWND hWin = FindWindow(ai->targv[1], nullptr);
+ if (hWin == nullptr)
+ return nullptr;
int len = GetWindowTextLength(hWin);
if (len == 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
memset(res, 0, ((len + 1) * sizeof(wchar_t)));
@@ -362,13 +362,13 @@ static wchar_t *parseFindWindow(ARGUMENTSINFO *ai) static wchar_t *parseListDir(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
wchar_t tszFirst[MAX_PATH], *tszRes, *tszSeperator, *tszFilter;
tszFirst[0] = 0;
tszSeperator = L"\r\n";
tszFilter = L"*";
- tszRes = NULL;
+ tszRes = nullptr;
if (ai->argc > 1)
wcsncpy(tszFirst, ai->targv[1], _countof(tszFirst) - 1);
@@ -396,7 +396,7 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai) WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(tszFirst, &ffd);
if (hFind == INVALID_HANDLE_VALUE) {
- return NULL;
+ return nullptr;
}
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
tszRes = (wchar_t*)mir_alloc((mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
@@ -404,7 +404,7 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai) }
while (FindNextFile(hFind, &ffd) != 0) {
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- if (tszRes != NULL) {
+ if (tszRes != nullptr) {
mir_wstrcat(tszRes, tszSeperator);
tszRes = (wchar_t*)mir_realloc(tszRes, (mir_wstrlen(tszRes) + mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
}
@@ -424,8 +424,8 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai) static BOOL CALLBACK MyProcessEnumerator(DWORD, WORD, char *szProcess, LPARAM lParam)
{
char **szProc = (char **)lParam;
- if ((*szProc != NULL) && (!_stricmp(*szProc, szProcess)))
- *szProc = NULL;
+ if ((*szProc != nullptr) && (!_stricmp(*szProc, szProcess)))
+ *szProc = nullptr;
return TRUE;
}
@@ -433,13 +433,13 @@ static BOOL CALLBACK MyProcessEnumerator(DWORD, WORD, char *szProcess, LPARAM lP static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
char *szProc, *ref;
szProc = ref = mir_u2a(ai->targv[1]);
EnumProcs(MyProcessEnumerator, (LPARAM)&szProc);
- if (szProc != NULL)
+ if (szProc != nullptr)
ai->flags |= AIF_FALSE;
mir_free(ref);
@@ -450,18 +450,18 @@ static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai) static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
DWORD len, type;
wchar_t *key = mir_wstrdup(ai->targv[1]);
- if (key == NULL)
- return NULL;
+ if (key == nullptr)
+ return nullptr;
wchar_t *cur = wcschr(key, '\\');
- if (cur == NULL) {
+ if (cur == nullptr) {
mir_free(key);
- return NULL;
+ return nullptr;
}
*cur = 0;
@@ -476,25 +476,25 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai) hKey = HKEY_USERS;
else {
mir_free(key);
- return NULL;
+ return nullptr;
}
wchar_t *subKey = cur + 1;
if (RegOpenKeyEx(hKey, subKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
mir_free(key);
- return NULL;
+ return nullptr;
}
mir_free(key);
len = MAX_REGVALUE_LENGTH + 1;
wchar_t *res = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, (len * sizeof(wchar_t)));
- int err = RegQueryValueEx(hKey, ai->targv[2], NULL, &type, (BYTE*)res, &len);
+ int err = RegQueryValueEx(hKey, ai->targv[2], nullptr, &type, (BYTE*)res, &len);
if ((err != ERROR_SUCCESS) || (type != REG_SZ)) {
RegCloseKey(hKey);
mir_free(res);
- return NULL;
+ return nullptr;
}
RegCloseKey(hKey);
@@ -504,7 +504,7 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai) static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp)
{
struct tm *pTime = localtime(×tamp);
- if (pTime == NULL)
+ if (pTime == nullptr)
return -1;
memset(sysTime, 0, sizeof(SYSTEMTIME));
@@ -522,30 +522,30 @@ static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp) static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
SYSTEMTIME sysTime;
wchar_t *szFormat;
time_t timestamp = ttoi(ai->targv[1]);
if (timestamp == 0)
- return NULL;
+ return nullptr;
if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
if (TsToSystemTime(&sysTime, timestamp) != 0)
- return NULL;
+ return nullptr;
- int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
+ int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -554,30 +554,30 @@ static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai) static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
SYSTEMTIME sysTime;
time_t timestamp = ttoi(ai->targv[1]);
if (timestamp == 0)
- return NULL;
+ return nullptr;
wchar_t *szFormat;
if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
if (TsToSystemTime(&sysTime, timestamp) != 0)
- return NULL;
+ return nullptr;
- int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
+ int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -586,16 +586,16 @@ static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai) static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
- HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
- return NULL;
+ return nullptr;
- DWORD fileSz = GetFileSize(hFile, NULL);
+ DWORD fileSz = GetFileSize(hFile, nullptr);
if (fileSz == INVALID_FILE_SIZE) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
int lineNo = ttoi(ai->targv[2]);
@@ -605,11 +605,11 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) unsigned long linePos;
wchar_t tUC, *res;
BYTE *pBuf, *pCur;
- ReadFile(hFile, &tUC, sizeof(wchar_t), &readSz, NULL);
+ ReadFile(hFile, &tUC, sizeof(wchar_t), &readSz, nullptr);
if (tUC != (wchar_t)0xFEFF) {
tUC = 0;
csz = sizeof(char);
- SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, 0, nullptr, FILE_BEGIN);
}
else csz = sizeof(wchar_t);
@@ -619,15 +619,15 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) // complete file
bufSz = fileSz + csz;
pBuf = (PBYTE)mir_calloc(bufSz);
- if (pBuf == NULL) {
+ if (pBuf == nullptr) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
CloseHandle(hFile);
mir_free(pBuf);
- return NULL;
+ return nullptr;
}
CloseHandle(hFile);
@@ -643,18 +643,18 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) }
bufSz = TXTFILEBUFSZ*csz;
pBuf = (PBYTE)mir_calloc(bufSz);
- if (pBuf == NULL) {
+ if (pBuf == nullptr) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
// count number of lines
do {
memset(pBuf, 0, bufSz);
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
CloseHandle(hFile);
mir_free(pBuf);
- return NULL;
+ return nullptr;
}
totalReadSz += readSz;
for (pCur = pBuf; *pCur != '\0'; pCur += csz) {
@@ -686,12 +686,12 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) totalReadSz = 0;
lineCount = 1;
linePos = 0xFFFFFFFF;
- SetFilePointer(hFile, tUC ? csz : 0, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, tUC ? csz : 0, nullptr, FILE_BEGIN);
// find the position in the file where the requested line starts
do {
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
totalReadSz += readSz;
for (pCur = pBuf; ((pCur < pBuf + bufSz) && (linePos == 0xFFFFFFFF)); pCur += csz) {
@@ -717,25 +717,25 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) }
if (((tUC) && (*(wchar_t*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
// in case the \r was at the end of the buffer, \n could be next
- SetFilePointer(hFile, -1 * csz, NULL, FILE_CURRENT);
+ SetFilePointer(hFile, -1 * csz, nullptr, FILE_CURRENT);
totalReadSz -= csz;
}
}
while ((totalReadSz < fileSz) && (readSz > 0));
- if (SetFilePointer(hFile, linePos, NULL, FILE_BEGIN) != linePos) {
+ if (SetFilePointer(hFile, linePos, nullptr, FILE_BEGIN) != linePos) {
CloseHandle(hFile);
mir_free(pBuf);
- return NULL;
+ return nullptr;
}
memset(pBuf, 0, bufSz);
pCur = pBuf;
do {
icur = 0;
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
mir_free(pBuf);
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
for (pCur = pBuf; (pCur < pBuf + readSz); pCur += csz) {
if ((tUC) && ((!wcsncmp((wchar_t*)pCur, L"\r\n", 2)) || (*(wchar_t*)pCur == '\n')) ||
@@ -784,38 +784,38 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) while (readSz > 0);
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
static wchar_t *parseUpTime(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
HQUERY hQuery;
- PDH_STATUS pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);
+ PDH_STATUS pdhStatus = PdhOpenQuery(nullptr, 0, &hQuery);
if (pdhStatus != ERROR_SUCCESS)
- return NULL;
+ return nullptr;
HCOUNTER hCounter;
pdhStatus = PdhAddCounter(hQuery, L"\\System\\System Up Time", 0, &hCounter);
if (pdhStatus != ERROR_SUCCESS) {
PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
PDH_FMT_COUNTERVALUE cValue;
- pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_LARGE, (LPDWORD)NULL, &cValue);
+ pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_LARGE, (LPDWORD)nullptr, &cValue);
if (pdhStatus != ERROR_SUCCESS) {
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
wchar_t szVal[32];
@@ -828,18 +828,18 @@ static wchar_t *parseUpTime(ARGUMENTSINFO *ai) static wchar_t *parseUserName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
DWORD len = UNLEN;
wchar_t *res = (wchar_t*)mir_alloc(len + 1);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, (len + 1));
if (!GetUserName(res, &len)) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
}
@@ -848,16 +848,16 @@ static wchar_t *parseUserName(ARGUMENTSINFO *ai) static wchar_t *parseClipboard(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
if (IsClipboardFormatAvailable(CF_TEXT)) {
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
- if (hData != NULL) {
+ if (hData != nullptr) {
wchar_t *tszText = (wchar_t*)GlobalLock(hData);
size_t len = mir_wstrlen(tszText);
res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 11d168e678..6fce6cd3fb 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -21,12 +21,12 @@ // this is for get and put(s)
static mir_cs csVarRegister;
-static VARIABLEREGISTER *vr = NULL;
+static VARIABLEREGISTER *vr = nullptr;
static int vrCount = 0;
static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
{
- if ((szName == NULL) || (szText == NULL) || (mir_wstrlen(szName) <= 0))
+ if ((szName == nullptr) || (szText == nullptr) || (mir_wstrlen(szName) <= 0))
return -1;
mir_cslock lck(csVarRegister);
@@ -38,7 +38,7 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText) }
}
VARIABLEREGISTER *pvr = (VARIABLEREGISTER*)mir_realloc(vr, (vrCount + 1)*sizeof(VARIABLEREGISTER));
- if (pvr == NULL)
+ if (pvr == nullptr)
return -1;
vr = pvr;
@@ -50,25 +50,25 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText) static wchar_t *searchVariableRegister(wchar_t *szName)
{
- if ((szName == NULL) || (mir_wstrlen(szName) <= 0))
- return NULL;
+ if ((szName == nullptr) || (mir_wstrlen(szName) <= 0))
+ return nullptr;
mir_cslock lck(csVarRegister);
for (int i = 0; i < vrCount; i++)
if ((!mir_wstrcmp(vr[i].szName, szName)))
return mir_wstrdup(vr[i].szText);
- return NULL;
+ return nullptr;
}
static wchar_t *parsePut(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
// ai->flags |= AIF_DONTPARSE;
if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -80,10 +80,10 @@ static wchar_t *parsePut(ARGUMENTSINFO *ai) static wchar_t *parsePuts(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
- return NULL;
+ return nullptr;
return mir_wstrdup(L"");
}
@@ -91,7 +91,7 @@ static wchar_t *parsePuts(ARGUMENTSINFO *ai) static wchar_t *parseGet(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
return searchVariableRegister(ai->targv[1]);
}
@@ -111,6 +111,6 @@ void unregisterVariablesTokens() mir_free(vr[i].szText);
}
mir_free(vr);
- vr = NULL;
+ vr = nullptr;
vrCount = 0;
}
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index 158a429582..11c2212449 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -67,29 +67,29 @@ int registerIntToken(wchar_t *szToken, wchar_t *(*parseFunction)(ARGUMENTSINFO * int deRegisterToken(wchar_t *token)
{
- if (token == NULL)
+ if (token == nullptr)
return -1;
TokenRegisterEntry *tre;
{
mir_cslock lck(csRegister);
tre = FindTokenRegisterByName(token);
- if (tre == NULL)
+ if (tre == nullptr)
return -1;
tokens.remove(tre);
}
- if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != NULL)
+ if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != nullptr)
mir_free(tre->tr.szService);
- if (tre->tr.tszTokenString != NULL)
+ if (tre->tr.tszTokenString != nullptr)
mir_free(tre->tr.tszTokenString);
- if (tre->tr.szHelpText != NULL)
+ if (tre->tr.szHelpText != nullptr)
mir_free(tre->tr.szHelpText);
- if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != NULL)
+ if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != nullptr)
mir_free(tre->tr.szCleanupService);
mir_free(tre);
@@ -101,7 +101,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) DWORD hash;
TOKENREGISTEREX *newVr = (TOKENREGISTEREX*)lParam;
- if (newVr == NULL || newVr->szTokenString == NULL || newVr->cbSize <= 0)
+ if (newVr == nullptr || newVr->szTokenString == nullptr || newVr->cbSize <= 0)
return -1;
if (newVr->flags & TRF_TCHAR) {
@@ -116,7 +116,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) }
TokenRegisterEntry *tre = (TokenRegisterEntry*)mir_alloc(sizeof(TokenRegisterEntry));
- if (tre == NULL)
+ if (tre == nullptr)
return -1;
memcpy(&tre->tr, newVr, newVr->cbSize);
@@ -124,7 +124,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) if (!mir_wstrcmp(newVr->tszTokenString, L"alias"))
log_debugA("alias");
- if (!(newVr->flags & TRF_PARSEFUNC) && newVr->szService != NULL)
+ if (!(newVr->flags & TRF_PARSEFUNC) && newVr->szService != nullptr)
tre->tr.szService = mir_strdup(newVr->szService);
if (newVr->flags & TRF_TCHAR)
@@ -132,10 +132,10 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) else
tre->tr.tszTokenString = mir_a2u(newVr->szTokenString);
- if (newVr->szHelpText != NULL)
+ if (newVr->szHelpText != nullptr)
tre->tr.szHelpText = mir_strdup(newVr->szHelpText);
- if ((newVr->flags & TRF_CLEANUP) && !(newVr->flags & TRF_CLEANUPFUNC) && newVr->szCleanupService != NULL)
+ if ((newVr->flags & TRF_CLEANUP) && !(newVr->flags & TRF_CLEANUPFUNC) && newVr->szCleanupService != nullptr)
tre->tr.szCleanupService = mir_strdup(newVr->szCleanupService);
mir_cslock lck(csRegister);
@@ -145,31 +145,31 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) TOKENREGISTEREX *searchRegister(wchar_t *tvar, int type)
{
- if (tvar == NULL)
- return 0;
+ if (tvar == nullptr)
+ return nullptr;
mir_cslock lck(csRegister);
TokenRegisterEntry *tre = FindTokenRegisterByName(tvar);
- if (tre == NULL || (type != 0 && (tre->tr.flags & (TRF_FIELD | TRF_FUNCTION)) != 0 && !(tre->tr.flags & type)))
- return NULL;
+ if (tre == nullptr || (type != 0 && (tre->tr.flags & (TRF_FIELD | TRF_FUNCTION)) != 0 && !(tre->tr.flags & type)))
+ return nullptr;
return &tre->tr;
}
wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
{
- if (ai == NULL || ai->argc == 0 || ai->targv[0] == NULL)
- return NULL;
+ if (ai == nullptr || ai->argc == 0 || ai->targv[0] == nullptr)
+ return nullptr;
INT_PTR callRes = 0;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
mir_cslock lck(csRegister);
/* note the following limitation: you cannot add/remove tokens during a call from a different thread */
TOKENREGISTEREX *thisVr = searchRegister(ai->targv[0], 0);
- if (thisVr == NULL)
- return NULL;
+ if (thisVr == nullptr)
+ return nullptr;
TOKENREGISTEREX trCopy = *thisVr;
@@ -184,23 +184,23 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai) if (thisVr->flags & TRF_PARSEFUNC)
callRes = (INT_PTR)thisVr->parseFunction(&cAi);
- else if (thisVr->szService != NULL)
+ else if (thisVr->szService != nullptr)
callRes = CallService(thisVr->szService, 0, (LPARAM)&cAi);
for (unsigned j = 0; j < cAi.argc; j++)
mir_free(cAi.argv[j]);
- if ((char *)callRes != NULL)
+ if ((char *)callRes != nullptr)
res = mir_a2u((char*)callRes);
}
else {
// unicode variables calls unicode plugin
if (thisVr->flags & TRF_PARSEFUNC)
callRes = (INT_PTR)thisVr->parseFunctionT(ai);
- else if (thisVr->szService != NULL)
+ else if (thisVr->szService != nullptr)
callRes = CallService(thisVr->szService, 0, (LPARAM)ai);
- if ((wchar_t*)callRes != NULL)
+ if ((wchar_t*)callRes != nullptr)
res = mir_wstrdup((wchar_t*)callRes);
}
@@ -208,7 +208,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai) if (trCopy.flags & TRF_CLEANUP) {
if (trCopy.flags & TRF_CLEANUPFUNC)
trCopy.cleanupFunctionT((wchar_t*)callRes);
- else if (trCopy.szCleanupService != NULL)
+ else if (trCopy.szCleanupService != nullptr)
CallService(trCopy.szCleanupService, 0, (LPARAM)callRes);
}
if ((trCopy.flags & TRF_FREEMEM) && trCopy.memType == TR_MEM_MIRANDA)
@@ -220,7 +220,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai) TOKENREGISTEREX* getTokenRegister(int i)
{
mir_cslock lck(csRegister);
- return (i >= tokens.getCount() || i < 0) ? NULL : &tokens[i]->tr;
+ return (i >= tokens.getCount() || i < 0) ? nullptr : &tokens[i]->tr;
}
int getTokenRegisterCount()
@@ -240,16 +240,16 @@ int deinitTokenRegister() {
for (int i = 0; i < tokens.getCount(); i++) {
TokenRegisterEntry *tre = tokens[i];
- if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != NULL)
+ if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != nullptr)
mir_free(tre->tr.szService);
- if (tre->tr.tszTokenString != NULL)
+ if (tre->tr.tszTokenString != nullptr)
mir_free(tre->tr.tszTokenString);
- if (tre->tr.szHelpText != NULL)
+ if (tre->tr.szHelpText != nullptr)
mir_free(tre->tr.szHelpText);
- if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != NULL)
+ if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != nullptr)
mir_free(tre->tr.szCleanupService);
mir_free(tre);
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index d5d9690372..3ba1ae1ab3 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -21,8 +21,8 @@ /* some handles */ static HANDLE - hOptionsHook = NULL, - hIconsChangedHook = NULL; + hOptionsHook = nullptr, + hIconsChangedHook = nullptr; HCURSOR hCurSplitNS; @@ -35,7 +35,7 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv) cur++; if (*cur != '(') - return NULL; + return nullptr; wchar_t *scur = cur; cur++; @@ -66,10 +66,10 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv) } if (bNewArg) { - wchar_t *tszArg = NULL; + wchar_t *tszArg = nullptr; if (cur > scur) tszArg = mir_wstrndup(scur + 1, cur - (scur + 1)); - if (tszArg == NULL) + if (tszArg == nullptr) tszArg = mir_wstrdup(L""); argv.insert(tszArg); @@ -82,7 +82,7 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv) // set args if (cur[-1] != ')') { argv.destroy(); - return NULL; + return nullptr; } return cur; @@ -105,14 +105,14 @@ int isValidTokenChar(wchar_t tc) /* pretty much the main loop */ static wchar_t* replaceDynVars(FORMATINFO *fi) { - if (fi->tszFormat == NULL) - return NULL; + if (fi->tszFormat == nullptr) + return nullptr; int i, scurPos, curPos, tmpVarPos; wchar_t *string = mir_wstrdup(fi->tszFormat); - if (string == NULL) - return NULL; + if (string == nullptr) + return nullptr; TArgList argv; @@ -179,7 +179,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) continue; } - TOKENREGISTEREX *tr = NULL; + TOKENREGISTEREX *tr = nullptr; { ptrW token(mir_wstrndup(cur + 1, tcur - scur)); @@ -198,7 +198,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) tr = searchRegister(token, (*cur == FIELD_CHAR) ? TRF_FIELD : TRF_FUNCTION); } - if (tmpVarPos < 0 && tr == NULL) { + if (tmpVarPos < 0 && tr == nullptr) { fi->eCount++; // token not found, continue continue; @@ -206,7 +206,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) scur = cur; // store this pointer for later use if (*cur == FIELD_CHAR) { - size_t len = mir_wstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); + size_t len = mir_wstrlen(tr != nullptr ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); cur++; if (cur[len] != FIELD_CHAR) { // the next char after the token should be % fi->eCount++; @@ -217,7 +217,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) { cur += mir_wstrlen(tr->tszTokenString) + 1; wchar_t *argcur = getArguments(cur, argv); - if (argcur == cur || argcur == NULL) { + if (argcur == cur || argcur == nullptr) { fi->eCount++; // error getting arguments continue; @@ -240,7 +240,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) // cur should now point at the character after FIELD_CHAR or after the last ')' ARGUMENTSINFO ai = { 0 }; ptrW parsedToken; - if (tr != NULL) { + if (tr != nullptr) { argv.insert(mir_wstrdup(tr->tszTokenString), 0); ai.cbSize = sizeof(ai); @@ -275,9 +275,9 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) if (tokenLen < parsedTokenLen) { // string needs more memory string = (wchar_t*)mir_realloc(string, (initStrLen - tokenLen + parsedTokenLen + 1)*sizeof(wchar_t)); - if (string == NULL) { + if (string == nullptr) { fi->eCount++; - return NULL; + return nullptr; } } scur = string + scurPos; @@ -334,10 +334,10 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM) if (!(fi->flags & FIF_TCHAR)) { copied = TRUE; log_debugA("mir_a2u (%s)", fi->szExtraText); - tszFormat = fi->szFormat != NULL ? mir_a2u(fi->szFormat) : NULL; - tszSource = fi->szExtraText != NULL ? mir_a2u(fi->szExtraText) : NULL; + tszFormat = fi->szFormat != nullptr ? mir_a2u(fi->szFormat) : nullptr; + tszSource = fi->szExtraText != nullptr ? mir_a2u(fi->szExtraText) : nullptr; for (i = 0; i < fi->cbTemporaryVarsSize; i++) { - fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != NULL ? mir_a2u(fi->szaTemporaryVars[i]) : NULL; + fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != nullptr ? mir_a2u(fi->szaTemporaryVars[i]) : nullptr; } } else { @@ -378,14 +378,14 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM) wchar_t* formatString(FORMATINFO *fi) { - if (fi == NULL) - return NULL; + if (fi == nullptr) + return nullptr; /* the service to format a given string */ if ((fi->eCount + fi->pCount) > 5000) { fi->eCount++; fi->pCount++; log_debugA("Variables: Overflow protection; %d parses", (fi->eCount + fi->pCount)); - return NULL; + return nullptr; } return replaceDynVars(fi); @@ -393,7 +393,7 @@ wchar_t* formatString(FORMATINFO *fi) int setParseOptions(struct ParseOptions *po) { - if (po == NULL) + if (po == nullptr) po = &gParseOpts; memset(po, 0, sizeof(struct ParseOptions)); @@ -413,11 +413,11 @@ int LoadVarModule() if (initTokenRegister() != 0 || initContactModule() != 0) return -1; - setParseOptions(NULL); + setParseOptions(nullptr); CreateServiceFunction(MS_VARS_FORMATSTRING, formatStringService); CreateServiceFunction(MS_VARS_REGISTERTOKEN, registerToken); // help dialog - hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); + hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); CreateServiceFunction(MS_VARS_SHOWHELP, showHelpService); CreateServiceFunction(MS_VARS_SHOWHELPEX, showHelpExService); @@ -448,7 +448,7 @@ int LoadVarModule() FORMATINFO fi = { 0 }; fi.cbSize = sizeof(fi); fi.tszFormat = db_get_wsa(NULL, MODULENAME, SETTING_STARTUPTEXT); - if (fi.tszFormat != NULL) { + if (fi.tszFormat != nullptr) { mir_free(formatString(&fi)); mir_free(fi.tszFormat); } @@ -461,7 +461,7 @@ int LoadVarModule() int UnloadVarModule() { UnhookEvent(hOptionsHook); - if (hIconsChangedHook != NULL) + if (hIconsChangedHook != nullptr) UnhookEvent(hIconsChangedHook); DestroyCursor(hCurSplitNS); diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index 5bedeb0101..4e037d7cb5 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -20,7 +20,7 @@ HNETLIBCONN ghConnection; HANDLE ghPacketReciever; BOOL Connected; int gbState; -SONGINFO SongInfo = {0}; +SONGINFO SongInfo = {}; void Start(void*) { @@ -43,7 +43,7 @@ void ReStart(void*) if(ghConnection) Netlib_CloseHandle(ghConnection); Sleep(500); - mir_forkthread(&Start, 0); + mir_forkthread(&Start, nullptr); } int Parser() @@ -56,7 +56,7 @@ int Parser() nlpr.dwTimeout = 5; if(!ghConnection) { - mir_forkthread(&Start, 0); + mir_forkthread(&Start, nullptr); } if(ghConnection) { @@ -68,7 +68,7 @@ int Parser() recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { - mir_forkthread(&ReStart, 0); + mir_forkthread(&ReStart, nullptr); // ReStart(); return 1; } @@ -81,7 +81,7 @@ int Parser() recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { - mir_forkthread(&ReStart, 0); + mir_forkthread(&ReStart, nullptr); return 1; } } @@ -91,14 +91,14 @@ int Parser() recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { - mir_forkthread(&ReStart, 0); + mir_forkthread(&ReStart, nullptr); return 1; } Netlib_Send(ghConnection, "currentsong\n", (int)mir_strlen("currentsong\n"), 0); recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { - mir_forkthread(&ReStart, 0); + mir_forkthread(&ReStart, nullptr); return 1; } nlpr.bytesUsed = nlpr.bytesAvailable; @@ -266,7 +266,7 @@ void Stop() int Init() { - mir_forkthread(&Start, 0); + mir_forkthread(&Start, nullptr); return 0; } @@ -280,21 +280,21 @@ HWND CheckPlayer(HWND, int) { if(!ghConnection) { - mir_forkthread(&Start, 0); - return 0; + mir_forkthread(&Start, nullptr); + return nullptr; } if(Parser()) return (HWND)WAT_PLS_STOPPED; if(Connected) return (HWND)WAT_PLS_PLAYING; - return 0; + return nullptr; } int GetStatus(HWND) { if(!ghConnection) { - mir_forkthread(&Start, 0); + mir_forkthread(&Start, nullptr); return 0; } return Parser() ? -1 : gbState; @@ -304,17 +304,17 @@ WCHAR* GetFileName(HWND, int) { if(!ghConnection) { - mir_forkthread(&Start, 0); - return 0; + mir_forkthread(&Start, nullptr); + return nullptr; } - return 0; + return nullptr; } int GetPlayerInfo(LPSONGINFO info, int) { if(!ghConnection) { - mir_forkthread(&Start, 0); + mir_forkthread(&Start, nullptr); return 0; } if(Parser()) @@ -398,7 +398,7 @@ void RegisterPlayer() { if(bWatrackService) { - PLAYERCELL player = {0}; + PLAYERCELL player = {}; player.Desc = "Music Player Daemon"; player.Notes = L"mpd is a nice music player for *nix which have not any gui, just daemon.\nuses very small amount of ram, cpu."; player.URL = "http://www.musicpd.org"; diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index 15984a3d34..10a6ffa28d 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -48,8 +48,8 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM case PSN_APPLY: { wchar_t szText[256]; - db_set_w(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE)); - gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE); + db_set_w(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, nullptr, FALSE)); + gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, nullptr, FALSE); GetDlgItemText(hwndDlg, IDC_SERVER, szText, _countof(szText)); db_set_ws(NULL, szModuleName, "Server", szText); mir_wstrcpy(gbHost, szText); diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 94327bc8e4..6739dcf5da 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -56,7 +56,7 @@ BOOL ThreadRunning; // variable to determine if module loaded
BOOL ModuleLoaded;
-HANDLE hTBButton = NULL;
+HANDLE hTBButton = nullptr;
// plugin info
static const PLUGININFOEX pluginInfoEx =
@@ -87,7 +87,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) int WeatherShutdown(WPARAM, LPARAM)
{
- KillTimer(NULL, timerId); // kill update timer
+ KillTimer(nullptr, timerId); // kill update timer
SaveOptions(); // save options once more
status = ID_STATUS_OFFLINE; // set status to offline
@@ -103,7 +103,7 @@ int WeatherShutdown(WPARAM, LPARAM) int OnToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.name = LPGEN("Enable/disable auto update");
ttb.pszService = MS_WEATHER_ENABLED;
ttb.pszTooltipUp = LPGEN("Auto Update Enabled");
@@ -128,7 +128,7 @@ int WeatherInit(WPARAM, LPARAM) AddMenuItems();
// timer for the first update
- timerId = SetTimer(NULL, 0, 5000, timerProc2); // first update is 5 sec after load
+ timerId = SetTimer(nullptr, 0, 5000, timerProc2); // first update is 5 sec after load
// weather user detail
HookEvent(ME_USERINFO_INITIALISE, UserInfoInit);
@@ -142,8 +142,8 @@ int WeatherInit(WPARAM, LPARAM) void InitVar()
{
// setup the linklist for weather update list
- UpdateListTail = NULL;
- UpdateListHead = NULL;
+ UpdateListTail = nullptr;
+ UpdateListHead = nullptr;
// other settings
timerId = 0;
@@ -213,7 +213,7 @@ extern "C" int __declspec(dllexport) Load(void) hDataWindowList = WindowList_Create();
hWindowList = WindowList_Create();
- hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
+ hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr);
// register weather protocol
PROTOCOLDESCRIPTOR pd = { 0 };
@@ -233,7 +233,7 @@ extern "C" int __declspec(dllexport) Load(void) wchar_t SvcFunc[100];
mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
return 0;
}
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 58379ec9c4..20b93fcecd 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -111,7 +111,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) // notification message box
mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
}
@@ -125,8 +125,8 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) // show a message box and cancel search if update is in process
BOOL CheckSearch()
{
- if (UpdateListHead != NULL) {
- MessageBox(NULL, TranslateT("Please try again after weather update is completed."), TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
+ if (UpdateListHead != nullptr) {
+ MessageBox(nullptr, TranslateT("Please try again after weather update is completed."), TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
return FALSE;
}
return TRUE;
@@ -160,7 +160,7 @@ INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam) sttSID[_countof(sttSID) - 1] = 0;
sttSearchId = 1;
// create a thread for the ID search
- mir_forkthread(BasicSearchTimerProc, NULL);
+ mir_forkthread(BasicSearchTimerProc, nullptr);
return sttSearchId;
}
@@ -214,7 +214,7 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam) GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
// search for the weather station using a thread
- mir_forkthread(NameSearchTimerProc, NULL);
+ mir_forkthread(NameSearchTimerProc, nullptr);
return sttSearchId;
}
@@ -231,16 +231,16 @@ int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *s if (sData->Available) {
char loc[255];
- wchar_t *szData = NULL;
+ wchar_t *szData = nullptr;
// load the page
mir_snprintf(loc, sData->SearchURL, sID);
- BOOL bFound = (InternetDownloadFile(loc, NULL, NULL, &szData) == 0);
+ BOOL bFound = (InternetDownloadFile(loc, nullptr, nullptr, &szData) == 0);
if (bFound) {
wchar_t* szInfo = szData;
// not found
- if (wcsstr(szInfo, sData->NotFoundStr) == NULL)
+ if (wcsstr(szInfo, sData->NotFoundStr) == nullptr)
GetDataValue(&sData->Name, str, &szInfo);
}
@@ -276,7 +276,7 @@ int IDSearch(wchar_t *sID, const int searchId) WIDATALIST *Item = WIHead;
// search every weather service using the search station ID
- while (Item != NULL) {
+ while (Item != nullptr) {
IDSearchProc(sID, searchId, &Item->Data.IDSearch, Item->Data.InternalName, Item->Data.DisplayName);
Item = Item->next;
}
@@ -306,21 +306,21 @@ int IDSearch(wchar_t *sID, const int searchId) // svcname = the name of the weather service that is currently searching (ie. Yahoo Weather)
int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar_t *svc, wchar_t *svcname)
{
- wchar_t Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = NULL, *search;
+ wchar_t Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = nullptr, *search;
// replace spaces with %20
char loc[256];
T2Utf szSearchName(name);
mir_snprintf(loc, sData->SearchURL, ptrA(mir_urlEncode(szSearchName)));
- if (InternetDownloadFile(loc, NULL, NULL, &szData) == 0) {
+ if (InternetDownloadFile(loc, nullptr, nullptr, &szData) == 0) {
wchar_t* szInfo = szData;
search = wcsstr(szInfo, sData->NotFoundStr); // determine if data is available
- if (search == NULL) { // if data is found
+ if (search == nullptr) { // if data is found
// test if it is single result
if (sData->Single.Available && sData->Multiple.Available)
search = wcsstr(szInfo, sData->SingleStr);
// for single result
- if (sData->Single.Available && (search != NULL || !sData->Multiple.Available)) { // single result
+ if (sData->Single.Available && (search != nullptr || !sData->Multiple.Available)) { // single result
// if station ID appears first in the downloaded data
if (!mir_wstrcmpi(sData->Single.First, L"ID")) {
GetDataValue(&sData->Single.ID, str, &szInfo);
@@ -414,7 +414,7 @@ int NameSearch(wchar_t *name, const int searchId) WIDATALIST *Item = WIHead;
// search every weather service using the search station name
- while (Item != NULL) {
+ while (Item != nullptr) {
if (Item->Data.NameSearch.Single.Available || Item->Data.NameSearch.Multiple.Available)
NameSearchProc(name, searchId, &Item->Data.NameSearch, Item->Data.InternalName, Item->Data.DisplayName);
Item = Item->next;
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 582ba51831..6d8bd85541 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -47,7 +47,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam) db_free(&dbv);
}
else // display warning dialog if no path is specified
- MessageBox(NULL, TranslateT("Weather condition was not logged."),
+ MessageBox(nullptr, TranslateT("Weather condition was not logged."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
return 0;
}
@@ -61,7 +61,7 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM) if (id[0] != 0) {
// check if the complte forecast URL is set. If it is not, display warning and quit
if (db_get_wstatic(wParam, WEATHERPROTONAME, "InfoURL", loc2, _countof(loc2)) || loc2[0] == 0) {
- MessageBox(NULL, NO_FORECAST_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
+ MessageBox(nullptr, NO_FORECAST_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
// set the url and open the webpage
@@ -79,7 +79,7 @@ INT_PTR WeatherMap(WPARAM wParam, LPARAM) if (id[0] != 0) {
// check if the weather map URL is set. If it is not, display warning and quit
if (db_get_wstatic(wParam, WEATHERPROTONAME, "MapURL", loc2, _countof(loc2)) || loc2[0] == 0) {
- MessageBox(NULL, NO_MAP_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
+ MessageBox(nullptr, NO_MAP_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
@@ -111,7 +111,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA OPENFILENAME ofn; // common dialog box structure
MCONTACT hContact;
WIDATA *sData;
- CntSetWndDataType *wndData = NULL;
+ CntSetWndDataType *wndData = nullptr;
switch (msg) {
case WM_INITDIALOG:
@@ -206,7 +206,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // if not, don't let user change the setting
GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
chop = wcsstr(str, L"/");
- if (chop == NULL)
+ if (chop == nullptr)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
else
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), TRUE);
@@ -236,13 +236,13 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // load the page
mir_snprintf(loc, sData->IDSearch.SearchURL, str);
str[0] = 0;
- wchar_t *pData = NULL;
- if (InternetDownloadFile(loc, NULL, sData->UserAgent, &pData) == 0) {
+ wchar_t *pData = nullptr;
+ if (InternetDownloadFile(loc, nullptr, sData->UserAgent, &pData) == 0) {
wchar_t *szInfo = pData;
wchar_t* search = wcsstr(szInfo, sData->IDSearch.NotFoundStr);
// if the page is found (ie. valid ID), get the name of the city
- if (search == NULL)
+ if (search == nullptr)
GetDataValue(&sData->IDSearch.Name, str, &szInfo);
}
// free memory
@@ -284,9 +284,9 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA *pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
+ ofn.lpstrInitialDir = nullptr;
ofn.Flags = OFN_PATHMUSTEXIST;
// Display a Open dialog box and put the file name on the dialog
@@ -410,7 +410,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM) HWND hEditDlg = WindowList_Find(hWindowList, wParam);
// search the dialog list to prevent multiple instance of dialog for the same contact
- if (hEditDlg != NULL) {
+ if (hEditDlg != nullptr) {
// if the dialog box already opened, bring it to the front
SetForegroundWindow(hEditDlg);
SetFocus(hEditDlg);
@@ -418,7 +418,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM) else {
// if the dialog box is not opened, open a new one
if (IsMyContact(wParam))
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), NULL, DlgProcChange, (LPARAM)wParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
}
return 0;
@@ -458,7 +458,7 @@ int ContactDeleted(WPARAM wParam, LPARAM) if (tszNick != NULL) {
wchar_t str[255];
mir_snwprintf(str, TranslateT("%s is now the default weather station"), (wchar_t*)tszNick);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
return 0; // exit this function quickly
@@ -475,5 +475,5 @@ int ContactDeleted(WPARAM wParam, LPARAM) BOOL IsMyContact(MCONTACT hContact)
{
const char *szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(WEATHERPROTONAME, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(WEATHERPROTONAME, szProto) == 0;
}
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index 15428e3839..ab9f85a26f 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -328,58 +328,58 @@ WORD GetIcon(const wchar_t* cond, WIDATA *Data) // internal detection
if (
- wcsstr(cond, L"mainy sunny") != NULL ||
- wcsstr(cond, L"mainy clear") != NULL ||
- wcsstr(cond, L"partly cloudy") != NULL ||
- wcsstr(cond, L"mostly") != NULL ||
- wcsstr(cond, L"clouds") != NULL) {
+ wcsstr(cond, L"mainy sunny") != nullptr ||
+ wcsstr(cond, L"mainy clear") != nullptr ||
+ wcsstr(cond, L"partly cloudy") != nullptr ||
+ wcsstr(cond, L"mostly") != nullptr ||
+ wcsstr(cond, L"clouds") != nullptr) {
return PCLOUDY;
}
else if (
- wcsstr(cond, L"sunny") != NULL ||
- wcsstr(cond, L"clear") != NULL ||
- wcsstr(cond, L"fair") != NULL) {
+ wcsstr(cond, L"sunny") != nullptr ||
+ wcsstr(cond, L"clear") != nullptr ||
+ wcsstr(cond, L"fair") != nullptr) {
return SUNNY;
}
else if (
- wcsstr(cond, L"thunder") != NULL ||
- wcsstr(cond, L"t-storm") != NULL) {
+ wcsstr(cond, L"thunder") != nullptr ||
+ wcsstr(cond, L"t-storm") != nullptr) {
return LIGHT;
}
else if (
- wcsstr(cond, L"cloud") != NULL ||
- wcsstr(cond, L"overcast") != NULL) {
+ wcsstr(cond, L"cloud") != nullptr ||
+ wcsstr(cond, L"overcast") != nullptr) {
return CLOUDY;
}
else if (
- wcsstr(cond, L"fog") != NULL ||
- wcsstr(cond, L"mist") != NULL ||
- wcsstr(cond, L"smoke") != NULL ||
- wcsstr(cond, L"sand") != NULL ||
- wcsstr(cond, L"dust") != NULL ||
- wcsstr(cond, L"haze") != NULL) {
+ wcsstr(cond, L"fog") != nullptr ||
+ wcsstr(cond, L"mist") != nullptr ||
+ wcsstr(cond, L"smoke") != nullptr ||
+ wcsstr(cond, L"sand") != nullptr ||
+ wcsstr(cond, L"dust") != nullptr ||
+ wcsstr(cond, L"haze") != nullptr) {
return FOG;
}
else if (
- (wcsstr(cond, L"shower") != NULL && wcsstr(cond, L"snow") != NULL) ||
- wcsstr(cond, L"flurries") != NULL) {
+ (wcsstr(cond, L"shower") != nullptr && wcsstr(cond, L"snow") != nullptr) ||
+ wcsstr(cond, L"flurries") != nullptr) {
return SSHOWER;
}
else if (
- wcsstr(cond, L"rain shower") != NULL ||
- wcsstr(cond, L"shower") != NULL) {
+ wcsstr(cond, L"rain shower") != nullptr ||
+ wcsstr(cond, L"shower") != nullptr) {
return RSHOWER;
}
else if (
- wcsstr(cond, L"snow") != NULL ||
- wcsstr(cond, L"ice") != NULL ||
- wcsstr(cond, L"freezing") != NULL ||
- wcsstr(cond, L"wintry") != NULL) {
+ wcsstr(cond, L"snow") != nullptr ||
+ wcsstr(cond, L"ice") != nullptr ||
+ wcsstr(cond, L"freezing") != nullptr ||
+ wcsstr(cond, L"wintry") != nullptr) {
return SNOW;
}
else if (
- wcsstr(cond, L"drizzle") != NULL ||
- wcsstr(cond, L"rain") != NULL) {
+ wcsstr(cond, L"drizzle") != nullptr ||
+ wcsstr(cond, L"rain") != nullptr) {
return RAIN;
}
@@ -393,7 +393,7 @@ WORD GetIcon(const wchar_t* cond, WIDATA *Data) mir_snwprintf(LangPackStr, L"# Weather %s %i #", statusStr[i], j);
wcsncpy_s(LangPackStr1, TranslateW(LangPackStr), _TRUNCATE);
CharLowerBuff(LangPackStr1, (DWORD)mir_wstrlen(LangPackStr1));
- if (wcsstr(cond, LangPackStr1) != NULL)
+ if (wcsstr(cond, LangPackStr1) != nullptr)
return statusValue[i];
// loop until the translation string exists (ie, the translated string is differ from original)
} while (mir_wstrcmp(TranslateW(LangPackStr), LangPackStr));
@@ -518,7 +518,7 @@ wchar_t* GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str) switch (chr) {
case 'c': mir_wstrcat(str, w->cond); break;
case 'd': // get the current date
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, lpzDate, _countof(lpzDate));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, lpzDate, _countof(lpzDate));
mir_wstrcat(str, lpzDate); break;
case 'e': mir_wstrcat(str, w->dewpoint); break;
case 'f': mir_wstrcat(str, w->feel); break;
@@ -581,7 +581,7 @@ INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam) void GetSvc(wchar_t *pszID)
{
wchar_t *chop = wcsstr(pszID, L"/");
- if (chop != NULL) *chop = '\0';
+ if (chop != nullptr) *chop = '\0';
else pszID[0] = 0;
}
@@ -591,7 +591,7 @@ void GetSvc(wchar_t *pszID) void GetID(wchar_t *pszID)
{
wchar_t *chop = wcsstr(pszID, L"/");
- if (chop != NULL) mir_wstrcpy(pszID, chop + 1);
+ if (chop != nullptr) mir_wstrcpy(pszID, chop + 1);
else pszID[0] = 0;
}
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index 498d9db482..e446b8bcb0 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -144,7 +144,7 @@ void EraseAllInfo() if (!db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
}
// get the handle of the default station
@@ -171,7 +171,7 @@ void EraseAllInfo() if (!db_get_ws(LastContact, WEATHERPROTONAME, "Nick", &dbv)) {
mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
}
// save option in case of default station changed
@@ -259,7 +259,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) // the start string must be found
if (UpdateData->Start[0] != 0) {
start = wcsstr(szInfo, UpdateData->Start);
- if (start != NULL) {
+ if (start != nullptr) {
// set the starting location for getting data
start += mir_wstrlen(UpdateData->Start);
szInfo = start;
@@ -272,7 +272,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) else
end = wcsstr(szInfo, L" ");
- if (end != NULL) {
+ if (end != nullptr) {
// set the ending location
startloc = 0;
endloc = end - szInfo;
@@ -281,7 +281,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) }
// ignore if not both of the string found - this prevent crashes
- if (start != NULL && end != NULL) {
+ if (start != nullptr && end != nullptr) {
// begin reading the data from start location to end location
// remove all HTML tag in between, as well as leading space, ending space,
// multiple spaces, tabs, and return key
@@ -377,14 +377,14 @@ void wfree(char **Data) {
if (*Data && mir_strlen(*Data) > 0)
mir_free(*Data);
- *Data = NULL;
+ *Data = nullptr;
}
void wfree(WCHAR **Data)
{
if (*Data && mir_wstrlen(*Data) > 0)
mir_free(*Data);
- *Data = NULL;
+ *Data = nullptr;
}
//============ MANAGE THE ITEMS STORED IN DB ============
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp index d2ffb09070..8b5995926b 100644 --- a/plugins/Weather/src/weather_http.cpp +++ b/plugins/Weather/src/weather_http.cpp @@ -47,7 +47,7 @@ static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr) //
int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **szData)
{
- if (userAgent == NULL || userAgent[0] == 0)
+ if (userAgent == nullptr || userAgent[0] == 0)
userAgent = NETLIB_USER_AGENT;
NETLIBHTTPHEADER headers[5];
@@ -71,17 +71,17 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s nlhr.headers = headers;
nlhr.headersCount = _countof(headers);
- if (cookie == NULL || cookie[0] == 0)
+ if (cookie == nullptr || cookie[0] == 0)
--nlhr.headersCount;
// download the page
NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
- if (nlhrReply == 0) {
+ if (nlhrReply == nullptr) {
// if the data does not downloaded successfully (ie. disconnected), then return 1000 as error code
*szData = (wchar_t*)mir_alloc(512);
// store the error code in szData
mir_wstrcpy(*szData, L"NetLib error occurred!!");
- hNetlibHttp = NULL;
+ hNetlibHttp = nullptr;
return NLHRF_REDIRECT;
}
@@ -125,10 +125,10 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s }
}
- wchar_t *retVal = NULL;
+ wchar_t *retVal = nullptr;
if (bIsUtf)
retVal = mir_utf8decodeW(nlhrReply->pData);
- if (retVal == NULL)
+ if (retVal == nullptr)
retVal = mir_a2u(nlhrReply->pData);
*szData = retVal;
}
@@ -164,7 +164,7 @@ void NetlibHttpDisconnect(void) {
if (hNetlibHttp) {
HANDLE hConn = hNetlibHttp;
- hNetlibHttp = NULL;
+ hNetlibHttp = nullptr;
Netlib_CloseHandle(hConn);
}
}
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp index 68d162e8fc..12f40ebaa3 100644 --- a/plugins/Weather/src/weather_icons.cpp +++ b/plugins/Weather/src/weather_icons.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE hIcoLibIconsChanged = NULL;
+HANDLE hIcoLibIconsChanged = nullptr;
static IconItem iconList[] =
{
@@ -55,7 +55,7 @@ HANDLE GetIconHandle(const char* name) if (mir_strcmp(iconList[i].szName, name) == 0)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(HICON hIcon)
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp index d78be15988..6f7ca4c1c7 100644 --- a/plugins/Weather/src/weather_info.cpp +++ b/plugins/Weather/src/weather_info.cpp @@ -43,7 +43,7 @@ static void INIInfo(HWND hwndDlg) LVITEM lvi = { 0 };
lvi.mask = LVIF_TEXT;
lvi.iItem = 0;
- for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next) {
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
// get the data for the ini file
lvi.iSubItem = 0;
lvi.pszText = Item->Data.InternalName;
@@ -146,9 +146,9 @@ void GetINIInfo(wchar_t *pszSvc) wchar_t str2[2048];
WIDATA *sData = GetWIData(pszSvc);
// if the service does not exist among the loaded INI's
- if (sData == NULL) {
+ if (sData == nullptr) {
mir_snwprintf(str2, TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
- MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
}
// if exist, get the information
else {
@@ -197,7 +197,7 @@ void GetINIInfo(wchar_t *pszSvc) mir_wstrncat(str2, sData->Description, _countof(str2) - mir_wstrlen(str2));
// display the message box and quit
- MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
}
}
@@ -213,16 +213,16 @@ void MoreVarList(void) wcsncpy(str, VARS_LIST, _countof(str) - 1);
mir_wstrncat(str, L"\n\n", _countof(str) - mir_wstrlen(str));
// loop through all weather services to find custom variables
- for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next) {
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
// loop through all update items in a service
- for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != NULL; WItem = WItem->Next) {
+ for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != nullptr; WItem = WItem->Next) {
// the custom variable is defined as "%[<variable name>]"
// ignore the "hi" item and hidden items
if (mir_wstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
mir_snwprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
wchar_t *find = wcsstr(str, tempstr);
// if the custom variable does not exist in the list, add it to the list
- if (find == NULL) {
+ if (find == nullptr) {
mir_wstrncat(str, tempstr, _countof(str) - mir_wstrlen(str));
mir_wstrncat(str, L", ", _countof(str) - mir_wstrlen(str));
}
@@ -231,10 +231,10 @@ void MoreVarList(void) }
// remove the last comma in the list
wchar_t* find = wcsrchr(str, ',');
- if (find != NULL)
+ if (find != nullptr)
*find = '\0';
// display the list in a message box
- MessageBox(NULL, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
+ MessageBox(nullptr, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
}
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index e0001c4159..717e7e1fd3 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -39,8 +39,8 @@ static void WIListAdd(WIDATA Data) WIDATALIST *newItem = (WIDATALIST*)mir_alloc(sizeof(WIDATALIST));
newItem->Data = Data;
// add to the linked list
- newItem->next = NULL;
- if (WITail == NULL) WIHead = newItem;
+ newItem->next = nullptr;
+ if (WITail == nullptr) WIHead = newItem;
else WITail->next = newItem;
WITail = newItem;
}
@@ -51,13 +51,13 @@ static void WIListAdd(WIDATA Data) WIDATA* GetWIData(wchar_t *pszServ)
{
// loop through the list to find matching internal name
- for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next)
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next)
// if internal name found, return the data
if (mir_wstrcmp(Item->Data.InternalName, pszServ) == 0)
return &Item->Data;
// return NULL when no match found
- return NULL;
+ return nullptr;
}
//============ DATA ITEM LIST (LINKED LIST) ============
@@ -67,8 +67,8 @@ void WIItemListAdd(WIDATAITEM *DataItem, WIDATA *Data) {
WIDATAITEMLIST *newItem = (WIDATAITEMLIST*)mir_alloc(sizeof(WIDATAITEMLIST));
newItem->Item = *DataItem;
- newItem->Next = NULL;
- if (Data->UpdateData == NULL) Data->UpdateData = newItem;
+ newItem->Next = nullptr;
+ if (Data->UpdateData == nullptr) Data->UpdateData = newItem;
else Data->UpdateDataTail->Next = newItem;
Data->UpdateDataTail = newItem;
}
@@ -104,8 +104,8 @@ void FreeDataItem(WIDATAITEM *Item) // initiate icon assignmet list
void WICondListInit(WICONDLIST *List)
{
- List->Tail = NULL;
- List->Head = NULL;
+ List->Tail = nullptr;
+ List->Head = nullptr;
}
// add a new update item into the current list
@@ -114,8 +114,8 @@ void WICondListAdd(char *str, WICONDLIST *List) WICONDITEM *newItem = (WICONDITEM*)mir_alloc(sizeof(WICONDITEM));
wSetData(&newItem->Item, str);
CharLowerBuff(newItem->Item, (DWORD)mir_wstrlen(newItem->Item));
- newItem->Next = NULL;
- if (List->Tail == NULL) List->Head = newItem;
+ newItem->Next = nullptr;
+ if (List->Tail == nullptr) List->Head = newItem;
else List->Tail->Next = newItem;
List->Tail = newItem;
}
@@ -124,7 +124,7 @@ void WICondListAdd(char *str, WICONDLIST *List) bool IsContainedInCondList(const wchar_t *pszStr, WICONDLIST *List)
{
// loop through the list to find matching internal name
- for (WICONDITEM *Item = List->Head; Item != NULL; Item = Item->Next) {
+ for (WICONDITEM *Item = List->Head; Item != nullptr; Item = Item->Next) {
// if internal name found, return true indicating that the data is found
if (wcsstr(pszStr, Item->Item))
return true;
@@ -138,13 +138,13 @@ bool IsContainedInCondList(const wchar_t *pszStr, WICONDLIST *List) void DestroyCondList(WICONDLIST *List)
{
// free the list one by one
- for (WICONDITEM *temp = List->Head; temp != NULL; temp = List->Head) {
+ for (WICONDITEM *temp = List->Head; temp != nullptr; temp = List->Head) {
List->Head = temp->Next;
wfree(&temp->Item); // free the data struct
mir_free(temp);
}
// make sure the entire list is clear
- List->Tail = NULL;
+ List->Tail = nullptr;
}
@@ -179,7 +179,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_STEP2:
{
wchar_t szPath[1024];
- GetModuleFileName(GetModuleHandle(NULL), szPath, _countof(szPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szPath, _countof(szPath));
wchar_t *chop = wcsrchr(szPath, '\\');
if (chop) {
*chop = '\0';
@@ -192,7 +192,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_STEP3:
if (LoadWIData(false))
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("All update data has been reloaded."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
break;
@@ -248,7 +248,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat // open the ini file
FILE *pfile = _wfsopen(pszFile, L"rt", _SH_DENYWR);
- if (pfile != NULL) {
+ if (pfile != nullptr) {
char Line[4096];
fgets(Line, _countof(Line), pfile);
TrimString(Line);
@@ -271,7 +271,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat else {
wchar_t str[4096];
mir_snwprintf(str, TranslateT("Invalid ini format for: %s"), pszFile);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
fclose(pfile);
return;
}
@@ -324,8 +324,8 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat // initialize the linked list for update items
Data->UpdateDataCount = 0;
Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_wstrlen(pszShortFile) + mir_wstrlen(pszFile) + 20)*sizeof(wchar_t);
- Data->UpdateData = NULL;
- Data->UpdateDataTail = NULL;
+ Data->UpdateData = nullptr;
+ Data->UpdateDataTail = nullptr;
// initialize the icon assignment list
for (int i = 0; i < 10; i++)
@@ -334,14 +334,14 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat while (!feof(pfile)) {
// determine current tag
- if (fgets(Line, _countof(Line), pfile) == NULL)
+ if (fgets(Line, _countof(Line), pfile) == nullptr)
break;
TrimString(Line);
// if the line is a group header/footer
if (Line[0] == '[') {
char *chop = strchr(Line + 1, ']');
- if (chop == NULL)
+ if (chop == nullptr)
continue;
if (Line[1] != '/') { // if it is not a footer (for old ini)
@@ -371,7 +371,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat }
// ignore comments and all lines without an '='
Value = strstr(Line, "=");
- if (Value == NULL) continue;
+ if (Value == nullptr) continue;
// get the string before '=' (ValName) and after '=' (Value)
ValName = (char *)mir_alloc(mir_strlen(Line) + 1);
@@ -481,14 +481,14 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat bool LoadWIData(bool dial)
{
// make sure that the current service data list is empty
- WITail = NULL;
+ WITail = nullptr;
WIHead = WITail;
// find all *.ini file in the plugin\weather directory
wchar_t szSearchPath[MAX_PATH], FileName[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szSearchPath, _countof(szSearchPath));
wchar_t *chop = wcsrchr(szSearchPath, '\\');
- if (chop == NULL)
+ if (chop == nullptr)
return false;
*chop = '\0';
mir_wstrncat(szSearchPath, L"\\Plugins\\Weather\\*.ini", _countof(szSearchPath) - mir_wstrlen(szSearchPath));
@@ -515,12 +515,12 @@ bool LoadWIData(bool dial) FindClose(hFind);
}
- if (WIHead == NULL) {
+ if (WIHead == nullptr) {
// no ini found, display an error message box.
if (dial)
- hWndSetup = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETUP), NULL, DlgProcSetup);
+ hWndSetup = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
else
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("No update data file is found. Please check your Plugins\\Weather directory."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
return false;
@@ -536,7 +536,7 @@ static void FreeWIData(WIDATA *Data) {
// free update items linked list first
WIDATAITEMLIST *WItem = Data->UpdateData;
- while (WItem != NULL) {
+ while (WItem != nullptr) {
Data->UpdateData = WItem->Next;
FreeDataItem(&WItem->Item);
mir_free(WItem);
@@ -579,7 +579,7 @@ static void FreeWIData(WIDATA *Data) void DestroyWIList(void)
{
// free the list one by one
- while (WIHead != NULL) {
+ while (WIHead != nullptr) {
WIDATALIST *wi = WIHead;
WIHead = wi->next;
FreeWIData(&wi->Data); // free the data struct
@@ -587,5 +587,5 @@ void DestroyWIList(void) }
// make sure the entire list is clear
- WITail = NULL;
+ WITail = nullptr;
}
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 14266b6a4f..a87517a9b4 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -48,7 +48,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara data->hContact = (DWORD_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD,
- 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, NULL, hInst, 0);
+ 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, hInst, nullptr);
if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
break;
@@ -61,7 +61,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara POINT pt;
GetCursorPos(&pt);
HMENU hMenu = Menu_BuildContactMenu(data->hContact);
- TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -121,14 +121,14 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara LONG_PTR style = GetWindowLongPtr(data->hAvt, GWL_STYLE);
data->haveAvatar = newava;
SetWindowLongPtr(data->hAvt, GWL_STYLE, newava ? (style | WS_VISIBLE) : (style & ~WS_VISIBLE));
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
}
}
break;
case WM_REDRAWWIN:
- if (data->hAvt != NULL) MoveWindow(data->hAvt, 0, 0, opt.AvatarSize, opt.AvatarSize, TRUE);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ if (data->hAvt != nullptr) MoveWindow(data->hAvt, 0, 0, opt.AvatarSize, opt.AvatarSize, TRUE);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case WM_PAINT:
@@ -141,7 +141,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara COLORREF fntc, fntc1;
COLORREF clr;
int picSize = opt.AvatarSize;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (!data->haveAvatar) {
int statusIcon = db_get_w(data->hContact, WEATHERPROTONAME, "Status", 0);
@@ -182,7 +182,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara }
if (!data->haveAvatar)
- DrawIconEx(hdc, 1, 1, hIcon, 0, 0, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, 1, 1, hIcon, 0, 0, 0, nullptr, DI_NORMAL);
SetBkMode(hdc, TRANSPARENT);
@@ -238,7 +238,7 @@ static void addWindow(MCONTACT hContact) db_free(&dbv);
HWND hWnd = CreateWindow(L"WeatherFrame", L"", WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, (void*)hContact);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, (void*)hContact);
WindowList_Add(hMwinWindowList, hWnd, hContact);
CLISTFrame Frame = { 0 };
@@ -269,13 +269,13 @@ void removeWindow(MCONTACT hContact) void UpdateMwinData(MCONTACT hContact)
{
HWND hwnd = WindowList_Find(hMwinWindowList, hContact);
- if (hwnd != NULL)
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ if (hwnd != nullptr)
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
}
INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM)
{
- BOOL addwnd = WindowList_Find(hMwinWindowList, wParam) == NULL;
+ BOOL addwnd = WindowList_Find(hMwinWindowList, wParam) == nullptr;
if (addwnd)
addWindow(wParam);
else
@@ -286,7 +286,7 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM) int BuildContactMenu(WPARAM wparam, LPARAM)
{
int flags = db_get_dw(wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0;
- Menu_ModifyItem(hMwinMenu, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(hMwinMenu, nullptr, INVALID_HANDLE_VALUE, flags);
return 0;
}
@@ -309,10 +309,10 @@ void InitMwin(void) wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.hIcon = nullptr;
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = L"WeatherFrame";
RegisterClass(&wndclass);
@@ -333,9 +333,9 @@ void InitMwin(void) mir_wstrcpy(fontid.name, LPGENW("Frame Font"));
mir_strcpy(fontid.prefix, "fnt0");
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
fontid.deffontsettings.size = -13;
- ReleaseDC(0, hdc);
+ ReleaseDC(nullptr, hdc);
fontid.deffontsettings.charset = DEFAULT_CHARSET;
mir_wstrcpy(fontid.deffontsettings.szFace, L"Verdana");
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index a84b00d61c..e7b1566672 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -35,43 +35,43 @@ void SetTextDefault(const char* in) {
wchar_t str[MAX_TEXT_SIZE];
- if (strchr(in, 'C') != NULL) {
+ if (strchr(in, 'C') != nullptr) {
wcsncpy(str, C_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.cText, str);
}
- if (strchr(in, 'b') != NULL) {
+ if (strchr(in, 'b') != nullptr) {
wcsncpy(str, b_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.bTitle, str);
}
- if (strchr(in, 'B') != NULL) {
+ if (strchr(in, 'B') != nullptr) {
wcsncpy(str, B_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.bText, str);
}
- if (strchr(in, 'N') != NULL) {
+ if (strchr(in, 'N') != nullptr) {
wcsncpy(str, N_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.nText, str);
}
- if (strchr(in, 'E') != NULL) {
+ if (strchr(in, 'E') != nullptr) {
wcsncpy(str, E_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.eText, str);
}
- if (strchr(in, 'H') != NULL) {
+ if (strchr(in, 'H') != nullptr) {
wcsncpy(str, H_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.hText, str);
}
- if (strchr(in, 'X') != NULL) {
+ if (strchr(in, 'X') != nullptr) {
wcsncpy(str, X_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.xText, str);
}
- if (strchr(in, 'P') != NULL) {
+ if (strchr(in, 'P') != nullptr) {
wcsncpy(str, P_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.pTitle, str);
}
- if (strchr(in, 'p') != NULL) {
+ if (strchr(in, 'p') != nullptr) {
wcsncpy(str, p_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.pText, str);
}
- if (strchr(in, 'S') != NULL) {
+ if (strchr(in, 'S') != nullptr) {
wcsncpy(str, s_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.sText, str);
}
@@ -337,8 +337,8 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l GetDlgItemText(hdlg, IDC_UPDATETIME, str, _countof(str));
opt.UpdateTime = (WORD)_wtoi(str);
if (opt.UpdateTime < 1) opt.UpdateTime = 1;
- KillTimer(NULL, timerId);
- timerId = SetTimer(NULL, 0, opt.UpdateTime * 60000, timerProc);
+ KillTimer(nullptr, timerId);
+ timerId = SetTimer(nullptr, 0, opt.UpdateTime * 60000, timerProc);
// other general options
GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, _countof(opt.DegreeSign));
@@ -349,7 +349,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l opt.UpdateOnlyConditionChanged = (BYTE)IsDlgButtonChecked(hdlg, IDC_UPDCONDCHG);
opt.RemoveOldData = IsDlgButtonChecked(hdlg, IDC_REMOVEOLD);
opt.MakeItalic = IsDlgButtonChecked(hdlg, IDC_MAKEI);
- opt.AvatarSize = GetDlgItemInt(hdlg, IDC_AVATARSIZE, NULL, FALSE);
+ opt.AvatarSize = GetDlgItemInt(hdlg, IDC_AVATARSIZE, nullptr, FALSE);
opt.DoNotAppendUnit = IsDlgButtonChecked(hdlg, IDC_DONOTAPPUNITS);
opt.NoFrac = IsDlgButtonChecked(hdlg, IDC_NOFRAC);
UpdateMenu(opt.AutoUpdate);
@@ -486,13 +486,13 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
- switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL)) {
+ switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
case ID_MPREVIEW:
{
// show the preview in a message box, using the weather data from the default station
WEATHERINFO winfo = LoadWeatherInfo(opt.DefStn);
GetDisplay(&winfo, *var[LOWORD(wParam) - IDC_TM1], str);
- MessageBox(NULL, str, TranslateT("Weather Protocol Text Preview"), MB_OK | MB_TOPMOST);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol Text Preview"), MB_OK | MB_TOPMOST);
break;
}
case ID_MRESET:
@@ -514,7 +514,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
- switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL)) {
+ switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
case ID_T1:
// reset to the strings in memory, discard all changes
LoadTextSettings(hdlg);
@@ -594,7 +594,7 @@ int OptInit(WPARAM wParam, LPARAM) odp.position = 100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.szGroup.a = LPGEN("Popups");
- odp.szTab.a = NULL;
+ odp.szTab.a = nullptr;
odp.pfnDlgProc = DlgPopupOpts;
Options_AddPage(wParam, &odp);
}
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index 765d71f830..c48e4c37c3 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -54,18 +54,18 @@ int WeatherError(WPARAM wParam, LPARAM lParam) wcsncpy(str1, tszMsg, _countof(str1) - 1);
wcsncpy(str2, tszMsg, _countof(str2) - 1);
wchar_t *chop = wcschr(str1, 255);
- if (chop != NULL)
+ if (chop != nullptr)
*chop = '\0';
else
str1[0] = 0;
chop = wcschr(str2, 255);
- if (chop != NULL)
+ if (chop != nullptr)
wcsncpy(str2, chop + 1, _countof(str2) - 1);
else
str2[0] = 0;
// setup the popup
- ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(OIC_BANG), IMAGE_ICON,
+ ppd.lchIcon = (HICON)LoadImage(nullptr, MAKEINTRESOURCE(OIC_BANG), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
mir_wstrcpy(ppd.lptzContactName, str1);
mir_wstrcpy(ppd.lptzText, str2);
@@ -176,7 +176,7 @@ LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam hMenu = Menu_BuildContactMenu(wParam);
GetCursorPos(&pt);
hPopupContact = wParam;
- TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, NULL);
+ TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, nullptr);
DestroyMenu(hMenu);
break;
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.RightClickAction);
- ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL);
+ ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr);
if (ID)
opt.RightClickAction = ID;
DestroyMenu(hMenu);
@@ -355,7 +355,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.LeftClickAction);
- ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL);
+ ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr);
if (ID) opt.LeftClickAction = ID;
DestroyMenu(hMenu);
@@ -398,7 +398,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) mir_wstrncat(str, VAR_LIST_POPUP, _countof(str) - mir_wstrlen(str));
mir_wstrncat(str, L"\n", _countof(str) - mir_wstrlen(str));
mir_wstrncat(str, CUSTOM_VARS, _countof(str) - mir_wstrlen(str));
- MessageBox(NULL, str, TranslateT("Variable List"), MB_OK | MB_ICONASTERISK | MB_TOPMOST);
+ MessageBox(nullptr, str, TranslateT("Variable List"), MB_OK | MB_ICONASTERISK | MB_TOPMOST);
break;
case IDC_PREVIEW:
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index 705288a25f..58d2dcfca9 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -132,7 +132,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam) unsigned i;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szSearchPath, _countof(szSearchPath));
chop = wcsrchr(szSearchPath, '\\');
if (chop) *chop = '\0';
@@ -169,7 +169,7 @@ void AvatarDownloaded(MCONTACT hContact) if (WeatherGetAvatarInfo(GAIF_FORCE, (LPARAM)&ai) == GAIR_SUCCESS)
ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
else
- ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
static void __cdecl WeatherGetAwayMsgThread(void *arg)
@@ -188,7 +188,7 @@ static void __cdecl WeatherGetAwayMsgThread(void *arg) static INT_PTR WeatherGetAwayMsg(WPARAM, LPARAM lParam)
{
CCSDATA* ccs = (CCSDATA*)lParam;
- if (ccs == NULL)
+ if (ccs == nullptr)
return 0;
mir_forkthread(WeatherGetAwayMsgThread, (void*)ccs->hContact);
@@ -372,8 +372,8 @@ void AddMenuItems(void) mi.pszService = "Weather/mwin_menu";
CreateServiceFunction(mi.pszService, Mwin_MenuClicked);
mi.position = -0x7FFFFFF0;
- mi.hIcolibItem = NULL;
- mi.root = NULL;
+ mi.hIcolibItem = nullptr;
+ mi.root = nullptr;
mi.name.a = LPGEN("Display in a frame");
hMwinMenu = Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
}
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 02d5129fab..d64786e53c 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -138,7 +138,7 @@ int UpdateWeather(MCONTACT hContact) else
db_unset(hContact, "CList", "StatusMsg");
- ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)(str2[0] ? str2 : 0));
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)(str2[0] ? str2 : nullptr));
// save descriptions in MyNotes
GetDisplay(&winfo, opt.nText, str2);
@@ -174,7 +174,7 @@ int UpdateWeather(MCONTACT hContact) // open the file and set point to the end of file
FILE *file = _wfopen(dbv.ptszVal, L"a");
db_free(&dbv);
- if (file != NULL) {
+ if (file != nullptr) {
// write data to the file and close
GetDisplay(&winfo, opt.eText, str2);
fputws(str2, file);
@@ -191,7 +191,7 @@ int UpdateWeather(MCONTACT hContact) DBEVENTINFO dbei = {};
dbei.szModule = WEATHERPROTONAME;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.pBlob = szMessage;
@@ -211,7 +211,7 @@ int UpdateWeather(MCONTACT hContact) // update brief info if its opened
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
- if (hMoreDataDlg != NULL)
+ if (hMoreDataDlg != nullptr)
PostMessage(hMoreDataDlg, WM_UPDATEDATA, 0, 0);
return 0;
}
@@ -225,11 +225,11 @@ void UpdateListAdd(MCONTACT hContact) {
UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST));
newItem->hContact = hContact;
- newItem->next = NULL;
+ newItem->next = nullptr;
WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListTail == NULL) UpdateListHead = newItem;
+ if (UpdateListTail == nullptr) UpdateListHead = newItem;
else UpdateListTail->next = newItem;
UpdateListTail = newItem;
@@ -244,15 +244,15 @@ MCONTACT UpdateGetFirst() WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListHead != NULL) {
+ if (UpdateListHead != nullptr) {
UPDATELIST* Item = UpdateListHead;
hContact = Item->hContact;
UpdateListHead = Item->next;
mir_free(Item);
- if (UpdateListHead == NULL)
- UpdateListTail = NULL;
+ if (UpdateListHead == nullptr)
+ UpdateListTail = nullptr;
}
ReleaseMutex(hUpdateMutex);
@@ -266,13 +266,13 @@ void DestroyUpdateList(void) // free the list one by one
UPDATELIST *temp = UpdateListHead;
- while (temp != NULL) {
+ while (temp != nullptr) {
UpdateListHead = temp->next;
mir_free(temp);
temp = UpdateListHead;
}
// make sure the entire list is clear
- UpdateListTail = NULL;
+ UpdateListTail = nullptr;
ReleaseMutex(hUpdateMutex);
}
@@ -290,7 +290,7 @@ static void UpdateThreadProc(void *) ReleaseMutex(hUpdateMutex);
// update weather by getting the first station from the queue until the queue is empty
- while (UpdateListHead != NULL && !Miranda_IsTerminated())
+ while (UpdateListHead != nullptr && !Miranda_IsTerminated())
UpdateWeather(UpdateGetFirst());
NetlibHttpDisconnect();
@@ -384,7 +384,7 @@ int GetWeatherData(MCONTACT hContact) // test ID format
wchar_t* szInfo = wcschr(id, '/');
- if (szInfo == NULL)
+ if (szInfo == nullptr)
return INVALID_ID_FORMAT;
GetID(id);
@@ -399,7 +399,7 @@ int GetWeatherData(MCONTACT hContact) // get the update strings (loaded to memory from ini files)
WIDATA *Data = GetWIData(Svc);
- if (Data == NULL)
+ if (Data == nullptr)
return SVC_NOT_FOUND; // the ini for the station cannot be found
WORD cond = NA;
@@ -431,13 +431,13 @@ int GetWeatherData(MCONTACT hContact) continue;
// download the html file from the internet
- wchar_t* szData = NULL;
+ wchar_t* szData = nullptr;
int retval = InternetDownloadFile(loc, Data->Cookie, Data->UserAgent, &szData);
if (retval != 0) {
mir_free(szData);
return retval;
}
- if (wcsstr(szData, L"Document Not Found") != NULL) {
+ if (wcsstr(szData, L"Document Not Found") != nullptr) {
mir_free(szData);
return DOC_NOT_FOUND;
}
@@ -446,7 +446,7 @@ int GetWeatherData(MCONTACT hContact) WIDATAITEMLIST *Item = Data->UpdateData;
// begin parsing item by item
- while (Item != NULL) {
+ while (Item != nullptr) {
if (Item->Item.Url[0] != 0 && Item->Item.Url[0] != (i + '1')) {
Item = Item->Next;
continue;
@@ -477,7 +477,7 @@ int GetWeatherData(MCONTACT hContact) do {
// the end of the string, last item
chop = wcsstr(str, L" & ");
- if (chop == NULL)
+ if (chop == nullptr)
chop = wcschr(str, '\0');
stl = min(sizeof(str2) - 1, (unsigned)(chop - str - 2));
@@ -523,7 +523,7 @@ int GetWeatherData(MCONTACT hContact) // generate the strings
wchar_t* end = wcsstr(DataValue, Item->Item.Break);
- if (end == NULL) {
+ if (end == nullptr) {
DataValue[0] = 0;
break; // exit if break string is not found
}
@@ -597,7 +597,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) // when this is run, it kill the old startup timer and create the permenant one above
void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
ThreadRunning = FALSE;
if (Miranda_IsTerminated())
@@ -605,5 +605,5 @@ void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD) if (opt.StartupUpdate && opt.NoProtoCondition)
UpdateAll(FALSE, FALSE);
- timerId = SetTimer(NULL, 0, ((int)opt.UpdateTime) * 60000, timerProc);
+ timerId = SetTimer(nullptr, 0, ((int)opt.UpdateTime) * 60000, timerProc);
}
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index a11962c332..cfba17d431 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -133,7 +133,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L Window_FreeIcon_IcoLib(hwndDlg);
Window_SetProtoIcon_IcoLib(hwndDlg, WEATHERPROTONAME, db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0));
- RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case WM_SIZE:
@@ -293,8 +293,8 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA switch (LOWORD(wParam)) {
case IDC_MOREDETAIL:
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
- if (hMoreDataDlg == NULL)
- hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData, hContact);
+ if (hMoreDataDlg == nullptr)
+ hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
else {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
@@ -344,11 +344,11 @@ int BriefInfo(WPARAM wParam, LPARAM) // make sure that the contact is actually a weather one
if (IsMyContact(wParam)) {
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, wParam);
- if (hMoreDataDlg != NULL) {
+ if (hMoreDataDlg != nullptr) {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
}
- else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData, (LPARAM)wParam);
+ else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 0);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 1);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index fd897fb380..421e92fdd2 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -29,7 +29,7 @@ HANDLE hHookDisplayDataAlert, hHookAlertPopup, hHookAlertWPopup, hHookErrorPopup int hLangpack = 0;
CLIST_INTERFACE *pcli;
-static HMODULE hRichEd = NULL;
+static HMODULE hRichEd = nullptr;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -95,8 +95,8 @@ extern "C" int __declspec(dllexport) Unload(void) {
ChangeContactStatus(0);
- KillTimer(NULL, timerId);
- KillTimer(NULL, Countdown);
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
SavewinSettings();
@@ -105,7 +105,7 @@ extern "C" int __declspec(dllexport) Unload(void) if (hNetlibUser) {
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
}
if (hHookDisplayDataAlert)
@@ -115,7 +115,7 @@ extern "C" int __declspec(dllexport) Unload(void) if (hHookAlertWPopup)
DestroyHookableEvent(hHookAlertWPopup);
- if (h_font != NULL)
+ if (h_font != nullptr)
DeleteObject(h_font);
if (hMenu)
DestroyMenu(hMenu);
@@ -136,9 +136,9 @@ extern "C" int __declspec(dllexport) Load() /*TIMERS*/
if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME) != 0)) {
- timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME)) * MINUTE), timerfunc);
+ timerId = SetTimer(nullptr, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME)) * MINUTE), timerfunc);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
- Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc);
+ Countdown = SetTimer(nullptr, 0, MINUTE, Countdownfunc);
}
InitialiseGlobals();
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 592a4a734d..9c77b5e6af 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -97,7 +97,7 @@ void TxtclrLoop() for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) {
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
SetDlgItemText(hwndDlg, IDC_DATA, L"");
- InvalidateRect(hwndDlg, NULL, 1);
+ InvalidateRect(hwndDlg, nullptr, 1);
}
}
@@ -108,7 +108,7 @@ void BGclrLoop() HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
SetDlgItemText(hwndDlg, IDC_DATA, L"");
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_SETBKGNDCOLOR, 0, BackgoundClr);
- InvalidateRect(hwndDlg, NULL, 1);
+ InvalidateRect(hwndDlg, nullptr, 1);
}
}
@@ -185,7 +185,7 @@ int Doubleclick(WPARAM wParam, LPARAM) SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
@@ -269,7 +269,7 @@ void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD) if (!(db_get_b(NULL, MODULENAME, OFFLINE_STATUS, 1)))
if (!(db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)))
- mir_forkthread(ContactLoop, NULL);
+ mir_forkthread(ContactLoop, nullptr);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
}
@@ -352,7 +352,7 @@ int ModulesLoaded(WPARAM, LPARAM) // get data on startup
if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
- mir_forkthread(StartUpdate, NULL);
+ mir_forkthread(StartUpdate, nullptr);
return 0;
}
@@ -362,13 +362,13 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) {
MCONTACT hContact = wParam;
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
- if (hwndDlg != NULL) {
+ if (hwndDlg != nullptr) {
DestroyWindow(hwndDlg);
return 0;
}
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
@@ -396,7 +396,7 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) /*****************************************************************************/
INT_PTR UpdateAllMenuCommand(WPARAM, LPARAM)
{
- mir_forkthread(ContactLoop, NULL);
+ mir_forkthread(ContactLoop, nullptr);
return 0;
}
@@ -474,7 +474,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), NULL, DlgProcContactOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -489,7 +489,7 @@ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), NULL, DlgProcAlertOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index bdd4551410..78d217a383 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -113,7 +113,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) {
POPUPDATAT ppd = { 0 };
- if( ((HANDLE)wParam) != NULL) {
+ if( ((HANDLE)wParam) != nullptr) {
DBVARIANT dbv;
db_get_ws(wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv);
mir_wstrncpy(ppd.lptzContactName, dbv.ptszVal, _countof(ppd.lptzContactName));
@@ -143,7 +143,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) ppd.colorText = TextClr;
}
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = db_get_dw(NULL, MODULENAME, POP_DELAY_KEY, 0);
if (ServiceExists(MS_POPUP_ADDPOPUPT))
@@ -196,7 +196,7 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
}
- Clist_TrayNotifyW(NULL, ptszContactName, TranslateW(displaytext), NIIF_ERROR, 15000);
+ Clist_TrayNotifyW(nullptr, ptszContactName, TranslateW(displaytext), NIIF_ERROR, 15000);
return 0;
}
@@ -220,13 +220,13 @@ void SaveToFile(MCONTACT hContact, char *truncated) return;
FILE *pfile = fopen(dbv.pszVal, mode);
- if (pfile == NULL)
+ if (pfile == nullptr)
WErrorPopup(hContact, TranslateT("Cannot write to file"));
else {
char timestring[128], timeprefix[32];
char temptime1[32], temptime2[32];
- time_t ftime = time(NULL);
+ time_t ftime = time(nullptr);
struct tm *nTime = localtime(&ftime);
mir_snprintf(timeprefix, " %s ", Translate("Last updated on"));
@@ -332,7 +332,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Start/end strings not found or strings not set."));
}
- else MessageBox(NULL, TranslateT("Start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
}
if (eventIndex == 0) { // string present
@@ -340,7 +340,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn strncpy_s(alertstring, _countof(alertstring), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
- if ((strstr(tempraw, alertstring)) != 0) { // // ENDALERT EVENT:CHECK FOR STRING
+ if ((strstr(tempraw, alertstring)) != nullptr) { // // ENDALERT EVENT:CHECK FOR STRING
// there was an alert
wasAlert = 1;
@@ -405,7 +405,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn HWND hwndDlg = WindowList_Find(hWindowList, hContact);
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Download successful; about to process data..."));
}
- else MessageBox(NULL, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
}
}
}
@@ -419,11 +419,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn *cacheend = '\0';
mir_snwprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
- CreateDirectory(cachedirectorypath, NULL);
+ CreateDirectory(cachedirectorypath, nullptr);
mir_snwprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
- if ((pcachefile = _wfopen(newcachepath, L"r")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"r")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot read from file"));
else {
memset(&cachecompare, 0, sizeof(cachecompare));
@@ -432,7 +432,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn }
}
// write to cache
- if ((pcachefile = _wfopen(newcachepath, L"w")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"w")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 1"));
else {
fwrite(tempraw, mir_strlen(tempraw), 1, pcachefile); //smaller cache
@@ -500,7 +500,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0))
db_set_s(hContact, "CList", "MyHandle", tstr);
}
- else MessageBox(NULL, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
}
}
}
@@ -517,7 +517,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn }
// putting data into string
- if (((strstr(tempraw, Alerttempstring)) != 0) && ((strstr(tempraw, Alerttempstring2)) != 0)) {
+ if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
//start string
alertpos = strstr(tempraw, Alerttempstring);
statalertpos = alertpos - tempraw;
@@ -616,13 +616,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Alert start/end strings not found or strings not set."));
}
- else MessageBox(NULL, TranslateT("Alert start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Alert start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY);
}
///////////////
- if (((strstr(tempraw, Alerttempstring)) != 0) && ((strstr(tempraw, Alerttempstring2)) != 0)) {
+ if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
GetModuleFileName(hInst, cachepath, _countof(cachepath));
@@ -631,11 +631,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn *cacheend = '\0';
mir_snwprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
- CreateDirectory(cachedirectorypath, NULL);
+ CreateDirectory(cachedirectorypath, nullptr);
mir_snwprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
- if ((pcachefile = _wfopen(newcachepath, L"r")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"r")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot read from file"));
else {
memset(&cachecompare, 0, sizeof(cachecompare));
@@ -644,7 +644,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn }
}
// write to cache
- if ((pcachefile = _wfopen(newcachepath, L"w")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"w")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 2"));
else {
fwrite(raw, mir_strlen(raw), 1, pcachefile); //smaller cache
@@ -710,7 +710,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0))
db_set_s(hContact, "CList", "MyHandle", tstr);
}
- else MessageBox(NULL, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
}
}
}
@@ -763,7 +763,7 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM) if ( WindowList_Find(hWindowList, hContact))
return 0;
- HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, hContact);
+ HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
@@ -802,7 +802,7 @@ void ReadFromFile(void *param) return;
FILE *pfile;
- if ((pfile = fopen(dbv.pszVal, "r")) == NULL) {
+ if ((pfile = fopen(dbv.pszVal, "r")) == nullptr) {
SendToRichEdit(hwndDlg, Translate("Cannot read from cache file"), TextClr, BackgoundClr);
fileexists = 0;
}
diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index 11c7558f9c..31d081e15c 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -374,8 +374,8 @@ void CodetoSymbol(char *truncated) while (true) { // loop forever
Sleep(1); // avoid 100% CPU
- if ( strstr(truncated, CharacterCodes[n]) != 0) { // does character code exist?
- if (strstr(truncated, CharacterCodes[n]) != 0)
+ if ( strstr(truncated, CharacterCodes[n]) != nullptr) { // does character code exist?
+ if (strstr(truncated, CharacterCodes[n]) != nullptr)
stringfrompos = strstr(truncated, CharacterCodes[n]);
position = stringfrompos - truncated;
@@ -415,25 +415,25 @@ void EraseBlock(char *truncated) Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (strstr(tempraw, "<!--") != 0) // does tag exist?
+ if (strstr(tempraw, "<!--") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "<!--");
positionStart = stringfrompos - tempraw;
}
- if (strstr(tempraw, "-->") != 0) // does tag exist?
+ if (strstr(tempraw, "-->") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "-->");
positionEnd = stringfrompos - tempraw;
}
BlockLength = (positionEnd - positionStart) + 3;
- if ((strstr(tempraw, "<!--") == 0) || (strstr(tempraw, "-->") == 0))
+ if ((strstr(tempraw, "<!--") == nullptr) || (strstr(tempraw, "-->") == nullptr))
break;
/////////////////////////////////////////
- if (strstr(tempraw, "<!--") != 0)
+ if (strstr(tempraw, "<!--") != nullptr)
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -455,9 +455,9 @@ void EraseBlock(char *truncated) Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (((strstr(tempraw, "<script")) != 0) || (strstr(tempraw, "<SCRIPT") != 0)) // does
+ if (((strstr(tempraw, "<script")) != nullptr) || (strstr(tempraw, "<SCRIPT") != nullptr)) // does
{
- if (strstr(tempraw, "<script") != 0)
+ if (strstr(tempraw, "<script") != nullptr)
stringfrompos = strstr(tempraw, "<script");
else
stringfrompos = strstr(tempraw, "<SCRIPT");
@@ -465,9 +465,9 @@ void EraseBlock(char *truncated) positionStart = stringfrompos - tempraw;
}
- if (((strstr(tempraw, "</script")) != 0) || (strstr(tempraw, "</SCRIPT") != 0)) // does
+ if (((strstr(tempraw, "</script")) != nullptr) || (strstr(tempraw, "</SCRIPT") != nullptr)) // does
{
- if (strstr(tempraw, "<script") != 0)
+ if (strstr(tempraw, "<script") != nullptr)
stringfrompos = strstr(tempraw, "</script");
else
stringfrompos = strstr(tempraw, "</SCRIPT");
@@ -476,15 +476,15 @@ void EraseBlock(char *truncated) }
BlockLength = (positionEnd - positionStart) + 9;
- if ((strstr(tempraw, "<script") != 0) && (strstr(tempraw, "</script") == 0))
+ if ((strstr(tempraw, "<script") != nullptr) && (strstr(tempraw, "</script") == nullptr))
break;
- if ((strstr(tempraw, "<SCRIPT") != 0) && (strstr(tempraw, "</SCRIPT") == 0))
+ if ((strstr(tempraw, "<SCRIPT") != nullptr) && (strstr(tempraw, "</SCRIPT") == nullptr))
break;
///////////////////////////////////////
- if (((strstr(tempraw, "<script")) != 0) || ((strstr(tempraw, "<SCRIPT")) != 0))
+ if (((strstr(tempraw, "<script")) != nullptr) || ((strstr(tempraw, "<SCRIPT")) != nullptr))
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -504,9 +504,9 @@ void EraseBlock(char *truncated) Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (((strstr(tempraw, "<style")) != 0) || (strstr(tempraw, "<STYLE") != 0)) // does
+ if (((strstr(tempraw, "<style")) != nullptr) || (strstr(tempraw, "<STYLE") != nullptr)) // does
{
- if (strstr(tempraw, "<style") != 0)
+ if (strstr(tempraw, "<style") != nullptr)
stringfrompos = strstr(tempraw, "<style");
else
stringfrompos = strstr(tempraw, "<STYLE");
@@ -514,9 +514,9 @@ void EraseBlock(char *truncated) positionStart = stringfrompos - tempraw;
}
- if (((strstr(tempraw, "</style")) != 0) || (strstr(tempraw, "</STYLE") != 0)) // does
+ if (((strstr(tempraw, "</style")) != nullptr) || (strstr(tempraw, "</STYLE") != nullptr)) // does
{
- if (strstr(tempraw, "<style") != 0)
+ if (strstr(tempraw, "<style") != nullptr)
stringfrompos = strstr(tempraw, "</style");
else
stringfrompos = strstr(tempraw, "</STYLE");
@@ -525,14 +525,14 @@ void EraseBlock(char *truncated) }
BlockLength = (positionEnd - positionStart) + 8;
- if ((strstr(tempraw, "<style") != 0) && (strstr(tempraw, "</style") == 0))
+ if ((strstr(tempraw, "<style") != nullptr) && (strstr(tempraw, "</style") == nullptr))
break;
- if ((strstr(tempraw, "<STYLE") != 0) && (strstr(tempraw, "</STYLE") == 0))
+ if ((strstr(tempraw, "<STYLE") != nullptr) && (strstr(tempraw, "</STYLE") == nullptr))
break;
///////////////////////////////////////
- if (((strstr(tempraw, "<style")) != 0) || ((strstr(tempraw, "<STYLE")) != 0))
+ if (((strstr(tempraw, "<style")) != nullptr) || ((strstr(tempraw, "<STYLE")) != nullptr))
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -550,24 +550,24 @@ void EraseBlock(char *truncated) while (true) {
Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (strstr(tempraw, "{") != 0) // does tag exist?
+ if (strstr(tempraw, "{") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "{");
positionStart = stringfrompos - tempraw;
}
- if (strstr(tempraw, "}") != 0) // does tag exist?
+ if (strstr(tempraw, "}") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "}");
positionEnd = stringfrompos - tempraw;
}
BlockLength = (positionEnd - positionStart) + 1;
- if ((strstr(tempraw, "}") == 0) || (strstr(tempraw, "{") == 0))
+ if ((strstr(tempraw, "}") == nullptr) || (strstr(tempraw, "{") == nullptr))
break;
/////////////////////////////////////////
- if (strstr(tempraw, "{") != 0)
+ if (strstr(tempraw, "{") != nullptr)
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -605,7 +605,7 @@ void EraseSymbols(char *truncated) /**/
counter = 0;
- if ((strstr(tempraw, "&#")) != 0) {
+ if ((strstr(tempraw, "&#")) != nullptr) {
stringfrompos = strstr(tempraw, "&#");
position = stringfrompos - tempraw;
@@ -647,7 +647,7 @@ void NumSymbols(char *truncated) counter = 0;
- if ((strstr(tempraw, "&#")) != 0) {
+ if ((strstr(tempraw, "&#")) != nullptr) {
stringfrompos = strstr(tempraw, "&#");
position = stringfrompos - tempraw;
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index dd66e38fbd..bbbed64265 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -69,7 +69,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara OLDstartposition = startposition;
- if ((strstr(Searchstr, NewSearchstr)) != 0)
+ if ((strstr(Searchstr, NewSearchstr)) != nullptr)
startposition = loc + (int)mir_strlen(Searchstr);
else {
oldloc = 0;
@@ -135,7 +135,7 @@ static MCONTACT FindContactByUrl(HWND hwndDlg) if (!mir_wstrcmp(urltext, db1) && !mir_wstrcmp(titlebartxt, db2)) {
contactcount++;
if (contactcount > 1) {
- MessageBox(NULL, TranslateT("ERROR: You have two or more Webview contacts with the same URL and contact name."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("ERROR: You have two or more Webview contacts with the same URL and contact name."), _A2W(MODULENAME), MB_OK);
return NULL;
}
res = hContact;
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetDlgItemText(hwndDlg, IDC_DATA, L"");
- InvalidateRect(hwndDlg, NULL, 1);
+ InvalidateRect(hwndDlg, nullptr, 1);
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_AUTOURLDETECT, 1, 0);
int mask = (int)SendDlgItemMessage(hwndDlg, IDC_DATA, EM_GETEVENTMASK, 0, 0);
@@ -270,7 +270,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr)) {
case IDM_COPY:
SendMessage(((NMHDR *) lParam)->hwndFrom, WM_COPY, 0, 0);
break;
@@ -320,7 +320,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tr.lpstrText = (char*)malloc(tr.chrg.cpMax - tr.chrg.cpMin + 8);
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
- if (strchr(tr.lpstrText, '@') != NULL && strchr(tr.lpstrText, ':') == NULL && strchr(tr.lpstrText, '/') == NULL) {
+ if (strchr(tr.lpstrText, '@') != nullptr && strchr(tr.lpstrText, ':') == nullptr && strchr(tr.lpstrText, '/') == nullptr) {
memmove(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1);
memcpy(tr.lpstrText, "mailto:", 7);
}
@@ -404,7 +404,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK:
case IDCANCEL:
- if (hwndDlg != NULL)
+ if (hwndDlg != nullptr)
DestroyWindow(hwndDlg);
return TRUE;
}
@@ -422,7 +422,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (hContact = FindContactByUrl(hwndDlg))
Utils_SaveWindowPosition(hwndDlg, hContact, MODULENAME, "WV");
- if (hwndDlg != NULL)
+ if (hwndDlg != nullptr)
DestroyWindow(hwndDlg);
return 0;
@@ -432,7 +432,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_SIZE:
Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
- InvalidateRect(hwndDlg, NULL, TRUE);
+ InvalidateRect(hwndDlg, nullptr, TRUE);
// global
GetWindowRect(hwndDlg, &rc);
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 3e0c656a0a..ef9ba7fa7e 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -115,7 +115,7 @@ void GetData(void *param) headers[0].szValue = NETLIB_USER_AGENT;
headers[1].szName = "Content-Length";
- headers[1].szValue = NULL;
+ headers[1].szValue = nullptr;
nlhr.headers = headers;
@@ -181,7 +181,7 @@ void GetData(void *param) mir_strncpy(truncated, truncated2, MAXSIZE1);
else { // use start and end string
// putting data into string
- if (((strstr(truncated2, tempstring)) != 0) && ((strstr(truncated2, tempstring2)) != 0)) {
+ if (((strstr(truncated2, tempstring)) != nullptr) && ((strstr(truncated2, tempstring2)) != nullptr)) {
// start string
pos = strstr(truncated2, tempstring);
statpos = pos - truncated2;
@@ -270,7 +270,7 @@ void GetData(void *param) if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
memset(&temptime, 0, sizeof(temptime));
memset(&tstr, 0, sizeof(tstr));
- ftime = time(NULL);
+ ftime = time(nullptr);
nTime = localtime(&ftime);
// 12 hour
if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -289,7 +289,7 @@ void GetData(void *param) db_get_ws(hContact, "CList", "MyHandle", &dbv);
memset(&temptime, 0, sizeof(temptime));
memset(&tstr, 0, sizeof(tstr));
- ftime = time(NULL);
+ ftime = time(nullptr);
nTime = localtime(&ftime);
// 12 hour
if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -306,7 +306,7 @@ void GetData(void *param) db_free(&dbv);
}
- ftime = time(NULL);
+ ftime = time(nullptr);
nTime = localtime(&ftime);
strncpy_s(timeprefix, _countof(timeprefix), Translate("Last updated on"), _TRUNCATE);
@@ -340,14 +340,14 @@ void GetData(void *param) }
// putting data into string
- if (((strstr(buff, Alerttempstring)) != 0) && ((strstr(buff, Alerttempstring2)) != 0)) {
+ if (((strstr(buff, Alerttempstring)) != nullptr) && ((strstr(buff, Alerttempstring2)) != nullptr)) {
location = (strstr(buff, Alerttempstring)) - buff;
location2 = (strstr(buff, Alerttempstring2)) - buff;
}
}
}
- if ((((strstr(truncated2, tempstring)) != 0) && ((strstr(truncated2, tempstring2)) != 0) && (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0)) || (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1)) {
+ if ((((strstr(truncated2, tempstring)) != nullptr) && ((strstr(truncated2, tempstring2)) != nullptr) && (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0)) || (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1)) {
RemoveTabs(truncated);
if ( db_get_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 0)) {
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index 66970dc59d..4ad9519b4a 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -43,9 +43,9 @@ wchar_t* FixButtonText(wchar_t *url, size_t len) wcsncpy_s(buttontext, url, _TRUNCATE);
wcsncpy_s(newbuttontext, url, _TRUNCATE);
- if (wcschr(newbuttontext, '&') != 0) {
+ if (wcschr(newbuttontext, '&') != nullptr) {
while (true) {
- if (wcschr(newbuttontext, '&') == 0)
+ if (wcschr(newbuttontext, '&') == nullptr)
break;
wcsncpy_s(buttontext, newbuttontext, _TRUNCATE);
@@ -62,12 +62,12 @@ wchar_t* FixButtonText(wchar_t *url, size_t len) }
while (true) {
- if (wcschr(newbuttontext, '!') != 0) {
+ if (wcschr(newbuttontext, '!') != nullptr) {
wchar_t *stringafter = wcschr(newbuttontext, '!');
int pos = (stringafter - newbuttontext);
newbuttontext[pos] = '&';
}
- if (wcschr(newbuttontext, '!') == 0)
+ if (wcschr(newbuttontext, '!') == nullptr)
break;
}
}
@@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
ppd.colorBack = BGColour;
ppd.colorText = TextColour;
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = _wtol(str3);
// display popups
PUAddPopupT(&ppd);
@@ -445,7 +445,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = L"TEXT Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0";
ofn.lpstrFile = szFileName;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
@@ -715,18 +715,18 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (eventIndex == 0) // string present
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ALERT_STRING))))
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
- MessageBox(NULL, TranslateT("You need to supply a search string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a search string."), _A2W(MODULENAME), MB_OK);
break;
}
if (eventIndex == 2) // part of web page changed
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_START2)))) {
- MessageBox(NULL, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
break;
}
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_END2)))) {
- MessageBox(NULL, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
break;
}
}
@@ -734,14 +734,14 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (alertIndex == 1) // log to file
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_FILENAME))))
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
- MessageBox(NULL, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
break;
}
if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYS_LOG))
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_FILENAME))))
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
- MessageBox(NULL, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
break;
}
@@ -780,7 +780,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l WindowList_Remove(hWindowList, hwndDlg);
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
break;
@@ -887,7 +887,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDCANCEL:
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
return TRUE;
@@ -952,61 +952,61 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
wchar_t str[128], contactname[128];
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URL))) {
- MessageBox(NULL, TranslateT("You need to supply a URL."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a URL."), _A2W(MODULENAME), MB_OK);
break;
}
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_START))) {
if (IsDlgButtonChecked(hwndDlg, IDC_U_SE_STRINGS)) {
- MessageBox(NULL, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
break;
}
}
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_END))) {
if (IsDlgButtonChecked(hwndDlg, IDC_U_SE_STRINGS)) {
- MessageBox(NULL, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
break;
}
}
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SITE_NAME))) {
- MessageBox(NULL, TranslateT("You need to supply a name for the contact."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a name for the contact."), _A2W(MODULENAME), MB_OK);
break;
}
GetDlgItemText(hwndDlg, IDC_SITE_NAME, contactname, _countof(contactname));
- if (wcschr(contactname, '\\') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '\\') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '/') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '/') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, ':') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, ':') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '*') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '*') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '?') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '?') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '\"') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '\"') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '<') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '<') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '>') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '>') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '|') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '|') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
@@ -1041,7 +1041,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
}
}
@@ -1053,7 +1053,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM WindowList_Remove(hWindowList, hwndDlg);
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
}
break;
@@ -1271,31 +1271,31 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, _countof(str));
db_set_ws(NULL, MODULENAME, FONT_FACE_KEY, str);
- db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE)));
+ db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, nullptr, FALSE)));
db_set_b(NULL, MODULENAME, FONT_SCRIPT_KEY, ((BYTE)SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0)));
db_set_b(NULL, MODULENAME, ERROR_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ERROR_POPUP));
- timerval = GetDlgItemInt(hwndDlg, IDC_TIME, NULL, FALSE);
+ timerval = GetDlgItemInt(hwndDlg, IDC_TIME, nullptr, FALSE);
db_set_dw(NULL, MODULENAME, REFRESH_KEY, timerval);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timerval);
- delaytime = GetDlgItemInt(hwndDlg, IDC_START_DELAY, NULL, FALSE);
+ delaytime = GetDlgItemInt(hwndDlg, IDC_START_DELAY, nullptr, FALSE);
db_set_dw(NULL, MODULENAME, START_DELAY_KEY, delaytime);
BackgoundClr = (SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0));
TextClr = (SendDlgItemMessage(hwndDlg, IDC_TXTCOLOR, CPM_GETCOLOUR, 0, 0));
if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0)) {
- KillTimer(NULL, timerId);
- KillTimer(NULL, Countdown);
- timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
- Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc);
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
+ timerId = SetTimer(nullptr, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
+ Countdown = SetTimer(nullptr, 0, MINUTE, Countdownfunc);
}
if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0)) {
- KillTimer(NULL, timerId);
- KillTimer(NULL, Countdown);
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
}
test = 0;
}
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 3fe04a9629..91ae497ba7 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -41,7 +41,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) int invalidpresent = 0; char *szProto = GetContactProto(hContact); - if (szProto == NULL || strcmp(szProto, MODULENAME)) + if (szProto == nullptr || strcmp(szProto, MODULENAME)) return 0; // A contact is renamed @@ -59,7 +59,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) for (int i=0; i < _countof(szInvalidChars); i++ ) { wchar_t *p = wcschr(nick, szInvalidChars[i]); - if (p != NULL) { + if (p != nullptr) { WErrorPopup((UINT_PTR)"ERROR", TranslateT("Invalid symbol present in contact name.")); *p = '_'; invalidpresent =1; @@ -67,13 +67,13 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) } if (invalidpresent) { - srand((unsigned)time(NULL)); + srand((unsigned)time(nullptr)); wchar_t ranStr[7]; _itow((int)10000 *rand() / (RAND_MAX + 1.0), ranStr, 10); mir_wstrcat(nick, ranStr); } - if ( wcschr(nick, '(') == 0) { + if ( wcschr(nick, '(') == nullptr) { db_set_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, nick); db_set_ws(hContact, MODULENAME, "Nick", nick); db_set_ws(hContact, "CList", "MyHandle", nick); @@ -86,7 +86,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) cacheend++; *cacheend = '\0'; mir_snwprintf(cachedirectorypath, L"%s" _A2W(MODULENAME) L"cache\\", cachepath); - CreateDirectory(cachedirectorypath, NULL); + CreateDirectory(cachedirectorypath, nullptr); wchar_t newcachepath[MAX_PATH + 50], renamedcachepath[MAX_PATH + 50]; mir_snwprintf(newcachepath, L"%s" _A2W(MODULENAME) L"cache\\%s.txt", cachepath, oldName); @@ -95,7 +95,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) // file exists? if ( _waccess(newcachepath, 0) != -1) { FILE *pcachefile = _wfopen(newcachepath, L"r"); - if (pcachefile != NULL) { + if (pcachefile != nullptr) { fclose(pcachefile); if (mir_wstrcmp(newcachepath, renamedcachepath)) { MoveFile(newcachepath, renamedcachepath); @@ -125,12 +125,12 @@ int SiteDeleted(WPARAM wParam, LPARAM) *cacheend = '\0'; mir_snwprintf(cachedirectorypath, L"%s" _A2W(MODULENAME) L"cache\\", cachepath); - CreateDirectory(cachedirectorypath, NULL); + CreateDirectory(cachedirectorypath, nullptr); mir_snwprintf(newcachepath, L"%s" _A2W(MODULENAME) L"cache\\%s.txt", cachepath, contactName); // file exists? if ( _waccess(newcachepath, 0) != -1) { FILE *pcachefile = _wfopen(newcachepath, L"r"); - if (pcachefile != NULL) { + if (pcachefile != nullptr) { fclose(pcachefile); DeleteFile(newcachepath); db_set_s(hContact, MODULENAME, CACHE_FILE_KEY, ""); @@ -154,7 +154,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) if( _waccess(cachedirectorypath, 0) != 0) WErrorPopup((UINT_PTR)"ERROR", TranslateT("Cache folder does not exist.")); else - ShellExecute(NULL, L"open", cachedirectorypath, NULL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, L"open", cachedirectorypath, nullptr, nullptr, SW_SHOWNORMAL); return 0; } @@ -162,7 +162,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM) { FILE *pfile = fopen("psite.bat", "r"); - if (pfile == NULL) { + if (pfile == nullptr) { WErrorPopup((UINT_PTR)"ERROR", TranslateT("Missing \"psite.bat\" file.")); return 0; } @@ -173,7 +173,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM) wchar_t Cnick[200], *Oldnick; wcsncpy(Cnick, url, _countof(Cnick)); - if ((Oldnick = wcsstr(Cnick, L"://")) != 0) + if ((Oldnick = wcsstr(Cnick, L"://")) != nullptr) Oldnick += 3; else Oldnick = Cnick; @@ -181,7 +181,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM) wchar_t *Nend = wcschr(Oldnick, '/'); if (Nend) *Nend = '\0'; - ShellExecute(NULL, L"open", L"psite.bat", Oldnick, NULL, SW_HIDE); + ShellExecute(nullptr, L"open", L"psite.bat", Oldnick, nullptr, SW_HIDE); return 0; } @@ -341,9 +341,9 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) int sameurl = 0; int samename = 0; - if (psr == NULL) + if (psr == nullptr) return 0; - if (psr->nick.w == NULL) { + if (psr->nick.w == nullptr) { WErrorPopup((UINT_PTR)"ERROR", TranslateT("Please select site in Find/Add contacts...")); return 0; } @@ -379,23 +379,23 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) //Convert url into a name for contact wchar_t Cnick[255]; - if (psr->nick.w != NULL) + if (psr->nick.w != nullptr) wcsncpy(Cnick, psr->nick.w, _countof(Cnick)); else Cnick[0] = 0; wchar_t *Oldnick = wcsstr(Cnick, L"://"); - if (Oldnick != 0) + if (Oldnick != nullptr) Oldnick += 3; else Oldnick = Cnick; wchar_t *Newnick = wcsstr(Oldnick, L"www."); - if (Newnick != 0) + if (Newnick != nullptr) Newnick += 4; else { Newnick = wcsstr(Oldnick, L"WWW."); - if (Newnick != 0) + if (Newnick != nullptr) Newnick += 4; else Newnick = Oldnick; @@ -423,7 +423,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) if ((sameurl > 0) || (samename > 0)) // contact has the same url or name as another contact, add rand num to name { - srand((unsigned) time(NULL)); + srand((unsigned) time(nullptr)); wchar_t ranStr[10]; _itow((int) 10000 *rand() / (RAND_MAX + 1.0), ranStr, 10); @@ -455,7 +455,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) /*****************************************************************************/ INT_PTR GetInfo(WPARAM, LPARAM) { - mir_forkthread(AckFunc, NULL); + mir_forkthread(AckFunc, nullptr); return 1; } diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index f321c71a0c..0bdd5bb7d6 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char ModuleName[] = "WhenWasIt";
HINSTANCE hInstance;
-HWND hBirthdaysDlg = NULL;
-HWND hUpcomingDlg = NULL;
-MWindowList hAddBirthdayWndsList = NULL;
+HWND hBirthdaysDlg = nullptr;
+HWND hUpcomingDlg = nullptr;
+MWindowList hAddBirthdayWndsList = nullptr;
int hLangpack;
CommonData commonData = { 0 };
@@ -110,7 +110,7 @@ extern "C" int __declspec(dllexport) Load(void) Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0x6f844569, 0xad06, 0x4b27, 0x8f, 0xd8, 0x1, 0x24, 0xe7, 0x1e, 0xcc, 0x43);
- mi.root = 0;
+ mi.root = nullptr;
mi.pszService = MS_WWI_ADD_BIRTHDAY;
mi.position = 10000000;
mi.hIcolibItem = hAddBirthdayContact;
diff --git a/plugins/WhenWasIt/src/birthdays.cpp b/plugins/WhenWasIt/src/birthdays.cpp index 7f4a93ed3e..067c61f162 100644 --- a/plugins/WhenWasIt/src/birthdays.cpp +++ b/plugins/WhenWasIt/src/birthdays.cpp @@ -26,7 +26,7 @@ CBirthdays::CBirthdays(int initialSize) {
count = 0;
size = 0;
- birthdays = NULL;
+ birthdays = nullptr;
advancedIcon = CLIST_ICON;
Realloc(initialSize);
@@ -42,7 +42,7 @@ void CBirthdays::Destroy() if (birthdays) {
Clear();
free(birthdays);
- birthdays = NULL;
+ birthdays = nullptr;
}
}
@@ -57,7 +57,7 @@ void CBirthdays::Clear() void CBirthdays::ClearItem(int index)
{
free(birthdays[index]);
- birthdays[index] = NULL;
+ birthdays[index] = nullptr;
}
int CBirthdays::Count() const
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp index d69a9b0dc3..4645e1f88e 100644 --- a/plugins/WhenWasIt/src/date_utils.cpp +++ b/plugins/WhenWasIt/src/date_utils.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. time_t Today()
{
- time_t now = time(NULL);
+ time_t now = time(nullptr);
struct tm* date = localtime(&now);
date->tm_hour = date->tm_min = date->tm_sec = 0;
return mktime(date);
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index c2c48930e5..4448ccb73c 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -47,15 +47,15 @@ const int cNotifyFor = sizeof(szNotifyFor) / sizeof(szNotifyFor[0]); #include "commctrl.h"
void CreateToolTip(HWND target, wchar_t* tooltip, LPARAM width)
{
- HWND hwndToolTip = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, target, NULL, NULL, NULL);
+ HWND hwndToolTip = CreateWindow(TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT, target, nullptr, nullptr, nullptr);
if (hwndToolTip) {
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS;
ti.hwnd = target;
ti.uId = 0;
- ti.hinst = NULL;
+ ti.hinst = nullptr;
ti.lpszText = tooltip;
GetClientRect(target, &ti.rect);
SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
@@ -251,9 +251,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara EnablePopupsGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
EnableClistGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_CLISTICON));
EnableDialogGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_DIALOG));
- RedrawWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(hWnd, IDC_USE_DIALOG), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hWnd, IDC_USE_DIALOG), nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE);
//fallthrough
case IDC_FOREGROUND:
@@ -307,7 +307,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara wchar_t buffer[maxSize];
GetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer, _countof(buffer));
- wchar_t *stop = NULL;
+ wchar_t *stop = nullptr;
commonData.daysInAdvance = wcstol(buffer, &stop, 10);
if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
@@ -413,7 +413,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case WM_SHOWWINDOW:
{
wchar_t *szTooltipText = TranslateT("Please select the module where you want the date of birth to be saved.\r\n\"UserInfo\" is the default location.\r\nUse \"Protocol module\" to make the data visible in User Details.\n\"mBirthday module\" uses the same module as mBirthday plugin.");
- wchar_t *szCurrentModuleTooltip = NULL;
+ wchar_t *szCurrentModuleTooltip = nullptr;
char *szProto = GetContactProto(hContact);
wchar_t buffer[2048];
@@ -461,7 +461,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l break;
default:
- szCurrentModuleTooltip = NULL;
+ szCurrentModuleTooltip = nullptr;
break;
}
@@ -494,7 +494,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l }
else SaveBirthday(hContact, 0, 0, 0, SAVE_MODE_DELETEALL);
- if (hBirthdaysDlg != NULL)
+ if (hBirthdaysDlg != nullptr)
SendMessage(hBirthdaysDlg, WWIM_UPDATE_BIRTHDAY, hContact, NULL);
SendMessage(hWnd, WM_CLOSE, 0, 0);
@@ -507,7 +507,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l 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);
@@ -592,7 +592,7 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll, char *szProto = GetContactProto(hContact);
PROTOACCOUNT *pAcc = Proto_GetAccount(szProto);
- wchar_t *ptszAccName = (pAcc == NULL) ? TranslateT("Unknown") : pAcc->tszAccountName;
+ wchar_t *ptszAccName = (pAcc == nullptr) ? TranslateT("Unknown") : pAcc->tszAccountName;
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_PARAM;
@@ -678,8 +678,8 @@ static LRESULT CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wP ListView_GetItem(hWnd, &item);
hContact = (MCONTACT)item.lParam;
HMENU hMenu = Menu_BuildContactMenu(hContact);
- if (hMenu != NULL) {
- Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL), MPCF_CONTACTMENU, hContact);
+ if (hMenu != nullptr) {
+ Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, nullptr), MPCF_CONTACTMENU, hContact);
DestroyMenu(hMenu);
}
break;
@@ -748,7 +748,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa LoadBirthdays(hWnd, 0);
int column = db_get_b(NULL, ModuleName, "SortColumn", 0);
- BirthdaysSortParams params = { 0 };
+ BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
params.column = column;
ListView_SortItemsEx(params.hList, BirthdaysCompare, (LPARAM)¶ms);
@@ -819,7 +819,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
int column = lv->iSubItem;
db_set_b(NULL, ModuleName, "SortColumn", column);
- BirthdaysSortParams params = { 0 };
+ BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
params.column = column;
ListView_SortItemsEx(params.hList, BirthdaysCompare, (LPARAM)¶ms);
@@ -830,7 +830,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa break;
case WM_DESTROY:
- hBirthdaysDlg = NULL;
+ hBirthdaysDlg = nullptr;
Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayList");
Window_FreeIcon_IcoLib(hWnd);
lastColumn = -1;
@@ -871,7 +871,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
if (timeout > 0)
- SetTimer(hWnd, UPCOMING_TIMER_ID, 1000, NULL);
+ SetTimer(hWnd, UPCOMING_TIMER_ID, 1000, nullptr);
Utils_RestoreWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming");
}
return TRUE;
@@ -919,7 +919,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar mir_snwprintf(buffer, L"%d", data->dtb);
ListView_SetItemText(hList, index, 2, buffer);
- BirthdaysSortParams params = { 0 };
+ BirthdaysSortParams params = {};
params.hList = hList;
params.column = 2;
ListView_SortItemsEx(hList, BirthdaysCompare, (LPARAM)¶ms);
@@ -950,15 +950,15 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar int cx = rcWin.right - rcWin.left;
int cy = rcWin.bottom - rcWin.top;
- SetWindowPos(hList, NULL, 0, 0, (cx - 30), (cy - 80), (SWP_NOZORDER | SWP_NOMOVE));
+ SetWindowPos(hList, nullptr, 0, 0, (cx - 30), (cy - 80), (SWP_NOZORDER | SWP_NOMOVE));
ListView_SetColumnWidth(hList, 0, (cx - 150));
- SetWindowPos(GetDlgItem(hWnd, IDC_CLOSE), NULL, ((cx / 2) - 95), (cy - 67), 0, 0, SWP_NOSIZE);
- RedrawWindow(hWnd, NULL, NULL, (RDW_FRAME | RDW_INVALIDATE));
+ SetWindowPos(GetDlgItem(hWnd, IDC_CLOSE), nullptr, ((cx / 2) - 95), (cy - 67), 0, 0, SWP_NOSIZE);
+ RedrawWindow(hWnd, nullptr, nullptr, (RDW_FRAME | RDW_INVALIDATE));
}
break;
case WM_DESTROY:
- hUpcomingDlg = NULL;
+ hUpcomingDlg = nullptr;
Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming");
Window_FreeIcon_IcoLib(hWnd);
KillTimer(hWnd, UPCOMING_TIMER_ID);
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index 4118efa6e1..072a57f2ba 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -31,7 +31,7 @@ static int currentDay = 0; static int OnTopToolBarModuleLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_WWI_CHECK_BIRTHDAYS;
ttb.hIconHandleUp = hCheckMenu;
@@ -144,19 +144,19 @@ int UpdateTimers() {
UINT interval = db_get_dw(NULL, ModuleName, "Interval", CHECK_INTERVAL);
interval *= (1000 * 60 * 60); //go from miliseconds to hours
- hCheckTimer = SetTimer(NULL, 0, interval, OnCheckTimer);
+ hCheckTimer = SetTimer(nullptr, 0, interval, OnCheckTimer);
if (!hDateChangeTimer)
- hDateChangeTimer = SetTimer(NULL, 0, (1000 * DATE_CHANGE_CHECK_INTERVAL), OnDateChangeTimer);
+ hDateChangeTimer = SetTimer(nullptr, 0, (1000 * DATE_CHANGE_CHECK_INTERVAL), OnDateChangeTimer);
return 0;
}
int KillTimers()
{
- KillTimer(NULL, hCheckTimer);
+ KillTimer(nullptr, hCheckTimer);
hCheckTimer = NULL;
- KillTimer(NULL, hDateChangeTimer);
+ KillTimer(nullptr, hDateChangeTimer);
hDateChangeTimer = NULL;
return 0;
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp index dbe48f467b..e4164f2e8a 100644 --- a/plugins/WhenWasIt/src/icons.cpp +++ b/plugins/WhenWasIt/src/icons.cpp @@ -24,14 +24,14 @@ HANDLE hCheckMenu, hListMenu, hAddBirthdayContact, hRefreshUserDetails; HANDLE hImportBirthdays, hExportBirthdays;
const int cDTB = 10;
-HANDLE hDTB[cDTB] = { NULL };
-HANDLE hDTBMore = NULL;
+HANDLE hDTB[cDTB] = {};
+HANDLE hDTBMore = nullptr;
HANDLE hWWIExtraIcons = (HANDLE)-1;
static HANDLE AddIcon(char *name, char *description, wchar_t *tszPath, int iDefaultIdx)
{
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.flags = SIDF_PATH_UNICODE;
sid.section.a = LPGEN("WhenWasIt");
sid.description.a = description;
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index 96bf7fe280..1280a06d5d 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -154,7 +154,7 @@ int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age) wchar_t text[1024];
BuildDTBText(dtb, name, text, _countof(text));
if (!hUpcomingDlg) {
- hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
+ hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), nullptr, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
@@ -176,7 +176,7 @@ int DialogNotifyMissedBirthday(MCONTACT hContact, int dab, int age) wchar_t text[1024];
BuildDABText(dab, name, text, _countof(text));
if (!hUpcomingDlg) {
- hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
+ hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), nullptr, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 9db7956f2a..399cf5aeb1 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -139,7 +139,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam) INT_PTR ShowListService(WPARAM, LPARAM)
{
if (!hBirthdaysDlg)
- hBirthdaysDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_BIRTHDAYS), NULL, DlgProcBirthdays);
+ hBirthdaysDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_BIRTHDAYS), nullptr, DlgProcBirthdays);
ShowWindow(hBirthdaysDlg, SW_SHOW);
return 0;
@@ -149,7 +149,7 @@ INT_PTR AddBirthdayService(WPARAM hContact, LPARAM) {
HWND hWnd = WindowList_Find(hAddBirthdayWndsList, hContact);
if (!hWnd)
- hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), NULL, DlgProcAddBirthday, hContact);
+ hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), nullptr, DlgProcAddBirthday, hContact);
return ShowWindow(hWnd, SW_SHOW);
}
@@ -184,7 +184,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*) INT_PTR RefreshUserDetailsService(WPARAM, LPARAM)
{
- mir_forkthread(RefreshUserDetailsWorkerThread, 0);
+ mir_forkthread(RefreshUserDetailsWorkerThread, nullptr);
return 0;
}
@@ -245,7 +245,7 @@ int DoImport(wchar_t *fileName) {
FILE *fin = _wfopen(fileName, L"rt");
if (!fin) {
- MessageBox(0, TranslateT("Could not open file to import birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Could not open file to import birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
}
@@ -292,7 +292,7 @@ int DoExport(wchar_t *fileName) {
FILE *fout = _wfopen(fileName, L"wt");
if (!fout) {
- MessageBox(0, TranslateT("Could not open file to export birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Could not open file to export birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
}
fwprintf(fout, L"%c%s", COMMENT_CHAR, TranslateT("Please do not edit this file by hand. Use the export function of WhenWasIt plugin.\n"));
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 2b1a8e3551..c77578adee 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -39,7 +39,7 @@ int Log(char *format, ...) if (!fout)
return -1;
- time_t tNow = time(NULL);
+ time_t tNow = time(nullptr);
struct tm *now = localtime(&tNow);
strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now);
fputs(str, fout);
@@ -68,14 +68,14 @@ int Info(char *title, char *format, ...) if (tBytes > 0)
str[tBytes] = 0;
va_end(vararg);
- return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION);
+ return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION);
}
#define HEX_SIZE 8
char* BinToHex(int size, PBYTE data)
{
- char *szresult = NULL;
+ char *szresult = nullptr;
char buffer[32] = { 0 }; //should be more than enough
int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[maxSize];
@@ -140,13 +140,13 @@ int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, si wchar_t* GetContactID(MCONTACT hContact)
{
- return GetContactID(hContact, NULL);
+ return GetContactID(hContact, nullptr);
}
wchar_t* GetContactID(MCONTACT hContact, char *szProto)
{
ptrW res(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
- return (res) ? wcsdup(res) : NULL;
+ return (res) ? wcsdup(res) : nullptr;
}
MCONTACT GetContactFromID(wchar_t *szID, char *szProto)
@@ -167,7 +167,7 @@ MCONTACT GetContactFromID(wchar_t *szID, char *szProto) MCONTACT GetContactFromID(wchar_t *szID, wchar_t *szProto)
{
char protocol[1024];
- WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), nullptr, nullptr);
return GetContactFromID(szID, protocol);
}
diff --git a/plugins/WhoUsesMyFiles/src/list.cpp b/plugins/WhoUsesMyFiles/src/list.cpp index 028d17f035..a597d99235 100644 --- a/plugins/WhoUsesMyFiles/src/list.cpp +++ b/plugins/WhoUsesMyFiles/src/list.cpp @@ -11,7 +11,7 @@ PWumf new_wumf( DWORD dwID, {
PWumf w = (PWumf)mir_calloc(sizeof(Wumf));
if (!w)
- return NULL;
+ return nullptr;
w->szUser = mir_wstrdup(szUser);
w->szPath = mir_wstrdup(szPath);
@@ -31,7 +31,7 @@ PWumf new_wumf( DWORD dwID, w->dwAttr = dwAttr;
w->dwPerm = dwPerm;
w->mark = FALSE;
- w->next = NULL;
+ w->next = nullptr;
return w;
}
@@ -56,7 +56,7 @@ BOOL add_cell(PWumf* l, PWumf w) while(p->next) p = p->next;
p->next = w;
}
- w->next = NULL;
+ w->next = nullptr;
return TRUE;
}
@@ -85,12 +85,12 @@ BOOL cpy_cell(PWumf *l, PWumf w) PWumf cpy_list(PWumf *l)
{
- PWumf w, p = NULL;
+ PWumf w, p = nullptr;
- if (!l || !*l) return NULL;
+ if (!l || !*l) return nullptr;
w = *l;
while(w) {
- if (!cpy_cell(&p, w))return NULL;
+ if (!cpy_cell(&p, w))return nullptr;
w = w->next;
}
return p;
@@ -98,7 +98,7 @@ PWumf cpy_list(PWumf *l) PWumf fnd_cell(PWumf *l, DWORD dwID)
{
- if (!l || !*l)return NULL;
+ if (!l || !*l)return nullptr;
PWumf w = *l;
while(w && w->dwID != dwID) w = w->next;
return w;
@@ -115,7 +115,7 @@ BOOL del_all(PWumf *l) w = p;
}
- *l = NULL;
+ *l = nullptr;
return TRUE;
}
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp index 99e2102d04..c4c3969081 100644 --- a/plugins/WhoUsesMyFiles/src/wumf.cpp +++ b/plugins/WhoUsesMyFiles/src/wumf.cpp @@ -5,10 +5,10 @@ #define NAME "WUMF"
#define WM_MYCMD 0x0401
-PWumf list = NULL;
-PWumf lst = NULL;
+PWumf list = nullptr;
+PWumf lst = nullptr;
-HANDLE hLogger = NULL;
+HANDLE hLogger = nullptr;
BOOL wumf();
static int DlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
@@ -83,12 +83,12 @@ INT_PTR CALLBACK ConnDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) lvc.cx = 50;
lvc.pszText = TranslateT("Access");
ListView_InsertColumn(hList, 3, &lvc);
- KillTimer(NULL, 777);
+ KillTimer(nullptr, 777);
lst = cpy_list(&list);
if (IsUserAnAdmin())
- SetTimer(NULL, 777, TIME, TimerProc);
+ SetTimer(nullptr, 777, TIME, TimerProc);
else
- MessageBox(NULL, TranslateT("Plugin WhoUsesMyFiles requires admin privileges in order to work."), L"Miranda NG", MB_OK);
+ MessageBox(nullptr, TranslateT("Plugin WhoUsesMyFiles requires admin privileges in order to work."), L"Miranda NG", MB_OK);
ShowList(lst, hList);
}
Utils_RestoreWindowPosition(hWnd, NULL, MODULENAME,"conn");
@@ -136,12 +136,12 @@ void LogWumf(PWumf w) {
if (!WumfOptions.LogFolders && (w->dwAttr & FILE_ATTRIBUTE_DIRECTORY)) return;
- if (hLogger == NULL) {
+ if (hLogger == nullptr) {
hLogger = mir_createLog("wumf", L"WhoIsUsingMyFiles log file", WumfOptions.LogFile, 0);
- if (hLogger == NULL) {
+ if (hLogger == nullptr) {
wchar_t str[256];
mir_snwprintf(str, L"Can't open log file %s", WumfOptions.LogFile);
- MessageBox(NULL, str, TranslateT("Error opening file"), MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, str, TranslateT("Error opening file"), MB_OK | MB_ICONSTOP);
WumfOptions.LogToFile = FALSE;
return;
}
@@ -151,17 +151,17 @@ void LogWumf(PWumf w) GetLocalTime(&time);
wchar_t lpDateStr[20], lpTimeStr[20];
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, lpDateStr, 20);
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &time, NULL, lpTimeStr, 20);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, nullptr, lpDateStr, 20);
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &time, nullptr, lpTimeStr, 20);
mir_writeLogW(hLogger, L"%s %s %20s\t%s\r\n", lpDateStr, lpTimeStr, w->szUser, w->szPath);
}
BOOL wumf()
{
- LPSESSION_INFO_1 s_info = NULL;
+ LPSESSION_INFO_1 s_info = nullptr;
DWORD ent_read = 0, ent_total = 0, res_handle = 0;
NET_API_STATUS res = NERR_Success;
- if ((res = NetSessionEnum(NULL, NULL, NULL, 1, (LPBYTE *)&s_info, MAX_PREFERRED_LENGTH, &ent_read, &ent_total, &res_handle)) == NERR_Success ||
+ if ((res = NetSessionEnum(nullptr, nullptr, nullptr, 1, (LPBYTE *)&s_info, MAX_PREFERRED_LENGTH, &ent_read, &ent_total, &res_handle)) == NERR_Success ||
res == ERROR_MORE_DATA)
{
mark_all(&list, TRUE);
@@ -177,10 +177,10 @@ BOOL wumf() void process_session(SESSION_INFO_1 s_info)
{
- LPFILE_INFO_3 f_info = NULL;
+ LPFILE_INFO_3 f_info = nullptr;
DWORD ent_read = 0, ent_total = 0, res_handle = 0;
NET_API_STATUS res = NERR_Success;
- if ((res = NetFileEnum(NULL, NULL, s_info.sesi1_username, 3, (LPBYTE *)&f_info, MAX_PREFERRED_LENGTH, &ent_read, &ent_total, (PDWORD_PTR)&res_handle)) == NERR_Success ||
+ if ((res = NetFileEnum(nullptr, nullptr, s_info.sesi1_username, 3, (LPBYTE *)&f_info, MAX_PREFERRED_LENGTH, &ent_read, &ent_total, (PDWORD_PTR)&res_handle)) == NERR_Success ||
res == ERROR_MORE_DATA)
{
for(unsigned i=0; i < ent_read; i++)
@@ -195,7 +195,7 @@ void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info) {
PWumf w = fnd_cell(&list, f_info.fi3_id);
if (!w) {
- w = new_wumf(f_info.fi3_id, f_info.fi3_username, f_info.fi3_pathname, s_info.sesi1_cname, NULL, 0, f_info.fi3_permissions, GetFileAttributes(f_info.fi3_pathname));
+ w = new_wumf(f_info.fi3_id, f_info.fi3_username, f_info.fi3_pathname, s_info.sesi1_cname, nullptr, 0, f_info.fi3_permissions, GetFileAttributes(f_info.fi3_pathname));
w->mark = FALSE;
if (!add_cell(&list, w))
msg(TranslateT("Error memory allocation"));
@@ -209,7 +209,7 @@ void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info) void printError(DWORD res)
{
LPVOID lpMsgBuf;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, res, 0, (LPTSTR) &lpMsgBuf, 0, NULL );
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, res, 0, (LPTSTR) &lpMsgBuf, 0, nullptr );
OutputDebugString((LPCTSTR)lpMsgBuf);
msg((LPCTSTR)lpMsgBuf);
LocalFree( lpMsgBuf );
@@ -218,7 +218,7 @@ void printError(DWORD res) VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
if (!wumf())
- KillTimer(NULL, 777);
+ KillTimer(nullptr, 777);
};
void FreeAll()
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 54643218f3..1a6ae70dad 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -2,7 +2,7 @@ HINSTANCE hInst;
WUMF_OPTIONS WumfOptions = { 0 };
-HGENMENU hMenuItem = 0;
+HGENMENU hMenuItem = nullptr;
int hLangpack;
HWND hDlg;
@@ -69,15 +69,15 @@ void ExecuteMenu(HWND hWnd) return;
}
AppendMenu(hMenu, MF_STRING, IDM_ABOUT, L"About\0");
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);//------------------
+ AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);//------------------
AppendMenu(hMenu, MF_STRING, IDM_SHOW, L"Show connections\0");
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);//------------------
+ AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);//------------------
AppendMenu(hMenu, MF_STRING, IDM_EXIT, L"Dismiss popup\0");
POINT point;
GetCursorPos(&point);
SetForegroundWindow(hWnd);
- TrackPopupMenu(hMenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RIGHTALIGN | TPM_TOPALIGN, point.x, point.y, 0, hWnd, NULL);
+ TrackPopupMenu(hMenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RIGHTALIGN | TPM_TOPALIGN, point.x, point.y, 0, hWnd, nullptr);
PostMessage(hWnd, WM_USER, 0, 0);
DestroyMenu(hMenu);
}
@@ -156,33 +156,33 @@ void ShowThePopup(PWumf w, LPTSTR title, LPTSTR text) void ShowThePreview()
{
if ( !ServiceExists(MS_POPUP_ADDPOPUPT)) {
- MessageBox(NULL, TranslateT("Popup plugin not found!"), TranslateT("Error"), MB_OK|MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("Popup plugin not found!"), TranslateT("Error"), MB_OK|MB_ICONSTOP);
return;
}
if (WumfOptions.AlertFolders) {
- ShowThePopup(NULL, L"Guest", L"C:\\My Share");
+ ShowThePopup(nullptr, L"Guest", L"C:\\My Share");
Sleep(300);
- ShowThePopup(NULL, L"Guest", L"C:\\My Share\\Photos");
+ ShowThePopup(nullptr, L"Guest", L"C:\\My Share\\Photos");
Sleep(300);
}
- ShowThePopup(NULL, L"Guest", L"C:\\Share\\My Photos\\photo.jpg");
+ ShowThePopup(nullptr, L"Guest", L"C:\\Share\\My Photos\\photo.jpg");
Sleep(300);
if (WumfOptions.AlertFolders) {
- ShowThePopup(NULL, L"User", L"C:\\My Share");
+ ShowThePopup(nullptr, L"User", L"C:\\My Share");
Sleep(300);
- ShowThePopup(NULL, L"User", L"C:\\My Share\\Movies");
+ ShowThePopup(nullptr, L"User", L"C:\\My Share\\Movies");
Sleep(300);
}
- ShowThePopup(NULL, L"User", L"C:\\My Share\\Movies\\The Two Towers.avi");
+ ShowThePopup(nullptr, L"User", L"C:\\My Share\\Movies\\The Two Towers.avi");
Sleep(300);
if (WumfOptions.AlertFolders) {
- ShowThePopup(NULL, L"Administrator", L"C:\\Distributives");
+ ShowThePopup(nullptr, L"Administrator", L"C:\\Distributives");
Sleep(300);
- ShowThePopup(NULL, L"Administrator", L"C:\\Distributives\\Win2k");
+ ShowThePopup(nullptr, L"Administrator", L"C:\\Distributives\\Win2k");
Sleep(300);
}
- ShowThePopup(NULL, L"Administrator", L"C:\\Distributives\\Win2k\\setup.exe");
+ ShowThePopup(nullptr, L"Administrator", L"C:\\Distributives\\Win2k\\setup.exe");
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
@@ -199,21 +199,21 @@ void ThreadProc(LPVOID) return;
}
- hDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONNLIST), NULL, ConnDlgProc);
+ hDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONNLIST), nullptr, ConnDlgProc);
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE)));
ShowWindow(hDlg, SW_SHOW);
MSG msg;
- while(GetMessage(&msg, NULL, 0, 0) == TRUE) {
+ while(GetMessage(&msg, nullptr, 0, 0) == TRUE) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- hDlg = NULL;
+ hDlg = nullptr;
}
static INT_PTR WumfShowConnections(WPARAM,LPARAM)
{
- mir_forkthread(ThreadProc, NULL);
+ mir_forkthread(ThreadProc, nullptr);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hWumfBut, 0);
return 0;
}
@@ -265,7 +265,7 @@ void ChooseFile(HWND hwndDlg) ofn.Flags = OFN_CREATEPROMPT;
// Display the Open dialog box.
if (GetSaveFileName(&ofn)) {
- HANDLE hf = CreateFile(szFile,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hf = CreateFile(szFile,GENERIC_WRITE,0,nullptr,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL, nullptr);
if (hf != INVALID_HANDLE_VALUE) {
SetDlgItemText(hwndDlg,IDC_FILE,szFile);
mir_wstrncpy(WumfOptions.LogFile, szFile, MAX_PATH);
@@ -358,7 +358,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara case IDC_ALERT_COMP:
case IDC_LOG_UNC:
case IDC_ALERT_UNC:
- MessageBox(NULL, TranslateT("Not implemented yet..."), L"WUMF", MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, TranslateT("Not implemented yet..."), L"WUMF", MB_OK | MB_ICONINFORMATION);
break;
/* end */
case IDC_LOG_INTO_FILE:
@@ -396,7 +396,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara case EN_CHANGE:
switch(wControlId) {
case IDC_DELAY_SEC:
- seconds = GetDlgItemInt(hwndDlg, IDC_DELAY_SEC, NULL, FALSE);
+ seconds = GetDlgItemInt(hwndDlg, IDC_DELAY_SEC, nullptr, FALSE);
if (seconds > LIFETIME_MAX)
WumfOptions.DelaySec = LIFETIME_MAX;
else if (seconds < LIFETIME_MIN)
@@ -457,7 +457,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara int InitTopToolbar(WPARAM,LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_DRIVE));
ttb.pszService = MS_WUMF_CONNECTIONSSHOW;
ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
@@ -514,15 +514,15 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_TTB_MODULELOADED, InitTopToolbar);
if (IsUserAnAdmin())
- SetTimer(NULL, 777, TIME, TimerProc);
+ SetTimer(nullptr, 777, TIME, TimerProc);
else
- MessageBox(NULL, TranslateT("Plugin WhoUsesMyFiles requires admin privileges in order to work."), L"Miranda NG", MB_OK);
+ MessageBox(nullptr, TranslateT("Plugin WhoUsesMyFiles requires admin privileges in order to work."), L"Miranda NG", MB_OK);
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- KillTimer(NULL, 777);
+ KillTimer(nullptr, 777);
if (hLogger)
mir_closeLog(hLogger);
FreeAll();
diff --git a/plugins/WinterSpeak/src/AnnounceDialog.cpp b/plugins/WinterSpeak/src/AnnounceDialog.cpp index ab9ddb8384..75c4d947ee 100644 --- a/plugins/WinterSpeak/src/AnnounceDialog.cpp +++ b/plugins/WinterSpeak/src/AnnounceDialog.cpp @@ -2,7 +2,7 @@ #include "AnnounceDialog.h"
-AnnounceDialog *AnnounceDialog::m_instance = 0;
+AnnounceDialog *AnnounceDialog::m_instance = nullptr;
//------------------------------------------------------------------------------
// public:
@@ -15,7 +15,7 @@ AnnounceDialog::AnnounceDialog(AnnounceDatabase &db) : m_db(db) //------------------------------------------------------------------------------
AnnounceDialog::~AnnounceDialog()
{
- m_instance = 0;
+ m_instance = nullptr;
}
//------------------------------------------------------------------------------
@@ -141,7 +141,7 @@ AnnounceDialog::save(HWND window) m_db.setEventFlag(AnnounceDatabase::EventFlag_DialogOpen, (IsDlgButtonChecked(window, IDC_DIALOG_OPEN) != 0));
m_db.setEventFlag(AnnounceDatabase::EventFlag_DialogFocused, (IsDlgButtonChecked(window, IDC_DIALOG_FOCUSED) != 0));
- m_db.setMaxMsgSize(GetDlgItemInt(window, IDC_MAX_MSG, NULL, 0));
+ m_db.setMaxMsgSize(GetDlgItemInt(window, IDC_MAX_MSG, nullptr, 0));
m_instance->m_db.save();
}
diff --git a/plugins/WinterSpeak/src/DialogConfigActive.cpp b/plugins/WinterSpeak/src/DialogConfigActive.cpp index f6061d0258..78f798bfcc 100644 --- a/plugins/WinterSpeak/src/DialogConfigActive.cpp +++ b/plugins/WinterSpeak/src/DialogConfigActive.cpp @@ -2,7 +2,7 @@ #include "DialogConfigActive.h"
//------------------------------------------------------------------------------
-DialogConfigActive *DialogConfigActive::m_instance = 0;
+DialogConfigActive *DialogConfigActive::m_instance = nullptr;
//------------------------------------------------------------------------------
// public:
@@ -15,7 +15,7 @@ DialogConfigActive::DialogConfigActive(ConfigDatabase &db) : m_db(db) //------------------------------------------------------------------------------
DialogConfigActive::~DialogConfigActive()
{
- m_instance = 0;
+ m_instance = nullptr;
}
//------------------------------------------------------------------------------
@@ -98,7 +98,7 @@ void DialogConfigActive::notify(HWND hwndDlg, LPARAM lParam) SetAllContactIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS));
//fall through
case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
break;
case CLN_OPTIONSCHANGED:
ResetListOptions(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS));
@@ -114,7 +114,7 @@ void DialogConfigActive::notify(HWND hwndDlg, LPARAM lParam) DWORD hitFlags;
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA))
break;
if (nm->iColumn == 2) { // ignore all
@@ -133,7 +133,7 @@ void DialogConfigActive::notify(HWND hwndDlg, LPARAM lParam) iImage = 0;
SetIconsForColumn(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, nm->iColumn, iImage);
}
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
m_instance->changed(hwndDlg);
}
break;
@@ -187,7 +187,7 @@ void DialogConfigActive::load(HWND window) this->InitialiseItem(listview, hItemUnknown, active_users[0].message, active_users[0].status);
}
this->SetAllContactIcons(listview);
- this->SetListGroupIcons(GetDlgItem(window, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ this->SetListGroupIcons(GetDlgItem(window, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
}
diff --git a/plugins/WinterSpeak/src/DialogConfigEngine.cpp b/plugins/WinterSpeak/src/DialogConfigEngine.cpp index 8914402120..dc6834fe13 100644 --- a/plugins/WinterSpeak/src/DialogConfigEngine.cpp +++ b/plugins/WinterSpeak/src/DialogConfigEngine.cpp @@ -1,12 +1,12 @@ #include "stdafx.h"
#include "DialogConfigEngine.h"
-DialogConfigEngine *DialogConfigEngine::m_instance = 0;
+DialogConfigEngine *DialogConfigEngine::m_instance = nullptr;
//------------------------------------------------------------------------------
// public:
//------------------------------------------------------------------------------
-DialogConfigEngine::DialogConfigEngine(ConfigDatabase &db) : m_db(db), m_test_tts(0)
+DialogConfigEngine::DialogConfigEngine(ConfigDatabase &db) : m_db(db), m_test_tts(nullptr)
{
m_instance = this;
}
@@ -14,7 +14,7 @@ DialogConfigEngine::DialogConfigEngine(ConfigDatabase &db) : m_db(db), m_test_tt //------------------------------------------------------------------------------
DialogConfigEngine::~DialogConfigEngine()
{
- m_instance = 0;
+ m_instance = nullptr;
}
//------------------------------------------------------------------------------
diff --git a/plugins/WinterSpeak/src/MirandaDialog.cpp b/plugins/WinterSpeak/src/MirandaDialog.cpp index 882ffa044f..646b8a198e 100644 --- a/plugins/WinterSpeak/src/MirandaDialog.cpp +++ b/plugins/WinterSpeak/src/MirandaDialog.cpp @@ -20,7 +20,7 @@ WCHAR *MirandaDialog::Hlp_GetDlgItemText(HWND hwndDlg, int nIDDlgItem) { int len = SendDlgItemMessage(hwndDlg, nIDDlgItem, WM_GETTEXTLENGTH, 0, 0);
if (len < 0)
- return NULL;
+ return nullptr;
WCHAR *res = (WCHAR*)mir_alloc((len+1)*sizeof(WCHAR));
memset(res, 0, ((len + 1) * sizeof(WCHAR)));
diff --git a/plugins/WinterSpeak/src/ProtocolInformation.cpp b/plugins/WinterSpeak/src/ProtocolInformation.cpp index 7020210881..1eaa23482b 100644 --- a/plugins/WinterSpeak/src/ProtocolInformation.cpp +++ b/plugins/WinterSpeak/src/ProtocolInformation.cpp @@ -3,7 +3,7 @@ //------------------------------------------------------------------------------
-ProtocolInformation *ProtocolInformation::m_instance = 0;
+ProtocolInformation *ProtocolInformation::m_instance = nullptr;
//------------------------------------------------------------------------------
// public:
@@ -16,12 +16,12 @@ ProtocolInformation::ProtocolInformation() : m_protocol_timeout() //------------------------------------------------------------------------------
ProtocolInformation::~ProtocolInformation()
{
- m_instance = 0;
+ m_instance = nullptr;
// kill all the timers
for (ProtocolTimeoutQueue::const_iterator iter = m_protocol_timeout.begin(); iter != m_protocol_timeout.end(); ++iter)
{
- KillTimer(NULL, (*iter).second);
+ KillTimer(nullptr, (*iter).second);
}
}
@@ -29,7 +29,7 @@ void CALLBACK ProtocolInformation::TimerProc(HWND, UINT, UINT_PTR, DWORD) {
ProtocolTimeout pt = m_instance->m_protocol_timeout.front();
- KillTimer(NULL, pt.second);
+ KillTimer(nullptr, pt.second);
m_instance->m_protocol_timeout.pop_front();
}
@@ -37,21 +37,21 @@ void CALLBACK ProtocolInformation::TimerProc(HWND, UINT, UINT_PTR, DWORD) //------------------------------------------------------------------------------
void ProtocolInformation::disable(const char *protocol)
{
- if (NULL == protocol)
+ if (nullptr == protocol)
{
return;
}
const unsigned int TIMEOUT = 10000;
- unsigned int t = SetTimer(NULL, (UINT_PTR)this, TIMEOUT, TimerProc);
+ unsigned int t = SetTimer(nullptr, (UINT_PTR)this, TIMEOUT, TimerProc);
m_protocol_timeout.push_back(std::make_pair(protocol, t));
}
//------------------------------------------------------------------------------
bool ProtocolInformation::isDisabled(const char *protocol) const
{
- if (NULL == protocol)
+ if (nullptr == protocol)
{
return false;
}
diff --git a/plugins/WinterSpeak/src/SpeakConfig.cpp b/plugins/WinterSpeak/src/SpeakConfig.cpp index b6401b4423..f80716a728 100644 --- a/plugins/WinterSpeak/src/SpeakConfig.cpp +++ b/plugins/WinterSpeak/src/SpeakConfig.cpp @@ -2,7 +2,7 @@ #include "SpeakConfig.h"
-SpeakConfig::SpeakConfig(HINSTANCE instance) : m_instance(instance), m_db(), m_tts(0), m_dialog_engine(m_db), m_dialog_active(m_db)
+SpeakConfig::SpeakConfig(HINSTANCE instance) : m_instance(instance), m_db(), m_tts(nullptr), m_dialog_engine(m_db), m_dialog_active(m_db)
{
// create and configure the tts
SpeechInterface si;
diff --git a/plugins/WinterSpeak/src/SpeechApi40a.cpp b/plugins/WinterSpeak/src/SpeechApi40a.cpp index fbb6851364..d3bf7d2975 100644 --- a/plugins/WinterSpeak/src/SpeechApi40a.cpp +++ b/plugins/WinterSpeak/src/SpeechApi40a.cpp @@ -19,7 +19,7 @@ #include <memory>
//------------------------------------------------------------------------------
-SpeechApi40a::SpeechApi40a() : m_tts_central(0), m_tts_attribs(0), m_state(TextToSpeech::State_Unloaded), m_voice(L""), m_volume(50), m_pitch(50), m_rate(50)
+SpeechApi40a::SpeechApi40a() : m_tts_central(nullptr), m_tts_attribs(nullptr), m_state(TextToSpeech::State_Unloaded), m_voice(L""), m_volume(50), m_pitch(50), m_rate(50)
{
}
@@ -33,13 +33,13 @@ SpeechApi40a::~SpeechApi40a() //------------------------------------------------------------------------------
bool SpeechApi40a::isAvailable()
{
- CoInitialize(NULL);
+ CoInitialize(nullptr);
PITTSENUM pITTSEnum;
bool ret = true;
// create the enumerator
- if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, nullptr, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
{
ret = false;
}
@@ -66,13 +66,13 @@ bool SpeechApi40a::unload() if (m_tts_attribs)
{
m_tts_attribs->Release();
- m_tts_attribs = 0;
+ m_tts_attribs = nullptr;
}
if (m_tts_central)
{
m_tts_central->Release();
- m_tts_central = 0;
+ m_tts_central = nullptr;
}
m_state = TextToSpeech::State_Unloaded;
@@ -101,7 +101,7 @@ bool SpeechApi40a::say(const std::wstring &sentence) SDATA data;
data.dwSize = (DWORD)(sentence.size() * sizeof(WCHAR));
data.pData = (WCHAR *)sentence.c_str();
- m_tts_central->TextData(CHARSET_TEXT, 0, data, NULL, IID_ITTSBufNotifySinkA);
+ m_tts_central->TextData(CHARSET_TEXT, 0, data, nullptr, IID_ITTSBufNotifySinkA);
}
return ret;
@@ -175,17 +175,17 @@ std::vector<std::wstring> SpeechApi40a::getVoices() const {
std::vector<std::wstring> ret;
- PITTSENUM pITTSEnum = NULL;
+ PITTSENUM pITTSEnum = nullptr;
TTSMODEINFO inf;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, nullptr, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
{
return ret;
}
- while (!pITTSEnum->Next(1, &inf, NULL))
+ while (!pITTSEnum->Next(1, &inf, nullptr))
{
ret.push_back(inf.szModeName);
}
@@ -220,22 +220,22 @@ std::wstring SpeechApi40a::getDescription() //------------------------------------------------------------------------------
bool SpeechApi40a::loadWithVoice(const std::wstring &voice)
{
- CoInitialize(NULL);
+ CoInitialize(nullptr);
PITTSENUM pITTSEnum;
TTSMODEINFO inf;
LPUNKNOWN pAudioDest;
// create the enumerator
- if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, nullptr, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
return false;
// iterate through the voices until we find the right one
- while (!pITTSEnum->Next(1, &inf, NULL))
+ while (!pITTSEnum->Next(1, &inf, nullptr))
if (inf.szModeName == voice)
break;
- if (FAILED(CoCreateInstance(CLSID_MMAudioDest, NULL, CLSCTX_ALL, IID_IAudioMultiMediaDevice, (void**)&pAudioDest)))
+ if (FAILED(CoCreateInstance(CLSID_MMAudioDest, nullptr, CLSCTX_ALL, IID_IAudioMultiMediaDevice, (void**)&pAudioDest)))
{
pITTSEnum->Release();
return false;
diff --git a/plugins/WinterSpeak/src/SpeechApi40aLexicon.cpp b/plugins/WinterSpeak/src/SpeechApi40aLexicon.cpp index 03c960e68a..e1702bde86 100644 --- a/plugins/WinterSpeak/src/SpeechApi40aLexicon.cpp +++ b/plugins/WinterSpeak/src/SpeechApi40aLexicon.cpp @@ -32,7 +32,7 @@ bool SpeechApi40aLexicon::display() return false;
}
- ITTSDialogs *tts_dialogs = 0;
+ ITTSDialogs *tts_dialogs = nullptr;
m_tts_central->QueryInterface(IID_ITTSDialogs, (void**)&tts_dialogs);
@@ -41,7 +41,7 @@ bool SpeechApi40aLexicon::display() return false;
}
- if (NOERROR != tts_dialogs->LexiconDlg(m_window, NULL))
+ if (NOERROR != tts_dialogs->LexiconDlg(m_window, nullptr))
{
return false;
}
diff --git a/plugins/WinterSpeak/src/SpeechApi51.cpp b/plugins/WinterSpeak/src/SpeechApi51.cpp index a674f80b35..d87ea33a53 100644 --- a/plugins/WinterSpeak/src/SpeechApi51.cpp +++ b/plugins/WinterSpeak/src/SpeechApi51.cpp @@ -29,7 +29,7 @@ namespace }
//------------------------------------------------------------------------------
-SpeechApi51::SpeechApi51() : m_sapi(0), m_state(TextToSpeech::State_Unloaded), m_voice(L""), m_volume(50), m_pitch(50), m_rate(50)
+SpeechApi51::SpeechApi51() : m_sapi(nullptr), m_state(TextToSpeech::State_Unloaded), m_voice(L""), m_volume(50), m_pitch(50), m_rate(50)
{
}
@@ -44,12 +44,12 @@ SpeechApi51::~SpeechApi51() //------------------------------------------------------------------------------
bool SpeechApi51::isAvailable()
{
- CoInitialize(NULL);
+ CoInitialize(nullptr);
ISpVoice *sapi;
bool ret = true;
- if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&sapi))))
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&sapi))))
{
ret = false;
}
@@ -69,9 +69,9 @@ bool SpeechApi51::load() return true;
}
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&m_sapi))))
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&m_sapi))))
{
return false;
}
@@ -92,7 +92,7 @@ bool SpeechApi51::unload() if (isLoaded())
{
m_sapi->Release();
- m_sapi = 0;
+ m_sapi = nullptr;
}
m_state = TextToSpeech::State_Unloaded;
@@ -123,7 +123,7 @@ bool SpeechApi51::say(const std::wstring &sentence) //mbstowcs(sapi_sentence.get(), output.str().c_str(), output.str().size() + 1);
// speak the sentence
- if (FAILED(m_sapi->Speak(p, SPF_IS_XML | SPF_ASYNC, NULL)))
+ if (FAILED(m_sapi->Speak(p, SPF_IS_XML | SPF_ASYNC, nullptr)))
{
return false;
}
@@ -178,14 +178,14 @@ bool SpeechApi51::setVoice(const std::wstring &voice) // get a voice enumerator
CComPtr<IEnumSpObjectTokens> cpEnum;
- if (FAILED(SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum)))
+ if (FAILED(SpEnumTokens(SPCAT_VOICES, nullptr, nullptr, &cpEnum)))
{
return false;
}
// iterate through the list till we find a matching voice
ISpObjectToken *voice_token;
- while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ while (S_OK == cpEnum->Next(1, &voice_token, nullptr))
{
CSpDynamicString voice_str;
@@ -205,18 +205,18 @@ std::vector<std::wstring> SpeechApi51::getVoices() const {
std::vector<std::wstring> ret;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
// get a voice enumerator
CComPtr<IEnumSpObjectTokens> cpEnum;
- if (S_OK != SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum))
+ if (S_OK != SpEnumTokens(SPCAT_VOICES, nullptr, nullptr, &cpEnum))
{
return ret;
}
// iterate through the voices and add them to the string vector
ISpObjectToken *voice_token;
- while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ while (S_OK == cpEnum->Next(1, &voice_token, nullptr))
{
CSpDynamicString voice_str;
diff --git a/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp b/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp index 1d9bce89ba..8762265b4f 100644 --- a/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp +++ b/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp @@ -6,7 +6,7 @@ extern HINSTANCE g_hInst;
//------------------------------------------------------------------------------
-SpeechApi51Lexicon::SpeechApi51Lexicon(HWND window) : m_parent_window(window), m_window(0)
+SpeechApi51Lexicon::SpeechApi51Lexicon(HWND window) : m_parent_window(window), m_window(nullptr)
{
}
diff --git a/plugins/WinterSpeak/src/SpeechInterface.cpp b/plugins/WinterSpeak/src/SpeechInterface.cpp index fa1282a8a8..eba58c079e 100644 --- a/plugins/WinterSpeak/src/SpeechInterface.cpp +++ b/plugins/WinterSpeak/src/SpeechInterface.cpp @@ -16,7 +16,7 @@ SpeechInterface::~SpeechInterface() //------------------------------------------------------------------------------
TextToSpeech * SpeechInterface::createTts(const std::wstring &engine) const
{
- TextToSpeech *tts = 0;
+ TextToSpeech *tts = nullptr;
if (SpeechApi40a::getDescription() == engine)
{
diff --git a/plugins/WinterSpeak/src/UserInformation.cpp b/plugins/WinterSpeak/src/UserInformation.cpp index 63576269e3..e0934a4861 100644 --- a/plugins/WinterSpeak/src/UserInformation.cpp +++ b/plugins/WinterSpeak/src/UserInformation.cpp @@ -47,7 +47,7 @@ std::wstring UserInformation::statusString(MCONTACT user) std::wstring UserInformation::statusModeString(MCONTACT user)
{
WCHAR *status = pcli->pfnGetStatusModeDescription(m_status_info[user], 0);
- if (NULL == status)
+ if (nullptr == status)
return L"";
return status;
@@ -64,7 +64,7 @@ void UserInformation::insertName(std::wstring &str, MCONTACT user) const std::wstring UserInformation::nameString(MCONTACT user) const
{
WCHAR *ret = pcli->pfnGetContactDisplayName(user, 0);
- if (0 == ret)
+ if (nullptr == ret)
return L"";
return TranslateW(ret);
diff --git a/plugins/WinterSpeak/src/main.cpp b/plugins/WinterSpeak/src/main.cpp index 109887b3ab..daffa20758 100644 --- a/plugins/WinterSpeak/src/main.cpp +++ b/plugins/WinterSpeak/src/main.cpp @@ -5,8 +5,8 @@ HINSTANCE g_hInst; int hLangpack;
DWORD g_mirandaVersion;
-SpeakConfig *g_speak_config = 0;
-SpeakAnnounce *g_speak_announce = 0;
+SpeakConfig *g_speak_config = nullptr;
+SpeakAnnounce *g_speak_announce = nullptr;
HANDLE g_dialog_options_initialise;
HANDLE g_event_status_change;
HANDLE g_event_message_added;
@@ -145,7 +145,7 @@ extern "C" __declspec(dllexport) int Unload(void) if (g_speak_config)
{
delete g_speak_config;
- g_speak_config = 0;
+ g_speak_config = nullptr;
}
if (g_speak_announce)
@@ -155,7 +155,7 @@ extern "C" __declspec(dllexport) int Unload(void) UnhookEvent(g_protocol_ack);
delete g_speak_announce;
- g_speak_announce = 0;
+ g_speak_announce = nullptr;
}
return 0;
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 7c8a3e794c..8c1dafa8de 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -25,7 +25,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP char* szProto = GetContactProto(hContact);
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
char* szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != NULL) {
+ if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != nullptr) {
DBVARIANT dbvuid = { 0 };
if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
wchar_t uid[MAX_PATH];
@@ -66,7 +66,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_IGNORE_SOUND), TRUE);
CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED);
p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL) {
+ if (p == nullptr) {
ptrW name(db_get_wsa(hContact, SETTINGSNAME, SETTINGSKEY));
if (name != NULL)
XSN_Users.insert(new XSN_Data(hContact, name, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1));
@@ -78,7 +78,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP switch (LOWORD(wParam)) {
case IDOK:
p = XSN_Users.find((XSN_Data *)&hContact);
- if (p != NULL) {
+ if (p != nullptr) {
if (mir_wstrcmpi(p->path, L"")) {
wchar_t shortpath[MAX_PATH];
PathToRelativeW(p->path, shortpath);
@@ -104,7 +104,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP else
mir_snwprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -116,7 +116,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP if (GetOpenFileName(&ofn)) {
SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(FileName));
p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL)
+ if (p == nullptr)
XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1));
else {
wcsncpy(p->path, FileName, _countof(p->path));
@@ -132,7 +132,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case IDC_CONT_BUTTON_TEST_PLAY:
p = XSN_Users.find((XSN_Data *)&hContact);
isIgnoreSound = 0;
- if (p == NULL) {
+ if (p == nullptr) {
DBVARIANT dbv;
if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
wchar_t longpath[MAX_PATH] = { 0 };
@@ -155,7 +155,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, TranslateT("Not set"));
p = XSN_Users.find((XSN_Data *)&hContact);
- if (p != NULL) {
+ if (p != nullptr) {
XSN_Users.remove(p);
delete p;
}
@@ -165,7 +165,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case IDC_CONT_IGNORE_SOUND:
p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL) {
+ if (p == nullptr) {
DBVARIANT dbv;
if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
wchar_t longpath[MAX_PATH];
@@ -194,7 +194,7 @@ INT_PTR ShowDialog(WPARAM wParam, LPARAM) {
HWND hChangeSoundDlg = WindowList_Find(hChangeSoundDlgList, wParam);
if (!hChangeSoundDlg) {
- hChangeSoundDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACTS), 0, DlgProcContactsOptions, (LPARAM)wParam);
+ hChangeSoundDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACTS), nullptr, DlgProcContactsOptions, (LPARAM)wParam);
ShowWindow(hChangeSoundDlg, SW_SHOW);
}
else {
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index fd5bc06ca8..035772e93d 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -11,7 +11,7 @@ There is no warranty. bool IsSuitableProto(PROTOACCOUNT *pa)
{
- if (pa == NULL)
+ if (pa == nullptr)
return false;
if (pa->bDynDisabled || !pa->bIsEnabled)
@@ -52,12 +52,12 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)TranslateT("All contacts")), cursel);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char *szUniqueId = NULL;
+ char *szUniqueId = nullptr;
if (db_get_b(hContact, pa->szModuleName, "ChatRoom", 0))
szUniqueId = "ChatRoomID";
else
szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != NULL) {
+ if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != nullptr) {
DBVARIANT dbvuid = { 0 };
if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
wchar_t uid[MAX_PATH];
@@ -148,7 +148,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else
mir_snwprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (!cursel) {
PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- if (p == NULL)
+ if (p == nullptr)
XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
else
{
@@ -177,7 +177,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else {
MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL)
+ if (p == nullptr)
XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
else
{
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
isIgnoreSound = 0;
- if (p == NULL) {
+ if (p == nullptr) {
DBVARIANT dbv;
if (!db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
wchar_t longpath[MAX_PATH];
@@ -219,7 +219,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
isIgnoreSound = 0;
- if (p == NULL) {
+ if (p == nullptr) {
DBVARIANT dbv;
if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
wchar_t longpath[MAX_PATH];
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (!cursel) {
PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- if (p != NULL) {
+ if (p != nullptr) {
XSN_Users.remove(p);
delete p;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -262,7 +262,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else {
MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p != NULL) {
+ if (p != nullptr) {
XSN_Users.remove(p);
delete p;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -279,7 +279,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (!cursel) {
PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- if (p == NULL) {
+ if (p == nullptr) {
DBVARIANT dbv;
if (!db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
wchar_t longpath[MAX_PATH];
@@ -295,7 +295,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else {
MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL) {
+ if (p == nullptr) {
DBVARIANT dbv;
if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
wchar_t longpath[MAX_PATH];
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index a42bf083c3..79e0d814ab 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -12,8 +12,8 @@ There is no warranty. HINSTANCE hInst;
int hLangpack;
LIST<XSN_Data> XSN_Users(10, NumericKeySortT);
-HGENMENU hChangeSound = NULL;
-MWindowList hChangeSoundDlgList = NULL;
+HGENMENU hChangeSound = nullptr;
+MWindowList hChangeSoundDlgList = nullptr;
BYTE isIgnoreSound = 0, isOwnSound = 0, isIgnoreAccSound = 0, isAccSound = 0;
CLIST_INTERFACE *pcli;
@@ -68,7 +68,7 @@ void InitSelfSounds() {
// initializing self sounds for protocols
int protoCount = 0;
- PROTOACCOUNT** protos = 0;
+ PROTOACCOUNT** protos = nullptr;
Proto_EnumAccounts(&protoCount, &protos);
for (int i = 0; i < protoCount; i++) {
@@ -86,7 +86,7 @@ void InitSelfSounds() static int ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack != 0 && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS) {
+ if (ack != nullptr && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS) {
for (int i = 0; i < _countof(selfSounds); i++) {
if (selfSounds[i].iStatus == ack->lParam) {
char buf[128];
@@ -157,7 +157,7 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam) MCONTACT hContact = pci->FindRoom(gce->pszModule, gce->ptszID);
if (hContact != 0) {
ptrW nick(db_get_wsa(hContact, gce->pszModule, "MyNick"));
- if (nick == NULL || gce->ptszText == NULL)
+ if (nick == NULL || gce->ptszText == nullptr)
return 0;
if (wcsstr(gce->ptszText, nick)) {
isIgnoreSound = db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0);
diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index fa1262c1da..0755276f7b 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -46,10 +46,10 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam) if (AccountVersion != YAMN_ACCOUNTVERSION) return NULL; - if (Plugin != NULL) + if (Plugin != nullptr) { HACCOUNT NewAccount; - if (Plugin->Fcn->NewAccountFcnPtr != NULL) + if (Plugin->Fcn->NewAccountFcnPtr != nullptr) //Let plugin create its own structure, which can be derived from CAccount structure NewAccount = Plugin->Fcn->NewAccountFcnPtr(Plugin, YAMN_ACCOUNTVERSION); else @@ -57,7 +57,7 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam) NewAccount = new struct CAccount; //If not created successfully - if (NewAccount == NULL) + if (NewAccount == nullptr) return NULL; NewAccount->Plugin = Plugin; @@ -73,11 +73,11 @@ INT_PTR DeletePluginAccountSvc(WPARAM wParam, LPARAM) { HACCOUNT OldAccount = (HACCOUNT)wParam; - if (OldAccount->Plugin->Fcn != NULL) + if (OldAccount->Plugin->Fcn != nullptr) { //Deinit every members and allocated fields of structure used by YAMN DeInitAccount(OldAccount); - if (OldAccount->Plugin->Fcn->DeleteAccountFcnPtr != NULL) + if (OldAccount->Plugin->Fcn->DeleteAccountFcnPtr != nullptr) { //Let plugin delete its own CAccount derived structure OldAccount->Plugin->Fcn->DeleteAccountFcnPtr(OldAccount); @@ -99,11 +99,11 @@ int InitAccount(HACCOUNT Which) { //initialize synchronizing objects Which->AccountAccessSO = new SWMRG; - SWMRGInitialize(Which->AccountAccessSO, NULL); + SWMRGInitialize(Which->AccountAccessSO, nullptr); Which->MessagesAccessSO = new SWMRG; - SWMRGInitialize(Which->MessagesAccessSO, NULL); + SWMRGInitialize(Which->MessagesAccessSO, nullptr); Which->UsingThreads = new SCOUNTER; - SWMRGInitialize(Which->MessagesAccessSO, NULL); + SWMRGInitialize(Which->MessagesAccessSO, nullptr); //zero memory, where timestamps are stored memset(&Which->LastChecked, 0, sizeof(Which->LastChecked)); @@ -111,12 +111,12 @@ int InitAccount(HACCOUNT Which) memset(&Which->LastSynchronised, 0, sizeof(Which->LastSynchronised)); memset(&Which->LastMail, 0, sizeof(Which->LastMail)); - Which->Name = NULL; - Which->Mails = NULL; + Which->Name = nullptr; + Which->Mails = nullptr; Which->Interval = 0; Which->Flags = 0; Which->StatusFlags = 0; - Which->Next = NULL; + Which->Next = nullptr; Which->Server = new struct CServer; Which->AbleToWork = TRUE; @@ -127,14 +127,14 @@ int InitAccount(HACCOUNT Which) void DeInitAccount(HACCOUNT Which) { //delete YAMN allocated fields - if (Which->Name != NULL) + if (Which->Name != nullptr) delete[] Which->Name; - if (Which->Server != NULL) { - if (Which->Server->Name != NULL) + if (Which->Server != nullptr) { + if (Which->Server->Name != nullptr) delete[] Which->Server->Name; - if (Which->Server->Login != NULL) + if (Which->Server->Login != nullptr) delete[] Which->Server->Login; - if (Which->Server->Passwd != NULL) + if (Which->Server->Passwd != nullptr) delete[] Which->Server->Passwd; delete[] Which->Server; } @@ -164,7 +164,7 @@ void CodeDecodeString(char *Dest, BOOL Encrypt) { wchar_t Code = STARTCODEPSW; - if (Dest == NULL) + if (Dest == nullptr) return; for (; *Dest != (wchar_t)0; Dest++) @@ -180,20 +180,20 @@ void CodeDecodeString(char *Dest, BOOL Encrypt) static DWORD PostFileToMemory(HANDLE File, char **MemFile, char **End) { DWORD FileSize, ReadBytes; - if (!(FileSize = GetFileSize(File, NULL))) { + if (!(FileSize = GetFileSize(File, nullptr))) { CloseHandle(File); return EACC_FILESIZE; } //allocate space in memory, where we copy the whole file - if (NULL == (*MemFile = new char[FileSize])) + if (nullptr == (*MemFile = new char[FileSize])) { CloseHandle(File); return EACC_ALLOC; } //copy file to memory - if (!ReadFile(File, (LPVOID)*MemFile, FileSize, &ReadBytes, NULL)) + if (!ReadFile(File, (LPVOID)*MemFile, FileSize, &ReadBytes, nullptr)) { CloseHandle(File); delete[] * MemFile; @@ -206,7 +206,7 @@ static DWORD PostFileToMemory(HANDLE File, char **MemFile, char **End) DWORD FileToMemory(wchar_t *FileName, char **MemFile, char **End) { - HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) return EACC_SYSTEM; @@ -255,14 +255,14 @@ DWORD ReadStringFromMemory(char **Parser, char *End, char **StoreTo) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) { - if (NULL == (Dest = *StoreTo = new char[Size + 1])) + if (nullptr == (Dest = *StoreTo = new char[Size + 1])) return EACC_ALLOC; for (; *Parser <= Finder; (*Parser)++, Dest++) *Dest = **Parser; } else { - *StoreTo = NULL; + *StoreTo = nullptr; (*Parser)++; } return 0; @@ -310,14 +310,14 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser, WCHAR *End, WCHAR **StoreTo) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) { - if (NULL == (Dest = *StoreTo = new WCHAR[Size + 1])) + if (nullptr == (Dest = *StoreTo = new WCHAR[Size + 1])) return EACC_ALLOC; for (; *Parser <= Finder; (*Parser)++, Dest++) *Dest = **Parser; } else { - *StoreTo = NULL; + *StoreTo = nullptr; (*Parser)++; } return 0; @@ -383,7 +383,7 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) { char *Finder; DWORD Size, Stat; - HYAMNMAIL ActualMail = NULL; + HYAMNMAIL ActualMail = nullptr; struct CMimeItem *items; char *ReadString; @@ -398,19 +398,19 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) { - if (Which->Mails == NULL) //First message in queue + if (Which->Mails == nullptr) //First message in queue { - if (NULL == (Which->Mails = ActualMail = CreateAccountMail(Which))) + if (nullptr == (Which->Mails = ActualMail = CreateAccountMail(Which))) return EACC_ALLOC; } else { - if (NULL == (ActualMail->Next = CreateAccountMail(Which))) { + if (nullptr == (ActualMail->Next = CreateAccountMail(Which))) { return EACC_ALLOC; } ActualMail = ActualMail->Next; } - items = NULL; + items = nullptr; #ifdef DEBUG_FILEREADMESSAGES if (Stat=ReadStringFromMemory(Parser,End,&ActualMail->ID,L"ID")) #else @@ -432,7 +432,7 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; - if ((NULL != Which->Plugin->MailFcn) && (NULL != Which->Plugin->MailFcn->ReadMailOptsFcnPtr)) + if ((nullptr != Which->Plugin->MailFcn) && (nullptr != Which->Plugin->MailFcn->ReadMailOptsFcnPtr)) Which->Plugin->MailFcn->ReadMailOptsFcnPtr(ActualMail, Parser, End); //read plugin mail settings from file do @@ -443,21 +443,21 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) if (Stat = ReadStringFromMemory(Parser, End, &ReadString)) #endif return Stat; - if (ReadString == NULL) + if (ReadString == nullptr) break; #ifdef DEBUG_DECODE DebugLog(DecodeFile,"<read name>%s</read name>",ReadString); #endif - if (items == NULL) + if (items == nullptr) items = ActualMail->MailData->TranslatedHeader = new struct CMimeItem; else { items->Next = new struct CMimeItem; items = items->Next; } - if (items == NULL) + if (items == nullptr) return EACC_ALLOC; items->name = ReadString; @@ -495,7 +495,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (Stat = ReadStringFromMemory(Parser, End, &Which->Name)) #endif return Stat; - if (Which->Name == NULL) + if (Which->Name == nullptr) return EACC_FILECOMPATIBILITY; //Read server parameters @@ -569,7 +569,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) return Stat; //Let plugin read its own data stored in file - if (Which->Plugin->Fcn != NULL && Which->Plugin->Fcn->ReadPluginOptsFcnPtr != NULL) + if (Which->Plugin->Fcn != nullptr && Which->Plugin->Fcn->ReadPluginOptsFcnPtr != nullptr) if (Stat = Which->Plugin->Fcn->ReadPluginOptsFcnPtr(Which, Parser, End)) return Stat; //Read mails @@ -655,7 +655,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write enter\n"); #endif - if (NULL == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) + if (nullptr == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n"); @@ -684,14 +684,14 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha if (Stat && (Stat != EACC_ENDOFFILE)) { - for (ActualAccount = FirstAllocatedAccount; ActualAccount != NULL; ActualAccount = Temp) + for (ActualAccount = FirstAllocatedAccount; ActualAccount != nullptr; ActualAccount = Temp) { Temp = ActualAccount->Next; delete ActualAccount; } delete[] MemFile; if (Plugin->FirstAccount == FirstAllocatedAccount) - Plugin->FirstAccount = NULL; + Plugin->FirstAccount = nullptr; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:ActualAccountSO-write done\n"); #endif @@ -704,16 +704,16 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha #endif WriteDoneFcn(ActualAccount->AccountAccessSO); - if ((Stat != EACC_ENDOFFILE) && (NULL == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION)))) + if ((Stat != EACC_ENDOFFILE) && (nullptr == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION)))) { - for (ActualAccount = FirstAllocatedAccount; ActualAccount != NULL; ActualAccount = Temp) + for (ActualAccount = FirstAllocatedAccount; ActualAccount != nullptr; ActualAccount = Temp) { Temp = ActualAccount->Next; delete ActualAccount; } delete[] MemFile; if (Plugin->FirstAccount == FirstAllocatedAccount) - Plugin->FirstAccount = NULL; + Plugin->FirstAccount = nullptr; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n"); #endif @@ -747,13 +747,13 @@ DWORD WriteStringToFile(HANDLE File, char *Source) DWORD Length, WrittenBytes; char null = 0; - if ((Source == NULL) || !(Length = (DWORD)mir_strlen(Source))) { - if (!WriteFile(File, &null, 1, &WrittenBytes, NULL)) { + if ((Source == nullptr) || !(Length = (DWORD)mir_strlen(Source))) { + if (!WriteFile(File, &null, 1, &WrittenBytes, nullptr)) { CloseHandle(File); return EACC_SYSTEM; } } - else if (!WriteFile(File, Source, (Length + 1), &WrittenBytes, NULL)) { + else if (!WriteFile(File, Source, (Length + 1), &WrittenBytes, nullptr)) { CloseHandle(File); return EACC_SYSTEM; } @@ -765,15 +765,15 @@ DWORD WriteStringToFileW(HANDLE File, WCHAR *Source) DWORD Length, WrittenBytes; WCHAR null = (WCHAR)0; - if ((Source == NULL) || !(Length = (DWORD)mir_wstrlen(Source))) + if ((Source == nullptr) || !(Length = (DWORD)mir_wstrlen(Source))) { - if (!WriteFile(File, &null, sizeof(WCHAR), &WrittenBytes, NULL)) + if (!WriteFile(File, &null, sizeof(WCHAR), &WrittenBytes, nullptr)) { CloseHandle(File); return EACC_SYSTEM; } } - else if (!WriteFile(File, Source, (Length + 1)*sizeof(WCHAR), &WrittenBytes, NULL)) + else if (!WriteFile(File, Source, (Length + 1)*sizeof(WCHAR), &WrittenBytes, nullptr)) return EACC_SYSTEM; return 0; } @@ -784,17 +784,17 @@ DWORD WriteMessagesToFile(HANDLE File, HACCOUNT Which) HYAMNMAIL ActualMail = (HYAMNMAIL)Which->Mails; struct CMimeItem *items; - while (ActualMail != NULL) + while (ActualMail != nullptr) { if (Stat = WriteStringToFile(File, ActualMail->ID)) return Stat; - if (!WriteFile(File, (char *)&ActualMail->MailData->Size, sizeof(ActualMail->MailData->Size), &WrittenBytes, NULL) || - !WriteFile(File, (char *)&ActualMail->Flags, sizeof(ActualMail->Flags), &WrittenBytes, NULL) || - !WriteFile(File, (char *)&ActualMail->Number, sizeof(ActualMail->Number), &WrittenBytes, NULL)) + if (!WriteFile(File, (char *)&ActualMail->MailData->Size, sizeof(ActualMail->MailData->Size), &WrittenBytes, nullptr) || + !WriteFile(File, (char *)&ActualMail->Flags, sizeof(ActualMail->Flags), &WrittenBytes, nullptr) || + !WriteFile(File, (char *)&ActualMail->Number, sizeof(ActualMail->Number), &WrittenBytes, nullptr)) return EACC_SYSTEM; - if ((NULL != Which->Plugin->MailFcn) && (NULL != Which->Plugin->MailFcn->WriteMailOptsFcnPtr)) + if ((nullptr != Which->Plugin->MailFcn) && (nullptr != Which->Plugin->MailFcn->WriteMailOptsFcnPtr)) Which->Plugin->MailFcn->WriteMailOptsFcnPtr(File, ActualMail); //write plugin mail options to file - for (items = ActualMail->MailData->TranslatedHeader; items != NULL; items = items->Next) + for (items = ActualMail->MailData->TranslatedHeader; items != nullptr; items = items->Next) { if (Stat = WriteStringToFile(File, items->name)) return Stat; @@ -827,7 +827,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #endif try { - for (ActualAccount = Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = ActualAccount->Next) + for (ActualAccount = Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read wait\n"); @@ -846,7 +846,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read enter\n"); #endif - if ((ActualAccount->Name == NULL) || (*ActualAccount->Name == (wchar_t)0)) + if ((ActualAccount->Name == nullptr) || (*ActualAccount->Name == (wchar_t)0)) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read done\n"); @@ -855,7 +855,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) continue; } - if (!Writed && !WriteFile(File, &Ver, sizeof(Ver), &WrittenBytes, NULL)) + if (!Writed && !WriteFile(File, &Ver, sizeof(Ver), &WrittenBytes, nullptr)) throw (DWORD)EACC_SYSTEM; Writed = TRUE; @@ -865,7 +865,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) if (Stat = WriteStringToFile(File, ActualAccount->Server->Name)) throw (DWORD)Stat; - if (!WriteFile(File, (char *)&ActualAccount->Server->Port, 2, &WrittenBytes, NULL)) + if (!WriteFile(File, (char *)&ActualAccount->Server->Port, 2, &WrittenBytes, nullptr)) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFile(File, ActualAccount->Server->Login))) @@ -880,38 +880,38 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) } CodeDecodeString(ActualAccount->Server->Passwd, FALSE); - if ((!WriteFile(File, (char *)&ActualAccount->Flags, sizeof(DWORD), &WrittenBytes, NULL) || - (!WriteFile(File, (char *)&ActualAccount->StatusFlags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->PluginFlags, sizeof(DWORD), &WrittenBytes, NULL)))) + if ((!WriteFile(File, (char *)&ActualAccount->Flags, sizeof(DWORD), &WrittenBytes, nullptr) || + (!WriteFile(File, (char *)&ActualAccount->StatusFlags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->PluginFlags, sizeof(DWORD), &WrittenBytes, nullptr)))) throw (DWORD)EACC_SYSTEM; - if (!WriteFile(File, (char *)&ActualAccount->Interval, sizeof(WORD), &WrittenBytes, NULL)) + if (!WriteFile(File, (char *)&ActualAccount->Interval, sizeof(WORD), &WrittenBytes, nullptr)) throw (DWORD)EACC_SYSTEM; - if ((!WriteFile(File, (char *)&ActualAccount->NewMailN.Flags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->NewMailN.Flags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, nullptr))) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFileW(File, ActualAccount->NewMailN.App)) || (Stat = WriteStringToFileW(File, ActualAccount->NewMailN.AppParam))) throw (DWORD)Stat; - if ((!WriteFile(File, (char *)&ActualAccount->NoNewMailN.Flags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->NoNewMailN.Flags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, nullptr))) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFileW(File, ActualAccount->NoNewMailN.App)) || (Stat = WriteStringToFileW(File, ActualAccount->NoNewMailN.AppParam))) throw (DWORD)Stat; - if ((!WriteFile(File, (char *)&ActualAccount->BadConnectN.Flags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupB, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupT, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupTime, sizeof(DWORD), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->BadConnectN.Flags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupB, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupT, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupTime, sizeof(DWORD), &WrittenBytes, nullptr))) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFileW(File, ActualAccount->BadConnectN.App)) || @@ -919,7 +919,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) throw (DWORD)Stat; //Let plugin write its own values into file - if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr != NULL) + if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr != nullptr) if (Stat = ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr(File, ActualAccount)) throw (DWORD)Stat; #ifdef DEBUG_SYNCHRO @@ -942,10 +942,10 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #endif ReadDoneFcn(ActualAccount->MessagesAccessSO); - if ((!WriteFile(File, (char *)&ActualAccount->LastChecked, sizeof(SYSTEMTIME), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->LastSChecked, sizeof(SYSTEMTIME), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->LastSynchronised, sizeof(SYSTEMTIME), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->LastMail, sizeof(SYSTEMTIME), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->LastChecked, sizeof(SYSTEMTIME), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->LastSChecked, sizeof(SYSTEMTIME), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->LastSynchronised, sizeof(SYSTEMTIME), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->LastMail, sizeof(SYSTEMTIME), &WrittenBytes, nullptr))) throw (DWORD)Stat; #ifdef DEBUG_SYNCHRO @@ -976,7 +976,7 @@ INT_PTR WriteAccountsToFileSvc(WPARAM wParam, LPARAM lParam) HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; mir_cslock lck(csFileWritingCS); - HANDLE hFile = CreateFile((wchar_t*)lParam, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile((wchar_t*)lParam, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) return EACC_SYSTEM; @@ -996,8 +996,8 @@ INT_PTR FindAccountByNameSvc(WPARAM wParam, LPARAM lParam) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read enter\n"); #endif - for (Finder = Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) - if ((Finder->Name != NULL) && (0 == mir_strcmp(SearchedAccount, Finder->Name))) + for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) + if ((Finder->Name != nullptr) && (0 == mir_strcmp(SearchedAccount, Finder->Name))) break; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read done\n"); @@ -1011,12 +1011,12 @@ INT_PTR GetNextFreeAccountSvc(WPARAM wParam, LPARAM lParam) HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; HACCOUNT Finder; - if (Plugin->FirstAccount == NULL) + if (Plugin->FirstAccount == nullptr) { Plugin->FirstAccount = (HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); return (INT_PTR)Plugin->FirstAccount; } - for (Finder = Plugin->FirstAccount; Finder->Next != NULL; Finder = Finder->Next); + for (Finder = Plugin->FirstAccount; Finder->Next != nullptr; Finder = Finder->Next); Finder->Next = (HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); return (INT_PTR)Finder->Next; } @@ -1067,7 +1067,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) //1. set stop signal StopSignalFcn(Which); WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Which, 0); - if (Plugin->Fcn->StopAccountFcnPtr != NULL) + if (Plugin->Fcn->StopAccountFcnPtr != nullptr) Plugin->Fcn->StopAccountFcnPtr(Which); //2. wait to get write access @@ -1080,7 +1080,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) #endif //3. remove from queue (chained list) - if (Plugin->FirstAccount == NULL) + if (Plugin->FirstAccount == nullptr) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"DeleteAccount:AccountBrowserSO-write done\n"); @@ -1110,7 +1110,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) // No, of course not. We will create new thread, that will wait and additionally remove our thread in background. //5. So, the last point (deleting from memory) is performed in new DeleteAccountInBackground thread - if ((Plugin->Fcn != NULL) && (Plugin->Fcn->WriteAccountsFcnPtr != NULL)) + if ((Plugin->Fcn != nullptr) && (Plugin->Fcn->WriteAccountsFcnPtr != nullptr)) Plugin->Fcn->WriteAccountsFcnPtr(); CloseHandle(mir_forkthread(DeleteAccountInBackground, (void*)Which)); @@ -1138,12 +1138,12 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"StopAccounts:AccountBrowserSO-write enter\n"); #endif - for (Finder = Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) + for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { //2. set stop signal StopSignalFcn(Finder); WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Finder, 0); - if (Plugin->Fcn->StopAccountFcnPtr != NULL) + if (Plugin->Fcn->StopAccountFcnPtr != nullptr) Plugin->Fcn->StopAccountFcnPtr(Finder); } @@ -1172,7 +1172,7 @@ int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin, BOOL GetAccountBrowserAccess) DebugLog(SynchroFile,"WaitForAllAccounts:AccountBrowserSO-write enter\n"); #endif } - for (Finder = Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) + for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { //2. wait for signal that account is not in use #ifdef DEBUG_SYNCHRO @@ -1211,7 +1211,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) WaitForAllAccounts(Plugin, FALSE); - for (Finder = Plugin->FirstAccount; Finder != NULL;) + for (Finder = Plugin->FirstAccount; Finder != nullptr;) { HACCOUNT Next = Finder->Next; DeletePluginAccountSvc((WPARAM)Finder, 0); @@ -1228,7 +1228,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) { - if (Which == NULL) + if (Which == nullptr) return; mir_cslock lck(csAccountStatusCS); @@ -1237,7 +1237,7 @@ void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value) { - if (Which != NULL) { + if (Which != nullptr) { mir_cslock lck(csAccountStatusCS); mir_wstrcpy(Which->Status, Value); } diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 90f5815d4e..d66878578e 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -30,20 +30,20 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read enter\n");
#endif
- if (ActualAccount->BadConnectN.App != NULL) {
+ if (ActualAccount->BadConnectN.App != nullptr) {
WCHAR *Command;
- if (ActualAccount->BadConnectN.AppParam != NULL)
+ if (ActualAccount->BadConnectN.AppParam != nullptr)
Command = new WCHAR[mir_wstrlen(ActualAccount->BadConnectN.App) + mir_wstrlen(ActualAccount->BadConnectN.AppParam) + 6];
else
Command = new WCHAR[mir_wstrlen(ActualAccount->BadConnectN.App) + 6];
- if (Command != NULL) {
+ if (Command != nullptr) {
mir_wstrcpy(Command, L"\"");
mir_wstrcat(Command, ActualAccount->BadConnectN.App);
mir_wstrcat(Command, L"\" ");
- if (ActualAccount->BadConnectN.AppParam != NULL)
+ if (ActualAccount->BadConnectN.AppParam != nullptr)
mir_wstrcat(Command, ActualAccount->BadConnectN.AppParam);
- CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+ CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi);
delete[] Command;
}
}
@@ -84,8 +84,8 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP HACCOUNT ActualAccount;
DWORD ErrorCode;
char* TitleStrA;
- char *Message1A = NULL;
- wchar_t *Message1W = NULL;
+ char *Message1A = nullptr;
+ wchar_t *Message1W = nullptr;
POPUPDATAT BadConnectPopup;
ActualAccount = ((struct BadConnectionParam *)lParam)->account;
@@ -122,14 +122,14 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP mir_wstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(BadConnectPopup.lptzContactName));
}
- if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) {
+ if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != nullptr) {
Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SetDlgItemText(hDlg, IDC_STATICMSG, Message1W);
wcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE);
if (ShowPopup)
PUAddPopupT(&BadConnectPopup);
}
- else if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr != NULL)
+ else if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr != nullptr)
{
Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SetDlgItemText(hDlg, IDC_STATICMSG, Message1W);
@@ -155,11 +155,11 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP SetWindowTextA(hDlg, TitleStrA);
delete[] TitleStrA;
- if (Message1A != NULL)
+ if (Message1A != nullptr)
delete[] Message1A;
- if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != NULL && Message1A != NULL)
+ if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != nullptr && Message1A != nullptr)
ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1A);
- if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != NULL && Message1W != NULL)
+ if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != nullptr && Message1W != nullptr)
ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1W);
return 0;
}
@@ -229,7 +229,7 @@ void __cdecl BadConnection(void *Param) __try
{
- hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), NULL, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
+ hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3));
#ifdef DEBUG_SYNCHRO
@@ -267,14 +267,14 @@ void __cdecl BadConnection(void *Param) ReadDoneFcn(ActualAccount->AccountAccessSO);
UpdateWindow(hBadConnect);
- while (GetMessage(&msg, NULL, 0, 0))
+ while (GetMessage(&msg, nullptr, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// now, write to file. Why? Because we want to write when was new mail last checked
- if ((ActualAccount->Plugin->Fcn != NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != NULL) && ActualAccount->AbleToWork)
+ if ((ActualAccount->Plugin->Fcn != nullptr) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != nullptr) && ActualAccount->AbleToWork)
ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr();
}
__finally
@@ -296,12 +296,12 @@ INT_PTR RunBadConnectionSvc(WPARAM wParam, LPARAM lParam) if ((DWORD)lParam != YAMN_BADCONNECTIONVERSION)
return 0;
- if (NULL != (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
+ if (nullptr != (ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr)))
{
HANDLE NewThread;
Param->ThreadRunningEV = ThreadRunningEV;
- if (NULL != (NewThread = mir_forkthread(BadConnection, (void*)Param)))
+ if (nullptr != (NewThread = mir_forkthread(BadConnection, (void*)Param)))
{
WaitForSingleObject(ThreadRunningEV, INFINITE);
CloseHandle(NewThread);
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 9342ecc1aa..58269b94af 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -204,7 +204,7 @@ inline HACCOUNT GetWindowAccount(HWND hDlg) { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); - return (mwui == NULL) ? NULL : mwui->Account; + return (mwui == nullptr) ? nullptr : mwui->Account; } void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN) @@ -354,11 +354,11 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) memset(&MN, 0, sizeof(MN)); - for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != NULL; msgq = msgq->Next) { + for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next) { if (!LoadedMailData(msgq)) //check if mail is already in memory { Loaded = false; - if (NULL == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it + if (nullptr == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it continue; } else @@ -370,12 +370,12 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) UnloadMailData(msgq); //do not keep data for mail in memory } - if (mwui != NULL) + if (mwui != nullptr) mwui->UpdateMailsMessagesAccess = TRUE; //Now we are going to check if extracting data from mail headers are needed. //If popups will be displayed or mailbrowser window - if ((((mwui != NULL) && !(mwui->RunFirstTime)) && + if ((((mwui != nullptr) && !(mwui->RunFirstTime)) && ( ((nnflags & YAMN_ACC_MSGP) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || ((nflags & YAMN_ACC_MSGP) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC)) @@ -397,7 +397,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (RunMailBrowser) ChangeExistingMailStatus(GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount); if (RunMailBrowser || RunPopups) - AddNewMailsToListView(hDlg == NULL ? NULL : GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount, nflags); + AddNewMailsToListView(hDlg == nullptr ? nullptr : GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount, nflags); if (RunMailBrowser) { size_t len = mir_strlen(ActualAccount->Name) + mir_strlen(Translate(MAILBROWSERTITLE)) + 10; //+10 chars for numbers @@ -425,7 +425,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (!RunMailBrowser) SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_UNSEEN, YAMN_MSG_STAYUNSEEN, YAMN_MSG_UNSEEN, YAMN_FLAG_REMOVE); //remove the unseen flag when it was not displayed and it has not "stay unseen" flag set - if (mwui != NULL) { + if (mwui != nullptr) { mwui->UpdateMailsMessagesAccess = FALSE; mwui->RunFirstTime = FALSE; } @@ -438,7 +438,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (RunMailBrowser) UpdateWindow(GetDlgItem(hDlg, IDC_LISTMAILS)); - else if (hDlg != NULL) + else if (hDlg != nullptr) DestroyWindow(hDlg); return 1; @@ -459,8 +459,8 @@ int ChangeExistingMailStatus(HWND hListView, HACCOUNT ActualAccount) mail = (HYAMNMAIL)item.lParam; else continue; - for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != NULL) && (msgq != mail); msgq = msgq->Next); //found the same mail in account queue - if (msgq == NULL) //if mail was not found + for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != nullptr) && (msgq != mail); msgq = msgq->Next); //found the same mail in account queue + if (msgq == nullptr) //if mail was not found if (TRUE == ListView_DeleteItem(hListView, i)) { in--; i--; continue; @@ -487,7 +487,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) memset(&item, 0, sizeof(item)); memset(&UnicodeHeader, 0, sizeof(UnicodeHeader)); - if (hListView != NULL) { + if (hListView != nullptr) { item.mask = LVIF_TEXT | LVIF_PARAM; item.iItem = 0; memset(&fi, 0, sizeof(fi)); @@ -509,14 +509,14 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) NewMailPopup.iSeconds = ActualAccount->NewMailN.PopupTime; NewMailPopup.PluginWindowProc = NewMailPopupProc; - NewMailPopup.PluginData = 0; //it's new mail popup + NewMailPopup.PluginData = nullptr; //it's new mail popup - for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != NULL; msgq = msgq->Next, lfoundi++) { + for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next, lfoundi++) { // now we hide mail pointer to item's lParam member. We can later use it to retrieve mail datas - Extracted = FALSE; FromStr = NULL; FromStrNew = FALSE; + Extracted = FALSE; FromStr = nullptr; FromStrNew = FALSE; - if (hListView != NULL) { + if (hListView != nullptr) { fi.lParam = (LPARAM)msgq; if (-1 != (foundi = ListView_FindItem(hListView, -1, &fi))) { // if mail is already in window lfoundi = foundi; @@ -529,43 +529,43 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) if (!LoadedMailData(msgq)) { // check if mail is already in memory Loaded = false; - if (NULL == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it + if (nullptr == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it continue; } else Loaded = true; - if (((hListView != NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) || + if (((hListView != nullptr) && (msgq->Flags & YAMN_MSG_DISPLAY)) || ((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW))) { if (!Extracted) ExtractHeader(msgq->MailData->TranslatedHeader, msgq->MailData->CP, &UnicodeHeader); Extracted = TRUE; - if ((UnicodeHeader.From != NULL) && (UnicodeHeader.FromNick != NULL)) { + if ((UnicodeHeader.From != nullptr) && (UnicodeHeader.FromNick != nullptr)) { size_t size = mir_wstrlen(UnicodeHeader.From) + mir_wstrlen(UnicodeHeader.FromNick) + 4; FromStr = new WCHAR[size]; mir_snwprintf(FromStr, size, L"%s <%s>", UnicodeHeader.FromNick, UnicodeHeader.From); FromStrNew = TRUE; } - else if (UnicodeHeader.From != NULL) + else if (UnicodeHeader.From != nullptr) FromStr = UnicodeHeader.From; - else if (UnicodeHeader.FromNick != NULL) + else if (UnicodeHeader.FromNick != nullptr) FromStr = UnicodeHeader.FromNick; - else if (UnicodeHeader.ReturnPath != NULL) + else if (UnicodeHeader.ReturnPath != nullptr) FromStr = UnicodeHeader.ReturnPath; - if (NULL == FromStr) { + if (nullptr == FromStr) { FromStr = L""; FromStrNew = FALSE; } } - if ((hListView != NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) { + if ((hListView != nullptr) && (msgq->Flags & YAMN_MSG_DISPLAY)) { item.iSubItem = 0; item.pszText = FromStr; item.iItem = SendMessage(hListView, LVM_INSERTITEM, 0, (LPARAM)&item); item.iSubItem = 1; - item.pszText = (NULL != UnicodeHeader.Subject ? UnicodeHeader.Subject : (WCHAR*)L""); + item.pszText = (nullptr != UnicodeHeader.Subject ? UnicodeHeader.Subject : (WCHAR*)L""); SendMessage(hListView, LVM_SETITEMTEXT, (WPARAM)item.iItem, (LPARAM)&item); item.iSubItem = 2; @@ -576,7 +576,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) item.iSubItem = 3; item.pszText = L""; - for (CMimeItem *heads = msgq->MailData->TranslatedHeader; heads != NULL; heads = heads->Next) { + for (CMimeItem *heads = msgq->MailData->TranslatedHeader; heads != nullptr; heads = heads->Next) { if (!_stricmp(heads->name, "Date")) { MimeDateToLocalizedDateTime(heads->value, LocalDateStr, 128); item.pszText = LocalDateStr; @@ -594,7 +594,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) if (MailParam) { MailParam->account = ActualAccount; MailParam->mail = msgq; - MailParam->ThreadRunningEV = 0; + MailParam->ThreadRunningEV = nullptr; NewMailPopup.PluginData = MailParam; PUAddPopupT(&NewMailPopup); } @@ -671,7 +671,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D NewMailPopup.iSeconds = ActualAccount->NewMailN.PopupTime; NewMailPopup.PluginWindowProc = NewMailPopupProc; - NewMailPopup.PluginData = (void *)0; //multiple popups + NewMailPopup.PluginData = (void *)nullptr; //multiple popups mir_wstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NewMailPopup.lptzContactName)); mir_snwprintf(NewMailPopup.lptzText, TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); @@ -679,14 +679,14 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D } // destroy tray icon if no new mail - if ((MN->Real.SysTrayUC + MN->Virtual.SysTrayUC == 0) && (hDlg != NULL)) + if ((MN->Real.SysTrayUC + MN->Virtual.SysTrayUC == 0) && (hDlg != nullptr)) Shell_NotifyIcon(NIM_DELETE, &nid); // and remove the event if ((nflags & YAMN_ACC_CONT) && (!(nflags & YAMN_ACC_CONTNOEVENT)) && (MN->Real.UnSeen + MN->Virtual.UnSeen == 0)) pcli->pfnRemoveEvent(ActualAccount->hContact, ActualAccount->hContact); - if ((MN->Real.BrowserUC + MN->Virtual.BrowserUC == 0) && (hDlg != NULL)) { + if ((MN->Real.BrowserUC + MN->Virtual.BrowserUC == 0) && (hDlg != nullptr)) { if (!IsWindowVisible(hDlg) && !(nflags & YAMN_ACC_MSG)) PostMessage(hDlg, WM_DESTROY, 0, 0); //destroy window if no new mail and window is not visible if (nnflags & YAMN_ACC_MSG) //if no new mail and msg should be executed @@ -696,7 +696,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D } } else - if (hDlg != NULL) //else insert icon and set window if new mails + if (hDlg != nullptr) //else insert icon and set window if new mails { SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_SCROLL, 0, (LPARAM)0x7ffffff); @@ -706,7 +706,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D nid.uCallbackMessage = WM_YAMN_NOTIFYICON; mir_snwprintf(nid.szTip, L"%S %s", ActualAccount->Name, TranslateT("- new mail message(s)")); Shell_NotifyIcon(NIM_ADD, &nid); - SetTimer(hDlg, TIMER_FLASHING, 500, NULL); + SetTimer(hDlg, TIMER_FLASHING, 500, nullptr); } if (nflags & YAMN_ACC_MSG) //if no new mail and msg should be executed ShowWindow(hDlg, SW_SHOWNORMAL); @@ -719,20 +719,20 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D memset(&si, 0, sizeof(si)); si.cb = sizeof(si); - if (ActualAccount->NewMailN.App != NULL) { + if (ActualAccount->NewMailN.App != nullptr) { WCHAR *Command; - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6]; else Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6]; - if (Command != NULL) { + if (Command != nullptr) { mir_wstrcpy(Command, L"\""); mir_wstrcat(Command, ActualAccount->NewMailN.App); mir_wstrcat(Command, L"\" "); - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) mir_wstrcat(Command, ActualAccount->NewMailN.AppParam); - CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); + CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi); delete[] Command; } } @@ -759,7 +759,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D NoNewMailPopup.iSeconds = ActualAccount->NoNewMailN.PopupTime; NoNewMailPopup.PluginWindowProc = NoNewMailPopupProc; - NoNewMailPopup.PluginData = 0; //it's not new mail popup + NoNewMailPopup.PluginData = nullptr; //it's not new mail popup mir_wstrncpy(NoNewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NoNewMailPopup.lptzContactName)); if (MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC) @@ -800,9 +800,9 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa memcpy(MailParam, (PINT_PTR)PluginParam, sizeof(YAMN_MAILSHOWPARAM)); hContact = MailParam->account->hContact; Account = MailParam->account; - if (NULL != (MailParam->ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL))) { + if (nullptr != (MailParam->ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr))) { HANDLE NewThread = mir_forkthread(ShowEmailThread, MailParam); - if (NewThread != NULL) { + if (NewThread != nullptr) { CloseHandle(NewThread); } CloseHandle(MailParam->ThreadRunningEV); @@ -832,7 +832,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa switch (msg) { case WM_COMMAND: { - YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, Account, + YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, Account, (Account->NewMailN.Flags & ~YAMN_ACC_POP) | YAMN_ACC_MSGP | YAMN_ACC_MSG, (Account->NoNewMailN.Flags & ~YAMN_ACC_POP) | YAMN_ACC_MSGP | YAMN_ACC_MSG }; @@ -923,7 +923,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) { case WM_COMMAND: { - YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, 0 }; + YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, nullptr }; Param.nnflags = Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account Param.nnflags = Param.nnflags & ~YAMN_ACC_POP; @@ -1008,7 +1008,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l ULONGLONG MimeDateToFileTime(char *datein) { - char *day = 0, *month = 0, *year = 0, *time = 0, *shift = 0; + char *day = nullptr, *month = nullptr, *year = nullptr, *time = nullptr, *shift = nullptr; SYSTEMTIME st; ULONGLONG res = 0; int wShiftSeconds = TimeZone_ToLocal(0); @@ -1047,7 +1047,7 @@ ULONGLONG MimeDateToFileTime(char *datein) m[0] = 0; m++; if (s = strchr(m, ':')) { s[0] = 0; s++; } } - else s = 0; + else s = nullptr; st.wHour = atoi(h); st.wMinute = m ? atoi(m) : 0; st.wSecond = s ? atoi(s) : 0; @@ -1117,11 +1117,11 @@ void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateo int templen = 0; if (!willShowDate) willShowDate = (wTodayYear != st.wYear) || (wTodayMonth != st.wMonth) || (wTodayDay != st.wDay); if (willShowDate) { - templen = GetDateFormatW(localeID, (optDateTime&SHOWDATELONG) ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, dateout, lendateout - 2); + templen = GetDateFormatW(localeID, (optDateTime&SHOWDATELONG) ? DATE_LONGDATE : DATE_SHORTDATE, &st, nullptr, dateout, lendateout - 2); dateout[templen - 1] = ' '; } if (templen < (lendateout - 1)) { - GetTimeFormatW(localeID, (optDateTime&SHOWDATENOSECONDS) ? TIME_NOSECONDS : 0, &st, NULL, &dateout[templen], lendateout - templen - 1); + GetTimeFormatW(localeID, (optDateTime&SHOWDATENOSECONDS) ? TIME_NOSECONDS : 0, &st, nullptr, &dateout[templen], lendateout - templen - 1); } } } @@ -1154,11 +1154,11 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo switch ((int)lParamSort) { case 0: //From - if (Header1.FromNick == NULL) + if (Header1.FromNick == nullptr) str1 = Header1.From; else str1 = Header1.FromNick; - if (Header2.FromNick == NULL) + if (Header2.FromNick == nullptr) str2 = Header2.From; else str2 = Header2.FromNick; @@ -1167,11 +1167,11 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo if (bFrom) nResult = -nResult; break; case 1: //Subject - if (Header1.Subject == NULL) + if (Header1.Subject == nullptr) str1 = " "; else str1 = Header1.Subject; - if (Header2.Subject == NULL) + if (Header2.Subject == nullptr) str2 = " "; else str2 = Header2.Subject; @@ -1200,10 +1200,10 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo break; default: - if (Header1.Subject == NULL) str1 = " "; + if (Header1.Subject == nullptr) str1 = " "; else str1 = Header1.Subject; - if (Header2.Subject == NULL) str2 = " "; + if (Header2.Subject == nullptr) str2 = " "; else str2 = Header2.Subject; nResult = mir_strcmp(str1, str2); @@ -1262,8 +1262,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_INITDIALOG: { PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)lParam; - WCHAR *iHeaderW = NULL; - WCHAR *iValueW = NULL; + WCHAR *iHeaderW = nullptr; + WCHAR *iValueW = nullptr; int StrLen; HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS); mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc); @@ -1273,11 +1273,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR ListView_SetUnicodeFormat(hListView, TRUE); ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); - StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Header"), -1, NULL, 0); + StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Header"), -1, nullptr, 0); iHeaderW = new WCHAR[StrLen + 1]; MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Header"), -1, iHeaderW, StrLen); - StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Value"), -1, NULL, 0); + StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Value"), -1, nullptr, 0); iValueW = new WCHAR[StrLen + 1]; MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Value"), -1, iValueW, StrLen); @@ -1285,9 +1285,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR LVCOLUMN lvc1 = { LVCF_FMT | LVCF_TEXT | LVCF_WIDTH, LVCFMT_LEFT, 400, iValueW, 0, 0 }; SendMessage(hListView, LVM_INSERTCOLUMN, 0, (LPARAM)&lvc0); SendMessage(hListView, LVM_INSERTCOLUMN, 1, (LPARAM)&lvc1); - if (NULL != iHeaderW) + if (nullptr != iHeaderW) delete[] iHeaderW; - if (NULL != iValueW) + if (nullptr != iValueW) delete[] iValueW; //WindowList_Add(YAMNVar.MessageWnds,hDlg,NULL); @@ -1310,18 +1310,18 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR struct CMimeItem *Header; LVITEMW item; item.mask = LVIF_TEXT | LVIF_PARAM; - WCHAR *From = 0, *Subj = 0; - char *contentType = 0, *transEncoding = 0, *body = 0; //should not be delete[]-ed - for (Header = MailParam->mail->MailData->TranslatedHeader; Header != NULL; Header = Header->Next) { - WCHAR *str1 = 0; - WCHAR *str2 = 0; + WCHAR *From = nullptr, *Subj = nullptr; + char *contentType = nullptr, *transEncoding = nullptr, *body = nullptr; //should not be delete[]-ed + for (Header = MailParam->mail->MailData->TranslatedHeader; Header != nullptr; Header = Header->Next) { + WCHAR *str1 = nullptr; + WCHAR *str2 = nullptr; WCHAR str_nul[2] = { 0 }; if (!body) if (!_stricmp(Header->name, "Body")) { body = Header->value; continue; } if (!contentType) if (!_stricmp(Header->name, "Content-Type")) contentType = Header->value; if (!transEncoding) if (!_stricmp(Header->name, "Content-Transfer-Encoding")) transEncoding = Header->value; //ConvertCodedStringToUnicode(Header->name,&str1,MailParam->mail->MailData->CP,1); { - int streamsize = MultiByteToWideChar(20127, 0, Header->name, -1, NULL, 0); + int streamsize = MultiByteToWideChar(20127, 0, Header->name, -1, nullptr, 0); str1 = (WCHAR *)malloc(sizeof(WCHAR) * (streamsize + 1)); MultiByteToWideChar(20127, 0, Header->name, -1, str1, streamsize);//US-ASCII } @@ -1336,7 +1336,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR mir_wstrcpy(Subj, str2); } //if (!hasBody) if (!mir_strcmp(Header->name,"Body")) hasBody = true; - int count = 0; WCHAR **split = 0; + int count = 0; WCHAR **split = nullptr; int ofs = 0; while (str2[ofs]) { if ((str2[ofs] == 0x266A) || (str2[ofs] == 0x25D9) || (str2[ofs] == 0x25CB) || @@ -1368,11 +1368,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.pszText = str1; else { item.iItem++; - item.pszText = 0; + item.pszText = nullptr; } item.iItem = SendMessage(hListView, LVM_INSERTITEM, 0, (LPARAM)&item); item.iSubItem = 1; - item.pszText = str2 ? split[i] : 0; + item.pszText = str2 ? split[i] : nullptr; SendMessage(hListView, LVM_SETITEMTEXT, (WPARAM)item.iItem, (LPARAM)&item); } delete[] split; @@ -1383,8 +1383,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR free(str2); } if (body) { - WCHAR *bodyDecoded = 0; - char *localBody = 0; + WCHAR *bodyDecoded = nullptr; + char *localBody = nullptr; if (contentType) { if (!_strnicmp(contentType, "text", 4)) { if (transEncoding) { @@ -1401,8 +1401,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR } } else if (!_strnicmp(contentType, "multipart/", 10)) { - char *bondary = NULL; - if (NULL != (bondary = ExtractFromContentType(contentType, "boundary="))) { + char *bondary = nullptr; + if (nullptr != (bondary = ExtractFromContentType(contentType, "boundary="))) { bodyDecoded = ParseMultipartBody(body, bondary); delete[] bondary; } @@ -1426,12 +1426,12 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR struct CChangeContent Params = { MailParam->account->NewMailN.Flags | YAMN_ACC_MSGP, MailParam->account->NoNewMailN.Flags | YAMN_ACC_MSGP }; SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)MailParam->account, (LPARAM)&Params); } - else UpdateMails(NULL, MailParam->account, MailParam->account->NewMailN.Flags, MailParam->account->NoNewMailN.Flags); + else UpdateMails(nullptr, MailParam->account, MailParam->account->NewMailN.Flags, MailParam->account->NoNewMailN.Flags); } } ShowWindow(GetDlgItem(hDlg, IDC_SPLITTER), (MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED) ? SW_SHOW : SW_HIDE); ShowWindow(hEdit, (MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED) ? SW_SHOW : SW_HIDE); - WCHAR *title = 0; + WCHAR *title = nullptr; size_t size = (From ? mir_wstrlen(From) : 0) + (Subj ? mir_wstrlen(Subj) : 0) + 4; title = new WCHAR[size]; if (From && Subj) @@ -1456,7 +1456,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM) (lParam ? lParam : GetWindowLongPtr(hDlg, DWLP_USER)); - if (NULL == MailParam) + if (nullptr == MailParam) break; if ((HACCOUNT)wParam != MailParam->account) break; @@ -1550,9 +1550,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected")); AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel")); - int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL); + int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, nullptr); DestroyMenu(hMenu); if (nReturnCmd > 0) { int courRow = 0; @@ -1605,7 +1605,7 @@ void __cdecl ShowEmailThread(void *Param) //if (!BringWindowToTop(MyParam.mail->MsgWindow)) { if (!SetForegroundWindow(MyParam.mail->MsgWindow)) { SendMessage(MyParam.mail->MsgWindow, WM_DESTROY, 0, 0); - MyParam.mail->MsgWindow = 0; + MyParam.mail->MsgWindow = nullptr; goto CREADTEVIEWMESSAGEWINDOW; } else { @@ -1616,17 +1616,17 @@ void __cdecl ShowEmailThread(void *Param) } else { CREADTEVIEWMESSAGEWINDOW: - MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), NULL, DlgProcYAMNShowMessage, (LPARAM)&MyParam); + MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam); WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow, NULL); MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) { - if (MyParam.mail->MsgWindow == NULL || !IsDialogMessage(MyParam.mail->MsgWindow, &msg)) { /* Wine fix. */ + while (GetMessage(&msg, nullptr, 0, 0)) { + if (MyParam.mail->MsgWindow == nullptr || !IsDialogMessage(MyParam.mail->MsgWindow, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } } WindowList_Remove(YAMNVar.MessageWnds, MyParam.mail->MsgWindow); - MyParam.mail->MsgWindow = NULL; + MyParam.mail->MsgWindow = nullptr; } #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "ShowMessage:Decrementing \"using threads\" %x (account %x)\n", MyParam.account->UsingThreads, MyParam.account); @@ -1676,7 +1676,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hDlg, IDC_LISTMAILS, LVM_INSERTCOLUMN, (WPARAM)2, (LPARAM)&lvc2); SendDlgItemMessage(hDlg, IDC_LISTMAILS, LVM_INSERTCOLUMN, (WPARAM)3, (LPARAM)&lvc3); - if ((ActualAccount->NewMailN.App != NULL) && (mir_wstrlen(ActualAccount->NewMailN.App))) + if ((ActualAccount->NewMailN.App != nullptr) && (mir_wstrlen(ActualAccount->NewMailN.App))) EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), TRUE); else EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), FALSE); @@ -1691,7 +1691,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR GetStatusFcn(ActualAccount, accstatus); SetDlgItemText(hDlg, IDC_STSTATUS, accstatus); } - SetTimer(hDlg, TIMER_FLASHING, 500, NULL); + SetTimer(hDlg, TIMER_FLASHING, 500, nullptr); if (ActualAccount->hContact != NULL) pcli->pfnRemoveEvent(ActualAccount->hContact, (LPARAM)"yamn new mail message"); @@ -1709,7 +1709,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR Window_FreeIcon_IcoLib(hDlg); struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; ColInfo.mask = LVCF_WIDTH; if (ListView_GetColumn(GetDlgItem(hDlg, IDC_LISTMAILS), 0, &ColInfo)) @@ -1756,7 +1756,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DebugLog(SynchroFile, "MailBrowser:DESTROY:ActualAccountMsgsSO-write enter\n"); #endif //delete mails from queue, which are deleted from server (spam level 3 mails e.g.) - for (Parser = (HYAMNMAIL)ActualAccount->Mails; Parser != NULL; Parser = Parser->Next) { + for (Parser = (HYAMNMAIL)ActualAccount->Mails; Parser != nullptr; Parser = Parser->Next) { if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags, YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it { DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, Parser, 1); @@ -1790,13 +1790,13 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); - if (mwui == NULL) + if (mwui == nullptr) return 0; mwui->Seen = TRUE; } case WM_YAMN_CHANGESTATUS: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; if ((HACCOUNT)wParam != ActualAccount) @@ -1810,9 +1810,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_YAMN_CHANGECONTENT: { struct CUpdateMails UpdateParams; - BOOL ThisThreadWindow = (GetCurrentThreadId() == GetWindowThreadProcessId(hDlg, NULL)); + BOOL ThisThreadWindow = (GetCurrentThreadId() == GetWindowThreadProcessId(hDlg, nullptr)); - if (NULL == (UpdateParams.Copied = CreateEvent(NULL, FALSE, FALSE, NULL))) { + if (nullptr == (UpdateParams.Copied = CreateEvent(nullptr, FALSE, FALSE, nullptr))) { DestroyWindow(hDlg); return 0; } @@ -1851,7 +1851,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DebugLog(SynchroFile, "MailBrowser:UPDATEMAILS\n"); #endif - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) return 0; if ((HACCOUNT)wParam != ActualAccount) return 0; @@ -1867,7 +1867,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR } return 1; case WM_YAMN_STOPACCOUNT: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; if ((HACCOUNT)wParam != ActualAccount) break; @@ -1875,7 +1875,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR return 1; case WM_YAMN_NOTIFYICON: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (lParam) { @@ -1918,16 +1918,16 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.stateMask = 0xFFFFFFFF; ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item); HYAMNMAIL ActualMail = (HYAMNMAIL)item.lParam; - if (NULL != ActualMail) { + if (nullptr != ActualMail) { //ShowEmailThread - HANDLE hThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL); - if (hThreadRunningEV != NULL) { + HANDLE hThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (hThreadRunningEV != nullptr) { PYAMN_MAILSHOWPARAM MailParam = new YAMN_MAILSHOWPARAM; MailParam->account = GetWindowAccount(hDlg); MailParam->mail = ActualMail; MailParam->ThreadRunningEV = hThreadRunningEV; HANDLE NewThread = mir_forkthread(ShowEmailThread, MailParam); - if (NULL != NewThread) { + if (nullptr != NewThread) { //WaitForSingleObject(MailParam->ThreadRunningEV,INFINITE); CloseHandle(NewThread); } @@ -1940,7 +1940,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; case WM_SYSCOMMAND: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (wParam) { case SC_CLOSE: @@ -1950,7 +1950,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; case WM_COMMAND: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (LOWORD(wParam)) { @@ -1976,20 +1976,20 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR si.cb = sizeof(si); if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) { - if (ActualAccount->NewMailN.App != NULL) { + if (ActualAccount->NewMailN.App != nullptr) { WCHAR *Command; - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6]; else Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6]; - if (Command != NULL) { + if (Command != nullptr) { mir_wstrcpy(Command, L"\""); mir_wstrcat(Command, ActualAccount->NewMailN.App); mir_wstrcat(Command, L"\" "); - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) mir_wstrcat(Command, ActualAccount->NewMailN.AppParam); - CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); + CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi); delete[] Command; } } @@ -2008,8 +2008,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DWORD Total = 0; // we use event to signal, that running thread has all needed stack parameters copied - HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL); - if (ThreadRunningEV == NULL) + HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (ThreadRunningEV == nullptr) break; Items = ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTMAILS)); @@ -2025,7 +2025,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.stateMask = 0xFFFFFFFF; ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item); ActualMail = (HYAMNMAIL)item.lParam; - if (NULL == ActualMail) + if (nullptr == ActualMail) break; if (item.state & LVIS_SELECTED) { ActualMail->Flags |= YAMN_MSG_USERDELETE; //set to mail we are going to delete it @@ -2041,11 +2041,11 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR mir_snwprintf(DeleteMsg, TranslateT("Do you really want to delete %d selected mails?"), Total); if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING)) { - struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, NULL }; + struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, nullptr }; // Find if there's mail marked to delete, which was deleted before if (WAIT_OBJECT_0 == WaitToWriteFcn(ActualAccount->MessagesAccessSO)) { - for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != NULL; ActualMail = ActualMail->Next) { + for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != nullptr; ActualMail = ActualMail->Next) { if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted { DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, ActualMail, 1); @@ -2058,7 +2058,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR // Create new thread which deletes marked mails. HANDLE NewThread = mir_forkthread(ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr, &ParamToDeleteMails); - if (NewThread != NULL) { + if (NewThread != nullptr) { WaitForSingleObject(ThreadRunningEV, INFINITE); CloseHandle(NewThread); } @@ -2126,7 +2126,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; case LVN_COLUMNCLICK: - if (NULL != (ActualAccount = GetWindowAccount(hDlg))) { + if (nullptr != (ActualAccount = GetWindowAccount(hDlg))) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam; if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) { #ifdef DEBUG_SYNCHRO @@ -2159,7 +2159,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR LPNMLVCUSTOMDRAW cd = (LPNMLVCUSTOMDRAW)lParam; LONG_PTR PaintCode; - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (cd->nmcd.dwDrawStage) { @@ -2229,9 +2229,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected")); AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel")); - int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL); + int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, nullptr); DestroyMenu(hMenu); if (nReturnCmd > 0) { int courRow = 0; @@ -2280,7 +2280,7 @@ LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case WM_GETDLGCODE: { LPMSG lpmsg = (LPMSG)lParam; - if (lpmsg != NULL) { + if (lpmsg != nullptr) { if (lpmsg->message == WM_KEYDOWN && lpmsg->wParam == VK_RETURN) return DLGC_WANTALLKEYS; @@ -2340,32 +2340,32 @@ void __cdecl MailBrowser(void *Param) ReadDoneFcn(ActualAccount->AccountAccessSO); - if (NULL != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount))) + if (nullptr != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount))) WndFound = TRUE; - if ((hMailBrowser == NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { - hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), NULL, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); + if ((hMailBrowser == nullptr) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { + hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE); } - if (hMailBrowser != NULL) { + if (hMailBrowser != nullptr) { struct CChangeContent Params = { MyParam.nflags, MyParam.nnflags }; //if this thread created window, just post message to update mails SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)ActualAccount, (LPARAM)&Params); //we ensure this will do the thread who created the browser window } else - UpdateMails(NULL, ActualAccount, MyParam.nflags, MyParam.nnflags); //update mails without displaying or refreshing any window + UpdateMails(nullptr, ActualAccount, MyParam.nflags, MyParam.nnflags); //update mails without displaying or refreshing any window - if ((hMailBrowser != NULL) && !WndFound) { //we process message loop only for thread that created window - while (GetMessage(&msg, NULL, 0, 0)) { - if (hMailBrowser == NULL || !IsDialogMessage(hMailBrowser, &msg)) { /* Wine fix. */ + if ((hMailBrowser != nullptr) && !WndFound) { //we process message loop only for thread that created window + while (GetMessage(&msg, nullptr, 0, 0)) { + if (hMailBrowser == nullptr || !IsDialogMessage(hMailBrowser, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } } } - if ((!WndFound) && (ActualAccount->Plugin->Fcn != NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != NULL) && ActualAccount->AbleToWork) + if ((!WndFound) && (ActualAccount->Plugin->Fcn != nullptr) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != nullptr) && ActualAccount->AbleToWork) ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr(); } __finally { @@ -2381,11 +2381,11 @@ INT_PTR RunMailBrowserSvc(WPARAM wParam, LPARAM lParam) return 0; //an event for successfull copy parameters to which point a pointer in stack for new thread - HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL); - if (ThreadRunningEV != NULL) { + HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (ThreadRunningEV != nullptr) { Param->ThreadRunningEV = ThreadRunningEV; HANDLE NewThread = mir_forkthread(MailBrowser, Param); - if (NewThread != NULL) { + if (NewThread != nullptr) { WaitForSingleObject(ThreadRunningEV, INFINITE); CloseHandle(NewThread); } diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index 06644d78ef..0736b3d77d 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -97,8 +97,8 @@ void DebugLog(HANDLE File,const char *fmt,...) str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
EnterCriticalSection(&FileAccessCS);
- WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL);
- WriteFile(File,str,(DWORD)mir_strlen(str),&Written,NULL);
+ WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,nullptr);
+ WriteFile(File,str,(DWORD)mir_strlen(str),&Written,nullptr);
LeaveCriticalSection(&FileAccessCS);
free(str);
}
@@ -118,8 +118,8 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...) str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
EnterCriticalSection(&FileAccessCS);
- WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL);
- WriteFile(File,str,(DWORD)mir_wstrlen(str)*sizeof(WCHAR),&Written,NULL);
+ WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,nullptr);
+ WriteFile(File,str,(DWORD)mir_wstrlen(str)*sizeof(WCHAR),&Written,nullptr);
LeaveCriticalSection(&FileAccessCS);
free(str);
}
diff --git a/plugins/YAMN/src/filterplugin.cpp b/plugins/YAMN/src/filterplugin.cpp index 884330ed4d..5b0020eb66 100644 --- a/plugins/YAMN/src/filterplugin.cpp +++ b/plugins/YAMN/src/filterplugin.cpp @@ -9,7 +9,7 @@ //--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin=NULL;
+PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin=nullptr;
INT_PTR RegisterFilterPluginSvc(WPARAM,LPARAM);
@@ -52,14 +52,14 @@ INT_PTR RegisterFilterPluginSvc(WPARAM wParam,LPARAM lParam) if (lParam != YAMN_FILTERREGISTRATIONVERSION)
return 0;
- if ((Registration->Name==NULL) || (Registration->Ver==NULL))
+ if ((Registration->Name==nullptr) || (Registration->Ver==nullptr))
return NULL;
- if (NULL==(Plugin=new YAMN_FILTERPLUGIN))
+ if (nullptr==(Plugin=new YAMN_FILTERPLUGIN))
return NULL;
Plugin->PluginInfo=Registration;
- Plugin->FilterFcn=NULL;
+ Plugin->FilterFcn=nullptr;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"::: YAMN- new filter registered: %0x (%s) :::\n",Plugin,Registration->Name);
@@ -78,19 +78,19 @@ INT_PTR UnregisterFilterPlugin(HYAMNFILTERPLUGIN Plugin) }
else
{
- for (Parser=FirstFilterPlugin;(Parser->Next != NULL) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
- if (Parser->Next != NULL)
+ for (Parser=FirstFilterPlugin;(Parser->Next != nullptr) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
+ if (Parser->Next != nullptr)
{
Found=Parser->Next;
Parser->Next=Parser->Next->Next;
}
else
- Found=NULL;
+ Found=nullptr;
}
- if (Found != NULL)
+ if (Found != nullptr)
{
- if (Plugin->FilterFcn->UnLoadFcn != NULL)
- Plugin->FilterFcn->UnLoadFcn((void *)0);
+ if (Plugin->FilterFcn->UnLoadFcn != nullptr)
+ Plugin->FilterFcn->UnLoadFcn((void *)nullptr);
delete Found->Plugin;
delete Found;
@@ -117,7 +117,7 @@ INT_PTR UnregisterFilterPlugins() mir_cslock lck(PluginRegCS);
// We remove protocols from the protocol list
- while(FirstFilterPlugin != NULL)
+ while(FirstFilterPlugin != nullptr)
UnregisterFilterPlugin(FirstFilterPlugin->Plugin);
return 1;
}
@@ -128,7 +128,7 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance if (YAMNFilterFcnVer != YAMN_FILTERIMPORTFCNVERSION)
return 0;
- if (YAMNFilterFcn==NULL)
+ if (YAMNFilterFcn==nullptr)
return 0;
#ifdef DEBUG_SYNCHRO
@@ -139,8 +139,8 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance mir_cslock lck(PluginRegCS);
// We add protocol to the protocol list
- for (Previous = NULL, Parser = FirstFilterPlugin; Parser != NULL && Parser->Next != NULL && Parser->Plugin->Importance <= Importance; Previous = Parser, Parser = Parser->Next);
- if (Previous==NULL) //insert to the beginnig of queue
+ for (Previous = nullptr, Parser = FirstFilterPlugin; Parser != nullptr && Parser->Next != nullptr && Parser->Plugin->Importance <= Importance; Previous = Parser, Parser = Parser->Next);
+ if (Previous==nullptr) //insert to the beginnig of queue
{
FirstFilterPlugin=new YAMN_FILTERPLUGINQUEUE;
FirstFilterPlugin->Plugin=Plugin;
@@ -170,9 +170,9 @@ INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FilterMail:ActualAccountMsgsSO-write enter\n");
#endif
- for (ActualPlugin=FirstFilterPlugin;ActualPlugin != NULL;ActualPlugin=ActualPlugin->Next)
+ for (ActualPlugin=FirstFilterPlugin;ActualPlugin != nullptr;ActualPlugin=ActualPlugin->Next)
{
- if (ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr != NULL)
+ if (ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr != nullptr)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tFiltering Mail, running plugin %0x to filter mail\n",ActualPlugin->Plugin);
diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp index d5c49e7ebe..6a767b7a17 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -209,7 +209,7 @@ int GetCharsetFromString(char *input,size_t size) char *pin=input;
char *pout,*parser;
- if ((size<1) || (parser=pout=new char[size+1])==NULL)
+ if ((size<1) || (parser=pout=new char[size+1])==nullptr)
return -1;
while((*pin != 0) && (pin-input< (INT_PTR)size))
{
@@ -405,17 +405,17 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out) break;
}
if (Index==-1)
- streamlen=MultiByteToWideChar(cp,0,stream,-1,NULL,0);
+ streamlen=MultiByteToWideChar(cp,0,stream,-1,nullptr,0);
else
- streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,NULL,0);
+ streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,nullptr,0);
- if (*out != NULL)
+ if (*out != nullptr)
outlen=mir_wstrlen(*out);
else
outlen=0;
temp=new WCHAR[streamlen+outlen+1];
- if (*out != NULL)
+ if (*out != nullptr)
{
for (dest=temp;*src != (WCHAR)0;src++,dest++) //copy old string from *out to temp
*dest=*src;
@@ -444,11 +444,11 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) char *start=stream,*finder,*finderend;
char Encoding=0;
- if (stream==NULL)
+ if (stream==nullptr)
return;
while(WS(start)) start++;
- WCHAR *tempstore=0;
+ WCHAR *tempstore=nullptr;
if (!ConvertStringToUnicode(stream,cp,&tempstore))return;
size_t tempstoreLength = mir_wstrlen(tempstore);
@@ -477,7 +477,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) if (Encoding != 0)
{
int size = 0,codeend;
- char *pcodeend = 0;
+ char *pcodeend = nullptr;
finder=finderend+2;
if (CODED(finder))
@@ -530,14 +530,14 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) DecodedResult[len+1]=0;
finderend++;
}
- WCHAR *oneWord=0;
+ WCHAR *oneWord=nullptr;
if (ConvertStringToUnicode(DecodedResult,cp,&oneWord)) {
size_t len = mir_wstrlen(oneWord);
memcpy(&tempstore[outind],oneWord,len*sizeof(WCHAR));
outind += len;
}
delete oneWord;
- oneWord = 0;
+ oneWord = nullptr;
delete[] DecodedResult;
start = finderend;
} else if (!EOS(start)) start++;
diff --git a/plugins/YAMN/src/mails/mails.cpp b/plugins/YAMN/src/mails/mails.cpp index 5ae21b95ef..c8baf41422 100644 --- a/plugins/YAMN/src/mails/mails.cpp +++ b/plugins/YAMN/src/mails/mails.cpp @@ -126,21 +126,21 @@ INT_PTR CreateAccountMailSvc(WPARAM wParam,LPARAM lParam) if (MailVersion != YAMN_MAILVERSION)
return NULL;
- if (Account->Plugin != NULL)
+ if (Account->Plugin != nullptr)
{
- if (Account->Plugin->MailFcn->NewMailFcnPtr != NULL)
+ if (Account->Plugin->MailFcn->NewMailFcnPtr != nullptr)
{
//Let plugin create its own structure, which can be derived from CAccount structure
- if (NULL==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
+ if (nullptr==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
return NULL;
}
else
{
//We suggest plugin uses standard CAccount structure, so we create it
- if (NULL==(NewMail=new YAMNMAIL))
+ if (nullptr==(NewMail=new YAMNMAIL))
//If not created successfully
return NULL;
- NewMail->MailData=NULL;
+ NewMail->MailData=nullptr;
}
//Init every members of structure, used by YAMN
return (INT_PTR)NewMail;
@@ -154,29 +154,29 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam) HYAMNMAIL OldMail=(HYAMNMAIL)lParam;
struct CMimeItem *TH;
- if (Plugin->MailFcn != NULL) {
- if (Plugin->MailFcn->DeleteMailFcnPtr != NULL) {
+ if (Plugin->MailFcn != nullptr) {
+ if (Plugin->MailFcn->DeleteMailFcnPtr != nullptr) {
//Let plugin delete its own CMimeMsgQueue derived structure
Plugin->MailFcn->DeleteMailFcnPtr(OldMail);
return 1;
}
}
- if (OldMail->MailData != NULL) {
- if (OldMail->MailData->Body != NULL)
+ if (OldMail->MailData != nullptr) {
+ if (OldMail->MailData->Body != nullptr)
delete[] OldMail->MailData->Body;
- if ((TH=OldMail->MailData->TranslatedHeader) != NULL)
- for (;OldMail->MailData->TranslatedHeader != NULL;) {
+ if ((TH=OldMail->MailData->TranslatedHeader) != nullptr)
+ for (;OldMail->MailData->TranslatedHeader != nullptr;) {
TH=TH->Next;
- if (OldMail->MailData->TranslatedHeader->name != NULL)
+ if (OldMail->MailData->TranslatedHeader->name != nullptr)
delete[] OldMail->MailData->TranslatedHeader->name;
- if (OldMail->MailData->TranslatedHeader->value != NULL)
+ if (OldMail->MailData->TranslatedHeader->value != nullptr)
delete[] OldMail->MailData->TranslatedHeader->value;
delete OldMail->MailData->TranslatedHeader;
OldMail->MailData->TranslatedHeader=TH;
}
delete OldMail->MailData;
}
- if (OldMail->ID != NULL)
+ if (OldMail->ID != nullptr)
delete[] OldMail->ID;
delete OldMail; //consider mail as standard HYAMNMAIL, not initialized before and use its own destructor
@@ -187,7 +187,7 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam) void WINAPI AppendQueueFcn(HYAMNMAIL first,HYAMNMAIL second)
{
HYAMNMAIL Finder=first;
- while(Finder->Next != NULL) Finder=Finder->Next;
+ while(Finder->Next != nullptr) Finder=Finder->Next;
Finder->Next=second;
}
@@ -227,12 +227,12 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R {
HYAMNMAIL Finder,FinderPrev;
HYAMNMAIL Parser,ParserPrev;
- HYAMNMAIL RemovedOldParser =NULL;
- HYAMNMAIL RemovedNewParser =NULL;
- if (RemovedOld != NULL) *RemovedOld=NULL;
- if (RemovedNew != NULL) *RemovedNew=NULL;
+ HYAMNMAIL RemovedOldParser =nullptr;
+ HYAMNMAIL RemovedNewParser =nullptr;
+ if (RemovedOld != nullptr) *RemovedOld=nullptr;
+ if (RemovedNew != nullptr) *RemovedNew=nullptr;
- for (FinderPrev=NULL,Finder=*OldQueue;Finder != NULL;)
+ for (FinderPrev=nullptr,Finder=*OldQueue;Finder != nullptr;)
{
if (Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
{
@@ -240,18 +240,18 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R Finder=Finder->Next; //get next message in old queue for testing
continue;
}
- for (ParserPrev=NULL,Parser=*NewQueue;Parser != NULL;ParserPrev=Parser,Parser=Parser->Next)
+ for (ParserPrev=nullptr,Parser=*NewQueue;Parser != nullptr;ParserPrev=Parser,Parser=Parser->Next)
{
if (Parser->Flags & YAMN_MSG_DELETED)
continue;
- if (Parser->ID==NULL) //simply ignore the message, that has not filled its ID
+ if (Parser->ID==nullptr) //simply ignore the message, that has not filled its ID
continue;
if (0==mir_strcmp(Parser->ID,Finder->ID)) //search for equal message in new queue
break;
}
- if (Parser != NULL) //found equal message in new queue
+ if (Parser != nullptr) //found equal message in new queue
{
if (Parser==*NewQueue)
*NewQueue=(*NewQueue)->Next;
@@ -259,16 +259,16 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R ParserPrev->Next=Parser->Next;
Finder->Number=Parser->Number; //rewrite the number of current message in old queue
- if (RemovedNew==NULL) //delete from new queue
+ if (RemovedNew==nullptr) //delete from new queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Parser);
else //or move to RemovedNew
{
- if (RemovedNewParser==NULL) //if it is first mail removed from NewQueue
+ if (RemovedNewParser==nullptr) //if it is first mail removed from NewQueue
*RemovedNew=Parser; //set RemovedNew queue to point to first message in removed queue
else
RemovedNewParser->Next=Parser; //else don't forget to show to next message in RemovedNew queue
RemovedNewParser=Parser; //follow RemovedNew queue
- RemovedNewParser->Next=NULL;
+ RemovedNewParser->Next=nullptr;
}
FinderPrev=Finder;
Finder=Finder->Next; //get next message in old queue for testing
@@ -278,32 +278,32 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R if (Finder==*OldQueue) //if we are at the first item in OldQueue
{
*OldQueue=(*OldQueue)->Next; //set OldQueue to next item
- if (RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==nullptr) //delete from old queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Finder);
else //or move to RemovedOld
{
- if (RemovedOldParser==NULL) //if it is first mail removed from OldQueue
+ if (RemovedOldParser==nullptr) //if it is first mail removed from OldQueue
*RemovedOld=Finder; //set RemovedOld queue to point to first message in removed queue
else
RemovedOldParser->Next=Finder; //else don't forget to show to next message in RemovedNew queue
RemovedOldParser=Finder; //follow RemovedOld queue
- RemovedOldParser->Next=NULL;
+ RemovedOldParser->Next=nullptr;
}
Finder=*OldQueue;
}
else
{
FinderPrev->Next=Finder->Next;
- if (RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==nullptr) //delete from old queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Finder);
else //or move to RemovedOld
{
- if (RemovedOldParser==NULL) //if it is first mail removed from OldQueue
+ if (RemovedOldParser==nullptr) //if it is first mail removed from OldQueue
*RemovedOld=Finder; //set RemovedOld queue to point to first message in removed queue
else
RemovedOldParser->Next=Finder; //else don't forget to show to next message in RemovedNew queue
RemovedOldParser=Finder; //follow RemovedOld queue
- RemovedOldParser->Next=NULL;
+ RemovedOldParser->Next=nullptr;
}
Finder=FinderPrev->Next;
}
@@ -314,7 +314,7 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From)
{
HYAMNMAIL Temp;
- while(From != NULL)
+ while(From != nullptr)
{
Temp=From;
From=From->Next;
@@ -341,7 +341,7 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0 Parser=Which->Next;
}
if (mode)
- for (;Parser != NULL;Parser=Parser->Next)
+ for (;Parser != nullptr;Parser=Parser->Next)
if (Parser->Number>Number) Parser->Number--;
}
@@ -349,7 +349,7 @@ void DeleteMessagesFromQueue(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0) {
HYAMNMAIL Parser;
- for (Parser=Which;Parser != NULL;Parser=Parser->Next)
+ for (Parser=Which;Parser != nullptr;Parser=Parser->Next)
DeleteMessageFromQueueFcn(From,Parser,mode);
}
@@ -357,7 +357,7 @@ HYAMNMAIL WINAPI FindMessageByIDFcn(HYAMNMAIL From,char *ID) {
HYAMNMAIL Browser;
- for (Browser=From;Browser != NULL;Browser=Browser->Next)
+ for (Browser=From;Browser != nullptr;Browser=Browser->Next)
if (0==mir_strcmp(Browser->ID,ID))
break;
return Browser;
@@ -369,7 +369,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) {
char *finder=stream;
char *prev1,*prev2,*prev3;
- struct CMimeItem *Item=NULL;
+ struct CMimeItem *Item=nullptr;
while(finder<=(stream+len))
{
@@ -399,9 +399,9 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) while(!ENDLINE(finder) && !EOS(finder)) finder++;
}while(ENDLINEWS(finder));
- if (Item != NULL)
+ if (Item != nullptr)
{
- if (NULL==(Item->Next=new struct CMimeItem))
+ if (nullptr==(Item->Next=new struct CMimeItem))
break;
Item=Item->Next;
}
@@ -411,7 +411,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) *head = Item;
}
- Item->Next=NULL;
+ Item->Next=nullptr;
Item->name=new char [prev2-prev1+1];
mir_strncpy(Item->name,prev1,prev2-prev1+1);
Item->value=new char [finder-prev3+1];
@@ -431,9 +431,9 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) if (ENDLINE(finder))finder--;
prev2 = finder;
if (prev2>prev1) { // yes, we have body
- if (NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
+ if (nullptr==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
Item=Item->Next;
- Item->Next=NULL;//just in case;
+ Item->Next=nullptr;//just in case;
Item->name=new char[5]; strncpy(Item->name,"Body",5);
Item->value=new char [prev2-prev1];
mir_strncpy(Item->value,prev1,prev2-prev1-1);
@@ -445,22 +445,22 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) }
catch(...)
{
- MessageBoxA(NULL,"Translate header error","",0);
+ MessageBoxA(nullptr,"Translate header error","",0);
}
}
HYAMNMAIL WINAPI CreateNewDeleteQueueFcn(HYAMNMAIL From)
{
- HYAMNMAIL FirstMail,Browser = 0;
+ HYAMNMAIL FirstMail,Browser = nullptr;
- for (FirstMail=NULL;From != NULL;From=From->Next)
+ for (FirstMail=nullptr;From != nullptr;From=From->Next)
{
if ((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
{
- if (FirstMail==NULL)
+ if (FirstMail==nullptr)
{
FirstMail=Browser=new YAMNMAIL;
- if (FirstMail==NULL)
+ if (FirstMail==nullptr)
break;
}
else
@@ -481,7 +481,7 @@ void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNo {
HYAMNMAIL msgq;
- for (msgq=(HYAMNMAIL)From;msgq != NULL;msgq=msgq->Next)
+ for (msgq=(HYAMNMAIL)From;msgq != nullptr;msgq=msgq->Next)
{
if ((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
{
diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index c768ae141f..076e139c40 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -69,7 +69,7 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) {
char *dst;
- if (dest==NULL)
+ if (dest==nullptr)
return;
if (srcstart>=srcend)
return;
@@ -83,9 +83,9 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) if (srcstart>=srcend)
return;
- if (NULL != *dest)
+ if (nullptr != *dest)
delete[] *dest;
- if (NULL==(*dest=new char[srcend-srcstart+1]))
+ if (nullptr==(*dest=new char[srcend-srcstart+1]))
return;
dst=*dest;
@@ -106,9 +106,9 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick)
{
- if (finder==NULL)
+ if (finder==nullptr)
{
- *storeto=*storetonick=NULL;
+ *storeto=*storetonick=nullptr;
return;
}
while(WS(finder)) finder++;
@@ -163,9 +163,9 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) void ExtractStringFromLine(char *finder,char **storeto)
{
- if (finder==NULL)
+ if (finder==nullptr)
{
- *storeto=NULL;
+ *storeto=nullptr;
return;
}
while(WS(finder)) finder++;
@@ -186,9 +186,9 @@ char *ExtractFromContentType(char *ContentType,char *value) char *lowered = _strdup(ContentType);
ToLower(lowered);
char *finder=strstr(lowered,value);
- if (finder==NULL) {
+ if (finder==nullptr) {
free (lowered);
- return NULL;
+ return nullptr;
}
finder = finder-lowered+ContentType;
free (lowered);
@@ -199,7 +199,7 @@ char *ExtractFromContentType(char *ContentType,char *value) temp=finder-1;
while((temp>ContentType) && WS(temp)) temp--; //now we have to find, if the word "Charset=" is located after ';' like "; Charset="
if (*temp != ';' && !ENDLINE(temp) && temp != ContentType)
- return NULL;
+ return nullptr;
finder=finder+mir_strlen(value); //jump over value string
while(WS(finder)) finder++; //jump over whitespaces
@@ -211,8 +211,8 @@ char *ExtractFromContentType(char *ContentType,char *value) finder++;
if (*temp=='\"') temp--;
}
- if (NULL==(CopiedString=new char[++temp-finder+1]))
- return NULL;
+ if (nullptr==(CopiedString=new char[++temp-finder+1]))
+ return nullptr;
for (copier=CopiedString;finder != temp;*copier++=*finder++); //copy string
*copier=0; //and end it with zero character
@@ -221,13 +221,13 @@ char *ExtractFromContentType(char *ContentType,char *value) void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
{
- for (;items != NULL;items=items->Next)
+ for (;items != nullptr;items=items->Next)
{
//at the start of line
//MessageBox(NULL,items->value,items->name,0);
if (0==_strnicmp(items->name,"From",4))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting from>");
@@ -239,7 +239,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Return-Path",11))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting return-path>");
@@ -251,7 +251,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Subject",7))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting subject>");
@@ -263,7 +263,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Body",4))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting body>");
@@ -275,7 +275,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Date",4))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting date>");
@@ -287,10 +287,10 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Content-Type",12))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
- char *ContentType=NULL,*CharSetStr;
+ char *ContentType=nullptr,*CharSetStr;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting Content-Type>");
#endif
@@ -299,7 +299,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
ToLower(ContentType);
- if (NULL != (CharSetStr=ExtractFromContentType(ContentType,"charset=")))
+ if (nullptr != (CharSetStr=ExtractFromContentType(ContentType,"charset=")))
{
head->CP=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr));
delete[] CharSetStr;
@@ -308,7 +308,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Importance",10))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting importance>");
@@ -328,7 +328,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"X-Priority",10))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<X-Priority>");
@@ -424,40 +424,40 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head) void DeleteShortHeaderContent(struct CShortHeader *head)
{
- if (head->From != NULL) delete[] head->From;
- if (head->FromNick != NULL) delete[] head->FromNick;
- if (head->ReturnPath != NULL) delete[] head->ReturnPath;
- if (head->ReturnPathNick != NULL) delete[] head->ReturnPathNick;
- if (head->Subject != NULL) delete[] head->Subject;
- if (head->Date != NULL) delete[] head->Date;
- if (head->To != NULL) DeleteShortNames(head->To);
- if (head->Cc != NULL) DeleteShortNames(head->Cc);
- if (head->Bcc != NULL) DeleteShortNames(head->Bcc);
- if (head->Body != NULL) delete[] head->Body;
+ if (head->From != nullptr) delete[] head->From;
+ if (head->FromNick != nullptr) delete[] head->FromNick;
+ if (head->ReturnPath != nullptr) delete[] head->ReturnPath;
+ if (head->ReturnPathNick != nullptr) delete[] head->ReturnPathNick;
+ if (head->Subject != nullptr) delete[] head->Subject;
+ if (head->Date != nullptr) delete[] head->Date;
+ if (head->To != nullptr) DeleteShortNames(head->To);
+ if (head->Cc != nullptr) DeleteShortNames(head->Cc);
+ if (head->Bcc != nullptr) DeleteShortNames(head->Bcc);
+ if (head->Body != nullptr) delete[] head->Body;
}
void DeleteHeaderContent(struct CHeader *head)
{
- if (head->From != NULL) delete[] head->From;
- if (head->FromNick != NULL) delete[] head->FromNick;
- if (head->ReturnPath != NULL) delete[] head->ReturnPath;
- if (head->ReturnPathNick != NULL) delete[] head->ReturnPathNick;
- if (head->Subject != NULL) delete[] head->Subject;
- if (head->Date != NULL) delete[] head->Date;
- if (head->Body != NULL) delete[] head->Body;
- if (head->To != NULL) DeleteNames(head->To);
- if (head->Cc != NULL) DeleteNames(head->Cc);
- if (head->Bcc != NULL) DeleteNames(head->Bcc);
+ if (head->From != nullptr) delete[] head->From;
+ if (head->FromNick != nullptr) delete[] head->FromNick;
+ if (head->ReturnPath != nullptr) delete[] head->ReturnPath;
+ if (head->ReturnPathNick != nullptr) delete[] head->ReturnPathNick;
+ if (head->Subject != nullptr) delete[] head->Subject;
+ if (head->Date != nullptr) delete[] head->Date;
+ if (head->Body != nullptr) delete[] head->Body;
+ if (head->To != nullptr) DeleteNames(head->To);
+ if (head->Cc != nullptr) DeleteNames(head->Cc);
+ if (head->Bcc != nullptr) DeleteNames(head->Bcc);
}
void DeleteNames(PYAMN_MIMENAMES Names)
{
PYAMN_MIMENAMES Parser=Names,Old;
- for (;Parser != NULL;Parser=Parser->Next)
+ for (;Parser != nullptr;Parser=Parser->Next)
{
- if (Parser->Value != NULL)
+ if (Parser->Value != nullptr)
delete[] Parser->Value;
- if (Parser->ValueNick != NULL)
+ if (Parser->ValueNick != nullptr)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -468,11 +468,11 @@ void DeleteNames(PYAMN_MIMENAMES Names) void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
{
PYAMN_MIMESHORTNAMES Parser=Names,Old;
- for (;Parser != NULL;Parser=Parser->Next)
+ for (;Parser != nullptr;Parser=Parser->Next)
{
- if (Parser->Value != NULL)
+ if (Parser->Value != nullptr)
delete[] Parser->Value;
- if (Parser->ValueNick != NULL)
+ if (Parser->ValueNick != nullptr)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -579,7 +579,7 @@ void ParseAPart(APartDataType *data) }
catch(...)
{
- MessageBox(NULL, TranslateT("Translate header error"), L"", 0);
+ MessageBox(nullptr, TranslateT("Translate header error"), L"", 0);
}
if (data->body) data->bodyLen = (int)mir_strlen(data->body);
}
@@ -616,14 +616,14 @@ WCHAR *ParseMultipartBody(char *src, char *bond) }
if (partData[i].ContType) {
char *CharSetStr;
- if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
+ if (nullptr != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
partData[i].CodePage=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr));
delete[] CharSetStr;
}
}
if (partData[i].ContType && !_strnicmp(partData[i].ContType,"text",4)) {
- char *localBody=0;
+ char *localBody=nullptr;
switch (partData[i].TransEncType) {
case TE_BASE64:
{
@@ -642,8 +642,8 @@ WCHAR *ParseMultipartBody(char *src, char *bond) if (localBody) delete[] localBody;
} else if (partData[i].ContType && !_strnicmp(partData[i].ContType,"multipart/",10)) {
//Multipart in mulitipart recursive? should be SPAM. Ah well
- char *bondary=NULL;
- if (NULL != (bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
+ char *bondary=nullptr;
+ if (nullptr != (bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
{
partData[i].wBody = ParseMultipartBody(partData[i].body,bondary);
delete[] bondary;
@@ -674,12 +674,12 @@ FailBackRaw: mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", partData[i].ContType);
linesize = mir_strlen(infoline);
partData[i].ContType=CharSetStr+1;
- if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) {
+ if (nullptr != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) {
mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", CharSetStr);
linesize = mir_strlen(infoline);
delete[] CharSetStr;
}
- if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
+ if (nullptr != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; \"%s\"", CharSetStr);
linesize = mir_strlen(infoline);
delete[] CharSetStr;
@@ -692,7 +692,7 @@ FailBackRaw: }
mir_snprintf(infoline + linesize, _countof(infoline) - linesize, ".\r\n");
{
- WCHAR *temp=0;
+ WCHAR *temp=nullptr;
dest[destpos] = dest[destpos+1] = dest[destpos+2] = 0x2022; // bullet;
destpos += 3;
ConvertStringToUnicode(infoline,CP_ACP,&temp);
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 9264edaf70..0a83969f8e 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -52,9 +52,9 @@ HANDLE hTTButton; UINT SecTimer; -HGENMENU hMenuItemMain = 0; -HGENMENU hMenuItemCont = 0; -HGENMENU hMenuItemContApp = 0; +HGENMENU hMenuItemMain = nullptr; +HGENMENU hMenuItemCont = nullptr; +HGENMENU hMenuItemContApp = nullptr; #define FIXED_TAB_SIZE 100 // default value for fixed width tabs @@ -68,13 +68,13 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath) VARSW ptszNewPath( L"%miranda_userdata%"); SHFILEOPSTRUCT file_op = { - NULL, + nullptr, FO_MOVE, tszOldPath, ptszNewPath, FOF_NOERRORUI | FOF_NOCONFIRMATION | FOF_SILENT, false, - 0, + nullptr, L"" }; SHFileOperation(&file_op); @@ -188,14 +188,14 @@ void LoadIcons() HANDLE WINAPI g_GetIconHandle( int idx ) { if ( idx >= _countof(iconList)) - return NULL; + return nullptr; return iconList[idx].hIcolib; } HICON WINAPI g_LoadIconEx( int idx, bool big ) { if ( idx >= _countof(iconList)) - return NULL; + return nullptr; return IcoLib_GetIcon(iconList[idx].szName, big); } @@ -209,7 +209,7 @@ static void LoadPlugins() wchar_t szSearchPath[MAX_PATH]; mir_snwprintf(szSearchPath, L"%s\\Plugins\\YAMN\\*.dll", szMirandaDir); - hDllPlugins = NULL; + hDllPlugins = nullptr; WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFile(szSearchPath, &fd); @@ -217,7 +217,7 @@ static void LoadPlugins() do { //rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too wchar_t *dot = wcsrchr(fd.cFileName, '.'); - if (dot == NULL ) + if (dot == nullptr ) continue; // we have a dot @@ -231,22 +231,22 @@ static void LoadPlugins() wchar_t szPluginPath[MAX_PATH]; mir_snwprintf(szPluginPath, L"%s\\Plugins\\YAMN\\%s", szMirandaDir, fd.cFileName); HINSTANCE hDll = LoadLibrary(szPluginPath); - if (hDll == NULL) + if (hDll == nullptr) continue; LOADFILTERFCN LoadFilter = (LOADFILTERFCN) GetProcAddress(hDll, "LoadFilter"); - if (NULL == LoadFilter) { + if (nullptr == LoadFilter) { FreeLibrary(hDll); - hDll = NULL; + hDll = nullptr; continue; } if (!LoadFilter(GetFcnPtrSvc)) { FreeLibrary(hDll); - hDll = NULL; + hDll = nullptr; } - if (hDll != NULL) { + if (hDll != nullptr) { hDllPlugins = (HINSTANCE *)realloc(hDllPlugins, (iDllPlugins+1)*sizeof(HINSTANCE)); hDllPlugins[iDllPlugins++] = hDll; } @@ -270,7 +270,7 @@ extern "C" int __declspec(dllexport) Load(void) // retrieve the current profile name Profile_GetNameW(_countof(ProfileName), ProfileName); wchar_t *fc = wcsrchr(ProfileName, '.'); - if ( fc != NULL ) *fc = 0; + if ( fc != nullptr ) *fc = 0; // we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file GetProfileDirectory(UserDirectory, _countof(UserDirectory)); @@ -290,11 +290,11 @@ extern "C" int __declspec(dllexport) Load(void) pd.type = PROTOTYPE_VIRTUAL; Proto_RegisterModule(&pd); - if (NULL == (NoWriterEV = CreateEvent(NULL, TRUE, TRUE, NULL))) + if (nullptr == (NoWriterEV = CreateEvent(nullptr, TRUE, TRUE, nullptr))) return 1; - if (NULL == (WriteToFileEV = CreateEvent(NULL, FALSE, FALSE, NULL))) + if (nullptr == (WriteToFileEV = CreateEvent(nullptr, FALSE, FALSE, nullptr))) return 1; - if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (nullptr == (ExitEV = CreateEvent(nullptr, TRUE, FALSE, nullptr))) return 1; PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0); @@ -315,8 +315,8 @@ extern "C" int __declspec(dllexport) Load(void) YAMNVar.NewMailAccountWnd = WindowList_Create(); YAMNVar.Shutdown = FALSE; - hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); - hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); + hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); + hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE); #ifdef _DEBUG InitDebug(); @@ -341,7 +341,7 @@ extern "C" int __declspec(dllexport) Load(void) Hotkey_Register(&hkd); //Create thread that will be executed every second - if (!(SecTimer = SetTimer(NULL, 0, 1000, TimerProc))) + if (!(SecTimer = SetTimer(nullptr, 0, 1000, TimerProc))) return 1; return 0; @@ -351,16 +351,16 @@ extern "C" int __declspec(dllexport) Load(void) static void UnloadPlugins() { - if (hDllPlugins == NULL) + if (hDllPlugins == nullptr) return; for (int i = iDllPlugins - 1; i >= 0; i --) { if (FreeLibrary(hDllPlugins[i])) { - hDllPlugins[i] = NULL; //for safety + hDllPlugins[i] = nullptr; //for safety iDllPlugins --; } } free((void *)hDllPlugins); - hDllPlugins = NULL; + hDllPlugins = nullptr; } extern "C" int __declspec(dllexport) Unload(void) diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index 24485fe871..7e4227ad91 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -10,7 +10,7 @@ //--------------------------------------------------------------------------------------------------
BOOL SSLLoaded = FALSE;
-HNETLIBUSER hNetlibUser = NULL;
+HNETLIBUSER hNetlibUser = nullptr;
void __stdcall SSL_DebugLog(const char *fmt, ...)
{
@@ -67,7 +67,7 @@ void CNLClient::SSLify() throw(DWORD) #ifdef DEBUG_COMM
SSL_DebugLog("Staring netlib core SSL");
#endif
- if (Netlib_StartSsl(hConnection, NULL)) {
+ if (Netlib_StartSsl(hConnection, nullptr)) {
#ifdef DEBUG_COMM
SSL_DebugLog("Netlib core SSL started");
#endif
@@ -97,7 +97,7 @@ void CNLClient::Connect(const char* servername, const int port) throw(DWORD) nloc.szHost = servername;
nloc.wPort = port;
nloc.flags = 0;
- if (NULL == (hConnection = Netlib_OpenConnection(hNetlibUser, &nloc))) {
+ if (nullptr == (hConnection = Netlib_OpenConnection(hNetlibUser, &nloc))) {
SystemError = WSAGetLastError();
throw NetworkError = (DWORD)ENL_CONNECT;
}
@@ -125,9 +125,9 @@ void CNLClient::Send(const char *query) throw(DWORD) {
unsigned int Sent;
- if (NULL == query)
+ if (nullptr == query)
return;
- if (hConnection == NULL)
+ if (hConnection == nullptr)
return;
#ifdef DEBUG_COMM
DebugLog(CommFile, "<send>%s", query);
@@ -174,9 +174,9 @@ char* CNLClient::Recv(char *buf, int buflen) throw(DWORD) DebugLog(CommFile, "<reading>");
#endif
try {
- if (buf == NULL)
+ if (buf == nullptr)
buf = (char *)malloc(sizeof(char)*(buflen + 1));
- if (buf == NULL)
+ if (buf == nullptr)
throw NetworkError = (DWORD)ENL_RECVALLOC;
if (!isTLSed) {
@@ -224,7 +224,7 @@ char* CNLClient::Recv(char *buf, int buflen) throw(DWORD) void CNLClient::Disconnect()
{
Netlib_CloseHandle(hConnection);
- hConnection = NULL;
+ hConnection = nullptr;
}
//Uninitializes netlib library
@@ -235,7 +235,7 @@ void UnregisterNLClient() #endif
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
#ifdef DEBUG_COMM
DebugLog(CommFile, "</Unregister PROXY support>\n");
#endif
diff --git a/plugins/YAMN/src/proto/pop3/pop3.cpp b/plugins/YAMN/src/proto/pop3/pop3.cpp index 5204ba1259..d47fac4836 100644 --- a/plugins/YAMN/src/proto/pop3/pop3.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3.cpp @@ -34,11 +34,11 @@ //sets AckFlag char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BOOL NoTLS) { - char *temp = 0; + char *temp = nullptr; if (Stopped) //check if we can work with this POP3 client session throw POP3Error=(DWORD)EPOP3_STOPPED; - if (NetClient != NULL) + if (NetClient != nullptr) delete NetClient; SSL=UseSSL; NetClient=new CNLClient; @@ -56,7 +56,7 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO catch (...) { NetClient->Disconnect(); - return NULL; + return nullptr; } } @@ -73,7 +73,7 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO NetClient->SSLify(); } catch (...) { NetClient->Disconnect(); - return NULL; + return nullptr; } // temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK); } @@ -105,7 +105,7 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size) { //if not found if (NetClient->Stopped) //check if we can work with this POP3 client session { - if (PrevString != NULL) + if (PrevString != nullptr) free(PrevString); throw POP3Error=(DWORD)EPOP3_STOPPED; } @@ -113,9 +113,9 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size) { SizeRead+=size; SizeLeft=size; - LastString=NetClient->Recv(NULL,SizeLeft); + LastString=NetClient->Recv(nullptr,SizeLeft); PrevString=(char *)realloc(PrevString,sizeof(char)*(SizeRead+size)); - if (PrevString==NULL) + if (PrevString==nullptr) throw POP3Error=(DWORD)EPOP3_RESTALLOC; memcpy(PrevString+SizeRead,LastString,size); free(LastString); @@ -239,7 +239,7 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp) char *Result; unsigned char digest[16]; - if (timestamp==NULL) + if (timestamp==nullptr) throw POP3Error=(DWORD)EPOP3_APOP; mir_md5_state_s ctx; mir_md5_init(&ctx); diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index 8984a4dfbb..edd7598c26 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -16,8 +16,8 @@ //--------------------------------------------------------------------------------------------------
-HANDLE hNetLib = NULL;
-PSCOUNTER CPOP3Account::AccountWriterSO = NULL;
+HANDLE hNetLib = nullptr;
+PSCOUNTER CPOP3Account::AccountWriterSO = nullptr;
//Creates new CPOP3Account structure
HACCOUNT WINAPI CreatePOP3Account(HYAMNPROTOPLUGIN Plugin, DWORD CAccountVersion);
@@ -87,8 +87,8 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue); void ExtractMail(char *stream, int len, HYAMNMAIL queue);
-YAMNExportedFcns *pYAMNFcn = NULL;
-MailExportedFcns *pYAMNMailFcn = NULL;
+YAMNExportedFcns *pYAMNFcn = nullptr;
+MailExportedFcns *pYAMNMailFcn = nullptr;
YAMN_PROTOIMPORTFCN POP3ProtocolFunctions =
{
@@ -102,23 +102,23 @@ YAMN_PROTOIMPORTFCN POP3ProtocolFunctions = SynchroPOP3,
DeleteMailsPOP3,
GetErrorString,
- NULL,
+ nullptr,
DeleteErrorString,
WritePOP3Accounts,
- NULL,
+ nullptr,
UnLoadPOP3,
};
YAMN_MAILIMPORTFCN POP3MailFunctions =
{
CreatePOP3Mail,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
};
-PYAMN_VARIABLES pYAMNVar = NULL;
-HYAMNPROTOPLUGIN POP3Plugin = NULL;
+PYAMN_VARIABLES pYAMNVar = nullptr;
+HYAMNPROTOPLUGIN POP3Plugin = nullptr;
YAMN_PROTOREGISTRATION POP3ProtocolRegistration =
{
@@ -130,7 +130,7 @@ YAMN_PROTOREGISTRATION POP3ProtocolRegistration = __AUTHORWEB,
};
-static wchar_t *FileName = NULL;
+static wchar_t *FileName = nullptr;
HANDLE RegisterNLClient(const char *name);
@@ -142,7 +142,7 @@ CPOP3Account::CPOP3Account() //NOTE! This constructor constructs CAccount structure. If your plugin is not internal,
//you will need these constructors. All you need is in Account.cpp. Just copy to your source code
//constructor and destructor of CAccount.
- UseInternetFree = CreateEvent(NULL, FALSE, TRUE, NULL);
+ UseInternetFree = CreateEvent(nullptr, FALSE, TRUE, nullptr);
InternetQueries = new SCOUNTER;
AbilityFlags = YAMN_ACC_BROWSE | YAMN_ACC_POPUP;
@@ -152,7 +152,7 @@ CPOP3Account::CPOP3Account() CPOP3Account::~CPOP3Account()
{
CloseHandle(UseInternetFree);
- if (InternetQueries != NULL)
+ if (InternetQueries != nullptr)
delete InternetQueries;
}
@@ -176,7 +176,7 @@ void WINAPI DeletePOP3Account(HACCOUNT Which) void WINAPI StopPOP3Account(HACCOUNT Which)
{
((HPOP3ACCOUNT)Which)->Client.Stopped = TRUE;
- if (((HPOP3ACCOUNT)Which)->Client.NetClient != NULL) //we should inform also network client. Usefull only when network client implements this feature
+ if (((HPOP3ACCOUNT)Which)->Client.NetClient != nullptr) //we should inform also network client. Usefull only when network client implements this feature
((HPOP3ACCOUNT)Which)->Client.NetClient->Stopped = TRUE;
}
@@ -185,19 +185,19 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) {
//Get YAMN variables we can use
- if (NULL == (pYAMNVar = (PYAMN_VARIABLES)CallService(MS_YAMN_GETVARIABLES, (WPARAM)YAMN_VARIABLESVERSION, 0)))
+ if (nullptr == (pYAMNVar = (PYAMN_VARIABLES)CallService(MS_YAMN_GETVARIABLES, (WPARAM)YAMN_VARIABLESVERSION, 0)))
return 0;
//We have to get pointers to YAMN exported functions: allocate structure and fill it
- if (NULL == (pYAMNFcn = new struct YAMNExportedFcns))
+ if (nullptr == (pYAMNFcn = new struct YAMNExportedFcns))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
//Register new pop3 user in netlib
- if (NULL == (hNetLib = RegisterNLClient("YAMN-POP3")))
+ if (nullptr == (hNetLib = RegisterNLClient("YAMN-POP3")))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
pYAMNFcn->SetProtocolPluginFcnImportFcn = (YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_SETPROTOCOLPLUGINFCNIMPORTID, 0);
@@ -211,9 +211,9 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) pYAMNFcn->SetStatusFcn = (YAMN_SETSTATUSFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_SETSTATUSID, 0);
pYAMNFcn->GetStatusFcn = (YAMN_GETSTATUSFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_GETSTATUSID, 0);
- if (NULL == (pYAMNMailFcn = new struct MailExportedFcns))
+ if (nullptr == (pYAMNMailFcn = new struct MailExportedFcns))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
pYAMNMailFcn->SynchroMessagesFcn = (YAMN_SYNCHROMIMEMSGSFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_SYNCHROMIMEMSGSID, 0);
@@ -225,10 +225,10 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) pYAMNMailFcn->CreateNewDeleteQueueFcn = (YAMN_CREATENEWDELETEQUEUEFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_CREATENEWDELETEQUEUEID, 0);
//set static variable
- if (CPOP3Account::AccountWriterSO == NULL) {
- if (NULL == (CPOP3Account::AccountWriterSO = new SCOUNTER))
+ if (CPOP3Account::AccountWriterSO == nullptr) {
+ if (nullptr == (CPOP3Account::AccountWriterSO = new SCOUNTER))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
}
@@ -236,7 +236,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) //it is quite impossible this function returns zero (failure) as YAMN and internal plugin structre versions are the same
POP3ProtocolRegistration.Name = Translate("POP3 protocol (internal)");
POP3ProtocolRegistration.Description = Translate(__DESCRIPTION);
- if (NULL == (POP3Plugin = (HYAMNPROTOPLUGIN)CallService(MS_YAMN_REGISTERPROTOPLUGIN, (WPARAM)&POP3ProtocolRegistration, (LPARAM)YAMN_PROTOREGISTRATIONVERSION)))
+ if (nullptr == (POP3Plugin = (HYAMNPROTOPLUGIN)CallService(MS_YAMN_REGISTERPROTOPLUGIN, (WPARAM)&POP3ProtocolRegistration, (LPARAM)YAMN_PROTOREGISTRATIONVERSION)))
return 0;
//Next we set our imported functions for YAMN
@@ -251,28 +251,28 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) switch (CallService(MS_YAMN_READACCOUNTS, (WPARAM)POP3Plugin, (LPARAM)FileName)) {
case EACC_FILEVERSION:
- MessageBox(NULL, TranslateT("Found new version of account book, not compatible with this version of YAMN."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Found new version of account book, not compatible with this version of YAMN."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
case EACC_FILECOMPATIBILITY:
- MessageBox(NULL, TranslateT("Error reading account file. Account file corrupted."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Error reading account file. Account file corrupted."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
case EACC_ALLOC:
- MessageBox(NULL, TranslateT("Memory allocation error while data reading"), TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Memory allocation error while data reading"), TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
case EACC_SYSTEM:
if (ERROR_FILE_NOT_FOUND != GetLastError())
{
wchar_t temp[1024] = { 0 };
mir_snwprintf(temp, L"%s\n%s", TranslateT("Reading file error. File already in use?"), FileName);
- MessageBox(NULL, temp, TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, temp, TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
}
break;
@@ -282,7 +282,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) HACCOUNT Finder;
DBVARIANT dbv;
- for (Finder = POP3Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) {
+ for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) {
Finder->hContact = NULL;
for (MCONTACT hContact = db_find_first(YAMN_DBMODULE); hContact; hContact = db_find_next(hContact, YAMN_DBMODULE)) {
if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
@@ -318,19 +318,19 @@ DWORD WINAPI UnLoadPOP3(void *) {
//pYAMNVar is only a pointr, no need delete or free
if (hNetLib) {
- Netlib_CloseHandle(hNetLib); hNetLib = NULL;
+ Netlib_CloseHandle(hNetLib); hNetLib = nullptr;
}
if (CPOP3Account::AccountWriterSO) {
- delete CPOP3Account::AccountWriterSO; CPOP3Account::AccountWriterSO = NULL;
+ delete CPOP3Account::AccountWriterSO; CPOP3Account::AccountWriterSO = nullptr;
}
if (pYAMNMailFcn) {
- delete pYAMNMailFcn; pYAMNMailFcn = NULL;
+ delete pYAMNMailFcn; pYAMNMailFcn = nullptr;
}
if (pYAMNFcn) {
- delete pYAMNFcn; pYAMNFcn = NULL;
+ delete pYAMNFcn; pYAMNFcn = nullptr;
}
if (FileName) {
- CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); FileName = NULL;
+ CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); FileName = nullptr;
}
#ifdef DEBUG_SYNCHRO
@@ -345,7 +345,7 @@ DWORD WINAPI WritePOP3Accounts() if (ReturnValue == EACC_SYSTEM) {
wchar_t temp[1024] = { 0 };
mir_snwprintf(temp, L"%s\n%s", TranslateT("Error while copying data to disk occurred. Is file in use?"), FileName);
- MessageBox(NULL, temp, TranslateT("POP3 plugin - write file error"), MB_OK);
+ MessageBox(nullptr, temp, TranslateT("POP3 plugin - write file error"), MB_OK);
}
return ReturnValue;
@@ -356,8 +356,8 @@ DWORD WINAPI WritePOP3Options(HANDLE File, HACCOUNT Which) DWORD WrittenBytes;
DWORD Ver = POP3_FILEVERSION;
- if ((!WriteFile(File, (char *)&Ver, sizeof(DWORD), &WrittenBytes, NULL)) ||
- (!WriteFile(File, (char *)&((HPOP3ACCOUNT)Which)->CP, sizeof(WORD), &WrittenBytes, NULL)))
+ if ((!WriteFile(File, (char *)&Ver, sizeof(DWORD), &WrittenBytes, nullptr)) ||
+ (!WriteFile(File, (char *)&((HPOP3ACCOUNT)Which)->CP, sizeof(WORD), &WrittenBytes, nullptr)))
return EACC_SYSTEM;
return 0;
}
@@ -396,13 +396,13 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account, DWORD) // if (MailDataVersion != YAMN_MAILDATAVERSION) return NULL;
//Now it is needed to construct our POP3 account and return its handle
- if (NULL == (NewMail = new YAMNMAIL))
- return NULL;
+ if (nullptr == (NewMail = new YAMNMAIL))
+ return nullptr;
- if (NULL == (NewMail->MailData = new MAILDATA))
+ if (nullptr == (NewMail->MailData = new MAILDATA))
{
delete NewMail;
- return NULL;
+ return nullptr;
}
NewMail->MailData->CP = ((HPOP3ACCOUNT)Account)->CP;
return (HYAMNMAIL)NewMail;
@@ -424,7 +424,7 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection PPOP3_ERRORCODE ErrorCode;
//We store status before we do Quit(), because quit can destroy our errorcode status
- if (NULL != (ErrorCode = new POP3_ERRORCODE))
+ if (nullptr != (ErrorCode = new POP3_ERRORCODE))
{
ErrorCode->SSL = UseSSL;
ErrorCode->AppError = ActualAccount->SystemError;
@@ -438,7 +438,7 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection try
{
DataRX = ActualAccount->Client.Quit();
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
}
catch (...)
@@ -456,19 +456,19 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection SetAccountStatus(ActualAccount, TranslateT("Disconnected"));
//If we cannot allocate memory, do nothing
- if (ErrorCode == NULL)
+ if (ErrorCode == nullptr)
{
SetEvent(ActualAccount->UseInternetFree);
return;
}
}
else //else it was called from POP3 plugin, probably error when deleting old mail (POP3 synchro calls POP3 delete)
- if (ErrorCode == NULL)
+ if (ErrorCode == nullptr)
return;
if ((ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP))
{
- YAMN_BADCONNECTIONPARAM cp = { (HANDLE)0, ActualAccount, (UINT_PTR)ErrorCode, ParamToBadConnection };
+ YAMN_BADCONNECTIONPARAM cp = { (HANDLE)nullptr, ActualAccount, (UINT_PTR)ErrorCode, ParamToBadConnection };
CallService(MS_YAMN_BADCONNECTION, (WPARAM)&cp, (LPARAM)YAMN_BADCONNECTIONVERSION);
}
@@ -481,8 +481,8 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) {
HPOP3ACCOUNT ActualAccount;
CPop3Client *MyClient;
- HYAMNMAIL NewMails = NULL, MsgQueuePtr = NULL;
- char* DataRX = NULL, *Temp;
+ HYAMNMAIL NewMails = nullptr, MsgQueuePtr = nullptr;
+ char* DataRX = nullptr, *Temp;
int mboxsize, msgs, i;
SYSTEMTIME now;
LPVOID YAMNParam;
@@ -589,14 +589,14 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #endif
// if we are already connected, we have open session (another thread left us open session), so we don't need to login
// note that connected state without logging cannot occur, because if we close session, we always close socket too (we must close socket is the right word :))
- if ((MyClient->NetClient == NULL) || !MyClient->NetClient->Connected())
+ if ((MyClient->NetClient == nullptr) || !MyClient->NetClient->Connected())
{
SetAccountStatus(ActualAccount, TranslateT("Connecting to server"));
DataRX = MyClient->Connect(ActualCopied.ServerName, ActualCopied.ServerPort, ActualCopied.Flags & YAMN_ACC_SSL23, ActualCopied.Flags & YAMN_ACC_NOTLS);
- char *timestamp = NULL;
+ char *timestamp = nullptr;
- if (DataRX != NULL)
+ if (DataRX != nullptr)
{
if (ActualCopied.Flags & YAMN_ACC_APOP)
{
@@ -610,7 +610,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) }
}
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
SetAccountStatus(ActualAccount, TranslateT("Entering POP3 account"));
@@ -618,20 +618,20 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) if (ActualCopied.Flags & YAMN_ACC_APOP)
{
DataRX = MyClient->APOP(ActualCopied.ServerLogin, ActualCopied.ServerPasswd, timestamp);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
delete[] timestamp;
}
else {
DataRX = MyClient->User(ActualCopied.ServerLogin);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
DataRX = MyClient->Pass(ActualCopied.ServerPasswd);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
}
SetAccountStatus(ActualAccount, TranslateT("Searching for new mail message"));
@@ -648,9 +648,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(DecodeFile,"<Msgs>%d</Msgs>\n",msgs);
DebugLog(DecodeFile,"</Extracting stat>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
for (i = 0; i < msgs; i++)
{
if (!i)
@@ -660,7 +660,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) MsgQueuePtr->Next = (HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL, (WPARAM)ActualAccount, (LPARAM)YAMN_MAILVERSION);
MsgQueuePtr = MsgQueuePtr->Next;
}
- if (MsgQueuePtr == NULL)
+ if (MsgQueuePtr == nullptr)
{
ActualAccount->SystemError = EPOP3_QUEUEALLOC;
throw (DWORD)ActualAccount->SystemError;
@@ -677,9 +677,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting list>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting UIDL>\n");
@@ -689,9 +689,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting UIDL>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait\n");
@@ -707,10 +707,10 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
#endif
ActualAccount->LastChecked = now;
- for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != NULL; MsgQueuePtr = MsgQueuePtr->Next) {
+ for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
if (MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) {
- HYAMNMAIL NewMsgsPtr = NULL;
- for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != NULL; NewMsgsPtr = NewMsgsPtr->Next) {
+ HYAMNMAIL NewMsgsPtr = nullptr;
+ for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != nullptr; NewMsgsPtr = NewMsgsPtr->Next) {
if (!mir_strcmp(MsgQueuePtr->ID, NewMsgsPtr->ID)) {
wchar_t accstatus[512];
mir_snwprintf(accstatus, TranslateT("Reading body %s"), NewMsgsPtr->ID);
@@ -720,7 +720,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(DecodeFile,"<Reading body>\n");
DebugLog(DecodeFile,"<Header>%s</Header>\n",DataRX);
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
{
Temp = DataRX;
while ((Temp < DataRX + MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
@@ -733,12 +733,12 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) continue;
//delete all the headers of the old mail MsgQueuePtr->MailData->TranslatedHeader
struct CMimeItem *TH = MsgQueuePtr->MailData->TranslatedHeader;
- if (TH) for (; MsgQueuePtr->MailData->TranslatedHeader != NULL;)
+ if (TH) for (; MsgQueuePtr->MailData->TranslatedHeader != nullptr;)
{
TH = TH->Next;
- if (MsgQueuePtr->MailData->TranslatedHeader->name != NULL)
+ if (MsgQueuePtr->MailData->TranslatedHeader->name != nullptr)
delete[] MsgQueuePtr->MailData->TranslatedHeader->name;
- if (MsgQueuePtr->MailData->TranslatedHeader->value != NULL)
+ if (MsgQueuePtr->MailData->TranslatedHeader->value != nullptr)
delete[] MsgQueuePtr->MailData->TranslatedHeader->value;
delete MsgQueuePtr->MailData->TranslatedHeader;
MsgQueuePtr->MailData->TranslatedHeader = TH;
@@ -752,23 +752,23 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #endif
MsgQueuePtr->Flags |= YAMN_MSG_BODYRECEIVED;
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
break;
}
}
}
}
- SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, NULL, (HYAMNMAIL *)&NewMails, NULL); //we get only new mails on server!
+ SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, nullptr, (HYAMNMAIL *)&NewMails, nullptr); //we get only new mails on server!
// NewMails=NULL;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write done\n");
#endif
MsgsWriteDone(ActualAccount);
- for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != NULL; MsgQueuePtr = MsgQueuePtr->Next) {
+ for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
if ((MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) && (MsgQueuePtr->Flags&YAMN_MSG_BODYRECEIVED)) {
MsgQueuePtr->Flags &= ~YAMN_MSG_BODYREQUESTED;
if (MsgQueuePtr->MsgWindow)
@@ -776,13 +776,13 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) }
}
- for (msgs = 0, MsgQueuePtr = NewMails; MsgQueuePtr != NULL; MsgQueuePtr = MsgQueuePtr->Next, msgs++); //get number of new mails
+ for (msgs = 0, MsgQueuePtr = NewMails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next, msgs++); //get number of new mails
try
{
wchar_t accstatus[512];
- for (i = 0, MsgQueuePtr = NewMails; MsgQueuePtr != NULL; i++)
+ for (i = 0, MsgQueuePtr = NewMails; MsgQueuePtr != nullptr; i++)
{
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY) != 0;
DataRX = MyClient->Top(MsgQueuePtr->Number, autoretr ? 100 : 0);
@@ -793,7 +793,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(DecodeFile,"<New mail>\n");
DebugLog(DecodeFile,"<Header>%s</Header>\n",DataRX);
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
{
Temp = DataRX;
while ((Temp < DataRX + MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
@@ -820,9 +820,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) // CallService(MS_YAMN_FILTERMAIL,(WPARAM)ActualAccount,(LPARAM)MsgQueuePtr);
FilterMailSvc((WPARAM)ActualAccount, (LPARAM)MsgQueuePtr);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
//MsgQueuePtr->MailData->Body=MyClient->Retr(MsgQueuePtr->Number);
@@ -846,7 +846,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
#endif
- if (ActualAccount->Mails == NULL)
+ if (ActualAccount->Mails == nullptr)
ActualAccount->Mails = NewMails;
else
{
@@ -871,9 +871,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) if (0 == SCGetNumber(ActualAccount->InternetQueries))
{
DataRX = MyClient->Quit();
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
MyClient->NetClient->Disconnect();
SetAccountStatus(ActualAccount, TranslateT("Disconnected"));
@@ -894,7 +894,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) }
{
- YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, ActualCopied.NFlags, ActualCopied.NNFlags, YAMNParam };
+ YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, ActualCopied.NFlags, ActualCopied.NNFlags, YAMNParam };
if (CheckFlags & YAMN_FORCECHECK)
Param.nnflags |= YAMN_ACC_POP; //if force check, show popup anyway and if mailbrowser was opened, do not close
@@ -935,9 +935,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DeleteMIMEQueue(ActualAccount, NewMails);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
switch (ActualAccount->SystemError)
{
case EACC_QUEUEALLOC:
@@ -976,8 +976,8 @@ void __cdecl DeleteMailsPOP3(void *param) DeleteParam *WhichTemp = (DeleteParam *)param;
CPop3Client *MyClient;
- HYAMNMAIL DeleteMails, NewMails = NULL, MsgQueuePtr = NULL;
- char* DataRX = NULL;
+ HYAMNMAIL DeleteMails, NewMails = nullptr, MsgQueuePtr = nullptr;
+ char* DataRX = nullptr;
int mboxsize = 0, msgs = 0, i;
BOOL UsingInternet = FALSE;
struct {
@@ -1028,11 +1028,11 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountSO-read enter\n");
#endif
- if (NULL == (DeleteMails = (HYAMNMAIL)CreateNewDeleteQueue((HYAMNMAIL)ActualAccount->Mails))) //if there's no mail for deleting, return
+ if (nullptr == (DeleteMails = (HYAMNMAIL)CreateNewDeleteQueue((HYAMNMAIL)ActualAccount->Mails))) //if there's no mail for deleting, return
{
if (POP3_DELETEFROMCHECK != POP3PluginParam) //We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
{
- YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, YAMN_ACC_MSGP, YAMN_ACC_MSGP, YAMNParam }; //Just update the window
+ YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, YAMN_ACC_MSGP, YAMN_ACC_MSGP, YAMNParam }; //Just update the window
CallService(MS_YAMN_MAILBROWSER, (WPARAM)&Param, (LPARAM)YAMN_MAILBROWSERVERSION);
}
@@ -1083,14 +1083,14 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_COMM
DebugLog(CommFile,"<--------Communication-------->\n");
#endif
- if ((MyClient->NetClient == NULL) || !MyClient->NetClient->Connected())
+ if ((MyClient->NetClient == nullptr) || !MyClient->NetClient->Connected())
{
SetAccountStatus(ActualAccount, TranslateT("Connecting to server"));
DataRX = MyClient->Connect(ActualCopied.ServerName, ActualCopied.ServerPort, ActualCopied.Flags & YAMN_ACC_SSL23, ActualCopied.Flags & YAMN_ACC_NOTLS);
- char *timestamp = NULL;
- if (DataRX != NULL) {
+ char *timestamp = nullptr;
+ if (DataRX != nullptr) {
if (ActualAccount->Flags & YAMN_ACC_APOP) {
char *lpos = strchr(DataRX, '<');
char *rpos = strchr(DataRX, '>');
@@ -1102,27 +1102,27 @@ void __cdecl DeleteMailsPOP3(void *param) }
}
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
SetAccountStatus(ActualAccount, TranslateT("Entering POP3 account"));
if (ActualAccount->Flags & YAMN_ACC_APOP)
{
DataRX = MyClient->APOP(ActualCopied.ServerLogin, ActualCopied.ServerPasswd, timestamp);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
delete[] timestamp;
}
else {
DataRX = MyClient->User(ActualCopied.ServerLogin);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
DataRX = MyClient->Pass(ActualCopied.ServerPasswd);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
}
@@ -1144,9 +1144,9 @@ void __cdecl DeleteMailsPOP3(void *param) DebugLog(DecodeFile,"<Msgs>%d</Msgs>\n",msgs);
DebugLog(DecodeFile,"</Extracting stat>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
for (i = 0; i < msgs; i++)
{
if (!i)
@@ -1156,7 +1156,7 @@ void __cdecl DeleteMailsPOP3(void *param) MsgQueuePtr->Next = (HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL, (WPARAM)ActualAccount, (LPARAM)YAMN_MAILVERSION);
MsgQueuePtr = MsgQueuePtr->Next;
}
- if (MsgQueuePtr == NULL)
+ if (MsgQueuePtr == nullptr)
{
ActualAccount->SystemError = EPOP3_QUEUEALLOC;
throw (DWORD)ActualAccount->SystemError;
@@ -1173,12 +1173,12 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting UIDL>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
// we get "new mails" on server (NewMails will contain all mails on server not found in DeleteMails)
// but also in DeleteMails we get only those, which are still on server with their responsable numbers
- SynchroMessages(ActualAccount, (HYAMNMAIL *)&DeleteMails, NULL, (HYAMNMAIL *)&NewMails, NULL);
+ SynchroMessages(ActualAccount, (HYAMNMAIL *)&DeleteMails, nullptr, (HYAMNMAIL *)&NewMails, nullptr);
}
}
else
@@ -1202,7 +1202,7 @@ void __cdecl DeleteMailsPOP3(void *param) {
HYAMNMAIL Temp;
- for (i = 0, MsgQueuePtr = DeleteMails; MsgQueuePtr != NULL; i++)
+ for (i = 0, MsgQueuePtr = DeleteMails; MsgQueuePtr != nullptr; i++)
{
if (!(MsgQueuePtr->Flags & YAMN_MSG_VIRTUAL)) //of course we can only delete real mails, not virtual
{
@@ -1228,9 +1228,9 @@ void __cdecl DeleteMailsPOP3(void *param) }
MsgQueuePtr = Temp;
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
else
MsgQueuePtr = MsgQueuePtr->Next;
@@ -1245,25 +1245,25 @@ void __cdecl DeleteMailsPOP3(void *param) throw; //and go to the main exception handling
}
- if (NewMails != NULL)
+ if (NewMails != nullptr)
// in ActualAccount->Mails we have all mails stored before calling this function
// in NewMails we have all mails not found in DeleteMails (in other words: we performed new ID checking and we
// stored all mails found on server, then we deleted the ones we wanted to delete in this function
// and NewMails queue now contains actual state of mails on server). But we will not use NewMails as actual state, because NewMails does not contain header data (subject, from...)
// We perform deleting from ActualAccount->Mails: we remove from original queue (ActualAccount->Mails) all deleted mails
- SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, NULL, (HYAMNMAIL *)&NewMails, NULL);
+ SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, nullptr, (HYAMNMAIL *)&NewMails, nullptr);
// Now ActualAccount->Mails contains all mails when calling this function except the ones, we wanted to delete (these are in DeleteMails)
// And in NewMails we have new mails (if any)
else if (POP3_DELETEFROMCHECK != POP3PluginParam)
{
DeleteMIMEQueue(ActualAccount, (HYAMNMAIL)ActualAccount->Mails);
- ActualAccount->Mails = NULL;
+ ActualAccount->Mails = nullptr;
}
}
else
{
DeleteMIMEQueue(ActualAccount, (HYAMNMAIL)ActualAccount->Mails);
- ActualAccount->Mails = NULL;
+ ActualAccount->Mails = nullptr;
}
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountMsgsSO-write done\n");
@@ -1281,16 +1281,16 @@ void __cdecl DeleteMailsPOP3(void *param) // if this functin was called from SynchroPOP3, then do not try to disconnect
if (POP3_DELETEFROMCHECK != POP3PluginParam)
{
- YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, ActualCopied.NFlags, YAMN_ACC_MSGP, YAMNParam };
+ YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, ActualCopied.NFlags, YAMN_ACC_MSGP, YAMNParam };
CallService(MS_YAMN_MAILBROWSER, (WPARAM)&Param, (LPARAM)YAMN_MAILBROWSERVERSION);
if (0 == SCGetNumber(ActualAccount->InternetQueries))
{
DataRX = MyClient->Quit();
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
MyClient->NetClient->Disconnect();
SetAccountStatus(ActualAccount, TranslateT("Disconnected"));
@@ -1315,7 +1315,7 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_COMM
DebugLog(CommFile,"ERROR %x\n",ErrorCode);
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
switch (ActualAccount->SystemError)
{
@@ -1485,7 +1485,7 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue) DebugLog(DecodeFile,"<Nr>%d</Nr>\n",msgnr);
#endif
- for (i = 1, queueptr = queue; (queueptr->Next != NULL) && (i < msgnr); queueptr = queueptr->Next, i++);
+ for (i = 1, queueptr = queue; (queueptr->Next != nullptr) && (i < msgnr); queueptr = queueptr->Next, i++);
if (i != msgnr)
throw (DWORD)EPOP3_LIST;
while (!WS(finder)) finder++; //jump characters
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 16fda3be2c..5d239f3e1e 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -92,22 +92,22 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) id = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
mir_cslock lck(PluginRegCS);
- for (PParser = FirstProtoPlugin; PParser != NULL; PParser = PParser->Next)
+ for (PParser = FirstProtoPlugin; PParser != nullptr; PParser = PParser->Next)
if (id == (INT_PTR)PParser->Plugin) {
SetDlgItemTextA(hDlg, IDC_STVER, PParser->Plugin->PluginInfo->Ver);
- SetDlgItemTextA(hDlg, IDC_STDESC, PParser->Plugin->PluginInfo->Description == NULL ? "" : PParser->Plugin->PluginInfo->Description);
- SetDlgItemTextA(hDlg, IDC_STCOPY, PParser->Plugin->PluginInfo->Copyright == NULL ? "" : PParser->Plugin->PluginInfo->Copyright);
- SetDlgItemTextA(hDlg, IDC_STMAIL, PParser->Plugin->PluginInfo->Email == NULL ? "" : PParser->Plugin->PluginInfo->Email);
- SetDlgItemTextA(hDlg, IDC_STWWW, PParser->Plugin->PluginInfo->WWW == NULL ? "" : PParser->Plugin->PluginInfo->WWW);
+ SetDlgItemTextA(hDlg, IDC_STDESC, PParser->Plugin->PluginInfo->Description == nullptr ? "" : PParser->Plugin->PluginInfo->Description);
+ SetDlgItemTextA(hDlg, IDC_STCOPY, PParser->Plugin->PluginInfo->Copyright == nullptr ? "" : PParser->Plugin->PluginInfo->Copyright);
+ SetDlgItemTextA(hDlg, IDC_STMAIL, PParser->Plugin->PluginInfo->Email == nullptr ? "" : PParser->Plugin->PluginInfo->Email);
+ SetDlgItemTextA(hDlg, IDC_STWWW, PParser->Plugin->PluginInfo->WWW == nullptr ? "" : PParser->Plugin->PluginInfo->WWW);
break;
}
- for (FParser = FirstFilterPlugin; FParser != NULL; FParser = FParser->Next)
+ for (FParser = FirstFilterPlugin; FParser != nullptr; FParser = FParser->Next)
if (id == (INT_PTR)FParser->Plugin) {
SetDlgItemTextA(hDlg, IDC_STVER, FParser->Plugin->PluginInfo->Ver);
- SetDlgItemTextA(hDlg, IDC_STDESC, FParser->Plugin->PluginInfo->Description == NULL ? "" : FParser->Plugin->PluginInfo->Description);
- SetDlgItemTextA(hDlg, IDC_STCOPY, FParser->Plugin->PluginInfo->Copyright == NULL ? "" : FParser->Plugin->PluginInfo->Copyright);
- SetDlgItemTextA(hDlg, IDC_STMAIL, FParser->Plugin->PluginInfo->Email == NULL ? "" : FParser->Plugin->PluginInfo->Email);
- SetDlgItemTextA(hDlg, IDC_STWWW, FParser->Plugin->PluginInfo->WWW == NULL ? "" : FParser->Plugin->PluginInfo->WWW);
+ SetDlgItemTextA(hDlg, IDC_STDESC, FParser->Plugin->PluginInfo->Description == nullptr ? "" : FParser->Plugin->PluginInfo->Description);
+ SetDlgItemTextA(hDlg, IDC_STCOPY, FParser->Plugin->PluginInfo->Copyright == nullptr ? "" : FParser->Plugin->PluginInfo->Copyright);
+ SetDlgItemTextA(hDlg, IDC_STMAIL, FParser->Plugin->PluginInfo->Email == nullptr ? "" : FParser->Plugin->PluginInfo->Email);
+ SetDlgItemTextA(hDlg, IDC_STWWW, FParser->Plugin->PluginInfo->WWW == nullptr ? "" : FParser->Plugin->PluginInfo->WWW);
break;
}
}
@@ -127,11 +127,11 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) if (TRUE == (BOOL)wParam) {
{
mir_cslock lck(PluginRegCS);
- for (PYAMN_PROTOPLUGINQUEUE PParser = FirstProtoPlugin; PParser != NULL; PParser = PParser->Next) {
+ for (PYAMN_PROTOPLUGINQUEUE PParser = FirstProtoPlugin; PParser != nullptr; PParser = PParser->Next) {
int index = SendDlgItemMessageA(hDlg, IDC_COMBOPLUGINS, CB_ADDSTRING, 0, (LPARAM)PParser->Plugin->PluginInfo->Name);
SendDlgItemMessage(hDlg, IDC_COMBOPLUGINS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)PParser->Plugin);
}
- for (PYAMN_FILTERPLUGINQUEUE FParser = FirstFilterPlugin; FParser != NULL; FParser = FParser->Next) {
+ for (PYAMN_FILTERPLUGINQUEUE FParser = FirstFilterPlugin; FParser != nullptr; FParser = FParser->Next) {
int index = SendDlgItemMessageA(hDlg, IDC_COMBOPLUGINS, CB_ADDSTRING, 0, (LPARAM)FParser->Plugin->PluginInfo->Name);
SendDlgItemMessage(hDlg, IDC_COMBOPLUGINS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)FParser->Plugin);
}
@@ -448,13 +448,13 @@ BOOL DlgShowAccount(HWND hDlg, WPARAM wParam, LPARAM lParam) }
else //default
{
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITSERVER, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITNAME, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITLOGIN, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITPASS, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPP, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPPPARAM, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITSERVER, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITNAME, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITLOGIN, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITPASS, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPP, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPPPARAM, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
SetDlgItemInt(hDlg, IDC_EDITPORT, 110, FALSE);
SetDlgItemInt(hDlg, IDC_EDITINTERVAL, 30, FALSE);
SetDlgItemInt(hDlg, IDC_EDITPOPS, 0, FALSE);
@@ -543,7 +543,7 @@ BOOL DlgShowAccountColors(HWND hDlg, WPARAM, LPARAM lParam) BOOL DlgSetItemText(HWND hDlg, WPARAM wParam, const char* str)
{
- if (str == NULL)
+ if (str == nullptr)
SetDlgItemTextA(hDlg, wParam, "");
else
SetDlgItemTextA(hDlg, wParam, str);
@@ -552,7 +552,7 @@ BOOL DlgSetItemText(HWND hDlg, WPARAM wParam, const char* str) BOOL DlgSetItemTextW(HWND hDlg, WPARAM wParam, const WCHAR* str)
{
- if (str == NULL)
+ if (str == nullptr)
SetDlgItemTextW(hDlg, wParam, L"");
else
SetDlgItemTextW(hDlg, wParam, str);
@@ -565,7 +565,7 @@ INT_PTR CALLBACK DlgProcPOP3AccStatusOpt(HWND hDlg, UINT msg, WPARAM wParam, LPA switch (msg) {
case WM_INITDIALOG:
ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
DlgShowAccountStatus(hDlg, (WPARAM)M_SHOWACTUAL, (LPARAM)ActualAccount);
DlgEnableAccountStatus(hDlg, TRUE, TRUE);
}
@@ -639,8 +639,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP DebugLog(SynchroFile, "Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
#ifdef DEBUG_SYNCHRO
@@ -656,7 +656,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP }
SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_SETCURSEL, (WPARAM)CPDEFINDEX, 0);
- ActualAccount = NULL;
+ ActualAccount = nullptr;
TranslateDialogDefault(hDlg);
SendMessage(GetParent(hDlg), PSM_UNCHANGED, (WPARAM)hDlg, 0);
return TRUE;
@@ -697,8 +697,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_COMBOACCOUNT:
switch (HIWORD(wParam)) {
case CBN_EDITCHANGE:
- ActualAccount = NULL;
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ ActualAccount = nullptr;
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
if (GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput)))
DlgEnableAccount(hDlg, TRUE, FALSE);
@@ -708,8 +708,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case CBN_KILLFOCUS:
GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput));
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
if (mir_strlen(DlgInput))
DlgEnableAccount(hDlg, TRUE, TRUE);
@@ -727,8 +727,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP if (CB_ERR != (Result = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0)))
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_GETLBTEXT, (WPARAM)Result, (LPARAM)DlgInput);
- if ((Result == CB_ERR) || (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if ((Result == CB_ERR) || (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
}
else {
@@ -815,7 +815,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDC_BTNADD:
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
DlgShowAccount(hDlg, (WPARAM)M_SHOWDEFAULT, 0);
DlgEnableAccount(hDlg, TRUE, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
@@ -860,7 +860,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput));
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
if ((CB_ERR == (Result = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0)))
- || (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))))
+ || (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))))
return TRUE;
if (IDOK != MessageBox(hDlg, TranslateT("Do you really want to delete this account?"), TranslateT("Delete account confirmation"), MB_OKCANCEL | MB_ICONWARNING))
@@ -876,13 +876,13 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP //We can consider our account as deleted.
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_DELETESTRING, (WPARAM)Result, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_COMBOACCOUNT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_COMBOACCOUNT, nullptr);
DlgEnableAccount(hDlg, FALSE, 0);
DlgShowAccount(hDlg, (WPARAM)M_SHOWDEFAULT, 0);
break;
case IDC_BTNRESET:
- if (ActualAccount != NULL)
+ if (ActualAccount != nullptr)
ActualAccount->TimeLeft = ActualAccount->Interval;
return 1;
}
@@ -955,7 +955,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)Text))) {
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)Text))) {
NewAcc = TRUE;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:APPLY:AccountBrowserSO-write wait\n");
@@ -964,7 +964,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:APPLY:AccountBrowserSO-write enter\n");
#endif
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)POP3Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) {
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)POP3Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:APPLY:AccountBrowserSO-write done\n");
#endif
@@ -1003,37 +1003,37 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, _countof(Text));
if (!(Length = mir_strlen(Text)))
break;
- if (NULL != ActualAccount->Name)
+ if (nullptr != ActualAccount->Name)
delete[] ActualAccount->Name;
ActualAccount->Name = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Name, Text);
GetDlgItemTextA(hDlg, IDC_EDITSERVER, Text, _countof(Text));
- if (NULL != ActualAccount->Server->Name)
+ if (nullptr != ActualAccount->Server->Name)
delete[] ActualAccount->Server->Name;
ActualAccount->Server->Name = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Server->Name, Text);
GetDlgItemTextA(hDlg, IDC_EDITLOGIN, Text, _countof(Text));
- if (NULL != ActualAccount->Server->Login)
+ if (nullptr != ActualAccount->Server->Login)
delete[] ActualAccount->Server->Login;
ActualAccount->Server->Login = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Server->Login, Text);
GetDlgItemTextA(hDlg, IDC_EDITPASS, Text, _countof(Text));
- if (NULL != ActualAccount->Server->Passwd)
+ if (nullptr != ActualAccount->Server->Passwd)
delete[] ActualAccount->Server->Passwd;
ActualAccount->Server->Passwd = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Server->Passwd, Text);
GetDlgItemTextW(hDlg, IDC_EDITAPP, TextW, _countof(TextW));
- if (NULL != ActualAccount->NewMailN.App)
+ if (nullptr != ActualAccount->NewMailN.App)
delete[] ActualAccount->NewMailN.App;
ActualAccount->NewMailN.App = new WCHAR[mir_wstrlen(TextW) + 1];
mir_wstrcpy(ActualAccount->NewMailN.App, TextW);
GetDlgItemTextW(hDlg, IDC_EDITAPPPARAM, TextW, _countof(TextW));
- if (NULL != ActualAccount->NewMailN.AppParam)
+ if (nullptr != ActualAccount->NewMailN.AppParam)
delete[] ActualAccount->NewMailN.AppParam;
ActualAccount->NewMailN.AppParam = new WCHAR[mir_wstrlen(TextW) + 1];
mir_wstrcpy(ActualAccount->NewMailN.AppParam, TextW);
@@ -1109,16 +1109,16 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), TRUE);
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
index = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0);
HPOP3ACCOUNT temp = ActualAccount;
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_RESETCONTENT, 0, 0);
- if (POP3Plugin->FirstAccount != NULL)
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
ActualAccount = temp;
@@ -1157,15 +1157,15 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- if (POP3Plugin->FirstAccount != NULL)
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:INITDIALOG:AccountBrowserSO-read done\n");
#endif
ReadDoneSO(POP3Plugin->AccountBrowserSO);
- ActualAccount = NULL;
+ ActualAccount = nullptr;
TranslateDialogDefault(hDlg);
@@ -1185,14 +1185,14 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM HPOP3ACCOUNT temp = ActualAccount;
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_RESETCONTENT, 0, 0);
- if (POP3Plugin->FirstAccount != NULL)
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
ActualAccount = temp;
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_SETCURSEL, (WPARAM)index, (LPARAM)ActualAccount->Name);
DlgShowAccount(hDlg, (WPARAM)M_SHOWACTUAL, (LPARAM)ActualAccount);
DlgShowAccountColors(hDlg, 0, (LPARAM)ActualAccount);
@@ -1216,8 +1216,8 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case CBN_KILLFOCUS:
GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput));
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
if (mir_strlen(DlgInput))
DlgEnableAccountPopup(hDlg, TRUE, TRUE);
else
@@ -1232,8 +1232,8 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case CBN_SELCHANGE:
if (CB_ERR != (Result = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0)))
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_GETLBTEXT, (WPARAM)Result, (LPARAM)DlgInput);
- if ((Result == CB_ERR) || (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if ((Result == CB_ERR) || (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
}
else {
DlgShowAccount(hDlg, (WPARAM)M_SHOWACTUAL, (LPARAM)ActualAccount);
@@ -1319,12 +1319,12 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM TesterN.colorBack = GetSysColor(COLOR_BTNFACE);
TesterN.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- Tester.PluginWindowProc = NULL;
- TesterF.PluginWindowProc = NULL;
- TesterN.PluginWindowProc = NULL;
- Tester.PluginData = NULL;
- TesterF.PluginData = NULL;
- TesterN.PluginData = NULL;
+ Tester.PluginWindowProc = nullptr;
+ TesterF.PluginWindowProc = nullptr;
+ TesterN.PluginWindowProc = nullptr;
+ Tester.PluginData = nullptr;
+ TesterF.PluginData = nullptr;
+ TesterN.PluginData = nullptr;
if (IsDlgButtonChecked(hDlg, IDC_CHECKPOP) == BST_CHECKED)
PUAddPopupT(&Tester);
diff --git a/plugins/YAMN/src/protoplugin.cpp b/plugins/YAMN/src/protoplugin.cpp index 20fc0f5817..d2ab6d2b79 100644 --- a/plugins/YAMN/src/protoplugin.cpp +++ b/plugins/YAMN/src/protoplugin.cpp @@ -9,7 +9,7 @@ //--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin=NULL;
+PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin=nullptr;
INT_PTR RegisterProtocolPluginSvc(WPARAM,LPARAM);
@@ -53,20 +53,20 @@ INT_PTR RegisterProtocolPluginSvc(WPARAM wParam,LPARAM lParam) if (lParam != YAMN_PROTOREGISTRATIONVERSION)
return 0;
- if ((Registration->Name==NULL) || (Registration->Ver==NULL))
+ if ((Registration->Name==nullptr) || (Registration->Ver==nullptr))
return (INT_PTR)NULL;
- if (NULL==(Plugin=new YAMN_PROTOPLUGIN))
+ if (nullptr==(Plugin=new YAMN_PROTOPLUGIN))
return (INT_PTR)NULL;
Plugin->PluginInfo=Registration;
- Plugin->FirstAccount=NULL;
+ Plugin->FirstAccount=nullptr;
Plugin->AccountBrowserSO=new SWMRG;
- SWMRGInitialize(Plugin->AccountBrowserSO,NULL);
+ SWMRGInitialize(Plugin->AccountBrowserSO,nullptr);
- Plugin->Fcn=NULL;
- Plugin->MailFcn=NULL;
+ Plugin->Fcn=nullptr;
+ Plugin->MailFcn=nullptr;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"::: YAMN- new protocol registered: %0x (%s) :::\n",Plugin,Registration->Name);
@@ -82,9 +82,9 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO return 0;
if (YAMNMailFcnVer != YAMN_MAILIMPORTFCNVERSION)
return 0;
- if (YAMNFcn==NULL)
+ if (YAMNFcn==nullptr)
return 0;
- if (YAMNMailFcn==NULL)
+ if (YAMNMailFcn==nullptr)
return 0;
#ifdef DEBUG_SYNCHRO
@@ -95,8 +95,8 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO mir_cslock lck(PluginRegCS);
// We add protocol to the protocol list
- for (Parser=FirstProtoPlugin;Parser != NULL && Parser->Next != NULL;Parser=Parser->Next);
- if (Parser==NULL)
+ for (Parser=FirstProtoPlugin;Parser != nullptr && Parser->Next != nullptr;Parser=Parser->Next);
+ if (Parser==nullptr)
{
FirstProtoPlugin=new YAMN_PROTOPLUGINQUEUE;
Parser=FirstProtoPlugin;
@@ -108,7 +108,7 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO }
Parser->Plugin=Plugin;
- Parser->Next=NULL;
+ Parser->Next=nullptr;
return 1;
}
@@ -126,21 +126,21 @@ INT_PTR UnregisterProtocolPlugin(HYAMNPROTOPLUGIN Plugin) }
else
{
- for (Parser=FirstProtoPlugin;(Parser->Next != NULL) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
- if (Parser->Next != NULL)
+ for (Parser=FirstProtoPlugin;(Parser->Next != nullptr) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
+ if (Parser->Next != nullptr)
{
Found=Parser->Next;
Parser->Next=Parser->Next->Next;
}
else
- Found=NULL;
+ Found=nullptr;
}
- if (Found != NULL)
+ if (Found != nullptr)
{
StopAccounts(Plugin);
DeleteAccounts(Plugin);
- if (Plugin->Fcn->UnLoadFcn != NULL)
- Plugin->Fcn->UnLoadFcn((void *)0);
+ if (Plugin->Fcn->UnLoadFcn != nullptr)
+ Plugin->Fcn->UnLoadFcn((void *)nullptr);
delete Found->Plugin->AccountBrowserSO;
delete Found->Plugin;
@@ -168,7 +168,7 @@ INT_PTR UnregisterProtoPlugins() {
mir_cslock lck(PluginRegCS);
// We remove protocols from the protocol list
- while(FirstProtoPlugin != NULL)
+ while(FirstProtoPlugin != nullptr)
UnregisterProtocolPlugin(FirstProtoPlugin->Plugin);
return 1;
}
@@ -176,7 +176,7 @@ INT_PTR UnregisterProtoPlugins() INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM)
{
wchar_t *FileName = new wchar_t[MAX_PATH];
- if (FileName == NULL)
+ if (FileName == nullptr)
return NULL;
mir_snwprintf(FileName, MAX_PATH, L"%s\\yamn-accounts.%s.%s.book", UserDirectory, wParam, ProfileName);
@@ -185,7 +185,7 @@ INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM) INT_PTR DeleteFileNameSvc(WPARAM wParam,LPARAM)
{
- if (( wchar_t* )wParam != NULL)
+ if (( wchar_t* )wParam != nullptr)
delete[] ( wchar_t* ) wParam;
return 0;
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index ba0f805c4e..56c7477213 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -74,7 +74,7 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM) return 0;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
STARTUPINFOW si = { 0 };
si.cb = sizeof(si);
@@ -85,22 +85,22 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ContactApplication:ualAccountSO-read enter\n");
#endif
- if (ActualAccount->NewMailN.App != NULL) {
+ if (ActualAccount->NewMailN.App != nullptr) {
WCHAR *Command;
- if (ActualAccount->NewMailN.AppParam != NULL)
+ if (ActualAccount->NewMailN.AppParam != nullptr)
Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App)+mir_wstrlen(ActualAccount->NewMailN.AppParam)+6];
else
Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App)+6];
- if (Command != NULL) {
+ if (Command != nullptr) {
mir_wstrcpy(Command, L"\"");
mir_wstrcat(Command, ActualAccount->NewMailN.App);
mir_wstrcat(Command, L"\" ");
- if (ActualAccount->NewMailN.AppParam != NULL)
+ if (ActualAccount->NewMailN.AppParam != nullptr)
mir_wstrcat(Command, ActualAccount->NewMailN.AppParam);
PROCESS_INFORMATION pi;
- CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+ CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi);
delete[] Command;
}
}
@@ -125,10 +125,10 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) //This service will check/sincronize the account pointed by wParam
HACCOUNT ActualAccount = (HACCOUNT)wParam;
// copy/paste make mistakes
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
//we use event to signal, that running thread has all needed stack parameters copied
- HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (ThreadRunningEV == NULL)
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
@@ -148,11 +148,11 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read enter\n");
#endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr) {
- struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK, 0, NULL};
+ struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK, nullptr, nullptr};
ActualAccount->TimeLeft = ActualAccount->Interval;
DWORD tid;
- HANDLE NewThread = CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr, &ParamToPlugin, 0, &tid);
+ HANDLE NewThread = CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr, &ParamToPlugin, 0, &tid);
if (NewThread) {
WaitForSingleObject(ThreadRunningEV, INFINITE);
CloseHandle(NewThread);
@@ -176,10 +176,10 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) return 0;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
//we use event to signal, that running thread has all needed stack parameters copied
HANDLE ThreadRunningEV;
- if (NULL == (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
+ if (nullptr == (ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
@@ -201,12 +201,12 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) #endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == NULL)
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == nullptr)
ReadDoneFcn(ActualAccount->AccountAccessSO);
DWORD tid;
- struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)0, NULL};
- if (NULL == CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
+ struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)nullptr, nullptr};
+ if (nullptr == CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
ReadDoneFcn(ActualAccount->AccountAccessSO);
else
WaitForSingleObject(ThreadRunningEV, INFINITE);
@@ -230,7 +230,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) return;
HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read wait\n");
#endif
@@ -238,7 +238,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read enter\n");
#endif
- YAMN_MAILBROWSERPARAM Param = { 0, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, 0 };
+ YAMN_MAILBROWSERPARAM Param = { nullptr, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, nullptr };
Param.nnflags = Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
Param.nnflags = Param.nnflags & ~YAMN_ACC_POP;
@@ -284,12 +284,12 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
- DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL);
SelectObject(hdcMem, hoBmp);
return hBmp;
}
@@ -297,8 +297,8 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) int AddTopToolbarIcon(WPARAM,LPARAM)
{
if ( db_get_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
- if ( ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == NULL) {
- TTBButton btn = { 0 };
+ if ( ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == nullptr) {
+ TTBButton btn = {};
btn.pszService = MS_YAMN_FORCECHECK;
btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
btn.hIconHandleUp = btn.hIconHandleDn = g_GetIconHandle(0);
@@ -307,9 +307,9 @@ int AddTopToolbarIcon(WPARAM,LPARAM) }
}
else {
- if (hTTButton != NULL) {
+ if (hTTButton != nullptr) {
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- hTTButton = NULL;
+ hTTButton = nullptr;
}
}
@@ -328,7 +328,7 @@ int Shutdown(WPARAM, LPARAM) db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
db_set_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
YAMNVar.Shutdown = TRUE;
- KillTimer(NULL, SecTimer);
+ KillTimer(nullptr, SecTimer);
UnregisterProtoPlugins();
UnregisterFilterPlugins();
@@ -435,7 +435,7 @@ void CreateServiceFunctions(void) void RefreshContact(void)
{
HACCOUNT Finder;
- for (Finder = POP3Plugin->FirstAccount;Finder != NULL;Finder = Finder->Next) {
+ for (Finder = POP3Plugin->FirstAccount;Finder != nullptr;Finder = Finder->Next) {
if (Finder->hContact != NULL) {
if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
db_unset(Finder->hContact, "CList", "Hidden");
diff --git a/plugins/YAMN/src/synchro.cpp b/plugins/YAMN/src/synchro.cpp index e008fe9db0..8a81f2a345 100644 --- a/plugins/YAMN/src/synchro.cpp +++ b/plugins/YAMN/src/synchro.cpp @@ -88,51 +88,51 @@ void WINAPI SWMRGDelete(PSWMRG pSWMRG) {
// Destroys any synchronization objects that were
// successfully created.
- if (NULL != pSWMRG->hEventNoWriter)
+ if (nullptr != pSWMRG->hEventNoWriter)
CloseHandle(pSWMRG->hEventNoWriter);
- if (NULL != pSWMRG->hEventNoReaders)
+ if (nullptr != pSWMRG->hEventNoReaders)
CloseHandle(pSWMRG->hEventNoReaders);
- if (NULL != pSWMRG->hSemNumReaders)
+ if (nullptr != pSWMRG->hSemNumReaders)
CloseHandle(pSWMRG->hSemNumReaders);
- if (NULL != pSWMRG->hFinishEV)
+ if (nullptr != pSWMRG->hFinishEV)
CloseHandle(pSWMRG->hFinishEV);
}
BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,wchar_t *Name)
{
- pSWMRG->hEventNoWriter=NULL;
- pSWMRG->hEventNoReaders=NULL;
- pSWMRG->hSemNumReaders=NULL;
- pSWMRG->hFinishEV=NULL;
+ pSWMRG->hEventNoWriter=nullptr;
+ pSWMRG->hEventNoReaders=nullptr;
+ pSWMRG->hSemNumReaders=nullptr;
+ pSWMRG->hFinishEV=nullptr;
// Creates the automatic-reset event that is signalled when
// no writer threads are writing.
// Initially no reader threads are reading.
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'W';
- pSWMRG->hEventNoWriter=CreateEvent(NULL,FALSE,TRUE,Name);
+ pSWMRG->hEventNoWriter=CreateEvent(nullptr,FALSE,TRUE,Name);
// Creates the manual-reset event that is signalled when
// no reader threads are reading.
// Initially no reader threads are reading.
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'R';
- pSWMRG->hEventNoReaders=CreateEvent(NULL,TRUE,TRUE,Name);
+ pSWMRG->hEventNoReaders=CreateEvent(nullptr,TRUE,TRUE,Name);
// Initializes the variable that indicates the number of
// reader threads that are reading.
// Initially no reader threads are reading.
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'C';
- pSWMRG->hSemNumReaders=CreateSemaphore(NULL,0,0x7FFFFFFF,Name);
+ pSWMRG->hSemNumReaders=CreateSemaphore(nullptr,0,0x7FFFFFFF,Name);
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'F';
- pSWMRG->hFinishEV=CreateEvent(NULL,TRUE,FALSE,Name);
+ pSWMRG->hFinishEV=CreateEvent(nullptr,TRUE,FALSE,Name);
// If a synchronization object could not be created,
// destroys any created objects and return failure.
- if ((NULL==pSWMRG->hEventNoWriter) || (NULL==pSWMRG->hEventNoReaders) || (NULL==pSWMRG->hSemNumReaders) || (NULL==pSWMRG->hFinishEV))
+ if ((nullptr==pSWMRG->hEventNoWriter) || (nullptr==pSWMRG->hEventNoReaders) || (nullptr==pSWMRG->hSemNumReaders) || (nullptr==pSWMRG->hFinishEV))
{
SWMRGDelete(pSWMRG);
return FALSE;
@@ -261,7 +261,7 @@ DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter) DebugLog(SynchroFile,"\tSO WaitToWrite: %x\n",SObject);
#endif
if (WAIT_OBJECT_0==(EnterCode=SWMRGWaitToWrite(SObject,INFINITE)))
- if (SCounter != NULL)
+ if (SCounter != nullptr)
SCIncFcn(SCounter);
return EnterCode;
}
@@ -272,7 +272,7 @@ void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter) DebugLog(SynchroFile,"\tSO WriteDone: %x\n",SObject);
#endif
SWMRGDoneWriting(SObject);
- if (SCounter != NULL)
+ if (SCounter != nullptr)
SCDecFcn(SCounter);
}
diff --git a/plugins/YAMN/src/yamn.cpp b/plugins/YAMN/src/yamn.cpp index ee15e5c343..9343f0f53f 100644 --- a/plugins/YAMN/src/yamn.cpp +++ b/plugins/YAMN/src/yamn.cpp @@ -100,8 +100,8 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) DWORD Status, tid;
// we use event to signal, that running thread has all needed stack parameters copied
- HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (ThreadRunningEV == NULL)
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
return;
// if we want to close miranda, we get event and do not run checking anymore
if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV, 0))
@@ -110,7 +110,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) Status=CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
mir_cslock lck(PluginRegCS);
- for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != NULL; ActualPlugin = ActualPlugin->Next) {
+ for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != nullptr; ActualPlugin = ActualPlugin->Next) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read wait\n");
#endif
@@ -124,9 +124,9 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read enter\n");
#endif
- for (ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount != NULL;ActualAccount=ActualAccount->Next)
+ for (ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount != nullptr;ActualAccount=ActualAccount->Next)
{
- if (ActualAccount->Plugin==NULL || ActualAccount->Plugin->Fcn==NULL) //account not inited
+ if (ActualAccount->Plugin==nullptr || ActualAccount->Plugin->Fcn==nullptr) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read wait\n");
@@ -192,7 +192,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) ((ActualAccount->StatusFlags & YAMN_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))))
{
- if ((!ActualAccount->Interval && !ActualAccount->TimeLeft) || ActualAccount->Plugin->Fcn->TimeoutFcnPtr==NULL)
+ if ((!ActualAccount->Interval && !ActualAccount->TimeLeft) || ActualAccount->Plugin->Fcn->TimeoutFcnPtr==nullptr)
{
goto ChangeIsCountingStatusLabel;
}
@@ -206,11 +206,11 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGETIME, (WPARAM)ActualAccount, (LPARAM)ActualAccount->TimeLeft);
if (!ActualAccount->TimeLeft)
{
- struct CheckParam ParamToPlugin={YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_NORMALCHECK, (void *)0, NULL};
+ struct CheckParam ParamToPlugin={YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_NORMALCHECK, (void *)nullptr, nullptr};
ActualAccount->TimeLeft=ActualAccount->Interval;
- HANDLE NewThread = CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, &ParamToPlugin, 0, &tid);
- if (NewThread == NULL)
+ HANDLE NewThread = CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, &ParamToPlugin, 0, &tid);
+ if (NewThread == nullptr)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read done\n");
@@ -256,8 +256,8 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) DWORD tid;
//we use event to signal, that running thread has all needed stack parameters copied
- HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (ThreadRunningEV == NULL)
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
@@ -265,7 +265,7 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) {
mir_cslock lck(PluginRegCS);
- for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != NULL; ActualPlugin = ActualPlugin->Next) {
+ for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != nullptr; ActualPlugin = ActualPlugin->Next) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read wait\n");
#endif
@@ -273,8 +273,8 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read enter\n");
#endif
- for (ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = ActualAccount->Next) {
- if (ActualAccount->Plugin->Fcn == NULL) //account not inited
+ for (ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) {
+ if (ActualAccount->Plugin->Fcn == nullptr) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait\n");
@@ -290,13 +290,13 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) #endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == NULL) {
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == nullptr) {
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
- struct CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)0, NULL };
+ struct CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)nullptr, nullptr };
- if (NULL == CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid)) {
+ if (nullptr == CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid)) {
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp index ea3e0b3197..606401da6b 100644 --- a/plugins/YAPP/src/message_pump.cpp +++ b/plugins/YAPP/src/message_pump.cpp @@ -14,9 +14,9 @@ unsigned __stdcall MessagePumpThread(void* param) if (param)
SetEvent((HANDLE)param);
- MSG hwndMsg = { 0 };
- while (GetMessage(&hwndMsg, 0, 0, 0) > 0 && !bShutdown) {
- if (hwndMsg.hwnd != NULL && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */
+ MSG hwndMsg = {};
+ while (GetMessage(&hwndMsg, nullptr, 0, 0) > 0 && !bShutdown) {
+ if (hwndMsg.hwnd != nullptr && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */
continue;
switch(hwndMsg.message) {
case MUM_CREATEPOPUP:
@@ -30,7 +30,7 @@ unsigned __stdcall MessagePumpThread(void* param) PopupData *pd = (PopupData*)hwndMsg.lParam;
if (enabled && num_popups < MAX_POPUPS) {
- HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, L"Popup", WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
+ HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, L"Popup", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInst, (LPVOID)hwndMsg.lParam);
num_popups++;
if (hwndMsg.wParam) // set notifyer handle
SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
@@ -93,12 +93,12 @@ void InitMessagePump() popup_win_class.lpfnWndProc = PopupWindowProc;
popup_win_class.hInstance = hInst;
popup_win_class.lpszClassName = POP_WIN_CLASS;
- popup_win_class.hCursor = LoadCursor(NULL, IDC_ARROW);
+ popup_win_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
RegisterClass(&popup_win_class);
InitServices();
- hMPEvent = CreateEvent(0, TRUE, 0, 0);
+ hMPEvent = CreateEvent(nullptr, TRUE, 0, nullptr);
CloseHandle(mir_forkthreadex(MessagePumpThread, hMPEvent, &message_pump_thread_id));
WaitForSingleObject(hMPEvent, INFINITE);
CloseHandle(hMPEvent);
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index 47720f25a9..423299490d 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -2,7 +2,7 @@ Options options;
-HICON hPopupIcon = 0;
+HICON hPopupIcon = nullptr;
void LoadModuleDependentOptions() {
if (ServiceExists(MS_AV_DRAWAVATAR))
@@ -427,7 +427,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_BTN_PREVIEW:
if (arNewClasses[i]->flags & PCF_UNICODE) {
POPUPCLASS pc = *arNewClasses[i];
- pc.PluginWindowProc = 0;
+ pc.PluginWindowProc = nullptr;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
d.pwszTitle = L"Preview";
d.pwszText = L"The quick brown fox jumps over the lazy dog.";
@@ -435,7 +435,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam }
else {
POPUPCLASS pc = *arNewClasses[i];
- pc.PluginWindowProc = 0;
+ pc.PluginWindowProc = nullptr;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
d.pszTitle = "Preview";
d.pszText = "The quick brown fox jumps over the lazy dog.";
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 60f273e1f0..bdaff9f4d1 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -24,7 +24,7 @@ struct HWNDStackNode { struct HWNDStackNode *next;
};
-HWNDStackNode *hwnd_stack_top = 0;
+HWNDStackNode *hwnd_stack_top = nullptr;
int stack_size = 0;
void RepositionWindows() {
@@ -127,7 +127,7 @@ void AddWindowToStack(HWND hwnd) { break;
}
- SetWindowPos(hwnd, 0, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwnd, nullptr, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
stack_size++;
@@ -136,7 +136,7 @@ void AddWindowToStack(HWND hwnd) { void RemoveWindowFromStack(HWND hwnd)
{
- HWNDStackNode *current = hwnd_stack_top, *prev = 0;
+ HWNDStackNode *current = hwnd_stack_top, *prev = nullptr;
while(current) {
if (current->hwnd == hwnd) {
if (prev)
@@ -171,7 +171,7 @@ void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) void DeinitWindowStack()
{
HWNDStackNode *current = hwnd_stack_top;
- hwnd_stack_top = NULL;
+ hwnd_stack_top = nullptr;
while(current) {
HWNDStackNode *pNext = current->next;
DestroyWindow(current->hwnd);
@@ -197,7 +197,7 @@ struct PopupWindowData LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PopupWindowData *pwd = (PopupWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- PopupData *pd = 0;
+ PopupData *pd = nullptr;
if (pwd) pd = pwd->pd;
switch(uMsg) {
@@ -207,7 +207,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd = (PopupWindowData *)mir_alloc(sizeof(PopupWindowData));
pd = (PopupData *)cs->lpCreateParams;
pwd->pd = pd;
- pwd->hNotify = 0;
+ pwd->hNotify = nullptr;
trimW(pwd->pd->pwzTitle);
trimW(pwd->pd->pwzText);
@@ -237,17 +237,17 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SYSTEMTIME st;
GetLocalTime(&st);
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, 0, pwd->tbuff, 128);
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, pwd->tbuff, 128);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pwd);
// make a really long timeout - say 7 days? ;)
if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1))
- SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, nullptr);
else if (pd->timeout == 0)
- SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, nullptr);
else
- SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, nullptr);
AddWindowToStack(hwnd); // this updates our size
}
@@ -301,7 +301,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (wParam == ID_CLOSETIMER) {
KillTimer(hwnd, ID_CLOSETIMER);
if (pwd->mouse_in || (options.global_hover && global_mouse_in))
- SetTimer(hwnd, ID_CLOSETIMER, 800, 0); // reset timer if mouse in window - allow another 800 ms
+ SetTimer(hwnd, ID_CLOSETIMER, 800, nullptr); // reset timer if mouse in window - allow another 800 ms
else {
PostMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
}
@@ -321,7 +321,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (adj_y == 0) adj_y = (pwd->new_y - r.top);
int x = r.left + adj_x, y = r.top + adj_y;
- SetWindowPos(hwnd, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
+ SetWindowPos(hwnd, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
if (!IsWindowVisible(hwnd)) {
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
@@ -436,7 +436,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa iconx = r.left + options.padding;
textxmin += 16 + options.padding;
}
- DrawIconEx(ps.hdc, iconx, options.padding + (pwd->tb_height - 16) / 2, pd->hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(ps.hdc, iconx, options.padding + (pwd->tb_height - 16) / 2, pd->hIcon, 16, 16, 0, nullptr, DI_NORMAL);
}
// title time
@@ -518,12 +518,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SendMessage(hwnd, UM_FREEPLUGINDATA, 0, 0);
if (pd) {
- pd->SetIcon(NULL);
+ pd->SetIcon(nullptr);
mir_free(pd->pwzTitle);
mir_free(pd->pwzText);
mir_free(pd);
}
- mir_free(pwd); pwd = 0; pd = 0;
+ mir_free(pwd); pwd = nullptr; pd = nullptr;
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
break;
@@ -548,10 +548,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa KillTimer(hwnd, ID_MOVETIMER);
pwd->new_x = (int)wParam;
pwd->new_y = (int)lParam;
- SetTimer(hwnd, ID_MOVETIMER, 10, 0);
+ SetTimer(hwnd, ID_MOVETIMER, 10, nullptr);
}
else {
- SetWindowPos(hwnd, 0, (int)wParam, (int)lParam, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
+ SetWindowPos(hwnd, nullptr, (int)wParam, (int)lParam, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
if (!IsWindowVisible(hwnd)) {
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
UpdateWindow(hwnd);
@@ -561,7 +561,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PUM_SETTEXT:
replaceStrW(pd->ptzText, (wchar_t*)lParam);
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
RepositionWindows();
return TRUE;
@@ -649,9 +649,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa RECT r;
GetWindowRect(hwnd, &r);
if (r.right - r.left != options.win_width || r.bottom - r.top != *pHeight) {
- SetWindowPos(hwnd, 0, 0, 0, options.win_width, *pHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hwnd, nullptr, 0, 0, options.win_width, *pHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SendMessage(hwnd, PUM_UPDATERGN, 0, 0);
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
}
return TRUE;
@@ -676,13 +676,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // make a really long timeout - say 7 days? ;)
if (pd->timeout == -1)
- SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, nullptr);
else if (pd->timeout == 0)
- SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, nullptr);
else
- SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, nullptr);
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
RepositionWindows();
}
return TRUE;
@@ -699,15 +699,15 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pd->hContact = (MCONTACT)MNotifyGetDWord(pwd->hNotify, NFOPT_CONTACT, 0);
pd->hIcon = (HICON)MNotifyGetDWord(pwd->hNotify, NFOPT_ICON, 0);
- const wchar_t *swzName = MNotifyGetWString(pwd->hNotify, NFOPT_TITLEW, 0);
+ const wchar_t *swzName = MNotifyGetWString(pwd->hNotify, NFOPT_TITLEW, nullptr);
mir_free(pd->pwzTitle);
pd->pwzTitle = mir_wstrdup(swzName);
- const wchar_t *swzText = MNotifyGetWString(pwd->hNotify, NFOPT_TEXTW, 0);
+ const wchar_t *swzText = MNotifyGetWString(pwd->hNotify, NFOPT_TEXTW, nullptr);
mir_free(pd->pwzText);
pd->pwzText = mir_wstrdup(swzText);
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
RepositionWindows();
}
return TRUE;
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index da7c2d89b8..71f68a7b05 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -6,7 +6,7 @@ static HANDLE hEventNotify; void StripBBCodesInPlace(wchar_t *text)
{
- if (text == 0 || db_get_b(0, MODULE, "StripBBCodes", 1) == 0)
+ if (text == nullptr || db_get_b(0, MODULE, "StripBBCodes", 1) == 0)
return;
int read = 0, write = 0;
@@ -69,7 +69,7 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM) pd_out->opaque = pd_in->PluginData;
pd_out->timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
+ lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
@@ -110,7 +110,7 @@ static INT_PTR CreatePopupW(WPARAM wParam, LPARAM) pd_out->opaque = pd_in->PluginData;
pd_out->timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
+ lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
@@ -149,7 +149,7 @@ void ShowPopup(PopupData &pd_in) StripBBCodesInPlace(pd_out->pwzTitle);
StripBBCodesInPlace(pd_out->pwzText);
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
+ lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr));
if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
mir_free(pd_out->pwzTitle);
@@ -166,7 +166,7 @@ static INT_PTR GetContact(WPARAM wParam, LPARAM) if (GetCurrentThreadId() == message_pump_thread_id)
SendMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, 0);
else {
- HANDLE hEvent = CreateEvent(0, 0, 0, 0);
+ HANDLE hEvent = CreateEvent(nullptr, 0, 0, nullptr);
PostMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, (LPARAM)hEvent);
MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, 0, 0);
CloseHandle(hEvent);
@@ -178,11 +178,11 @@ static INT_PTR GetContact(WPARAM wParam, LPARAM) static INT_PTR GetOpaque(WPARAM wParam, LPARAM)
{
HWND hwndPop = (HWND)wParam;
- void *data = 0;
+ void *data = nullptr;
if (GetCurrentThreadId() == message_pump_thread_id)
SendMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, 0);
else {
- HANDLE hEvent = CreateEvent(0, 0, 0, 0);
+ HANDLE hEvent = CreateEvent(nullptr, 0, 0, nullptr);
PostMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, (LPARAM)hEvent);
MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, 0, 0);
CloseHandle(hEvent);
@@ -196,11 +196,11 @@ void UpdateMenu() bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1;
if (isEnabled) {
Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON));
- Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_ON));
+ Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIcon(ICO_POPUP_ON));
}
else {
Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), IcoLib_GetIcon(ICO_POPUP_OFF));
- Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_OFF));
+ Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIcon(ICO_POPUP_OFF));
}
if (hTTButton)
@@ -275,7 +275,7 @@ static INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam) pd_out.opaque = pd_in->PluginData;
pd_out.timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(0));
+ lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(nullptr));
SendMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)&pd_out);
}
@@ -290,7 +290,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
POPUPDATAT pd = {0};
mir_wstrcpy(pd.lptzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
- pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
+ pd.lchIcon = LoadIcon(nullptr, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
wcsncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0;
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
}
@@ -305,7 +305,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
POPUPDATAW pd = {0};
mir_wstrcpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
- pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
+ pd.lchIcon = LoadIcon(nullptr, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
wcsncpy(pd.lpwzText, (wchar_t *)wParam, MAX_SECONDLINE);
CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, 0);
}
@@ -317,7 +317,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) INT_PTR Popup_ShowHistory(WPARAM, LPARAM)
{
if (!hHistoryWindow)
- hHistoryWindow = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LST_HISTORY), NULL, DlgProcHistLst);
+ hHistoryWindow = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LST_HISTORY), nullptr, DlgProcHistLst);
ShowWindow(hHistoryWindow, SW_SHOW);
return 0;
@@ -359,7 +359,7 @@ static void FreePopupClass(POPUPCLASS *pc) static INT_PTR UnregisterPopupClass(WPARAM, LPARAM lParam)
{
POPUPCLASS *pc = (POPUPCLASS*)lParam;
- if (pc == NULL)
+ if (pc == nullptr)
return 1;
for (int i=0; i < arClasses.getCount(); i++)
@@ -377,7 +377,7 @@ static INT_PTR CreateClassPopup(WPARAM wParam, LPARAM lParam) POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam;
if (pdc->cbSize < sizeof(POPUPDATACLASS)) return 1;
- POPUPCLASS *pc = 0;
+ POPUPCLASS *pc = nullptr;
if (wParam)
pc = (POPUPCLASS *)wParam;
else {
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index b045e2d873..482f774ec6 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -3,10 +3,10 @@ #include "stdafx.h"
-HMODULE hInst = 0;
+HMODULE hInst = nullptr;
bool bShutdown = false;
-MNOTIFYLINK *notifyLink = 0;
+MNOTIFYLINK *notifyLink = nullptr;
// used to work around a bug in neweventnotify and others with the address passed in the GetPluginData function
bool ignore_gpd_passed_addy = false;
@@ -15,7 +15,7 @@ FontIDW font_id_firstline = {0}, font_id_secondline = {0}, font_id_time = {0}; ColourIDW colour_id_bg = {0}, colour_id_border = {0}, colour_id_sidebar = {0}, colour_id_titleunderline = {0};
COLORREF colBg = GetSysColor(COLOR_3DSHADOW);
-HFONT hFontFirstLine = 0, hFontSecondLine = 0, hFontTime = 0;
+HFONT hFontFirstLine = nullptr, hFontSecondLine = nullptr, hFontTime = nullptr;
COLORREF colFirstLine = RGB(255, 0, 0), colSecondLine = 0, colTime = RGB(0, 0, 255), colBorder = RGB(0, 0, 0),
colSidebar = RGB(128, 128, 128), colTitleUnderline = GetSysColor(COLOR_3DSHADOW);
@@ -75,7 +75,7 @@ int ReloadFont(WPARAM, LPARAM) int TTBLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.pszService = "Popup/EnableDisableMenuCommand";
ttb.lParamUp = 1;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
diff --git a/plugins/YAPP/src/yapp_history.cpp b/plugins/YAPP/src/yapp_history.cpp index 8e02c3c2ca..fb881cf1c1 100644 --- a/plugins/YAPP/src/yapp_history.cpp +++ b/plugins/YAPP/src/yapp_history.cpp @@ -38,8 +38,8 @@ void PopupHistoryList::DeleteData(int index) mir_free(item->titleT); mir_free(item->messageT); item->timestamp = 0; //invalidate item - item->title = NULL; - item->message = NULL; + item->title = nullptr; + item->message = nullptr; item->flags = 0; } @@ -77,7 +77,7 @@ PopupHistoryData *PopupHistoryList::Get(int index) { if ((index < 0) || (index >= count)) //a bit of sanity check { - return NULL; + return nullptr; } return &historyData[index]; diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index cd8d2f7720..025d987620 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -13,7 +13,7 @@ #define ANCHOR_BOTTOM 0x000008
#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM
-HWND hHistoryWindow = 0; //the history window
+HWND hHistoryWindow = nullptr; //the history window
PopupHistoryList lstPopupHistory; //defined in main.cpp
const wchar_t *szHistoryColumns[] = {L"Title", L"Message", L"Timestamp"}; //need to make sure that the string and size vectors have the same number of elements
@@ -103,7 +103,7 @@ void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) 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);
@@ -339,7 +339,7 @@ IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem) eventData->pszTextW = popupItem->messageT;
eventData->time = (DWORD) popupItem->timestamp;
- eventData->next = NULL;
+ eventData->next = nullptr;
}
return eventData;
@@ -357,9 +357,9 @@ void AddEventsCustomControl(HWND hWnd, int renderer, wchar_t *filter, SIG_MATCHE ieEvent.iType = IEE_LOG_MEM_EVENTS;
ieEvent.hContact = NULL;
- IEVIEWEVENTDATA *eventData = NULL;
- IEVIEWEVENTDATA *cED = NULL;
- IEVIEWEVENTDATA *prevED = NULL;
+ IEVIEWEVENTDATA *eventData = nullptr;
+ IEVIEWEVENTDATA *cED = nullptr;
+ IEVIEWEVENTDATA *prevED = nullptr;
int i;
int count = 0;
@@ -447,7 +447,7 @@ void RefreshPopupHistory(HWND hWnd, int renderer) if (renderer == RENDER_DEFAULT)
{
HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY);
- SortParams params = {0};
+ SortParams params = {};
params.hList = hHistoryList;
params.column = lastColumn;
@@ -525,7 +525,7 @@ static LRESULT CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wPara AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard"));
AppendMenu(hMenu, MF_STRING, POPUPMENU_MESSAGE, TranslateT("Copy message to clipboard"));
AppendMenu(hMenu, MF_STRING, POPUPMENU_TIMESTAMP, TranslateT("Copy timestamp to clipboard"));
- selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
+ selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, nullptr);
DestroyMenu(hMenu);
if (selection)
{
@@ -601,7 +601,7 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_DESTROY:
UnloadRenderer(hWnd, lstPopupHistory.GetRenderer());
- hHistoryWindow = NULL;
+ hHistoryWindow = nullptr;
break;
case WM_CLOSE:
@@ -657,7 +657,7 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara {
LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam;
int column = lv->iSubItem;
- SortParams params = {0};
+ SortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY);
params.column = column;
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 3e1f6f3d6a..2797e6322c 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -61,7 +61,7 @@ int ProtoAck(WPARAM,LPARAM lparam) return 0;
MESSAGE_PROC* p = arMessageProcs.find((MESSAGE_PROC*)&pAck->hProcess);
- if (p == NULL)
+ if (p == nullptr)
return 0;
if (iSendAndHistory > 0){
diff --git a/plugins/YARelay/src/options.cpp b/plugins/YARelay/src/options.cpp index 5749ea1549..f10bfcb0e3 100644 --- a/plugins/YARelay/src/options.cpp +++ b/plugins/YARelay/src/options.cpp @@ -161,8 +161,8 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_CHECK8) == BST_CHECKED) iForwardOnStatus |= STATUS_INVISIBLE;
GetDlgItemText(hwndDlg, IDC_EDIT_TEMPLATE, tszForwardTemplate, _countof(tszForwardTemplate));
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_SPLIT) == BST_CHECKED) iSplit = 1; else iSplit = 0;
- iSplitMaxSize = GetDlgItemInt(hwndDlg, IDC_EDIT_MAXSIZE, NULL, FALSE);
- iSendParts = GetDlgItemInt(hwndDlg, IDC_EDIT_SENDPARTS, NULL, FALSE);
+ iSplitMaxSize = GetDlgItemInt(hwndDlg, IDC_EDIT_MAXSIZE, nullptr, FALSE);
+ iSendParts = GetDlgItemInt(hwndDlg, IDC_EDIT_SENDPARTS, nullptr, FALSE);
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_MARKREAD) == BST_CHECKED) iMarkRead = 1; else iMarkRead = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_SAVEHISTORY) == BST_CHECKED) iSendAndHistory = 1; else iSendAndHistory = 0;
if (iSplitMaxSize <= 0)
diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index af2e1c1e42..646fff1d3c 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -60,7 +60,7 @@ static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *value TVINSERTSTRUCT tvis;
int i;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
for (i = 0; i < nValues; i++) {
diff --git a/plugins/ZeroSwitch/src/ZeroSwitch.cpp b/plugins/ZeroSwitch/src/ZeroSwitch.cpp index 4e1591811c..e38dc64403 100644 --- a/plugins/ZeroSwitch/src/ZeroSwitch.cpp +++ b/plugins/ZeroSwitch/src/ZeroSwitch.cpp @@ -5,7 +5,7 @@ HINSTANCE hInst;
HHOOK hHook;
-HWND hDummyWnd = NULL, hHelperWnd = NULL, hMirandaWnd = NULL;
+HWND hDummyWnd = nullptr, hHelperWnd = nullptr, hMirandaWnd = nullptr;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -44,9 +44,9 @@ LRESULT CALLBACK HelperProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara break;
case WM_DESTROY:
if (hWnd == hHelperWnd)
- hHelperWnd = NULL;
+ hHelperWnd = nullptr;
else
- hDummyWnd = NULL;
+ hDummyWnd = nullptr;
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -76,19 +76,19 @@ void CreateHelperWnd() wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true);
- wcex.hCursor = NULL;
+ wcex.hCursor = nullptr;
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- wcex.lpszMenuName = NULL;
+ wcex.lpszMenuName = nullptr;
wcex.lpszClassName = L"ZeroSwitchHlp";
wcex.hIconSm = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
if (NULL == RegisterClassEx(&wcex))
return; // wtf
- hDummyWnd = CreateWindow(L"ZeroSwitchHlp", L"", WS_POPUP, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
+ hDummyWnd = CreateWindow(L"ZeroSwitchHlp", L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr);
if (!hDummyWnd)
UnregisterClass(L"ZeroSwitchHlp", hInst);
- hHelperWnd = CreateWindow(L"ZeroSwitchHlp", L"Miranda NG", WS_OVERLAPPEDWINDOW | WS_VISIBLE, -100, -100, 90, 90, hDummyWnd, NULL, hInst, NULL);
+ hHelperWnd = CreateWindow(L"ZeroSwitchHlp", L"Miranda NG", WS_OVERLAPPEDWINDOW | WS_VISIBLE, -100, -100, 90, 90, hDummyWnd, nullptr, hInst, nullptr);
if (!hHelperWnd)
{
DestroyWindow(hDummyWnd);
@@ -127,7 +127,7 @@ LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) }
}
}
- return CallNextHookEx(NULL, nCode, wParam, lParam); // Pass the message to other hooks in chain
+ return CallNextHookEx(nullptr, nCode, wParam, lParam); // Pass the message to other hooks in chain
}
extern "C" int __declspec(dllexport) Load(void)
@@ -136,14 +136,14 @@ extern "C" int __declspec(dllexport) Load(void) pcli = Clist_GetInterface();
if (IsWinVerVistaPlus()) {
- MessageBox(NULL, TranslateT("Plugin works under Windows XP only"), TranslateT("ZeroSwitch plugin failed"), MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("Plugin works under Windows XP only"), TranslateT("ZeroSwitch plugin failed"), MB_ICONSTOP);
return 1;
}
// Let's setup shop :)
- hHook = SetWindowsHookEx(WH_CALLWNDPROCRET, CallWndRetProc, NULL, GetCurrentThreadId());
- if (hHook == NULL)
- MessageBox(NULL, TranslateT("Oops, we've got a big hook error here :("), TranslateT("ZeroSwitch plugin failed"), MB_ICONSTOP);
+ hHook = SetWindowsHookEx(WH_CALLWNDPROCRET, CallWndRetProc, nullptr, GetCurrentThreadId());
+ if (hHook == nullptr)
+ MessageBox(nullptr, TranslateT("Oops, we've got a big hook error here :("), TranslateT("ZeroSwitch plugin failed"), MB_ICONSTOP);
return 0;
}
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index 8ad7a2076c..a52c58754b 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -63,7 +63,7 @@ wchar_t *Hlp_GetWindowText(HWND hwndDlg) // Logging
static int WriteToDebugLogA(const char *szMsg)
{
- return Netlib_Log(0, szMsg);
+ return Netlib_Log(nullptr, szMsg);
}
int AddDebugLogMessageA(const char* fmt, ...)
diff --git a/plugins/mTextControl/src/FormattedTextDraw.cpp b/plugins/mTextControl/src/FormattedTextDraw.cpp index 61bd51534a..346cb8f1e2 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.cpp +++ b/plugins/mTextControl/src/FormattedTextDraw.cpp @@ -176,14 +176,14 @@ HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc) m_spTextServices->TxDraw(
DVASPECT_CONTENT, // Draw Aspect
0, // Lindex
- NULL, // Info for drawing optimization
- NULL, // target device information
+ nullptr, // Info for drawing optimization
+ nullptr, // target device information
(HDC)hdcDraw, // Draw device HDC
- NULL, // Target device HDC
+ nullptr, // Target device HDC
(RECTL *)prc, // Bounding client rectangle
- NULL, // Clipping rectangle for metafiles
- (RECT *)NULL, // Update rectangle
- NULL, // Call back function
+ nullptr, // Clipping rectangle for metafiles
+ (RECT *)nullptr, // Update rectangle
+ nullptr, // Call back function
NULL, // Call back parameter
TXTVIEW_INACTIVE); // What view of the object could be TXTVIEW_ACTIVE
return S_OK;
@@ -223,7 +223,7 @@ HRESULT CFormattedTextDraw::get_NaturalSize(void *hdcDraw, long *Width, long *He SIZEL szExtent;
szExtent.cx = *Width;
szExtent.cy = *Height;
- if (m_spTextServices->TxGetNaturalSize(DVASPECT_CONTENT, (HDC)hdcDraw, NULL, NULL, TXTNS_FITTOCONTENT, &szExtent, Width, Height) != S_OK)
+ if (m_spTextServices->TxGetNaturalSize(DVASPECT_CONTENT, (HDC)hdcDraw, nullptr, nullptr, TXTNS_FITTOCONTENT, &szExtent, Width, Height) != S_OK)
return S_FALSE;
return S_OK;
@@ -234,7 +234,7 @@ HRESULT CFormattedTextDraw::get_NaturalSize(void *hdcDraw, long *Width, long *He HDC CFormattedTextDraw::TxGetDC()
{
- return NULL;
+ return nullptr;
}
INT CFormattedTextDraw::TxReleaseDC(HDC)
@@ -307,7 +307,7 @@ void CFormattedTextDraw::TxSetFocus() void CFormattedTextDraw::TxSetCursor(HCURSOR hcur, BOOL fText)
{
if (fText)
- SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
+ SetCursor(LoadCursor(nullptr, MAKEINTRESOURCE(IDC_ARROW)));
else
SetCursor(hcur);
}
@@ -425,7 +425,7 @@ HRESULT CFormattedTextDraw::TxNotify(DWORD, void *) HIMC CFormattedTextDraw::TxImmGetContext()
{
- return NULL;
+ return nullptr;
}
void CFormattedTextDraw::TxImmReleaseContext(HIMC)
@@ -490,7 +490,7 @@ HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) HRESULT CFormattedTextDraw::InitDefaultCharFormat()
{
- return CharFormatFromHFONT(m_pCF, NULL);
+ return CharFormatFromHFONT(m_pCF, nullptr);
}
HRESULT CFormattedTextDraw::InitDefaultParaFormat()
@@ -507,7 +507,7 @@ HRESULT CFormattedTextDraw::InitDefaultParaFormat() HRESULT CFormattedTextDraw::CreateTextServicesObject()
{
IUnknown *spUnk;
- HRESULT hr = MyCreateTextServices(NULL, static_cast<ITextHost*>(this), &spUnk);
+ HRESULT hr = MyCreateTextServices(nullptr, static_cast<ITextHost*>(this), &spUnk);
if (hr == S_OK) {
hr = spUnk->QueryInterface(IID_ITextServices, (void**)&m_spTextServices);
hr = spUnk->QueryInterface(IID_ITextDocument, (void**)&m_spTextDocument);
diff --git a/plugins/mTextControl/src/ImageDataObjectHlp.cpp b/plugins/mTextControl/src/ImageDataObjectHlp.cpp index 762ccf7322..3c7a66eb55 100644 --- a/plugins/mTextControl/src/ImageDataObjectHlp.cpp +++ b/plugins/mTextControl/src/ImageDataObjectHlp.cpp @@ -28,7 +28,7 @@ struct EMFCACHE HICON hIcon;
EMFCACHE *prev;
EMFCACHE *next;
-} *emfCache = 0;
+} *emfCache = nullptr;
int emfCacheSize = 0;
mir_cs csEmfCache;
@@ -44,7 +44,7 @@ void UnloadEmfCache() HENHMETAFILE CacheIconToEmf(HICON hIcon)
{
- HENHMETAFILE result = 0;
+ HENHMETAFILE result = nullptr;
mir_cslock lck(csEmfCache);
for (EMFCACHE *p = emfCache; p; p = p->next)
if (p->hIcon == hIcon)
@@ -53,11 +53,11 @@ HENHMETAFILE CacheIconToEmf(HICON hIcon) {
p->prev->next = p->next;
if (p->next) p->next->prev = p->prev;
- p->prev = 0;
+ p->prev = nullptr;
emfCache->prev = p;
p->next = emfCache;
emfCache = p;
- result = CopyEnhMetaFile(emfCache->hEmf, 0);
+ result = CopyEnhMetaFile(emfCache->hEmf, nullptr);
break;
}
}
@@ -66,17 +66,17 @@ HENHMETAFILE CacheIconToEmf(HICON hIcon) if (!result)
{
EMFCACHE *newItem = new EMFCACHE;
- newItem->prev = 0;
+ newItem->prev = nullptr;
newItem->next = emfCache;
if (emfCache) emfCache->prev = newItem;
emfCache = newItem;
emfCacheSize++;
- HDC emfdc = CreateEnhMetaFile(NULL, NULL, NULL, L"icon");
- DrawIconEx(emfdc, 0, 0, (HICON)hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ HDC emfdc = CreateEnhMetaFile(nullptr, nullptr, nullptr, L"icon");
+ DrawIconEx(emfdc, 0, 0, (HICON)hIcon, 16, 16, 0, nullptr, DI_NORMAL);
emfCache->hIcon = hIcon;
emfCache->hEmf = CloseEnhMetaFile(emfdc);
- result = CopyEnhMetaFile(emfCache->hEmf, 0);
+ result = CopyEnhMetaFile(emfCache->hEmf, nullptr);
}
// tail cutoff
@@ -112,14 +112,14 @@ bool InsertBitmap(IRichEditOle* pRichEditOle, HENHMETAFILE hEmf) //
static const FORMATETC lc_format[] =
{
- { CF_ENHMETAFILE, 0, DVASPECT_CONTENT, -1, TYMED_ENHMF }//,
+ { CF_ENHMETAFILE, nullptr, DVASPECT_CONTENT, -1, TYMED_ENHMF }//,
// { CF_BITMAP, 0, DVASPECT_CONTENT, -1, TYMED_GDI },
// { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }
};
STGMEDIUM lc_stgmed[] =
{
- { TYMED_ENHMF, { (HBITMAP)hEmf }, 0 }//,
+ { TYMED_ENHMF, { (HBITMAP)hEmf }, nullptr }//,
// { TYMED_GDI, { hBitmap }, 0 },
// { TYMED_HGLOBAL, { (HBITMAP)hGlobal }, 0 }
};
@@ -134,8 +134,8 @@ bool InsertBitmap(IRichEditOle* pRichEditOle, HENHMETAFILE hEmf) // Initialize a Storage Object
//
- LPLOCKBYTES lpLockBytes = NULL;
- sc = CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
+ LPLOCKBYTES lpLockBytes = nullptr;
+ sc = CreateILockBytesOnHGlobal(nullptr, TRUE, &lpLockBytes);
if (sc != S_OK)
{
pOleClientSite->Release();
diff --git a/plugins/mTextControl/src/dataobject.cpp b/plugins/mTextControl/src/dataobject.cpp index 53fcd0e2f7..a05a63d05c 100644 --- a/plugins/mTextControl/src/dataobject.cpp +++ b/plugins/mTextControl/src/dataobject.cpp @@ -128,7 +128,7 @@ HRESULT __stdcall CDataObject::QueryInterface(REFIID iid, void **ppvObject) return S_OK;
}
- *ppvObject = 0;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
@@ -163,7 +163,7 @@ HRESULT __stdcall CDataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium // found a match! transfer the data into the supplied storage-medium
//
pMedium->tymed = m_pFormatEtc[idx].tymed;
- pMedium->pUnkForRelease = 0;
+ pMedium->pUnkForRelease = nullptr;
switch (pMedium->tymed) {
case TYMED_HGLOBAL:
@@ -176,7 +176,7 @@ HRESULT __stdcall CDataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium default:
return DV_E_FORMATETC;
}
- if (pMedium->hBitmap == NULL) return STG_E_MEDIUMFULL;
+ if (pMedium->hBitmap == nullptr) return STG_E_MEDIUMFULL;
return S_OK;
}
@@ -210,7 +210,7 @@ HRESULT __stdcall CDataObject::QueryGetData(FORMATETC *pFormatEtc) HRESULT __stdcall CDataObject::GetCanonicalFormatEtc(FORMATETC *, FORMATETC *pFormatEtcOut)
{
// Apparently we have to set this field to NULL even though we don't do anything else
- pFormatEtcOut->ptd = NULL;
+ pFormatEtcOut->ptd = nullptr;
return E_NOTIMPL;
}
@@ -267,7 +267,7 @@ HRESULT __stdcall CDataObject::EnumDAdvise(IEnumSTATDATA **) //
HRESULT CreateDataObject(const FORMATETC *fmtetc, const STGMEDIUM *stgmeds, UINT count, IDataObject **ppDataObject)
{
- if (ppDataObject == 0)
+ if (ppDataObject == nullptr)
return E_INVALIDARG;
*ppDataObject = new CDataObject(fmtetc, stgmeds, count);
diff --git a/plugins/mTextControl/src/enumformat.cpp b/plugins/mTextControl/src/enumformat.cpp index 27aceb5790..64ae07e3c3 100644 --- a/plugins/mTextControl/src/enumformat.cpp +++ b/plugins/mTextControl/src/enumformat.cpp @@ -55,7 +55,7 @@ private: //
HRESULT CreateEnumFormatEtc(UINT nNumFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc)
{
- if (nNumFormats == 0 || pFormatEtc == 0 || ppEnumFormatEtc == 0)
+ if (nNumFormats == 0 || pFormatEtc == nullptr || ppEnumFormatEtc == nullptr)
return E_INVALIDARG;
*ppEnumFormatEtc = new CEnumFormatEtc(pFormatEtc, nNumFormats);
@@ -149,7 +149,7 @@ HRESULT __stdcall CEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject) return S_OK;
}
else {
- *ppvObject = 0;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
@@ -165,7 +165,7 @@ HRESULT __stdcall CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG ULONG copied = 0;
// validate arguments
- if (celt == 0 || pFormatEtc == 0)
+ if (celt == 0 || pFormatEtc == nullptr)
return E_INVALIDARG;
// copy FORMATETC structures into caller's buffer
@@ -176,7 +176,7 @@ HRESULT __stdcall CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG }
// store result
- if (pceltFetched != 0)
+ if (pceltFetched != nullptr)
*pceltFetched = copied;
// did we copy all that was requested?
diff --git a/plugins/mTextControl/src/fancy_rtf.cpp b/plugins/mTextControl/src/fancy_rtf.cpp index 17f5f76dba..6aacfe0362 100644 --- a/plugins/mTextControl/src/fancy_rtf.cpp +++ b/plugins/mTextControl/src/fancy_rtf.cpp @@ -85,14 +85,14 @@ static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, wchar_t *t static BBCodeInfo bbCodes[] =
{
- { L"[b]", 0, bbCodeSimpleFunc, BBS_BOLD_S },
- { L"[/b]", 0, bbCodeSimpleFunc, BBS_BOLD_E },
- { L"[i]", 0, bbCodeSimpleFunc, BBS_ITALIC_S },
- { L"[/i]", 0, bbCodeSimpleFunc, BBS_ITALIC_E },
- { L"[u]", 0, bbCodeSimpleFunc, BBS_UNDERLINE_S },
- { L"[/u]", 0, bbCodeSimpleFunc, BBS_UNDERLINE_E },
- { L"[s]", 0, bbCodeSimpleFunc, BBS_STRIKEOUT_S },
- { L"[/s]", 0, bbCodeSimpleFunc, BBS_STRIKEOUT_E },
+ { L"[b]", nullptr, bbCodeSimpleFunc, BBS_BOLD_S },
+ { L"[/b]", nullptr, bbCodeSimpleFunc, BBS_BOLD_E },
+ { L"[i]", nullptr, bbCodeSimpleFunc, BBS_ITALIC_S },
+ { L"[/i]", nullptr, bbCodeSimpleFunc, BBS_ITALIC_E },
+ { L"[u]", nullptr, bbCodeSimpleFunc, BBS_UNDERLINE_S },
+ { L"[/u]", nullptr, bbCodeSimpleFunc, BBS_UNDERLINE_E },
+ { L"[s]", nullptr, bbCodeSimpleFunc, BBS_STRIKEOUT_S },
+ { L"[/s]", nullptr, bbCodeSimpleFunc, BBS_STRIKEOUT_E },
// { L"[color=", L"]", bbCodeSimpleFunc, BBS_COLOR_S },
// { L"[/color]", 0, bbCodeSimpleFunc, BBS_COLOR_E }
@@ -115,8 +115,8 @@ void bbCodeParse(IFormattedTextDraw *ftd) for (bool found = true; found;) {
found = false;
CHARRANGE fRange; fRange.cpMin = -1;
- wchar_t *fText = 0;
- BBCodeInfo *fBBCode = NULL;
+ wchar_t *fText = nullptr;
+ BBCodeInfo *fBBCode = nullptr;
for (int i = 0; i < bbCodeCount; i++) {
CHARRANGE range;
diff --git a/plugins/mTextControl/src/main.cpp b/plugins/mTextControl/src/main.cpp index f96175de84..ce4ce10b7e 100644 --- a/plugins/mTextControl/src/main.cpp +++ b/plugins/mTextControl/src/main.cpp @@ -21,13 +21,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = 0;
+HINSTANCE hInst = nullptr;
int hLangpack;
-HMODULE hMsfteditDll = 0;
+HMODULE hMsfteditDll = nullptr;
typedef HRESULT(WINAPI *pfnMyCreateTextServices)(IUnknown *punkOuter, ITextHost *pITextHost, IUnknown **ppUnk);
-pfnMyCreateTextServices MyCreateTextServices = NULL;
+pfnMyCreateTextServices MyCreateTextServices = nullptr;
PLUGININFOEX pluginInfoEx =
{
@@ -59,7 +59,7 @@ extern "C" __declspec(dllexport) int Load(void) {
mir_getLP(&pluginInfoEx);
- MyCreateTextServices = 0;
+ MyCreateTextServices = nullptr;
hMsfteditDll = LoadLibrary(L"msftedit.dll");
if (hMsfteditDll)
MyCreateTextServices = (pfnMyCreateTextServices)GetProcAddress(hMsfteditDll, "CreateTextServices");
diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp index 442e512d4e..650c596129 100644 --- a/plugins/mTextControl/src/richeditutils.cpp +++ b/plugins/mTextControl/src/richeditutils.cpp @@ -10,7 +10,7 @@ public: CREOleCallback()
{
refCount = 1;
- pictStg = 0;
+ pictStg = nullptr;
nextStgId = 0;
}
@@ -21,15 +21,15 @@ public: this->AddRef();
return S_OK;
}
- *ppvObj = NULL;
+ *ppvObj = nullptr;
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE AddRef()
{
if (this->refCount == 0) {
- if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &this->pictStg))
- this->pictStg = NULL;
+ if (S_OK != StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &this->pictStg))
+ this->pictStg = nullptr;
this->nextStgId = 0;
}
return ++this->refCount;
@@ -78,7 +78,7 @@ public: {
wchar_t sztName[64];
mir_snwprintf(sztName, L"s%u", this->nextStgId);
- if (this->pictStg == NULL)
+ if (this->pictStg == nullptr)
return STG_E_MEDIUMFULL;
return this->pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
@@ -101,7 +101,7 @@ public: }
};
-IRichEditOleCallback *reOleCallback = 0;
+IRichEditOleCallback *reOleCallback = nullptr;
void InitRichEdit(ITextServices *ts)
{
@@ -131,12 +131,12 @@ void LoadRichEdit() 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 = L"NBRichEditProxyWndClass";
- wcl.hIconSm = 0;
+ wcl.hIconSm = nullptr;
RegisterClassEx(&wcl);
}
@@ -147,7 +147,7 @@ void UnloadRichEdit() HWND CreateProxyWindow(ITextServices *ts)
{
- HWND hwnd = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, 0, 0, hInst, 0);
+ HWND hwnd = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ts);
return hwnd;
}
diff --git a/plugins/mTextControl/src/services.cpp b/plugins/mTextControl/src/services.cpp index affac23e92..162e87057a 100644 --- a/plugins/mTextControl/src/services.cpp +++ b/plugins/mTextControl/src/services.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "stdafx.h"
-static HANDLE hService[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+static HANDLE hService[11] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
INT_PTR MText_Register(WPARAM, LPARAM);
INT_PTR MText_Create(WPARAM, LPARAM);
@@ -37,7 +37,7 @@ struct TextObject {
DWORD options;
IFormattedTextDraw *ftd;
- TextObject() : options(0), ftd(0) {}
+ TextObject() : options(0), ftd(nullptr) {}
~TextObject() { if (ftd) delete ftd; }
};
@@ -62,8 +62,8 @@ void MText_InitFormatting1(TextObject *text) SMADD_RICHEDIT3 sm = { 0 };
sm.cbSize = sizeof(sm);
sm.hwndRichEditControl = hwnd;
- sm.rangeToReplace = 0;
- sm.Protocolname = 0;
+ sm.rangeToReplace = nullptr;
+ sm.Protocolname = nullptr;
sm.flags = SAFLRE_INSERTEMF;
CallService(MS_SMILEYADD_REPLACESMILEYS, RGB(0xff, 0xff, 0xff), (LPARAM)&sm);
DestroyWindow(hwnd);
@@ -164,7 +164,7 @@ MTI_MTextCreateEx(HANDLE userHandle, void *text, DWORD flags) MText_InitFormatting1(result);
delete result;
- return 0;
+ return nullptr;
}
INT_PTR MText_CreateEx(WPARAM wParam, LPARAM lParam)
@@ -272,7 +272,7 @@ MTI_MTextSendMessage(HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lPa if (hwnd && (msg == WM_MOUSEMOVE)) {
HDC hdc = GetDC(hwnd);
- ((TextObject *)text)->ftd->getTextService()->OnTxSetCursor(DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, LOWORD(0), HIWORD(0));
+ ((TextObject *)text)->ftd->getTextService()->OnTxSetCursor(DVASPECT_CONTENT, 0, nullptr, nullptr, hdc, nullptr, nullptr, LOWORD(0), HIWORD(0));
ReleaseDC(hwnd, hdc);
}
@@ -291,7 +291,7 @@ INT_PTR MText_SendMessage(WPARAM wParam, LPARAM) HWND DLL_CALLCONV
MTI_MTextCreateProxy(HANDLE text)
{
- if (!text) return 0;
+ if (!text) return nullptr;
return CreateProxyWindow(((TextObject *)text)->ftd->getTextService());
}
@@ -325,7 +325,7 @@ INT_PTR MText_Destroy(WPARAM wParam, LPARAM) INT_PTR MText_GetInterface(WPARAM, LPARAM lParam)
{
MTEXT_INTERFACE *MText = (MTEXT_INTERFACE *)lParam;
- if (MText == NULL)
+ if (MText == nullptr)
return CALLSERVICE_NOTFOUND;
MText->version = pluginInfoEx.version;
diff --git a/plugins/mTextControl/src/textcontrol.cpp b/plugins/mTextControl/src/textcontrol.cpp index 4dad57ec55..b8f66ef432 100644 --- a/plugins/mTextControl/src/textcontrol.cpp +++ b/plugins/mTextControl/src/textcontrol.cpp @@ -39,12 +39,12 @@ void MTextControl_RegisterClass() 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 = MODULNAMEW;
- wcl.hIconSm = 0;
+ wcl.hIconSm = nullptr;
RegisterClassEx(&wcl);
}
@@ -54,8 +54,8 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) {
case WM_CREATE:
data = new TextControlData;
- data->text = 0;
- data->mtext = 0;
+ data->text = nullptr;
+ data->mtext = nullptr;
data->htu = htuDefault;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
PostMessage(hwnd, MTM_UPDATE, 0, 0);
@@ -81,7 +81,7 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rc; GetClientRect(hwnd, &rc);
MTI_MTextSetParent(data->mtext, hwnd, rc);
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
return TRUE;
@@ -120,7 +120,7 @@ LRESULT MTextControl_OnPaint(HWND hwnd, WPARAM, LPARAM) // Find the text to draw
TextControlData *data = (TextControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (data->mtext) {
- HFONT hfntSave = 0;
+ HFONT hfntSave = nullptr;
HFONT hfnt = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
if (!hfnt)
hfnt = (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, 0, 0);
diff --git a/plugins/mTextControl/src/textusers.cpp b/plugins/mTextControl/src/textusers.cpp index 867c5e1243..b9a16a3d21 100644 --- a/plugins/mTextControl/src/textusers.cpp +++ b/plugins/mTextControl/src/textusers.cpp @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "stdafx.h"
-HANDLE htuDefault = 0;
+HANDLE htuDefault = nullptr;
-TextUser *textUserFirst = 0;
-TextUser *textUserLast = 0;
+TextUser *textUserFirst = nullptr;
+TextUser *textUserLast = nullptr;
void LoadTextUsers()
{
@@ -48,7 +48,7 @@ HANDLE DLL_CALLCONV MTI_TextUserAdd(const char *userTitle, DWORD options) (db_get_dw(0, MODULNAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK);
db_set_dw(0, MODULNAME, userTitle, textUserNew->options);
textUserNew->prev = textUserLast;
- textUserNew->next = 0;
+ textUserNew->next = nullptr;
if (textUserLast) {
textUserLast->next = textUserNew;
textUserLast = textUserNew;
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 5a1a11bf4c..2ab9f02e91 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -180,7 +180,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) pbuf++;
}
- wchar_t *c1 = 0, *c2 = 0;
+ wchar_t *c1 = nullptr, *c2 = nullptr;
if ( i1 == 1 )
c1 = mir_wstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
else if ( i1 == 2 )
diff --git a/plugins/wbOSD/src/main.cpp b/plugins/wbOSD/src/main.cpp index ad1213f930..def91cae53 100644 --- a/plugins/wbOSD/src/main.cpp +++ b/plugins/wbOSD/src/main.cpp @@ -11,7 +11,7 @@ Distributed under GNU's GPL 2 or later HINSTANCE hI;
-HWND g_hWnd = 0;
+HWND g_hWnd = nullptr;
int hLangpack = 0;
CLIST_INTERFACE *pcli;
HANDLE hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged;
diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp index e779cea271..5c77d0390f 100644 --- a/plugins/wbOSD/src/options.cpp +++ b/plugins/wbOSD/src/options.cpp @@ -11,14 +11,14 @@ Distributed under GNU's GPL 2 or later COLORREF pencustcolors[16];
-const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), 0, 0 };
+const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), nullptr, 0 };
void FillCheckBoxTree(HWND hwndTree, DWORD style)
{
logmsg("FillCheckBoxTree");
- TVINSERTSTRUCT tvis = { 0 };
- tvis.hParent = NULL;
+ TVINSERTSTRUCT tvis = {};
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
for (WORD status = ID_STATUS_OFFLINE; status <= ID_STATUS_OUTTOLUNCH; status++) {
@@ -226,7 +226,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) ps[1] = ps[0];
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ps);
SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX);
- SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+ SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE2), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
@@ -277,9 +277,9 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) saveDBSettings(&ps[0]);
SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP);
- SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+ SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
- SetWindowPos(g_hWnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(g_hWnd, nullptr, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER | SWP_NOACTIVATE);
SetLayeredWindowAttributes(g_hWnd, ps->bkclr, ps->alpha, (ps->transparent ? LWA_COLORKEY : 0) | LWA_ALPHA);
free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA));
@@ -318,10 +318,10 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) case IDC_CHECK2:
ps->showMsgWindow = IsDlgButtonChecked(hDlg, IDC_CHECK2);
case IDC_EDIT1:
- ps->distance = GetDlgItemInt(hDlg, IDC_EDIT1, 0, 0);
+ ps->distance = GetDlgItemInt(hDlg, IDC_EDIT1, nullptr, 0);
break;
case IDC_EDIT5:
- ps->timeout = GetDlgItemInt(hDlg, IDC_EDIT5, 0, 0);
+ ps->timeout = GetDlgItemInt(hDlg, IDC_EDIT5, nullptr, 0);
break;
case IDC_CHECK3:
ps->transparent = IsDlgButtonChecked(hDlg, IDC_CHECK3);
@@ -362,12 +362,12 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) }
xxx:
saveDBSettings(ps);
- SetWindowPos(g_hWnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(g_hWnd, nullptr, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetLayeredWindowAttributes(g_hWnd,
db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR),
db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA),
(db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
- InvalidateRect(g_hWnd, 0, TRUE);
+ InvalidateRect(g_hWnd, nullptr, TRUE);
SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
return 0;
@@ -398,7 +398,7 @@ xxx: saveDBSettings(ps);
SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
- InvalidateRect(g_hWnd, 0, TRUE);
+ InvalidateRect(g_hWnd, nullptr, TRUE);
break;
}
break;
diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index 5034133a09..7f10ac8ff3 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -10,7 +10,7 @@ Distributed under GNU's GPL 2 or later #include "stdafx.h"
wchar_t szClassName[] = L"wbOSD";
-const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), 0, 0 };
+const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), nullptr, 0 };
int DrawMe(HWND hwnd, wchar_t *string, COLORREF color)
{
@@ -165,7 +165,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM if (lParam == 0)
lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
ms->timeout = lParam;
- ms->callback = 0;
+ ms->callback = nullptr;
ms->color = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
ms->param = 0;
SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0);
@@ -196,7 +196,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM logmsg("WindowProcedure::USER+4");
ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (ms != 0) {
+ if (ms != nullptr) {
logmsg("WindowProcedure::USER+4/old");
KillTimer(hwnd, (UINT_PTR)ms);
mir_free(ms->text);
@@ -209,8 +209,8 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM ms->text = mir_wstrdup(ms->text);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms);
- SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0);
- InvalidateRect(hwnd, 0, TRUE);
+ SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, nullptr);
+ InvalidateRect(hwnd, nullptr, TRUE);
SendMessage(hwnd, WM_USER + 2, 0, 0);
return 0;
@@ -248,7 +248,7 @@ int pluginShutDown(WPARAM, LPARAM) logmsg("pluginShutDown/hwnd");
SendMessage(g_hWnd, WM_USER + 3, 0, 0);
DestroyWindow(g_hWnd);
- g_hWnd = NULL;
+ g_hWnd = nullptr;
}
return 0;
}
@@ -265,13 +265,13 @@ int MainInit(WPARAM, LPARAM) wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof(WNDCLASSEX);
- wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
- wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
- wincl.lpszMenuName = NULL;
+ wincl.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
+ wincl.hIconSm = LoadIcon(nullptr, IDI_APPLICATION);
+ wincl.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wincl.lpszMenuName = nullptr;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
- wincl.hbrBackground = 0;
+ wincl.hbrBackground = nullptr;
if (!RegisterClassEx(&wincl))
return 0;
@@ -282,7 +282,7 @@ int MainInit(WPARAM, LPARAM) db_get_dw(NULL, THIS_MODULE, "winypos", DEFAULT_WINYPOS),
db_get_dw(NULL, THIS_MODULE, "winx", DEFAULT_WINX),
db_get_dw(NULL, THIS_MODULE, "winy", DEFAULT_WINY),
- HWND_DESKTOP, NULL, hI, NULL);
+ HWND_DESKTOP, nullptr, hI, nullptr);
SetWindowLongPtr(g_hWnd, GWLP_USERDATA, 0);
|