diff options
Diffstat (limited to 'src')
128 files changed, 970 insertions, 970 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index 8497cbb693..821b4bae55 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -71,7 +71,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP  			Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus);
  		}
 -		if (dat->hSeq == NULL) {
 +		if (dat->hSeq == nullptr) {
  			ACKDATA ack = { 0 };
  			ack.cbSize = sizeof(ack);
  			ack.hContact = dat->hContact;
 @@ -87,7 +87,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP  			ACKDATA *ack = (ACKDATA*)lParam;
  			if (ack->hContact != dat->hContact || ack->type != ACKTYPE_AWAYMSG) break;
  			if (ack->result != ACKRESULT_SUCCESS) break;
 -			if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) { UnhookEvent(dat->hAwayMsgEvent); dat->hAwayMsgEvent = NULL; }
 +			if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) { UnhookEvent(dat->hAwayMsgEvent); dat->hAwayMsgEvent = nullptr; }
  			SetDlgItemText(hwndDlg, IDC_MSG, (const wchar_t*)ack->lParam);
 @@ -134,7 +134,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM)  static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
  {
  	char *szProto = GetContactProto(hContact);
 -	if (szProto != NULL) {
 +	if (szProto != nullptr) {
  		int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
  		if (!chatRoom) {
  			int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
 diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index d3013ea14f..09a9ae9bf3 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -42,7 +42,7 @@ static 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;
  }
  static const char *StatusModeToDbSetting(int status, const char *suffix)
 @@ -63,7 +63,7 @@ static 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;
 @@ -82,10 +82,10 @@ static void SetStatusModeByte(int status, const char *suffix, BYTE value)  static wchar_t* GetAwayMessage(int statusMode, char *szProto)
  {
  	if (szProto && !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode)))
 -		return NULL;
 +		return nullptr;
  	if ( GetStatusModeByte(statusMode, "Ignore"))
 -		return NULL;
 +		return nullptr;
  	DBVARIANT dbv;
  	if ( GetStatusModeByte(statusMode, "UsePrev")) {
 @@ -173,7 +173,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar  void ChangeAllProtoMessages(char *szProto, int statusMode, wchar_t *msg)
  {
 -	if (szProto == NULL) {
 +	if (szProto == nullptr) {
  		int nAccounts;
  		PROTOACCOUNT **accounts;
  		Proto_EnumAccounts(&nAccounts, &accounts);
 @@ -239,7 +239,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa  			SendMessage(hwndDlg, WM_TIMER, 0, 0);
  			Window_SetProtoIcon_IcoLib(hwndDlg, dat->szProto, dat->statusMode);
  			Utils_RestoreWindowPosition(hwndDlg, NULL, "SRAway", "AwayMsgDlg");
 -			SetTimer(hwndDlg, 1, 1000, 0);
 +			SetTimer(hwndDlg, 1, 1000, nullptr);
  			dat->hPreshutdown = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, DM_SRAWAY_SHUTDOWN);
  		}
  		return TRUE;
 @@ -298,7 +298,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa  		UnhookEvent(dat->hPreshutdown);
  		Window_FreeIcon_IcoLib(hwndDlg);
  		mir_free(dat);
 -		hwndStatusMsg = NULL;
 +		hwndStatusMsg = nullptr;
  		break;
  	}
  	return FALSE;
 @@ -326,7 +326,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam)  	BOOL bScreenSaverRunning = IsScreenSaverRunning();
  	if (GetStatusModeByte(statusMode, "Ignore"))
 -		ChangeAllProtoMessages(szProto, statusMode, NULL);
 +		ChangeAllProtoMessages(szProto, statusMode, nullptr);
  	else if (bScreenSaverRunning || GetStatusModeByte(statusMode, "NoDlg", true)) {
  		wchar_t *msg = GetAwayMessage(statusMode, szProto);
 @@ -435,7 +435,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam  			}
  			RECT rc = dis->rcItem;
 -			DrawIconEx(dis->hDC, 3, (rc.top + rc.bottom - 16) / 2, Skin_LoadProtoIcon(NULL, dis->itemData), 16, 16, 0, NULL, DI_NORMAL);
 +			DrawIconEx(dis->hDC, 3, (rc.top + rc.bottom - 16) / 2, Skin_LoadProtoIcon(nullptr, dis->itemData), 16, 16, 0, nullptr, DI_NORMAL);
  			rc.left += 25;
  			SetBkMode(dis->hDC, TRANSPARENT);
  			DrawText(dis->hDC, buf, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
 diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index a2fae81932..b1678d1ef9 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -56,7 +56,7 @@ void RegisterCListFonts()  	strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
  	wcsncpy(fontid.group, LPGENW("Contact list"), _countof(fontid.group));
 -	HDC hdc = GetDC(NULL);
 +	HDC hdc = GetDC(nullptr);
  	for (int i = 0; i < _countof(clistFontDescr); i++) {
  		LOGFONT lf;
  		pcli->pfnGetFontSetting(i, &lf, &fontid.deffontsettings.colour);
 @@ -78,7 +78,7 @@ void RegisterCListFonts()  		fontid.order = i;
  		Font_RegisterW(&fontid);
  	}
 -	ReleaseDC(NULL, hdc);
 +	ReleaseDC(nullptr, hdc);
  	// and colours
  	ColourIDW colourid = { 0 };
 diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 0beae07eec..c431534d3f 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -89,7 +89,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++) {
 @@ -120,7 +120,7 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree)  static LONG CalcMinRowHeight()
  {
  	LONG minHeight = 16;
 -	HDC hdc = GetDC(NULL);
 +	HDC hdc = GetDC(nullptr);
  	for (int i = 0; i < FONTID_LAST; i++) {
  		LOGFONT lf;
  		COLORREF color;
 @@ -135,7 +135,7 @@ static LONG CalcMinRowHeight()  		hFont = (HFONT)SelectObject(hdc, hFont);
  		DeleteObject(hFont);
  	}
 -	ReleaseDC(NULL, hdc);
 +	ReleaseDC(nullptr, hdc);
  	return minHeight;
  }
 @@ -346,7 +346,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;
  			Bitmap_GetFilter(filter, _countof(filter));
  			ofn.lpstrFilter = filter;
  			ofn.lpstrFile = str;
 diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 456497a34c..c5b13837ba 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -162,14 +162,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)  	RECT clRect;
  	GetClientRect(hwnd, &clRect);
 -	if (rcPaint == NULL)
 +	if (rcPaint == nullptr)
  		rcPaint = &clRect;
  	if (IsRectEmpty(rcPaint))
  		return;
  	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 = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
  	TEXTMETRIC tm;
 @@ -180,7 +180,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)  	GetTextMetrics(hdcMem, &tm);
  	groupCountsFontTopShift -= tm.tmAscent;
 -	HBRUSH hBrushAlternateGrey = NULL;
 +	HBRUSH hBrushAlternateGrey = nullptr;
  	if (style & CLS_GREYALTERNATE)
  		hBrushAlternateGrey = CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10)));
 @@ -266,7 +266,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)  	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--;
 @@ -316,7 +316,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)  			GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_wstrlen(cc->szText), &textSize);
  			width = textSize.cx;
 -			wchar_t *ptszGroupCount = NULL;
 +			wchar_t *ptszGroupCount = nullptr;
  			if (cc->type == CLCIT_GROUP) {
  				ptszGroupCount = pcli->pfnGetGroupCountsText(dat, cc);
  				if (*ptszGroupCount) {
 @@ -432,7 +432,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)  					else if (hottrack)
  						SetHotTrackColour(hdcMem, dat);
  					rc.right--;
 -					ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_wstrlen(cc->szText), NULL);
 +					ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_wstrlen(cc->szText), nullptr);
  				}
  				else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_wstrlen(cc->szText));
 diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index 8a92ee1146..f9442fb5ce 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -31,7 +31,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP  		{
  			MCONTACT hContact = 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);
  			}
 @@ -176,7 +176,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/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index e97dcc9667..df06e1d9e2 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -155,7 +155,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));
 @@ -195,12 +195,12 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L  				SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);
  			if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) {
 -				HWND hProgMan = FindWindow(L"Progman", NULL);
 +				HWND hProgMan = FindWindow(L"Progman", nullptr);
  				if (hProgMan)
  					SetParent(pcli->hwndContactList, hProgMan);
  			}
  			else
 -				SetParent(pcli->hwndContactList, NULL);
 +				SetParent(pcli->hwndContactList, nullptr);
  			if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
  				int style = GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
 @@ -212,12 +212,12 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L  			}
  			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);
 @@ -297,7 +297,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/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp index 56d7826474..f883bf1438 100644 --- a/src/core/stdclist/src/contact.cpp +++ b/src/core/stdclist/src/contact.cpp @@ -65,7 +65,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/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp index 4bd2f23e92..4c8c0bc39c 100644 --- a/src/core/stdclist/src/init.cpp +++ b/src/core/stdclist/src/init.cpp @@ -24,9 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "stdafx.h"
 -HINSTANCE g_hInst = 0;
 -CLIST_INTERFACE* pcli = NULL, coreCli;
 -HIMAGELIST himlCListClc = NULL;
 +HINSTANCE g_hInst = nullptr;
 +CLIST_INTERFACE* pcli = nullptr, coreCli;
 +HIMAGELIST himlCListClc = nullptr;
  int hLangpack;
  /////////////////////////////////////////////////////////////////////////////////////////
 diff --git a/src/core/stdcrypt/src/Rijndael.cpp b/src/core/stdcrypt/src/Rijndael.cpp index 3392d5022c..510af48871 100644 --- a/src/core/stdcrypt/src/Rijndael.cpp +++ b/src/core/stdcrypt/src/Rijndael.cpp @@ -933,7 +933,7 @@ CRijndael::~CRijndael()  // blockSize  - The block size in bytes of this Rijndael (16, 24 or 32 bytes).
  int CRijndael::MakeKey(BYTE const* key, char const* chain, int keylength, int blockSize)
  {
 -	if (NULL == key)
 +	if (nullptr == key)
  		return 1;
  	if (!(16 == keylength || 24 == keylength || 32 == keylength))
  		return 2;
 diff --git a/src/core/stdcrypt/src/encrypt.cpp b/src/core/stdcrypt/src/encrypt.cpp index 1ca04f4782..3439772592 100644 --- a/src/core/stdcrypt/src/encrypt.cpp +++ b/src/core/stdcrypt/src/encrypt.cpp @@ -119,10 +119,10 @@ void CStdCrypt::setPassword(const char *pszPassword)  // result must be freed using mir_free or assigned to mir_ptr<BYTE>
  BYTE* CStdCrypt::encodeString(const char *src, size_t *cbResultLen)
  {
 -	if (!m_valid || src == NULL) {
 +	if (!m_valid || src == nullptr) {
  		if (cbResultLen)
  			*cbResultLen = 0;
 -		return NULL;
 +		return nullptr;
  	}
  	return encodeBuffer(src, mir_strlen(src)+1, cbResultLen);
 @@ -133,8 +133,8 @@ BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen  	if (cbResultLen)
  		*cbResultLen = 0;
 -	if (!m_valid || src == NULL || cbLen >= 0xFFFE)
 -		return NULL;
 +	if (!m_valid || src == nullptr || cbLen >= 0xFFFE)
 +		return nullptr;
  	BYTE *tmpBuf = (BYTE*)_alloca(cbLen + 2);
  	*(PWORD)tmpBuf = (WORD)cbLen;
 @@ -148,7 +148,7 @@ BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen  	m_aes.ResetChain();
  	if (m_aes.Encrypt(tmpBuf, LPSTR(result), cbLen)) {
  		mir_free(result);
 -		return NULL;
 +		return nullptr;
  	}
  	if (cbResultLen)
 @@ -163,7 +163,7 @@ char* CStdCrypt::decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultL  	if (result) {
  		if (result[resLen-1] != 0) { // smth went wrong
  			mir_free(result);
 -			return NULL;
 +			return nullptr;
  		}
  	}
 @@ -177,21 +177,21 @@ void* CStdCrypt::decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultL  	if (cbResultLen)
  		*cbResultLen = 0;
 -	if (!m_valid || pBuf == NULL || (bufLen % BLOCK_SIZE) != 0)
 -		return NULL;
 +	if (!m_valid || pBuf == nullptr || (bufLen % BLOCK_SIZE) != 0)
 +		return nullptr;
  	char *result = (char*)mir_alloc(bufLen + 1);
  	m_aes.ResetChain();
  	if (m_aes.Decrypt(LPCSTR(pBuf), result, bufLen)) {
  		mir_free(result);
 -		return NULL;
 +		return nullptr;
  	}
  	result[bufLen] = 0;
  	WORD cbLen = *(PWORD)result;
  	if (cbLen > bufLen) {
  		mir_free(result);
 -		return NULL;
 +		return nullptr;
  	}
  	memmove(result, result + 2, cbLen);
 diff --git a/src/core/stdcrypt/src/utils.cpp b/src/core/stdcrypt/src/utils.cpp index c7bf59fbfd..27e641d1cd 100644 --- a/src/core/stdcrypt/src/utils.cpp +++ b/src/core/stdcrypt/src/utils.cpp @@ -27,9 +27,9 @@ bool getRandomBytes(BYTE *buf, size_t bufLen)  {
  	// try to use Intel hardware randomizer first
  	HCRYPTPROV hProvider = NULL;
 -	if (::CryptAcquireContext(&hProvider, NULL, L"Intel Hardware Cryptographic Service Provider", PROV_INTEL_SEC, 0) ||
 -		 ::CryptAcquireContext(&hProvider, NULL, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) ||
 -		 ::CryptAcquireContext(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
 +	if (::CryptAcquireContext(&hProvider, nullptr, L"Intel Hardware Cryptographic Service Provider", PROV_INTEL_SEC, 0) ||
 +		 ::CryptAcquireContext(&hProvider, nullptr, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) ||
 +		 ::CryptAcquireContext(&hProvider, nullptr, nullptr, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
  	{
  		::CryptGenRandom(hProvider, DWORD(bufLen), buf);
  		::CryptReleaseContext(hProvider, 0);
 @@ -38,7 +38,7 @@ bool getRandomBytes(BYTE *buf, size_t bufLen)  	else {
  		typedef BOOL(WINAPI *pfnGetRandom)(PVOID RandomBuffer, ULONG RandomBufferLength);
  		pfnGetRandom fnGetRandom = (pfnGetRandom)GetProcAddress(GetModuleHandleA("advapi32.dll"), "SystemFunction036");
 -		if (fnGetRandom == NULL)
 +		if (fnGetRandom == nullptr)
  			return false;
  		fnGetRandom(buf, DWORD(bufLen));
 diff --git a/src/core/stdemail/src/email.cpp b/src/core/stdemail/src/email.cpp index a5f36e95ea..66f42ce61d 100644 --- a/src/core/stdemail/src/email.cpp +++ b/src/core/stdemail/src/email.cpp @@ -27,7 +27,7 @@ static HGENMENU hEMailMenuItem;  void SendEmailThread(void *szUrl)
  {
 -	ShellExecuteA(NULL, "open", (char*)szUrl, "", "", SW_SHOW);
 +	ShellExecuteA(nullptr, "open", (char*)szUrl, "", "", SW_SHOW);
  	mir_free(szUrl);
  	return;
  }
 @@ -36,7 +36,7 @@ static INT_PTR SendEMailCommand(WPARAM hContact, LPARAM lParam)  {
  	DBVARIANT dbv;
  	char *szProto = GetContactProto(hContact);
 -	if (szProto == NULL || db_get_s(hContact, szProto, "e-mail", &dbv)) {
 +	if (szProto == nullptr || db_get_s(hContact, szProto, "e-mail", &dbv)) {
  		if (db_get_s(hContact, "UserInfo", "Mye-mail0", &dbv)) {
  			MessageBox((HWND)lParam, TranslateT("User has not registered an e-mail address"), TranslateT("Send e-mail"), MB_OK);
  			return 1;
 @@ -55,7 +55,7 @@ static int EMailPreBuildMenu(WPARAM hContact, LPARAM)  	bool bEnabled = true;
  	DBVARIANT dbv = { 0 };
  	char *szProto = GetContactProto(hContact);
 -	if (szProto == NULL || db_get_s(hContact, szProto, "e-mail", &dbv))
 +	if (szProto == nullptr || db_get_s(hContact, szProto, "e-mail", &dbv))
  		if (db_get_s(hContact, "UserInfo", "Mye-mail0", &dbv))
  			bEnabled = false;
 diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 3d391dd7a7..b2e5b04769 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -46,7 +46,7 @@ static INT_PTR SendFileCommand(WPARAM hContact, LPARAM)  {
  	struct FileSendData fsd;
  	fsd.hContact = hContact;
 -	fsd.ppFiles = NULL;
 +	fsd.ppFiles = nullptr;
  	return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
  }
 @@ -57,13 +57,13 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam)  	char** ppFiles = (char**)lParam;
  	int count = 0;
 -	while (ppFiles[count] != NULL)
 +	while (ppFiles[count] != nullptr)
  		count++;
  	fsd.ppFiles = (const wchar_t**)alloca((count + 1) * sizeof(void*));
  	for (int i = 0; i < count; i++)
  		fsd.ppFiles[i] = mir_a2u(ppFiles[i]);
 -	fsd.ppFiles[count] = NULL;
 +	fsd.ppFiles[count] = nullptr;
  	HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
  	for (int j = 0; j < count; j++)
 @@ -141,7 +141,7 @@ int SRFile_GetRegValue(HKEY hKeyBase, const wchar_t *szSubKey, const wchar_t *sz  	if (RegOpenKeyEx(hKeyBase, szSubKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
  		return 0;
 -	if (RegQueryValueEx(hKey, szValue, NULL, NULL, (PBYTE)szOutput, &cbOut) != ERROR_SUCCESS) {
 +	if (RegQueryValueEx(hKey, szValue, nullptr, nullptr, (PBYTE)szOutput, &cbOut) != ERROR_SUCCESS) {
  		RegCloseKey(hKey);
  		return 0;
  	}
 @@ -175,20 +175,20 @@ void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unit  // Tripple redirection sucks but is needed to nullify the array pointer
  void FreeFilesMatrix(wchar_t ***files)
  {
 -	if (*files == NULL)
 +	if (*files == nullptr)
  		return;
  	// Free each filename in the pointer array
  	wchar_t **pFile = *files;
 -	while (*pFile != NULL) {
 +	while (*pFile != nullptr) {
  		mir_free(*pFile);
 -		*pFile = NULL;
 +		*pFile = nullptr;
  		pFile++;
  	}
  	// Free the array itself
  	mir_free(*files);
 -	*files = NULL;
 +	*files = nullptr;
  }
  void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts)
 @@ -222,7 +222,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS  	if (dest->totalFiles != src->totalFiles) {
  		for (int i = 0; i < dest->totalFiles; i++) mir_free(dest->ptszFiles[i]);
  		mir_free(dest->ptszFiles);
 -		dest->ptszFiles = NULL;
 +		dest->ptszFiles = nullptr;
  		dest->totalFiles = src->totalFiles;
  	}
  	if (src->ptszFiles) {
 @@ -234,14 +234,14 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS  				if (src->ptszFiles[i])
  					dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
  				else
 -					dest->ptszFiles[i] = NULL;
 +					dest->ptszFiles[i] = nullptr;
  			}
  	}
  	else if (dest->ptszFiles) {
  		for (int i = 0; i < dest->totalFiles; i++)
  			mir_free(dest->ptszFiles[i]);
  		mir_free(dest->ptszFiles);
 -		dest->ptszFiles = NULL;
 +		dest->ptszFiles = nullptr;
  	}
  	dest->currentFileNumber = src->currentFileNumber;
 @@ -252,7 +252,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS  		if (src->tszWorkingDir)
  			dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
  		else
 -			dest->tszWorkingDir = NULL;
 +			dest->tszWorkingDir = nullptr;
  	}
  	if (!dest->tszCurrentFile || !src->tszCurrentFile || PFTS_CompareWithTchar(src, src->tszCurrentFile, dest->tszCurrentFile)) {
 @@ -260,7 +260,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS  		if (src->tszCurrentFile)
  			dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
  		else
 -			dest->tszCurrentFile = NULL;
 +			dest->tszCurrentFile = nullptr;
  	}
  	dest->currentFileSize = src->currentFileSize;
  	dest->currentFileProgress = src->currentFileProgress;
 @@ -287,7 +287,7 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM)  {
  	bool bEnabled = false;
  	char *szProto = GetContactProto(wParam);
 -	if (szProto != NULL) {
 +	if (szProto != nullptr) {
  		bool isChat = db_get_b(wParam, szProto, "ChatRoom", false) != 0;
  		if (CallProtoService(szProto, PS_GETCAPS, isChat ? PFLAGNUM_4 : PFLAGNUM_1, 0) & (isChat ? PF4_GROUPCHATFILES : PF1_FILESEND)) {
  			if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
 @@ -338,7 +338,7 @@ INT_PTR openContRecDir(WPARAM hContact, LPARAM)  {
  	wchar_t szContRecDir[MAX_PATH];
  	GetContactReceivedFilesDir(hContact, szContRecDir, _countof(szContRecDir), TRUE);
 -	ShellExecute(0, L"open", szContRecDir, 0, 0, SW_SHOW);
 +	ShellExecute(nullptr, L"open", szContRecDir, nullptr, nullptr, SW_SHOW);
  	return 0;
  }
 @@ -346,7 +346,7 @@ INT_PTR openRecDir(WPARAM, LPARAM)  {
  	wchar_t szContRecDir[MAX_PATH];
  	GetReceivedFilesDir(szContRecDir, _countof(szContRecDir));
 -	ShellExecute(0, L"open", szContRecDir, 0, 0, SW_SHOW);
 +	ShellExecute(nullptr, L"open", szContRecDir, nullptr, nullptr, SW_SHOW);
  	return 0;
  }
 @@ -389,7 +389,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)  	dbei.cbBlob += (int)mir_strlen(szDescr) + 1;
 -	if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == 0)
 +	if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == nullptr)
  		return 0;
  	*(DWORD*)dbei.pBlob = 0;
 @@ -401,7 +401,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)  			mir_free(pszFiles[i]);
  	}
 -	mir_strcpy((char*)p, (szDescr == NULL) ? "" : szDescr);
 +	mir_strcpy((char*)p, (szDescr == nullptr) ? "" : szDescr);
  	if (bUnicode)
  		mir_free(szDescr);
 diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index 13e2557e35..217d80fa82 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -54,7 +54,7 @@ static void DoAnnoyingShellCommand(HWND hwnd, const wchar_t *szFilename, int cmd  		ITEMIDLIST *pCurrentIdl;
  		WCHAR* wszFilename = (LPWSTR)szFilename;
 -		if (pDesktopFolder->ParseDisplayName(NULL, NULL, wszFilename, NULL, &pCurrentIdl, NULL) == NOERROR) {
 +		if (pDesktopFolder->ParseDisplayName(nullptr, nullptr, wszFilename, nullptr, &pCurrentIdl, nullptr) == NOERROR) {
  			if (pCurrentIdl->mkid.cb) {
  				ITEMIDLIST *pidl, *pidlNext, *pidlFilename;
  				IShellFolder *pFileFolder;
 @@ -69,9 +69,9 @@ static void DoAnnoyingShellCommand(HWND hwnd, const wchar_t *szFilename, int cmd  					}
  					pidl = pidlNext;
  				}
 -				if (pDesktopFolder->BindToObject(pCurrentIdl, NULL, IID_IShellFolder, (void**)&pFileFolder) == NOERROR) {
 +				if (pDesktopFolder->BindToObject(pCurrentIdl, nullptr, IID_IShellFolder, (void**)&pFileFolder) == NOERROR) {
  					IContextMenu *pContextMenu;
 -					if (pFileFolder->GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*)&pidlFilename, IID_IContextMenu, NULL, (void**)&pContextMenu) == NOERROR) {
 +					if (pFileFolder->GetUIObjectOf(nullptr, 1, (LPCITEMIDLIST*)&pidlFilename, IID_IContextMenu, nullptr, (void**)&pContextMenu) == NOERROR) {
  						switch (cmd) {
  						case C_PROPERTIES:
  							{
 @@ -87,7 +87,7 @@ static void DoAnnoyingShellCommand(HWND hwnd, const wchar_t *szFilename, int cmd  						case C_CONTEXTMENU:
  							HMENU hMenu = CreatePopupMenu();
  							if (SUCCEEDED(pContextMenu->QueryContextMenu(hMenu, 0, 1000, 65535, (GetKeyState(VK_SHIFT) & 0x8000 ? CMF_EXTENDEDVERBS : 0) | CMF_NORMAL))) {
 -								int ret = TrackPopupMenu(hMenu, TPM_RETURNCMD, ptCursor->x, ptCursor->y, 0, hwnd, NULL);
 +								int ret = TrackPopupMenu(hMenu, TPM_RETURNCMD, ptCursor->x, ptCursor->y, 0, hwnd, nullptr);
  								if (ret) {
  									CMINVOKECOMMANDINFO ici = { 0 };
  									ici.cbSize = sizeof(ici);
 @@ -118,7 +118,7 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,  	switch (msg) {
  	case WM_LBUTTONDBLCLK:
 -		ShellExecute(hwnd, NULL, pft->tszCurrentFile, NULL, NULL, SW_SHOW);
 +		ShellExecute(hwnd, nullptr, pft->tszCurrentFile, nullptr, nullptr, SW_SHOW);
  		break;
  	case WM_RBUTTONUP:
  		POINT pt;
 @@ -144,7 +144,7 @@ void __cdecl LoadIconsAndTypesThread(void* param)  		wchar_t szExtension[64], szIconFile[MAX_PATH];
  		wchar_t *pszFilename = wcsrchr(info->szFilename, '\\');
 -		if (pszFilename == NULL)
 +		if (pszFilename == nullptr)
  			pszFilename = info->szFilename;
  		wchar_t *pszExtension = wcsrchr(pszFilename, '.');
 diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index d751fce211..1b30b39758 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -37,7 +37,7 @@ struct virusscannerinfo {  } virusScanners[] = {
  	{L"Network Associates/McAfee VirusScan", L"SOFTWARE\\McAfee\\VirusScan", L"Scan32EXE", L"\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot"},
  	{L"Dr Solomon's VirusScan (Network Associates)", L"SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General", L"szScannerExe", L"\"%s\" %%f /uinone /noboot /comp /prompt /autoexit"},
 -	{L"Norton AntiVirus", L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Navw32.exe", NULL, L"\"%s\" %%f /b- /m- /s+ /noresults"},
 +	{L"Norton AntiVirus", L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Navw32.exe", nullptr, L"\"%s\" %%f /b- /m- /s+ /noresults"},
  	{L"Computer Associates/Inoculate IT", L"Software\\Antivirus", L"ImageFilename", L"\"%s\" %%f /display = progress /exit"},
  	{L"Computer Associates eTrust", L"SOFTWARE\\ComputerAssociates\\Anti-Virus\\Resident", L"VetPath", L"\"%s\" %%f /display = progress /exit"},
  	{L"Kaspersky Anti-Virus", L"SOFTWARE\\KasperskyLab\\Components\\101", L"EXEName", L"\"%s\" /S /Q %%f"},
 @@ -188,7 +188,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L  			}
  			ofn.nMaxFileTitle = MAX_PATH;
  			if (!GetOpenFileName(&ofn)) break;
 -			if (wcschr(str, ' ') != NULL) {
 +			if (wcschr(str, ' ') != nullptr) {
  				memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
  				str[0] = '"';
  				mir_wstrcat(str, L"\"");
 diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 5f6baa2e04..baf12e60ec 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -41,7 +41,7 @@ static void GetLowestExistingDirName(const wchar_t *szTestDir, wchar_t *szExisti  	mir_wstrncpy(szExistingDir, szTestDir, cchExistingDir);
  	while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
  		pszLastBackslash = wcsrchr(szExistingDir, '\\');
 -		if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
 +		if (pszLastBackslash == nullptr) { *szExistingDir = '\0'; break; }
  		*pszLastBackslash = '\0';
  	}
  	if (szExistingDir[0] == '\0')
 @@ -83,7 +83,7 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p  int BrowseForFolder(HWND hwnd, wchar_t *szPath)
  {
 -	BROWSEINFO bi = { 0 };
 +	BROWSEINFO bi = {};
  	bi.hwndOwner = hwnd;
  	bi.pszDisplayName = szPath;
  	bi.lpszTitle = TranslateT("Select folder");
 @@ -97,7 +97,7 @@ int BrowseForFolder(HWND hwnd, wchar_t *szPath)  		mir_wstrcat(szPath, L"\\");
  		CoTaskMemFree(pidlResult);
  	}
 -	return pidlResult != NULL;
 +	return pidlResult != nullptr;
  }
  static REPLACEVARSARRAY sttVarsToReplace[] =
 @@ -105,7 +105,7 @@ static REPLACEVARSARRAY sttVarsToReplace[] =  	{ "///", "//" },
  	{ "//", "/" },
  	{ "()", "" },
 -	{ NULL, NULL }
 +	{ nullptr, nullptr }
  };
  static void patchDir(wchar_t *str, size_t strSize)
 @@ -141,8 +141,8 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B  		rvaVarsToReplace[1].value.w = GetContactID(hContact);
  		rvaVarsToReplace[2].key.w = L"proto";
  		rvaVarsToReplace[2].value.w = mir_a2u(GetContactProto(hContact));
 -		rvaVarsToReplace[3].key.w = NULL;
 -		rvaVarsToReplace[3].value.w = NULL;
 +		rvaVarsToReplace[3].key.w = nullptr;
 +		rvaVarsToReplace[3].value.w = nullptr;
  		for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
  			RemoveInvalidFilenameChars(rvaVarsToReplace[i].value.w);
 @@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  				if (szProto) {
  					HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
  					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);
  					}
  				}
 @@ -341,7 +341,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  		case IDCANCEL:
  			if (dat->fs) ProtoChainSend(dat->hContact, PSS_FILEDENY, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
 -			dat->fs = NULL; /* the protocol will free the handle */
 +			dat->fs = nullptr; /* the protocol will free the handle */
  			DestroyWindow(hwndDlg);
  			break;
 @@ -380,7 +380,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  	case HM_RECVEVENT:
  		{
  			ACKDATA *ack = (ACKDATA*)lParam;
 -			if ((ack == NULL) || (ack->hProcess != dat->fs) || (ack->type != ACKTYPE_FILE) || (ack->hContact != dat->hContact))
 +			if ((ack == nullptr) || (ack->hProcess != dat->fs) || (ack->type != ACKTYPE_FILE) || (ack->hContact != dat->hContact))
  				break;
  			if (ack->result == ACKRESULT_DENIED || ack->result == ACKRESULT_FAILED) {
 diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 1e2741f1d2..c8c6fb4a3d 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -97,7 +97,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu  		}
  		// Allocate memory for a pointer array
 -		if ((dat->files = (wchar_t**)mir_alloc((nNumberOfFiles + 1) * sizeof(wchar_t*))) == NULL)
 +		if ((dat->files = (wchar_t**)mir_alloc((nNumberOfFiles + 1) * sizeof(wchar_t*))) == nullptr)
  			return;
  		// Fill the array
 @@ -118,15 +118,15 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu  			nTemp++;
  		}
  		// Terminate array
 -		dat->files[nNumberOfFiles] = NULL;
 +		dat->files[nNumberOfFiles] = nullptr;
  	}
  	// ...the selection is a single file
  	else {
 -		if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == NULL) // Leaks when aborted
 +		if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == nullptr) // Leaks when aborted
  			return;
  		dat->files[0] = mir_wstrdup(buf);
 -		dat->files[1] = NULL;
 +		dat->files[1] = nullptr;
  	}
  	// Update dialog text with new file selection
 @@ -140,7 +140,7 @@ void __cdecl ChooseFilesThread(void* param)  	FileDlgData *dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  	wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t) * 32767);
 -	if (buf == NULL) {
 +	if (buf == nullptr) {
  		PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, NULL);
  		return;
  	}
 @@ -212,7 +212,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  			dat->hContact = fsd->hContact;
  			dat->send = 1;
  			dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN);
 -			dat->fs = NULL;
 +			dat->fs = nullptr;
  			dat->dwTicks = GetTickCount();
  			EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
 @@ -225,13 +225,13 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  			EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
 -			if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
 +			if (fsd->ppFiles != nullptr && fsd->ppFiles[0] != nullptr) {
  				int totalCount, i;
  				for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++);
  				dat->files = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(totalCount + 1)); // Leaks
  				for (i = 0; i < totalCount; i++)
  					dat->files[i] = mir_wstrdup(fsd->ppFiles[i]);
 -				dat->files[totalCount] = NULL;
 +				dat->files[totalCount] = nullptr;
  				SetFileListAndSizeControls(hwndDlg, dat);
  			}
 @@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  			ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
  			SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
 -			if (fsd->ppFiles == NULL) {
 +			if (fsd->ppFiles == nullptr) {
  				EnableWindow(hwndDlg, FALSE);
  				dat->closeIfFileChooseCancelled = 1;
  				PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHOOSE, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDC_CHOOSE));
 @@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  				if (szProto) {
  					HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
  					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);
  					}
  				}
 diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index d3499bfcb8..37a22a1dcf 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i)  {  	if (dat->send) return 1; -	if (dat->fileVirusScanned == NULL) return 0; +	if (dat->fileVirusScanned == nullptr) return 0;  	if (dat->fileVirusScanned[i]) return 1;  	if (db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1;  	return IDYES == MessageBox(hwnd, TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"), TranslateT("File received"), MB_YESNO|MB_DEFBUTTON2); @@ -78,7 +78,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)  	dbei.szModule = GetContactProto(dat->hContact);  	dbei.eventType = EVENTTYPE_FILE;  	dbei.flags = DBEF_SENT; -	dbei.timestamp = time(NULL); +	dbei.timestamp = time(nullptr);  	char *szFileNames = Utf8EncodeW(dat->szFilenames), *szMsg = Utf8EncodeW(dat->szMsg);  	dbei.flags |= DBEF_UTF; @@ -109,7 +109,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)  				wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE);  			PROCESS_INFORMATION pi; -			if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { +			if (CreateProcess(nullptr, szCmdLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {  				if (WaitForSingleObject(pi.hProcess, 3600 * 1000) == WAIT_OBJECT_0)  					PostMessage(info->hwndReply, M_VIRUSSCANDONE, info->returnCode, 0);  				CloseHandle(pi.hProcess); @@ -125,17 +125,17 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)  static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFERSTATUS *fts)  {  	wchar_t msg[MAX_PATH]; -	wchar_t *fnbuf = NULL, *fn = NULL; -	SHFILEINFO shfi = { 0 }; +	wchar_t *fnbuf = nullptr, *fn = nullptr; +	SHFILEINFO shfi = {};  	if (fts->tszCurrentFile) {  		fnbuf = mir_wstrdup(fts->tszCurrentFile); -		if ((fn = wcsrchr(fnbuf, '\\')) == NULL) +		if ((fn = wcsrchr(fnbuf, '\\')) == nullptr)  			fn = fnbuf;  		else fn++;  	} -	if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL; +	if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = nullptr;  	if (fn && (fts->totalFiles > 1)) {  		mir_snwprintf(msg, L"%s: %s (%d %s %d)", @@ -182,8 +182,8 @@ static void HideProgressControls(HWND hwndDlg)  	char buf[64];  	GetWindowRect(GetDlgItem(hwndDlg, IDC_ALLPRECENTS), &rc); -	MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2); -	SetWindowPos(hwndDlg, NULL, 0, 0, 100, rc.bottom + 3, SWP_NOMOVE | SWP_NOZORDER); +	MapWindowPoints(nullptr, hwndDlg, (LPPOINT)&rc, 2); +	SetWindowPos(hwndDlg, nullptr, 0, 0, 100, rc.bottom + 3, SWP_NOMOVE | SWP_NOZORDER);  	ShowWindow(GetDlgItem(hwndDlg, IDC_ALLTRANSFERRED), SW_HIDE);  	ShowWindow(GetDlgItem(hwndDlg, IDC_ALLSPEED), SW_HIDE); @@ -265,11 +265,11 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			hFont = CreateFontIndirect(&lf);  			SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_SETFONT, (WPARAM)hFont, 0); -			SHFILEINFO shfi = { 0 }; +			SHFILEINFO shfi = {};  			SHGetFileInfo(L"", FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON);  			dat->hIconFolder = shfi.hIcon;  		} -		dat->hIcon = NULL; +		dat->hIcon = nullptr;  		{  			char *szProto = GetContactProto(dat->hContact);  			WORD status = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_ONLINE); @@ -290,7 +290,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  		SetDlgItemText(hwndDlg, IDC_CONTACTNAME, pcli->pfnGetContactDisplayName(dat->hContact, 0)); -		if (!dat->waitingForAcceptance) SetTimer(hwndDlg, 1, 1000, NULL); +		if (!dat->waitingForAcceptance) SetTimer(hwndDlg, 1, 1000, nullptr);  		return TRUE;  	case WM_TIMER: @@ -384,7 +384,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  		case IDC_OPENFILE:  			wchar_t **files;  			if (dat->send) { -				if (dat->files == NULL) +				if (dat->files == nullptr)  					files = dat->transferStatus.ptszFiles;  				else  					files = dat->files; @@ -393,7 +393,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			HMENU hMenu = CreatePopupMenu();  			AppendMenu(hMenu, MF_STRING, 1, TranslateT("Open folder")); -			AppendMenu(hMenu, MF_SEPARATOR, 0, 0); +			AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);  			if (files && *files) {  				int limit; @@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  				// Loop over all transfered files and add them to the menu  				for (int i = 0; i < limit; i++) {  					pszFilename = wcsrchr(files[i], '\\'); -					if (pszFilename == NULL) +					if (pszFilename == nullptr)  						pszFilename = files[i];  					else  						pszFilename++; @@ -432,7 +432,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			RECT rc;  			GetWindowRect((HWND)lParam, &rc);  			CheckDlgButton(hwndDlg, IDC_OPENFILE, BST_CHECKED); -			int ret = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_RIGHTALIGN, rc.right, rc.bottom, 0, hwndDlg, NULL); +			int ret = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_RIGHTALIGN, rc.right, rc.bottom, 0, hwndDlg, nullptr);  			CheckDlgButton(hwndDlg, IDC_OPENFILE, BST_UNCHECKED);  			DestroyMenu(hMenu); @@ -445,10 +445,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  						*p = 0;  				} -				if (path) ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW); +				if (path) ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);  			}  			else if (ret && CheckVirusScanned(hwndDlg, dat, ret)) -				ShellExecute(NULL, NULL, files[ret - 10], NULL, NULL, SW_SHOW); +				ShellExecute(nullptr, nullptr, files[ret - 10], nullptr, nullptr, SW_SHOW);  		}  		break; @@ -462,7 +462,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			switch (pfr->action) {  			case FILERESUME_CANCEL:  				if (dat->fs) ProtoChainSend(dat->hContact, PSS_FILECANCEL, (WPARAM)dat->fs, 0); -				dat->fs = NULL; +				dat->fs = nullptr;  				mir_free(szOriginalFilename);  				if (pfr->szFilename) mir_free((char*)pfr->szFilename);  				mir_free(pfr); @@ -476,8 +476,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  				pfr->action = FILERESUME_RENAME;  				{  					wchar_t *pszExtension, *pszFilename; -					if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; -					if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_wstrlen(pszFilename); +					if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == nullptr) pszFilename = szOriginalFilename; +					if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == nullptr) pszExtension = pszFilename + mir_wstrlen(pszFilename);  					if (pfr->szFilename) mir_free((wchar_t*)pfr->szFilename);  					size_t size = (pszExtension - szOriginalFilename) + 21 + mir_wstrlen(pszExtension);  					pfr->szFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*size); @@ -504,7 +504,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  			if (ack->hContact != dat->hContact) break;  			if (dat->waitingForAcceptance) { -				SetTimer(hwndDlg, 1, 1000, NULL); +				SetTimer(hwndDlg, 1, 1000, nullptr);  				dat->waitingForAcceptance = 0;  			} @@ -552,7 +552,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  					else {  						PROTOFILERESUME *pfr = (PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME));  						pfr->action = dat->resumeBehaviour; -						pfr->szFilename = NULL; +						pfr->szFilename = nullptr;  						PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfr);  					}  				} @@ -564,14 +564,14 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  					PROTOFILETRANSFERSTATUS *fts = (PROTOFILETRANSFERSTATUS*)ack->lParam;  					wchar_t str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName; -					if (dat->fileVirusScanned == NULL) +					if (dat->fileVirusScanned == nullptr)  						dat->fileVirusScanned = (int*)mir_calloc(sizeof(int) * fts->totalFiles);  					// This needs to be here - otherwise we get holes in the files array  					if (!dat->send) { -						if (dat->files == NULL) +						if (dat->files == nullptr)  							dat->files = (wchar_t**)mir_calloc((fts->totalFiles + 1) * sizeof(wchar_t*)); -						if (fts->currentFileNumber < fts->totalFiles && dat->files[fts->currentFileNumber] == NULL) +						if (fts->currentFileNumber < fts->totalFiles && dat->files[fts->currentFileNumber] == nullptr)  							dat->files[fts->currentFileNumber] = PFTS_StringToTchar(fts->flags, fts->tszCurrentFile);  					} @@ -620,30 +620,30 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  				SetDlgItemText(hwndDlg, IDCANCEL, TranslateT("Close"));  				if (dat->hNotifyEvent)  					UnhookEvent(dat->hNotifyEvent); -				dat->hNotifyEvent = NULL; +				dat->hNotifyEvent = nullptr;  				if (ack->result == ACKRESULT_DENIED) { -					dat->fs = NULL; /* protocol will free structure */ +					dat->fs = nullptr; /* protocol will free structure */  					Skin_PlaySound("FileDenied");  					SetFtStatus(hwndDlg, LPGENW("File transfer denied"), FTS_TEXT);  				}  				else if (ack->result == ACKRESULT_FAILED) { -					dat->fs = NULL; /* protocol will free structure */ +					dat->fs = nullptr; /* protocol will free structure */  					Skin_PlaySound("FileFailed");  					SetFtStatus(hwndDlg, LPGENW("File transfer failed"), FTS_TEXT);  				}  				else {  					Skin_PlaySound("FileDone");  					if (dat->send) { -						dat->fs = NULL; /* protocol will free structure */ +						dat->fs = nullptr; /* protocol will free structure */  						SetFtStatus(hwndDlg, LPGENW("Transfer completed."), FTS_TEXT); -						DBEVENTINFO dbei = { 0 }; +						DBEVENTINFO dbei = {};  						FillSendData(dat, dbei);  						db_event_add(dat->hContact, &dbei);  						if (dbei.pBlob)  							mir_free(dbei.pBlob); -						dat->files = NULL;   //protocol library frees this +						dat->files = nullptr;   //protocol library frees this  					}  					else {  						SetFtStatus(hwndDlg, @@ -662,7 +662,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  								if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) {  									PostMessage(hwndDlg, M_VIRUSSCANDONE, vstsi->returnCode, 0);  									mir_free(vstsi); -									vstsi = NULL; +									vstsi = nullptr;  								}  								else vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]);  							} @@ -674,7 +674,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  							if (vstsi)  								mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi);  						} -						else dat->fs = NULL; /* protocol will free structure */ +						else dat->fs = nullptr; /* protocol will free structure */  						dat->transferStatus.currentFileNumber = dat->transferStatus.totalFiles;  					} // else dat->send @@ -703,7 +703,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  					}  			}  			if (done) { -				dat->fs = NULL; /* protocol will free structure */ +				dat->fs = nullptr; /* protocol will free structure */  				SetFtStatus(hwndDlg, LPGENW("Transfer and virus scan complete"), FTS_TEXT);  			}  		} @@ -737,7 +737,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR  void FreeFileDlgData(FileDlgData* dat)  { -	if (dat == NULL) +	if (dat == nullptr)  		return;  	if (dat->fs) diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp index fa749d503e..a70a26d2eb 100644 --- a/src/core/stdfile/src/ftmanager.cpp +++ b/src/core/stdfile/src/ftmanager.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "stdafx.h"
  #include "file.h"
 -static HWND hwndFtMgr = NULL;
 +static HWND hwndFtMgr = nullptr;
  struct TFtMgrData
  {
 @@ -78,8 +78,8 @@ static void LayoutTransfers(HWND hwnd, struct TFtPageData *dat)  		top -= dat->scrollPos;
  		for (int i = 0; i < dat->wnds->realCount; ++i) {
  			int height = dat->wnds->items[i]->rc.bottom - dat->wnds->items[i]->rc.top;
 -			if (NULL != dat->wnds->items[i]->hwnd) /* Wine fix. */
 -				hdwp = DeferWindowPos(hdwp, dat->wnds->items[i]->hwnd, NULL, 0, top, rc.right, height, SWP_NOZORDER);
 +			if (nullptr != dat->wnds->items[i]->hwnd) /* Wine fix. */
 +				hdwp = DeferWindowPos(hdwp, dat->wnds->items[i]->hwnd, nullptr, 0, top, rc.right, height, SWP_NOZORDER);
  			top += height;
  		}
  		top += dat->scrollPos;
 @@ -215,7 +215,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  			if (pos < 0) pos = 0;
  			if (dat->scrollPos != pos) {
 -				ScrollWindow(hwnd, 0, dat->scrollPos - pos, NULL, NULL);
 +				ScrollWindow(hwnd, 0, dat->scrollPos - pos, nullptr, nullptr);
  				SetScrollPos(hwnd, SB_VERT, pos, TRUE);
  				dat->scrollPos = pos;
  			}
 @@ -306,25 +306,25 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  			hdwp = BeginDeferWindowPos(3);
  			hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_CLEAR), NULL, rc.left, rc.bottom-rcButton.bottom, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
 -			hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDCANCEL), NULL, rc.right-rcButton.right, rc.bottom-rcButton.bottom, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
 +			hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDCANCEL), nullptr, rc.right-rcButton.right, rc.bottom-rcButton.bottom, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
  			rc.bottom -= rcButton.bottom + 5;
 -			if (NULL != hwndTab) /* Wine fix. */
 -				hdwp = DeferWindowPos(hdwp, hwndTab, NULL, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, SWP_NOZORDER);
 +			if (nullptr != hwndTab) /* Wine fix. */
 +				hdwp = DeferWindowPos(hdwp, hwndTab, nullptr, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, SWP_NOZORDER);
  			EndDeferWindowPos(hdwp);
  			GetWindowRect(hwndTab, &rc);
 -			MapWindowPoints(NULL, hwnd, (LPPOINT)&rc, 2);
 +			MapWindowPoints(nullptr, hwnd, (LPPOINT)&rc, 2);
  			TabCtrl_AdjustRect(hwndTab, FALSE, &rc);
  			InflateRect(&rc, -5, -5);
  			hdwp = BeginDeferWindowPos(2);
 -			if (NULL != dat->hwndIncoming) /* Wine fix. */
 +			if (nullptr != dat->hwndIncoming) /* Wine fix. */
  				hdwp = DeferWindowPos(hdwp, dat->hwndIncoming, HWND_TOP, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, 0);
 -			if (NULL != dat->hwndOutgoing) /* Wine fix. */
 +			if (nullptr != dat->hwndOutgoing) /* Wine fix. */
  				hdwp = DeferWindowPos(hdwp, dat->hwndOutgoing, HWND_TOP, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, 0);
  			EndDeferWindowPos(hdwp);
 @@ -444,7 +444,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  	case WM_TIMER:
  		if (pTaskbarInterface) {
 -			SetTimer(hwnd, 1, 400, NULL);
 +			SetTimer(hwnd, 1, 400, nullptr);
  			if ((lParam == ACKRESULT_FAILED) || (lParam == ACKRESULT_DENIED))
  				dat->errorState = TBPF_ERROR;
 @@ -478,7 +478,7 @@ HWND FtMgr_Show(bool bForceActivate, bool bFromMenu)  {
  	bool bAutoMin = db_get_b(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */
 -	bool bJustCreated = (hwndFtMgr == NULL);
 +	bool bJustCreated = (hwndFtMgr == nullptr);
  	if (bJustCreated)
  		hwndFtMgr = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc);
 @@ -522,8 +522,8 @@ HWND FtMgr_AddTransfer(FileDlgData *fdd)  {
  	bool bForceActivate = fdd->send || !db_get_b(NULL, "SRFile", "AutoAccept", 0);
  	TFtMgrData *dat = (TFtMgrData*)GetWindowLongPtr(FtMgr_Show(bForceActivate, false), GWLP_USERDATA);
 -	if (dat == NULL)
 -		return NULL;
 +	if (dat == nullptr)
 +		return nullptr;
  	HWND hwndBox = fdd->send ? dat->hwndOutgoing : dat->hwndIncoming;
  	HWND hwndFt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd);
 diff --git a/src/core/stdfile/src/main.cpp b/src/core/stdfile/src/main.cpp index 82815089e7..6fd42be78e 100644 --- a/src/core/stdfile/src/main.cpp +++ b/src/core/stdfile/src/main.cpp @@ -62,7 +62,7 @@ extern "C" int __declspec(dllexport) Load(void)  	pcli = Clist_GetInterface();
  	if ( IsWinVer7Plus())
 -		CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
 +		CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
  	LoadSendRecvFileModule();
  	return 0;
 diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index f638e7276f..3b74c287e7 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar  			UINT blockSize;
  			PVOID pVerInfo;
 -			GetModuleFileName(NULL, filename, _countof(filename));
 +			GetModuleFileName(nullptr, filename, _countof(filename));
  			verInfoSize = GetFileVersionInfoSize(filename, &unused);
  			pVerInfo = mir_alloc(verInfoSize);
  			GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
 diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index 42c679a2dc..2b9ce456e0 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 -HWND hAboutDlg = NULL;
 +HWND hAboutDlg = nullptr;
  static INT_PTR AboutCommand(WPARAM wParam, LPARAM)
  {
 @@ -60,7 +60,7 @@ static INT_PTR BugCommand(WPARAM, LPARAM)  int ShutdownHelpModule(WPARAM, LPARAM)
  {
  	if (IsWindow(hAboutDlg)) DestroyWindow(hAboutDlg);
 -	hAboutDlg = NULL;
 +	hAboutDlg = nullptr;
  	return 0;
  }
 diff --git a/src/core/stdidle/src/idle.cpp b/src/core/stdidle/src/idle.cpp index 6176f7baa2..78661c1eb2 100644 --- a/src/core/stdidle/src/idle.cpp +++ b/src/core/stdidle/src/idle.cpp @@ -110,7 +110,7 @@ static BOOL bModuleInitialized = FALSE;  BOOL IsTerminalDisconnected()
  {
 -	PVOID pBuffer = NULL;
 +	PVOID pBuffer = nullptr;
  	DWORD pBytesReturned = 0;
  	BOOL result = FALSE;
 @@ -166,7 +166,7 @@ static void IdleObject_ReadSettings(IdleObject * obj)  static void IdleObject_Create(IdleObject * obj)
  {
  	memset(obj, 0, sizeof(IdleObject));
 -	obj->hTimer = SetTimer(NULL, 0, 2000, IdleTimer);
 +	obj->hTimer = SetTimer(nullptr, 0, 2000, IdleTimer);
  	IdleObject_ReadSettings(obj);
  }
 @@ -175,7 +175,7 @@ static void IdleObject_Destroy(IdleObject * obj)  	if (IdleObject_IsIdle(obj))
  		NotifyEventHooks(hIdleEvent, 0, 0);
  	IdleObject_ClearIdle(obj);
 -	KillTimer(NULL, obj->hTimer);
 +	KillTimer(nullptr, obj->hTimer);
  }
  static int IdleObject_IsUserIdle(IdleObject * obj)
 @@ -386,5 +386,5 @@ void UnloadIdleModule()  	IdleObject_Destroy(&gIdleObject);
  	DestroyHookableEvent(hIdleEvent);
 -	hIdleEvent = NULL;
 +	hIdleEvent = nullptr;
  }
 diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index e3d9e2dc9c..d907977a32 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -137,7 +137,7 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, struct branch_t *branch  {  	int iState; -	if (hParent == 0) +	if (hParent == nullptr)  		return;  	TVINSERTSTRUCT tvis; @@ -181,7 +181,7 @@ static void CheckHeading(HWND hwndTree, HTREEITEM hHeading)  {  	BOOL bChecked = TRUE; -	if (hHeading == 0) +	if (hHeading == nullptr)  		return;  	TVITEM tvi; @@ -205,7 +205,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading)  {  	BOOL bChecked = TRUE; -	if (hHeading == 0) +	if (hHeading == nullptr)  		return;  	TVITEM tvi; diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 3c130511ed..859fe50a79 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -1186,7 +1186,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)  			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_NOACTIVATE | SWP_NOSIZE); +				SetWindowPos((HWND)wParam, nullptr, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);  				*(int *)lParam = 1;  			}  		} diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index a63430bf1c..10213d8018 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -96,7 +96,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz  	dbei.eventType = EVENTTYPE_MESSAGE;
  	dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & PREF_RTL ? DBEF_RTL : 0);
  	dbei.szModule = GetContactProto(hContact);
 -	dbei.timestamp = time(0);
 +	dbei.timestamp = time(nullptr);
  	dbei.cbBlob = (DWORD)(mir_strlen(p->szMsg) + 1);
  	dbei.pBlob = (PBYTE)p->szMsg;
 diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 77c69e8316..104b5fff31 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -103,7 +103,7 @@ void CSrmmWindow::OnInitDialog()  	CSuper::OnInitDialog();
  	m_bIsMeta = db_mc_isMeta(m_hContact) != 0;
 -	m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY);
 +	m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY);
  	m_wMinute = 61;
  	NotifyEvent(MSG_WINDOW_EVT_OPENING);
 @@ -239,9 +239,9 @@ void CSrmmWindow::OnInitDialog()  	if (Utils_RestoreWindowPosition(m_hwnd, g_dat.bSavePerContact ? m_hContact : 0, SRMMMOD, "", flag)) {
  		if (g_dat.bSavePerContact) {
  			if (Utils_RestoreWindowPosition(m_hwnd, 0, SRMMMOD, "", flag | RWPF_NOMOVE))
 -				SetWindowPos(m_hwnd, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
 +				SetWindowPos(m_hwnd, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
  		}
 -		else SetWindowPos(m_hwnd, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
 +		else SetWindowPos(m_hwnd, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
  	}
  	if (m_bNoActivate) {
 @@ -1051,7 +1051,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)  		break;
  	case DM_NEWTIMEZONE:
 -		m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY);
 +		m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY);
  		m_wMinute = 61;
  		Resize();
  		break;
 @@ -1063,7 +1063,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)  			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_NOACTIVATE | SWP_NOSIZE);
 +				SetWindowPos((HWND)wParam, nullptr, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
  				*(int *)lParam = 1;
  			}
  		}
 @@ -1295,7 +1295,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)  				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))
 diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 32f51cd7c7..ae36b73a40 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -490,7 +490,7 @@ static wchar_t tszError[] = LPGENW("Miranda could not load the built-in message  int LoadSendRecvMessageModule(void)
  {
  	if ((hMsftEdit = LoadLibrary(L"Msftedit.dll")) == nullptr) {
 -		if (IDYES != MessageBox(0, TranslateW(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION))
 +		if (IDYES != MessageBox(nullptr, TranslateW(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION))
  			return 1;
  		return 0;
  	}
 diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index e0ce1ad97c..40a871e80b 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -53,7 +53,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar  				RECT rc, rcParent;
  				if (GetWindowRect(hwndDlg, &rc))
  					if (GetWindowRect(hwndParent, &rcParent))
 -						SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2,
 +						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/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index f467720907..ccd69b46ce 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -44,7 +44,7 @@ void DrawStatusIcons(MCONTACT hContact, HDC hDC, const RECT &rc, int gap)  	int nIcon = 0;
  	StatusIconData *sid;
 -	while ((sid = Srmm_GetNthIcon(hContact, nIcon++)) != 0 && x < rc.right) {
 +	while ((sid = Srmm_GetNthIcon(hContact, nIcon++)) != nullptr && x < rc.right) {
  		HICON hIcon = ((sid->flags & MBF_DISABLED) && sid->hIconDisabled) ? sid->hIconDisabled : sid->hIcon;
  		SetBkMode(hDC, TRANSPARENT);
 diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 56b226614e..87b1e94670 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -282,9 +282,9 @@ void CTabbedWindow::SetWindowPosition()  	if (Utils_RestoreWindowPosition(m_hwnd, g_dat.bSavePerContact ? m_pEmbed->m_hContact : 0, CHAT_MODULE, "room")) {  		if (g_dat.bSavePerContact) {  			if (Utils_RestoreWindowPosition(m_hwnd, 0, CHAT_MODULE, "room", RWPF_NOMOVE)) -				SetWindowPos(m_hwnd, 0, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); +				SetWindowPos(m_hwnd, nullptr, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);  		} -		else SetWindowPos(m_hwnd, 0, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); +		else SetWindowPos(m_hwnd, nullptr, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);  	}  	if (!g_dat.bSavePerContact && g_dat.bCascade) @@ -622,7 +622,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)  					break;  				case ID_LOCKPOSITION: -					if (si != 0) { +					if (si != nullptr) {  						if (!(GetMenuState(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND)&MF_CHECKED)) {  							if (si->hContact)  								db_set_w(si->hContact, si->pszModule, "TabPosition", (WORD)(i + 1)); diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp index 2b4dd3ccb4..9bd1316c06 100644 --- a/src/core/stdssl/src/netlibssl.cpp +++ b/src/core/stdssl/src/netlibssl.cpp @@ -76,14 +76,14 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false)  		break;
  	default:
 -		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);
  	}
  	wchar_t szMsgBuf2[512];
  	mir_snwprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf);
  	char* szMsg = Utf8EncodeW(szMsgBuf2);
 -	Netlib_Logf(NULL, szMsg);
 +	Netlib_Logf(nullptr, szMsg);
  	mir_free(szMsg);
  	SetLastError(scRet);
 @@ -104,13 +104,13 @@ static bool AcquireCredentials(void)  	// Create an SSPI credential.
  	scRet = g_pSSPI->AcquireCredentialsHandle(
 -		NULL,                   // Name of principal
 +		nullptr,                   // Name of principal
  		UNISP_NAME,             // Name of package
  		SECPKG_CRED_OUTBOUND,   // Flags indicating use
 -		NULL,                   // Pointer to logon ID
 +		nullptr,                   // Pointer to logon ID
  		&SchannelCred,          // Package specific data
 -		NULL,                   // Pointer to GetKey() func
 -		NULL,                   // Value to pass to GetKey()
 +		nullptr,                   // Pointer to GetKey() func
 +		nullptr,                   // Value to pass to GetKey()
  		&hCreds, 				// (out) Cred Handle
  		&tsExpiry);             // (out) Lifetime (optional)
 @@ -140,7 +140,7 @@ static bool SSL_library_init(void)  void NetlibSslFree(SslHandle *ssl)
  {
 -	if (ssl == NULL) return;
 +	if (ssl == nullptr) return;
  	g_pSSPI->DeleteSecurityContext(&ssl->hContext);
 @@ -152,7 +152,7 @@ void NetlibSslFree(SslHandle *ssl)  BOOL NetlibSslPending(SslHandle *ssl)
  {
 -	return ssl != NULL && (ssl->cbRecDataBuf != 0 || ssl->cbIoBuffer != 0);
 +	return ssl != nullptr && (ssl->cbRecDataBuf != 0 || ssl->cbIoBuffer != 0);
  }
  static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertFlags)
 @@ -168,8 +168,8 @@ 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);
 @@ -178,7 +178,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF  	if (scRet != SEC_E_OK)
  		goto cleanup;
 -	if (pServerCert == NULL) {
 +	if (pServerCert == nullptr) {
  		scRet = SEC_E_WRONG_PRINCIPAL;
  		goto cleanup;
  	}
 @@ -188,7 +188,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF  	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;
  	}
 @@ -258,20 +258,20 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)  				FD_ZERO(&fd);
  				FD_SET(ssl->s, &fd);
 -				if (select(1, &fd, NULL, NULL, &tv) != 1) {
 -					Netlib_Logf(NULL, "SSL Negotiation failure recieving data (timeout) (bytes %u)", ssl->cbIoBuffer);
 +				if (select(1, &fd, nullptr, nullptr, &tv) != 1) {
 +					Netlib_Logf(nullptr, "SSL Negotiation failure recieving data (timeout) (bytes %u)", ssl->cbIoBuffer);
  					scRet = ERROR_NOT_READY;
  					break;
  				}
  				DWORD cbData = recv(ssl->s, (char*)ssl->pbIoBuffer + ssl->cbIoBuffer, ssl->sbIoBuffer - ssl->cbIoBuffer, 0);
  				if (cbData == SOCKET_ERROR) {
 -					Netlib_Logf(NULL, "SSL Negotiation failure recieving data (%d)", WSAGetLastError());
 +					Netlib_Logf(nullptr, "SSL Negotiation failure recieving data (%d)", WSAGetLastError());
  					scRet = ERROR_NOT_READY;
  					break;
  				}
  				if (cbData == 0) {
 -					Netlib_Logf(NULL, "SSL Negotiation connection gracefully closed");
 +					Netlib_Logf(nullptr, "SSL Negotiation connection gracefully closed");
  					scRet = ERROR_NOT_READY;
  					break;
  				}
 @@ -291,7 +291,7 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)  		InBuffers[0].cbBuffer = ssl->cbIoBuffer;
  		InBuffers[0].BufferType = SECBUFFER_TOKEN;
 -		InBuffers[1].pvBuffer = NULL;
 +		InBuffers[1].pvBuffer = nullptr;
  		InBuffers[1].cbBuffer = 0;
  		InBuffers[1].BufferType = SECBUFFER_EMPTY;
 @@ -305,7 +305,7 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)  		// garbage later.
  		SecBuffer OutBuffers[1];
 -		OutBuffers[0].pvBuffer = NULL;
 +		OutBuffers[0].pvBuffer = nullptr;
  		OutBuffers[0].BufferType = SECBUFFER_TOKEN;
  		OutBuffers[0].cbBuffer = 0;
 @@ -316,23 +316,23 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)  		TimeStamp tsExpiry;
  		DWORD dwSSPIOutFlags;
 -		scRet = g_pSSPI->InitializeSecurityContext(&hCreds, &ssl->hContext, NULL, dwSSPIFlags, 0, 0,
 -			&InBuffer, 0, NULL, &OutBuffer, &dwSSPIOutFlags, &tsExpiry);
 +		scRet = g_pSSPI->InitializeSecurityContext(&hCreds, &ssl->hContext, nullptr, dwSSPIFlags, 0, 0,
 +			&InBuffer, 0, nullptr, &OutBuffer, &dwSSPIOutFlags, &tsExpiry);
  		// If success (or if the error was one of the special extended ones),
  		// send the contents of the output buffer to the server.
  		if (scRet == SEC_E_OK || scRet == SEC_I_CONTINUE_NEEDED || (FAILED(scRet) && (dwSSPIOutFlags & ISC_RET_EXTENDED_ERROR))) {
 -			if (OutBuffers[0].cbBuffer != 0 && OutBuffers[0].pvBuffer != NULL) {
 +			if (OutBuffers[0].cbBuffer != 0 && OutBuffers[0].pvBuffer != nullptr) {
  				DWORD cbData = send(ssl->s, (char*)OutBuffers[0].pvBuffer, OutBuffers[0].cbBuffer, 0);
  				if (cbData == SOCKET_ERROR || cbData == 0) {
 -					Netlib_Logf(NULL, "SSL Negotiation failure sending data (%d)", WSAGetLastError());
 +					Netlib_Logf(nullptr, "SSL Negotiation failure sending data (%d)", WSAGetLastError());
  					g_pSSPI->FreeContextBuffer(OutBuffers[0].pvBuffer);
  					return SEC_E_INTERNAL_ERROR;
  				}
  				// Free output buffer.
  				g_pSSPI->FreeContextBuffer(OutBuffers[0].pvBuffer);
 -				OutBuffers[0].pvBuffer = NULL;
 +				OutBuffers[0].pvBuffer = nullptr;
  			}
  		}
 @@ -378,7 +378,7 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)  	if (ssl->cbIoBuffer == 0) {
  		mir_free(ssl->pbIoBuffer);
 -		ssl->pbIoBuffer = NULL;
 +		ssl->pbIoBuffer = nullptr;
  		ssl->sbIoBuffer = 0;
  	}
 @@ -403,7 +403,7 @@ static bool ClientConnect(SslHandle *ssl, const char *host)  	//  Initiate a ClientHello message and generate a token.
  	SecBuffer OutBuffers[1];
 -	OutBuffers[0].pvBuffer = NULL;
 +	OutBuffers[0].pvBuffer = nullptr;
  	OutBuffers[0].BufferType = SECBUFFER_TOKEN;
  	OutBuffers[0].cbBuffer = 0;
 @@ -414,7 +414,7 @@ static bool ClientConnect(SslHandle *ssl, const char *host)  	TimeStamp tsExpiry;
  	DWORD dwSSPIOutFlags;
 -	SECURITY_STATUS scRet = g_pSSPI->InitializeSecurityContext(&hCreds, NULL, _A2T(host), dwSSPIFlags, 0, 0, NULL, 0,
 +	SECURITY_STATUS scRet = g_pSSPI->InitializeSecurityContext(&hCreds, nullptr, _A2T(host), dwSSPIFlags, 0, 0, nullptr, 0,
  		&ssl->hContext, &OutBuffer, &dwSSPIOutFlags, &tsExpiry);
  	if (scRet != SEC_I_CONTINUE_NEEDED) {
  		ReportSslError(scRet, __LINE__);
 @@ -422,17 +422,17 @@ static bool ClientConnect(SslHandle *ssl, const char *host)  	}
  	// Send response to server if there is one.
 -	if (OutBuffers[0].cbBuffer != 0 && OutBuffers[0].pvBuffer != NULL) {
 +	if (OutBuffers[0].cbBuffer != 0 && OutBuffers[0].pvBuffer != nullptr) {
  		DWORD cbData = send(ssl->s, (char*)OutBuffers[0].pvBuffer, OutBuffers[0].cbBuffer, 0);
  		if (cbData == SOCKET_ERROR || cbData == 0) {
 -			Netlib_Logf(NULL, "SSL failure sending connection data (%d %d)", ssl->s, WSAGetLastError());
 +			Netlib_Logf(nullptr, "SSL failure sending connection data (%d %d)", ssl->s, WSAGetLastError());
  			g_pSSPI->FreeContextBuffer(OutBuffers[0].pvBuffer);
  			return 0;
  		}
  		// Free output buffer.
  		g_pSSPI->FreeContextBuffer(OutBuffers[0].pvBuffer);
 -		OutBuffers[0].pvBuffer = NULL;
 +		OutBuffers[0].pvBuffer = nullptr;
  	}
  	return ClientHandshakeLoop(ssl, TRUE) == SEC_E_OK;
 @@ -457,14 +457,14 @@ SslHandle* NetlibSslConnect(SOCKET s, const char* host, int verify)  	if (!res) {
  		NetlibSslFree(ssl);
 -		ssl = NULL;
 +		ssl = nullptr;
  	}
  	return ssl;
  }
  void NetlibSslShutdown(SslHandle *ssl)
  {
 -	if (ssl == NULL || !SecIsValidHandle(&ssl->hContext))
 +	if (ssl == nullptr || !SecIsValidHandle(&ssl->hContext))
  		return;
  	DWORD dwType = SCHANNEL_SHUTDOWN;
 @@ -492,7 +492,7 @@ void NetlibSslShutdown(SslHandle *ssl)  		ISC_REQ_ALLOCATE_MEMORY |
  		ISC_REQ_STREAM;
 -	OutBuffers[0].pvBuffer = NULL;
 +	OutBuffers[0].pvBuffer = nullptr;
  	OutBuffers[0].BufferType = SECBUFFER_TOKEN;
  	OutBuffers[0].cbBuffer = 0;
 @@ -502,13 +502,13 @@ void NetlibSslShutdown(SslHandle *ssl)  	TimeStamp tsExpiry;
  	DWORD dwSSPIOutFlags;
 -	scRet = g_pSSPI->InitializeSecurityContext(&hCreds, &ssl->hContext, NULL, dwSSPIFlags, 0, 0, NULL, 0,
 +	scRet = g_pSSPI->InitializeSecurityContext(&hCreds, &ssl->hContext, nullptr, dwSSPIFlags, 0, 0, nullptr, 0,
  		&ssl->hContext, &OutBuffer, &dwSSPIOutFlags, &tsExpiry);
  	if (FAILED(scRet))
  		return;
  	// Send the close notify message to the server.
 -	if (OutBuffers[0].pvBuffer != NULL && OutBuffers[0].cbBuffer != 0) {
 +	if (OutBuffers[0].pvBuffer != nullptr && OutBuffers[0].cbBuffer != 0) {
  		send(ssl->s, (char*)OutBuffers[0].pvBuffer, OutBuffers[0].cbBuffer, 0);
  		g_pSSPI->FreeContextBuffer(OutBuffers[0].pvBuffer);
  	}
 @@ -533,7 +533,7 @@ static int NetlibSslReadSetResult(SslHandle *ssl, char *buf, int num, int peek)  int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)
  {
 -	if (ssl == NULL) return SOCKET_ERROR;
 +	if (ssl == nullptr) return SOCKET_ERROR;
  	if (num <= 0) return 0;
 @@ -555,7 +555,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)  				FD_ZERO(&fd);
  				FD_SET(ssl->s, &fd);
 -				DWORD cbData = select(1, &fd, NULL, NULL, &tv);
 +				DWORD cbData = select(1, &fd, nullptr, nullptr, &tv);
  				if (cbData == SOCKET_ERROR) {
  					ssl->state = sockError;
  					return NetlibSslReadSetResult(ssl, buf, num, peek);
 @@ -567,13 +567,13 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)  			DWORD cbData = recv(ssl->s, (char*)ssl->pbIoBuffer + ssl->cbIoBuffer, ssl->sbIoBuffer - ssl->cbIoBuffer, 0);
  			if (cbData == SOCKET_ERROR) {
 -				Netlib_Logf(NULL, "SSL failure recieving data (%d)", WSAGetLastError());
 +				Netlib_Logf(nullptr, "SSL failure recieving data (%d)", WSAGetLastError());
  				ssl->state = sockError;
  				return NetlibSslReadSetResult(ssl, buf, num, peek);
  			}
  			if (cbData == 0) {
 -				Netlib_Logf(NULL, "SSL connection gracefully closed");
 +				Netlib_Logf(nullptr, "SSL connection gracefully closed");
  				if (peek && ssl->cbRecDataBuf) {
  					ssl->state = sockClosed;
  					return NetlibSslReadSetResult(ssl, buf, num, peek);
 @@ -605,10 +605,10 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)  		Message.cBuffers = _countof(Buffers);
  		Message.pBuffers = Buffers;
 -		if (g_pSSPI->DecryptMessage != NULL && g_pSSPI->DecryptMessage != PVOID(0x80000000))
 -			scRet = g_pSSPI->DecryptMessage(&ssl->hContext, &Message, 0, NULL);
 +		if (g_pSSPI->DecryptMessage != nullptr && g_pSSPI->DecryptMessage != PVOID(0x80000000))
 +			scRet = g_pSSPI->DecryptMessage(&ssl->hContext, &Message, 0, nullptr);
  		else
 -			scRet = ((DECRYPT_MESSAGE_FN)g_pSSPI->Reserved4)(&ssl->hContext, &Message, 0, NULL);
 +			scRet = ((DECRYPT_MESSAGE_FN)g_pSSPI->Reserved4)(&ssl->hContext, &Message, 0, nullptr);
  		// The input buffer contains only a fragment of an
  		// encrypted record. Loop around and read some more
 @@ -623,13 +623,13 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)  		}
  		// Locate data and (optional) extra buffers.
 -		SecBuffer *pDataBuffer = NULL;
 -		SecBuffer *pExtraBuffer = NULL;
 +		SecBuffer *pDataBuffer = nullptr;
 +		SecBuffer *pExtraBuffer = nullptr;
  		for (int i = 1; i < _countof(Buffers); i++) {
 -			if (pDataBuffer == NULL && Buffers[i].BufferType == SECBUFFER_DATA)
 +			if (pDataBuffer == nullptr && Buffers[i].BufferType == SECBUFFER_DATA)
  				pDataBuffer = &Buffers[i];
 -			if (pExtraBuffer == NULL && Buffers[i].BufferType == SECBUFFER_EXTRA)
 +			if (pExtraBuffer == nullptr && Buffers[i].BufferType == SECBUFFER_EXTRA)
  				pExtraBuffer = &Buffers[i];
  		}
 @@ -670,7 +670,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)  		// Server signaled end of session
  		if (scRet == SEC_I_CONTEXT_EXPIRED) {
 -			Netlib_Logf(NULL, "SSL Server signaled SSL Shutdown");
 +			Netlib_Logf(nullptr, "SSL Server signaled SSL Shutdown");
  			ssl->state = sockClosed;
  			return NetlibSslReadSetResult(ssl, buf, num, peek);
  		}
 @@ -690,7 +690,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)  int NetlibSslWrite(SslHandle *ssl, const char *buf, int num)
  {
 -	if (ssl == NULL) return SOCKET_ERROR;
 +	if (ssl == nullptr) return SOCKET_ERROR;
  	SecPkgContext_StreamSizes Sizes;
  	SECURITY_STATUS scRet = g_pSSPI->QueryContextAttributes(&ssl->hContext, SECPKG_ATTR_STREAM_SIZES, &Sizes);
 @@ -726,7 +726,7 @@ int NetlibSslWrite(SslHandle *ssl, const char *buf, int num)  		Message.cBuffers = _countof(Buffers);
  		Message.pBuffers = Buffers;
 -		if (g_pSSPI->EncryptMessage != NULL)
 +		if (g_pSSPI->EncryptMessage != nullptr)
  			scRet = g_pSSPI->EncryptMessage(&ssl->hContext, 0, &Message, 0);
  		else
  			scRet = ((ENCRYPT_MESSAGE_FN)g_pSSPI->Reserved3)(&ssl->hContext, 0, &Message, 0);
 @@ -739,7 +739,7 @@ int NetlibSslWrite(SslHandle *ssl, const char *buf, int num)  		// Send the encrypted data to the server.
  		cbData = send(ssl->s, (char*)pbDataBuffer, cbData, 0);
  		if (cbData == SOCKET_ERROR || cbData == 0) {
 -			Netlib_Logf(NULL, "SSL failure sending data (%d)", WSAGetLastError());
 +			Netlib_Logf(nullptr, "SSL failure sending data (%d)", WSAGetLastError());
  			scRet = SEC_E_INTERNAL_ERROR;
  			break;
  		}
 @@ -754,7 +754,7 @@ int NetlibSslWrite(SslHandle *ssl, const char *buf, int num)  static INT_PTR GetSslApi(WPARAM, LPARAM lParam)
  {
  	SSL_API *si = (SSL_API*)lParam;
 -	if (si == NULL)
 +	if (si == nullptr)
  		return FALSE;
  	if (si->cbSize != sizeof(SSL_API))
 @@ -772,7 +772,7 @@ static INT_PTR GetSslApi(WPARAM, LPARAM lParam)  int LoadSslModule(void)
  {
  	CreateServiceFunction(MS_SYSTEM_GET_SI, GetSslApi);
 -	g_hSslMutex = CreateMutex(NULL, FALSE, NULL);
 +	g_hSslMutex = CreateMutex(nullptr, FALSE, nullptr);
  	SecInvalidateHandle(&hCreds);
  	return 0;
  }
 diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index cdffaa1c57..60843731a0 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -31,8 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 -static MWindowList hWindowList = 0;
 -static HGENMENU hContactMenu = 0;
 +static MWindowList hWindowList = nullptr;
 +static HGENMENU hContactMenu = nullptr;
  /////////////////////////////////////////////////////////////////////////////////////////
  // Fills the events list
 @@ -96,7 +96,7 @@ static void GetObjectDescription(DBEVENTINFO *dbei, wchar_t* str, int cbStr)  static void GetObjectSummary(DBEVENTINFO *dbei, wchar_t* str, int cbStr)
  {
 -	wchar_t* pszSrc, *pszTmp = NULL;
 +	wchar_t* pszSrc, *pszTmp = nullptr;
  	switch(dbei->eventType) {
  	case EVENTTYPE_MESSAGE:
 @@ -320,7 +320,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP  			GetObjectDescription(&dbei, str, _countof(str));
  			if (str[0]) {
  				CharUpperBuff(str, (int)mir_wstrlen(str));
 -				if (wcsstr(str, (const wchar_t*)lParam) != NULL) {
 +				if (wcsstr(str, (const wchar_t*)lParam) != nullptr) {
  					SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0);
  					SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);
  					break;
 @@ -378,7 +378,7 @@ static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM)  static int HistoryContactDelete(WPARAM wParam, LPARAM)
  {
  	HWND hwnd = WindowList_Find(hWindowList, wParam);
 -	if (hwnd != NULL)
 +	if (hwnd != nullptr)
  		DestroyWindow(hwnd);
  	return 0;
  }
 diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index a8df0ebeb5..2d9caa7525 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "stdafx.h"
 -static HFONT hEmailFont = NULL;
 -static HCURSOR hHandCursor = NULL;
 +static HFONT hEmailFont = nullptr;
 +static HCURSOR hHandCursor = nullptr;
  static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  {
 @@ -126,7 +126,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar  			if (noRecursion) break;
  			noRecursion = 1;
  			{
 -				char szText[256], *pText = NULL, *pArea, *pNumber;
 +				char szText[256], *pText = nullptr, *pArea, *pNumber;
  				int i, isValid = 1;
  				GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, _countof(szText));
  				if (szText[0] != '+')
 @@ -224,8 +224,8 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			lf.lfUnderline = 1;
  			hEmailFont = CreateFontIndirect(&lf);
  		}
 -		if (hHandCursor == NULL)
 -			hHandCursor = LoadCursor(NULL, IDC_HAND);
 +		if (hHandCursor == nullptr)
 +			hHandCursor = LoadCursor(nullptr, IDC_HAND);
  		{
  			RECT rc;
  			GetClientRect(GetDlgItem(hwndDlg, IDC_EMAILS), &rc);
 @@ -257,7 +257,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  			if (hContact != NULL) {
  				char *szProto = GetContactProto(hContact);
 -				if (szProto == NULL)
 +				if (szProto == nullptr)
  					break;
  				//e-mails
 @@ -516,7 +516,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			GetCursorPos(&pt);
  			ScreenToClient(hwndDlg, &pt);
  		}
 -		if (IsOverEmail(hwndDlg, NULL, 0)) {
 +		if (IsOverEmail(hwndDlg, nullptr, 0)) {
  			SetCursor(hHandCursor);
  			SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
  			return TRUE;
 diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index af0e8acc97..e158eae615 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -53,22 +53,22 @@ static wchar_t* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hCon  	DBCONTACTGETSETTING cgs = { szModule, szSetting, &dbv };
  	dbv.type = DBVT_WCHAR;
  	if (CallProtoService(szModule, PS_GETINFOSETTING, hContact, (LPARAM)&cgs))
 -		return NULL;
 +		return nullptr;
  	return dbv.ptszVal;
  }
  static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special)
  {
 -	char str[80], *pstr = NULL;
 -	wchar_t *ptstr = NULL;
 +	char str[80], *pstr = nullptr;
 +	wchar_t *ptstr = nullptr;
  	char *szProto = GetContactProto(hContact);
  	bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
  	DBVARIANT dbv = { DBVT_DELETED };
  	int unspecified;
 -	if (szModule == NULL)
 +	if (szModule == nullptr)
  		unspecified = 1;
  	else if (proto_service)
  		unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
 @@ -159,7 +159,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule  				}
  				pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0));
 -				unspecified = pstr == NULL;
 +				unspecified = pstr == nullptr;
  			}
  			else {
  				unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
 @@ -194,7 +194,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule  			}
  			pstr = dbv.pszVal;
 -			Utf8Decode(dbv.pszVal, NULL);
 +			Utf8Decode(dbv.pszVal, nullptr);
  			break;
  		default:
 @@ -206,7 +206,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule  	if (unspecified)
  		SetDlgItemText(hwndDlg, idCtrl, TranslateT("<not specified>"));
 -	else if (ptstr != NULL)
 +	else if (ptstr != nullptr)
  		SetDlgItemText(hwndDlg, idCtrl, ptstr);
  	else
  		SetDlgItemTextA(hwndDlg, idCtrl, pstr);
 @@ -230,7 +230,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP  				MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
  				if (hContact != NULL) {
  					char *szProto = GetContactProto(hContact);
 -					if (szProto == NULL)
 +					if (szProto == nullptr)
  						break;
  					SetValue(hwndDlg, IDC_NICK, hContact, szProto, "Nick", 0);
 @@ -275,7 +275,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L  		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
  		TranslateDialogDefault(hwndDlg);
 -		SetTimer(hwndDlg, 1, 1000, NULL);
 +		SetTimer(hwndDlg, 1, 1000, nullptr);
  		TimeZone_PrepareList(lParam, NULL, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB);
  		SendMessage(hwndDlg, WM_TIMER, 0, 0);
 @@ -305,7 +305,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L  				MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
  				if (hContact != NULL) {
  					char *szProto = GetContactProto(hContact);
 -					if (szProto == NULL)
 +					if (szProto == nullptr)
  						break;
  					SetValue(hwndDlg, IDC_STREET, hContact, szProto, "Street", SVS_ZEROISUNSPEC);
 @@ -355,7 +355,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA  				MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
  				if (hContact != NULL) {
  					char *szProto = GetContactProto(hContact);
 -					if (szProto == NULL) break;
 +					if (szProto == nullptr) break;
  					SetValue(hwndDlg, IDC_COMPANY, hContact, szProto, "Company", SVS_ZEROISUNSPEC);
  					SetValue(hwndDlg, IDC_DEPARTMENT, hContact, szProto, "CompanyDepartment", SVS_ZEROISUNSPEC);
  					SetValue(hwndDlg, IDC_POSITION, hContact, szProto, "CompanyPosition", SVS_ZEROISUNSPEC);
 @@ -432,7 +432,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,  				MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
  				if (hContact != NULL) {
  					char *szProto = GetContactProto(hContact);
 -					if (szProto == NULL)
 +					if (szProto == nullptr)
  						break;
  					bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
 @@ -604,7 +604,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam)  	if (lParam == NULL)
  		return 0;
 -	if (GetContactProto(lParam) == 0)
 +	if (GetContactProto(lParam) == nullptr)
  		return 0;
  	OPTIONSDIALOGPAGE odp = { 0 };
 diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 916a89f4f8..ce59b8864d 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  int DetailsInit(WPARAM wParam, LPARAM lParam);
  static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 -static MWindowList hWindowList = NULL;
 +static MWindowList hWindowList = nullptr;
  static HANDLE hDetailsInitEvent;
  struct DetailsPageInit
 @@ -103,7 +103,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)  	DetailsPageInit opi = { 0 };
  	opi.pageCount = 0;
 -	opi.odp = NULL;
 +	opi.odp = nullptr;
  	NotifyEventHooks(hDetailsInitEvent, (WPARAM)&opi, wParam);
  	if (opi.pageCount == 0)
  		return 0;
 @@ -112,16 +112,16 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)  	PROPSHEETHEADER psh = { sizeof(psh) };
  	psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
 -	psh.hwndParent = NULL;
 +	psh.hwndParent = nullptr;
  	psh.nPages = opi.pageCount;
 -	psh.pStartPage = 0;
 +	psh.pStartPage = nullptr;
  	psh.pszCaption = (wchar_t*)wParam;	  //more abuses of structure: this is hContact
  	psh.ppsp = (PROPSHEETPAGE*)opi.odp;		  //blatent misuse of the structure, but what the hell
  	CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
  	for (int i = 0; i < opi.pageCount; i++) {
  		//cleanup moved to WM_DESTROY
 -		if (opi.odp[i].szGroup.w != NULL)
 +		if (opi.odp[i].szGroup.w != nullptr)
  			mir_free(opi.odp[i].szGroup.a);
  		if ((DWORD_PTR)opi.odp[i].pszTemplate & 0xFFFF0000)
  			mir_free((char*)opi.odp[i].pszTemplate);
 @@ -135,7 +135,7 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam)  	OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)lParam;
  	struct DetailsPageInit *opi = (struct DetailsPageInit*)wParam;
 -	if (odp == NULL || opi == NULL)
 +	if (odp == nullptr || opi == nullptr)
  		return 1;
  	opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount + 1));
 @@ -147,12 +147,12 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam)  	dst->pszTemplate = ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000) ? mir_strdup(odp->pszTemplate) : odp->pszTemplate;
  	if (odp->flags & ODPF_UNICODE) {
 -		dst->szTitle.w = (odp->szTitle.w == 0) ? NULL : mir_wstrdup(odp->szTitle.w);
 -		dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_wstrdup(odp->szTab.w) : NULL;
 +		dst->szTitle.w = (odp->szTitle.w == nullptr) ? nullptr : mir_wstrdup(odp->szTitle.w);
 +		dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_wstrdup(odp->szTab.w) : nullptr;
  	}
  	else {
  		dst->szTitle.w = mir_a2u(odp->szTitle.a);
 -		dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_a2u(odp->szTab.a) : NULL;
 +		dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_a2u(odp->szTab.a) : nullptr;
  	}
  	dst->hLangpack = odp->hLangpack;
 @@ -218,7 +218,7 @@ static void CreateDetailsPageWindow(HWND hwndDlg, DetailsData *dat, DetailsPageD  static int UserInfoContactDelete(WPARAM wParam, LPARAM)
  {
  	HWND hwnd = WindowList_Find(hWindowList, wParam);
 -	if (hwnd != NULL)
 +	if (hwnd != nullptr)
  		DestroyWindow(hwnd);
  	return 0;
  }
 @@ -269,7 +269,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  				ptszLastTab = NEWWSTR_ALLOCA(dbv.ptszVal);
  				db_free(&dbv);
  			}
 -			else ptszLastTab = NULL;
 +			else ptszLastTab = nullptr;
  			dat->currentPage = 0;
  			dat->pageCount = psh->nPages;
 @@ -296,7 +296,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  				}
  				TVINSERTSTRUCT tvis;
 -				tvis.hParent = NULL;
 +				tvis.hParent = nullptr;
  				tvis.hInsertAfter = TVI_LAST;
  				tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
  				tvis.item.lParam = (LPARAM)i;
 @@ -342,7 +342,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  			SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
  			if (!ProtoChainSend(dat->hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) {
  				EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
 -				SetTimer(hwndDlg, 1, 100, NULL);
 +				SetTimer(hwndDlg, 1, 100, nullptr);
  			}
  			else ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE);
 @@ -394,7 +394,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  		for (i = 0; i < dat->pageCount; i++) {
  			DetailsPageData &odp = dat->opd[i];
  			pshn.hdr.hwndFrom = odp.hwnd;
 -			if (odp.hwnd != NULL)
 +			if (odp.hwnd != nullptr)
  				SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
  		}
  		break;
 @@ -402,7 +402,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  	case M_CHECKONLINE:
  		if (dat->hContact != NULL) {
  			char *szProto = GetContactProto(dat->hContact);
 -			if (szProto == NULL)
 +			if (szProto == nullptr)
  				EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
  			else {
  				if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE)
 @@ -431,7 +431,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  				SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
  				break;
  			} //if
 -			if (dat->infosUpdated == NULL)
 +			if (dat->infosUpdated == nullptr)
  				dat->infosUpdated = (int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess);
  			if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED)
  				dat->infosUpdated[ack->lParam] = 1;
 @@ -521,7 +521,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  			for (i = 0; i < dat->pageCount; i++) {
  				DetailsPageData &odp = dat->opd[i];
 -				if (odp.hwnd == NULL || !odp.changed)
 +				if (odp.hwnd == nullptr || !odp.changed)
  					continue;
  				pshn.hdr.hwndFrom = odp.hwnd;
  				SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
 @@ -542,7 +542,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  			pshn.hdr.code = PSN_APPLY;
  			for (i = 0; i < dat->pageCount; i++) {
  				DetailsPageData &odp = dat->opd[i];
 -				if (odp.hwnd == NULL || !odp.changed)
 +				if (odp.hwnd == nullptr || !odp.changed)
  					continue;
  				pshn.hdr.hwndFrom = odp.hwnd;
  				if (SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
 @@ -565,7 +565,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  				if (!ProtoChainSend(dat->hContact, PSS_GETINFO, 0, 0)) {
  					EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
  					ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_SHOW);
 -					SetTimer(hwndDlg, 1, 100, NULL);
 +					SetTimer(hwndDlg, 1, 100, nullptr);
  				}
  			}
  			break;
 @@ -594,7 +594,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP  		for (i = 0; i < dat->pageCount; i++) {
  			DetailsPageData &odp = dat->opd[i];
 -			if (odp.hwnd != NULL)
 +			if (odp.hwnd != nullptr)
  				DestroyWindow(odp.hwnd);
  			mir_free(odp.ptszTitle);
  			mir_free(odp.ptszTab);
 diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index b7ff2473b0..38fc00426c 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -75,7 +75,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)  static int UserOnlineAck(WPARAM, LPARAM lParam)
  {
  	ACKDATA * ack = (ACKDATA*) lParam;
 -	if (ack != 0 && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS && ack->hProcess == (HANDLE)ID_STATUS_OFFLINE) {
 +	if (ack != nullptr && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS && ack->hProcess == (HANDLE)ID_STATUS_OFFLINE) {
  		// if going from offline to any other mode, remember when it happened.
  		db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
  	}
 diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp index f941917f6e..29d09dd49d 100644 --- a/src/mir_app/src/DefaultExtraIcons.cpp +++ b/src/mir_app/src/DefaultExtraIcons.cpp @@ -304,7 +304,7 @@ void DefaultExtraIcons_Load()  {
  	hExtraChat = ExtraIcon_RegisterIcolib("chat_activity", LPGEN("Chat activity"), "ChatActivity");
  	hExtraVisibility = ExtraIcon_RegisterIcolib("visibility", "Visibility", Skin_GetIconName(SKINICON_OTHER_VISIBLE_ALL));
 -	hExtraGender = ExtraIcon_RegisterIcolib("gender", "Gender", "gender_male", 0, 0, EIF_DISABLED_BY_DEFAULT);
 +	hExtraGender = ExtraIcon_RegisterIcolib("gender", "Gender", "gender_male", nullptr, 0, EIF_DISABLED_BY_DEFAULT);
  	hExtraProto = ExtraIcon_RegisterCallback("protocol", "Account", Skin_GetIconName(SKINICON_OTHER_ACCMGR),
  		&ProtocolRebuildIcons, &ProtocolApplyIcon, &ProtocolOnClick, 0, EIF_DISABLED_BY_DEFAULT);
 @@ -314,7 +314,7 @@ void DefaultExtraIcons_Load()  		if (p.OnClick)
  			p.hExtraIcon = ExtraIcon_RegisterIcolib(p.name, p.desc, Skin_GetIconName(p.iSkinIcon), DefaultOnClick, (LPARAM)&p, p.flags);
  		else
 -			p.hExtraIcon = ExtraIcon_RegisterIcolib(p.name, p.desc, Skin_GetIconName(p.iSkinIcon), 0, 0, p.flags);
 +			p.hExtraIcon = ExtraIcon_RegisterIcolib(p.name, p.desc, Skin_GetIconName(p.iSkinIcon), nullptr, 0, p.flags);
  	}
  	for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
 diff --git a/src/mir_app/src/Docking.cpp b/src/mir_app/src/Docking.cpp index 88f4d99fed..ebdc031c18 100644 --- a/src/mir_app/src/Docking.cpp +++ b/src/mir_app/src/Docking.cpp @@ -323,7 +323,7 @@ int fnDocking_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,
 +				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),
 diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index 511ee8e16c..b652bf8e25 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -345,7 +345,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam  		hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName);
  		if (!sectionName || !hItem) {
  			if (!hItem) {
 -				TVINSERTSTRUCT tvis = { 0 };
 +				TVINSERTSTRUCT tvis = {};
  				TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
  				treeItem->groupName = sectionName ? nullptr : mir_wstrdup(groupName);
  				treeItem->paramName = mir_u2a(itemName);
 @@ -507,7 +507,7 @@ static void sttSaveFontData(HWND hwndDlg, FontInternal &F)  	if (db_set_ws(0, F.dbSettingsGroup, str, F.value.szFace)) {
  		char buff[1024];
 -		WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, 0, 0);
 +		WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, nullptr, nullptr);
  		db_set_s(0, F.dbSettingsGroup, str, buff);
  	}
 @@ -551,7 +551,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,  	int selCount;
  	LOGFONT lf;
 -	static HBRUSH hBkgColourBrush = 0;
 +	static HBRUSH hBkgColourBrush = nullptr;
  	switch (msg) {
  	case WM_INITDIALOG:
 @@ -624,7 +624,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,  				if (hBkgColourBrush) {
  					DeleteObject(hBkgColourBrush);
 -					hBkgColourBrush = 0;
 +					hBkgColourBrush = nullptr;
  				}
  				for (int colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++) {
 @@ -1208,7 +1208,7 @@ static FontInternal* sttFindFont(OBJLIST<FontInternal> &fonts, char *module, cha  			return &F;
  	}
 -	return 0;
 +	return nullptr;
  }
  static FontInternal fntHeader, fntGeneral, fntSmall;
 diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp index b40410ad6c..664fc57044 100644 --- a/src/mir_app/src/FontService.cpp +++ b/src/mir_app/src/FontService.cpp @@ -115,7 +115,7 @@ void ConvertLOGFONT(LOGFONTW *lfw, LOGFONTA *lfa)  	lfa->lfQuality = lfw->lfQuality;
  	lfa->lfPitchAndFamily = lfw->lfPitchAndFamily;
 -	WideCharToMultiByte(code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, 0, 0);
 +	WideCharToMultiByte(code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, nullptr, nullptr);
  }
  static void GetDefaultFontSetting(LOGFONT *lf, COLORREF *colour)
 @@ -126,9 +126,9 @@ static void GetDefaultFontSetting(LOGFONT *lf, COLORREF *colour)  	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);
  }
  int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORREF *colour, DWORD flags)
 @@ -175,7 +175,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR  	lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
  	if (lf->lfHeight > 0) {
 -		HDC hdc = GetDC(0);
 +		HDC hdc = GetDC(nullptr);
  		if (flags & FIDF_SAVEPOINTSIZE)
  			lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
  		else { // assume SAVEACTUALHEIGHT
 @@ -190,7 +190,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR  			DeleteObject(hFont);
  		}
 -		ReleaseDC(0, hdc);
 +		ReleaseDC(nullptr, hdc);
  	}
  	return retval;
 @@ -198,7 +198,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR  int CreateFromFontSettings(FontSettingsW *fs, LOGFONT *lf)
  {
 -	GetDefaultFontSetting(lf, 0);
 +	GetDefaultFontSetting(lf, nullptr);
  	wcsncpy_s(lf->lfFaceName, fs->szFace, _TRUNCATE);
 diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp index a39b55e5ce..8cce3de438 100644 --- a/src/mir_app/src/button.cpp +++ b/src/mir_app/src/button.cpp @@ -614,7 +614,7 @@ int LoadButtonModule(void)  	wc.lpfnWndProc = MButtonWndProc;
  	wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
  	wc.cbWndExtra = sizeof(MButtonCtrl*);
 -	wc.hbrBackground = 0;
 +	wc.hbrBackground = nullptr;
  	wc.style = CS_GLOBALCLASS;
  	RegisterClassEx(&wc);
 diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index b61eadf7ff..26377bad40 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -523,7 +523,7 @@ char* SM_GetUsers(SESSION_INFO *si)  		if (pLen + nameLen + 2 > alloced)
  			p = (char*)mir_realloc(p, alloced += 4096);
 -		WideCharToMultiByte(CP_ACP, 0, utemp->pszUID, -1, p + pLen, (int)nameLen + 1, 0, 0);
 +		WideCharToMultiByte(CP_ACP, 0, utemp->pszUID, -1, p + pLen, (int)nameLen + 1, nullptr, nullptr);
  		mir_strcpy(p + pLen + nameLen, " ");
  		utemp = utemp->next;
  	}
 @@ -644,7 +644,7 @@ static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const wchar_t *pszStat  		if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
  			return pTemp;
 -	return 0;
 +	return nullptr;
  }
  static WORD TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus)
 @@ -674,7 +674,7 @@ static wchar_t* TM_WordToString(STATUSINFO *pStatusList, WORD Status)  				return pTemp->pszGroup;
  		}
  	}
 -	return 0;
 +	return nullptr;
  }
  static BOOL TM_RemoveAll(STATUSINFO **ppStatusList)
 diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index a2293e6d84..8bad7a2ef3 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -532,7 +532,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)  			long trimlimit = g_Settings->LoggingLimit * 1024;
  			if (dwSize > trimlimit) {
 -				time_t now = time(0);
 +				time_t now = time(nullptr);
  				wchar_t tszTimestamp[20];
  				wcsftime(tszTimestamp, 20, L"%Y%m%d-%H%M%S", _localtime32((__time32_t *)&now));
 @@ -551,7 +551,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)  				wchar_t tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
  				mir_snwprintf(tszNewName, L"%s%s-%s%s", tszNewPath, tszName, tszTimestamp, tszExt);
  				fclose(hFile);
 -				hFile = 0;
 +				hFile = nullptr;
  				if (!PathFileExists(tszNewName))
  					CopyFile(si->pszLogFileName, tszNewName, TRUE);
  				DeleteFile(si->pszLogFileName);
 @@ -711,7 +711,7 @@ MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in)  MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, int _hLang)
  {
  	if (nItems > 0)
 -		AppendMenu(hMenu, MF_SEPARATOR, 0, 0);
 +		AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);
  	HMENU hSubMenu = nullptr;
  	for (int i = 0; i < nItems; i++) {
 @@ -723,13 +723,13 @@ MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item  			AppendMenu(hMenu, dwState | MF_POPUP, (UINT_PTR)hSubMenu, ptszText);
  		}
  		else if (Item[i].uType == MENU_POPUPHMENU)
 -			AppendMenu(hSubMenu == 0 ? hMenu : hSubMenu, dwState | MF_POPUP, Item[i].dwID, ptszText);
 +			AppendMenu(hSubMenu == nullptr ? hMenu : hSubMenu, dwState | MF_POPUP, Item[i].dwID, ptszText);
  		else if (Item[i].uType == MENU_POPUPITEM)
 -			AppendMenu(hSubMenu == 0 ? hMenu : hSubMenu, dwState | MF_STRING, Item[i].dwID, ptszText);
 +			AppendMenu(hSubMenu == nullptr ? hMenu : hSubMenu, dwState | MF_STRING, Item[i].dwID, ptszText);
  		else if (Item[i].uType == MENU_POPUPCHECK)
 -			AppendMenu(hSubMenu == 0 ? hMenu : hSubMenu, dwState | MF_CHECKED | MF_STRING, Item[i].dwID, ptszText);
 +			AppendMenu(hSubMenu == nullptr ? hMenu : hSubMenu, dwState | MF_CHECKED | MF_STRING, Item[i].dwID, ptszText);
  		else if (Item[i].uType == MENU_POPUPSEPARATOR)
 -			AppendMenu(hSubMenu == 0 ? hMenu : hSubMenu, MF_SEPARATOR, 0, ptszText);
 +			AppendMenu(hSubMenu == nullptr ? hMenu : hSubMenu, MF_SEPARATOR, 0, ptszText);
  		else if (Item[i].uType == MENU_SEPARATOR)
  			AppendMenu(hMenu, MF_SEPARATOR, 0, ptszText);
  		else if (Item[i].uType == MENU_HMENU)
 diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 3e286c8176..82862617fa 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -1245,7 +1245,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam  			case POPUP_NEWSUBGROUP:
  				SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
  				SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS);
 -				Clist_GroupCreate(contact->groupId, 0);
 +				Clist_GroupCreate(contact->groupId, nullptr);
  				break;
  			case POPUP_RENAMEGROUP:
  				cli.pfnBeginRenameSelection(hwnd, dat);
 diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 25ae4e3a07..dd6a91b8fd 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -77,7 +77,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar  		}
  	case CLM_AUTOREBUILD:
 -		SetTimer(hwnd, TIMERID_REBUILDAFTER, 50, 0);
 +		SetTimer(hwnd, TIMERID_REBUILDAFTER, 50, nullptr);
  		break;
  	case CLM_DELETEITEM:
 diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 7eeb250597..77009d6fe7 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -65,7 +65,7 @@ static void fnReloadProtoMenus(void)  	RebuildMenuOrder();
  	if (db_get_b(0, "CList", "MoveProtoMenus", TRUE))
  		BuildProtoMenus();
 -	cli.pfnCluiProtocolStatusChanged(0, 0);
 +	cli.pfnCluiProtocolStatusChanged(0, nullptr);
  }
  MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void)
 diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 2997961683..9fdb1099bc 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -81,7 +81,7 @@ static mir_cs csGroups;  static int GroupNameExists(const wchar_t *ptszGroupName, int skipGroup)
  {
 -	if (ptszGroupName == 0)
 +	if (ptszGroupName == nullptr)
  		return 0;
  	wchar_t str[256];
 @@ -144,7 +144,7 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName)  MIR_APP_DLL(MGROUP) Clist_GroupCreate(MGROUP hParent, LPCTSTR ptszGroupName)
  {
  	// no name specified. just create a new group with a default name
 -	if (ptszGroupName == 0)
 +	if (ptszGroupName == nullptr)
  		return CreateGroupInternal(hParent, nullptr);
  	if (ptszGroupName == nullptr || ptszGroupName[0] == '\0' || ptszGroupName[0] == '\\')
 diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index f39d12bbab..ef6f6749ca 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -276,7 +276,7 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY)  	POINT pt;
  	register int i, j, width, height, iCountedDots = 0, iNotCoveredDots = 0;
  	BOOL bPartiallyCovered = FALSE;
 -	HWND hAux = 0;
 +	HWND hAux = nullptr;
  	if (hWnd == nullptr) {
  		SetLastError(0x00000006);       //Wrong handle
 diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 1d1ffbc0b1..af0ac7c96d 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -94,7 +94,7 @@ static int MenuItem_PreBuild(WPARAM, LPARAM)  	GetClassName(hwndClist, cls, _countof(cls));
  	hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
  	HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
 -	Menu_ShowItem(hRenameMenuItem, hItem != 0);
 +	Menu_ShowItem(hRenameMenuItem, hItem != nullptr);
  	return 0;
  }
 @@ -378,7 +378,7 @@ void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon)  			DeleteObject(hBr);
  		} //if
  		/* draw the icon */
 -		if (eventIcon != 0) {
 +		if (eventIcon != nullptr) {
  			DrawState(dis->hDC, nullptr, nullptr, (LPARAM)eventIcon, 0, 2, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
  			DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, 4 + g_IconWidth, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
  		}
 @@ -392,7 +392,7 @@ void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon)  		else if (dis->itemState & ODS_SELECTED)
  			DrawEdge(dis->hDC, &dis->rcItem, BDR_SUNKENOUTER, BF_RECT);
 -		if (eventIcon != 0) {
 +		if (eventIcon != nullptr) {
  			DrawState(dis->hDC, nullptr, nullptr, (LPARAM)eventIcon, 0, 2, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
  			DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, 4 + g_IconWidth, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
  		}
 @@ -445,7 +445,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  			flags |= cluiopt.showgrip ? SBARS_SIZEGRIP : 0;
  			cli.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, cli.hInst, nullptr);
  		}
 -		cli.pfnCluiProtocolStatusChanged(0, 0);
 +		cli.pfnCluiProtocolStatusChanged(0, nullptr);
  		//delay creation of CLC so that it can get the status icons right the first time (needs protocol modules loaded)
  		PostMessage(hwnd, M_CREATECLC, 0, 0);
 @@ -510,7 +510,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  			if (cluiopt.showsbar) {
  				SetWindowPos(cli.hwndStatus, nullptr, 0, rect.bottom - 20, rect.right - rect.left, 20, SWP_NOZORDER);
  				GetWindowRect(cli.hwndStatus, &rcStatus);
 -				cli.pfnCluiProtocolStatusChanged(0, 0);
 +				cli.pfnCluiProtocolStatusChanged(0, nullptr);
  			}
  			else
  				rcStatus.top = rcStatus.bottom = 0;
 @@ -646,7 +646,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  			if (wParam)
  				SetForegroundWindow(hwnd);
  			AnimateWindow(hwnd, 200, AW_BLEND | (wParam ? 0 : AW_HIDE));
 -			SetWindowPos(cli.hwndContactTree, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
 +			SetWindowPos(cli.hwndContactTree, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
  		}
  		break;
 @@ -699,7 +699,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  		case POPUP_NEWGROUP:
  			SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
 -			Clist_GroupCreate(0, 0);
 +			Clist_GroupCreate(0, nullptr);
  			break;
  		case POPUP_HIDEOFFLINE:
 @@ -825,7 +825,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM  						if (rcWindow.bottom > rcWorkArea.bottom)
  							rcWindow.bottom = rcWorkArea.bottom;
  					}
 -					SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top,
 +					SetWindowPos(hwnd, nullptr, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top,
  						SWP_NOZORDER | SWP_NOACTIVATE);
  					break;
  				}
 diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 30c68295ff..8c3a5c06a1 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -134,7 +134,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s  			const char* saveProto = szProto; szProto = "CList";
  			if (hContact != 0 && !ProcessDatabaseValueDefault(hContact, szProto, "MyHandle")) {
  				szProto = saveProto;
 -				return 0;
 +				return nullptr;
  			}
  			szProto = saveProto;
  		}
 @@ -270,7 +270,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s  		return ProcessDatabaseValueDefault(hContact, "UserInfo", "MyNotes");
  	case CNF_TIMEZONE:
 -		HANDLE hTz = TimeZone_CreateByContact(hContact, 0, TZF_KNOWNONLY);
 +		HANDLE hTz = TimeZone_CreateByContact(hContact, nullptr, TZF_KNOWNONLY);
  		if (hTz) {
  			LPTIME_ZONE_INFORMATION tzi = TimeZone_GetInfo(hTz);
  			int offset = tzi->Bias + tzi->StandardBias;
 diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index b1a0b64cc7..0723325a7f 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -312,7 +312,7 @@ static int getProfile(wchar_t *szProfile, size_t cch)  		return 0;
  	}
 -	PROFILEMANAGERDATA pd = { 0 };
 +	PROFILEMANAGERDATA pd = {};
  	if (CmdLine_GetOption(L"ForceShowPM")) {
  LBL_Show:
  		pd.ptszProfile = szProfile;
 @@ -466,7 +466,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam)  static int FindMirandaForProfile(wchar_t *szProfile)
  {
 -	ENUMMIRANDAWINDOW x = { 0 };
 +	ENUMMIRANDAWINDOW x = {};
  	x.profile = szProfile;
  	x.msg = RegisterWindowMessage(L"Miranda::ProcessProfile");
  	x.aPath = GlobalAddAtom(szProfile);
 diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp index 02b241d0a1..0c22077b3d 100644 --- a/src/mir_app/src/db_ini.cpp +++ b/src/mir_app/src/db_ini.cpp @@ -241,7 +241,7 @@ void CIniImportDoneDlg::Delete_OnClick(CCtrlBase*)  void CIniImportDoneDlg::Recycle_OnClick(CCtrlBase*)
  {
  	ptrW szIniPath(m_iniPath.GetText());
 -	SHFILEOPSTRUCT shfo = { 0 };
 +	SHFILEOPSTRUCT shfo = {};
  	shfo.wFunc = FO_DELETE;
  	shfo.pFrom = szIniPath;
  	szIniPath[mir_wstrlen(szIniPath) + 1] = '\0';
 @@ -568,7 +568,7 @@ static void DoAutoExec(void)  			if (!mir_wstrcmpi(szOnCompletion, L"delete"))
  				DeleteFile(szIniPath);
  			else if (!mir_wstrcmpi(szOnCompletion, L"recycle")) {
 -				SHFILEOPSTRUCT shfo = { 0 };
 +				SHFILEOPSTRUCT shfo = {};
  				shfo.wFunc = FO_DELETE;
  				shfo.pFrom = szIniPath;
  				szIniPath[mir_wstrlen(szIniPath) + 1] = 0;
 diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp index 1a064cfc11..a180400d1c 100644 --- a/src/mir_app/src/descbutton.cpp +++ b/src/mir_app/src/descbutton.cpp @@ -74,7 +74,7 @@ int LoadDescButtonModule()  	wc.lpfnWndProc = MDescButtonWndProc;
  	wc.hCursor = LoadCursor(nullptr, IDC_HAND);
  	wc.cbWndExtra = sizeof(MDescButtonCtrl *);
 -	wc.hbrBackground = 0; //GetStockObject(WHITE_BRUSH);
 +	wc.hbrBackground = nullptr; //GetStockObject(WHITE_BRUSH);
  	wc.style = CS_GLOBALCLASS | CS_SAVEBITS;
  	RegisterClassEx(&wc);
  	return 0;
 @@ -115,7 +115,7 @@ static void MDescButton_FillRect(HDC hdc, int x, int y, int width, int height, C  	COLORREF oldColor = SetBkColor(hdc, cl);
  	RECT rc; SetRect(&rc, x, y, x + width, y + height);
 -	ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, 0);
 +	ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
  	SetBkMode(hdc, oldMode);
  	SetBkColor(hdc, oldColor);
 @@ -135,7 +135,7 @@ static void MDescButton_DrawGradient(HDC hdc, int x, int y, int width, int heigh  		rc.top = rc.bottom = i;
  		++rc.bottom;
  		SetBkColor(hdc, color);
 -		ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, 0);
 +		ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
  	}
  	SetBkMode(hdc, oldMode);
 diff --git a/src/mir_app/src/dll_sniffer.cpp b/src/mir_app/src/dll_sniffer.cpp index 4b853dbba7..8d70cb75ec 100644 --- a/src/mir_app/src/dll_sniffer.cpp +++ b/src/mir_app/src/dll_sniffer.cpp @@ -62,7 +62,7 @@ MUUID* GetPluginInterfaces(const wchar_t* ptszFileName, bool& bIsPlugin)  			if (ptr == nullptr)
  				__leave;
 -			PIMAGE_NT_HEADERS pINTH = { 0 };
 +			PIMAGE_NT_HEADERS pINTH = {};
  			PIMAGE_DOS_HEADER pIDH = (PIMAGE_DOS_HEADER)ptr;
  			if ( pIDH->e_magic == IMAGE_DOS_SIGNATURE )
  				pINTH = (PIMAGE_NT_HEADERS)(ptr + pIDH->e_lfanew);
 diff --git a/src/mir_app/src/extracticon.cpp b/src/mir_app/src/extracticon.cpp index 4eb9f02afb..1303ddeb0b 100644 --- a/src/mir_app/src/extracticon.cpp +++ b/src/mir_app/src/extracticon.cpp @@ -230,7 +230,7 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC  	if (res)
  		return res;
 -	HANDLE hFile = CreateFile(lpszFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
 +	HANDLE hFile = CreateFile(lpszFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
  	if (hFile == INVALID_HANDLE_VALUE)
  		return 0;
 diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index 499d8d1505..af7fb41629 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -77,7 +77,7 @@ int ExtraImage_ExtraIDToColumnNum(int extra)  int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage)
  {
 -	if (cli.hwndContactTree == 0)
 +	if (cli.hwndContactTree == nullptr)
  		return -1;
  	int icol = ExtraImage_ExtraIDToColumnNum(ConvertToClistSlot(slot));
 @@ -85,7 +85,7 @@ int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage)  		return -1;
  	HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_FINDCONTACT, hContact, 0);
 -	if (hItem == 0)
 +	if (hItem == nullptr)
  		return -1;
  	SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol, hImage));
 @@ -280,7 +280,7 @@ static HIMAGELIST hExtraImageList;  MIR_APP_DLL(HANDLE) ExtraIcon_AddIcon(HICON hIcon)
  {
 -	if (hExtraImageList == 0 || hIcon == 0)
 +	if (hExtraImageList == nullptr || hIcon == nullptr)
  		return INVALID_HANDLE_VALUE;
  	int res = ImageList_AddIcon(hExtraImageList, hIcon);
 @@ -305,7 +305,7 @@ void fnReloadExtraIcons()  void fnSetAllExtraIcons(MCONTACT hContact)
  {
 -	if (cli.hwndContactTree == 0)
 +	if (cli.hwndContactTree == nullptr)
  		return;
  	bool hcontgiven = (hContact != 0);
 @@ -392,14 +392,14 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const  {
  	// EXTRAICON_TYPE_CALLBACK 
  	if (IsEmpty(name) || IsEmpty(description))
 -		return 0;
 +		return nullptr;
  	if (ApplyIcon == nullptr || RebuildIcons == nullptr)
 -		return 0;
 +		return nullptr;
  	// no way to merge
  	if (GetExtraIconByName(name) != nullptr)
 -		return 0;
 +		return nullptr;
  	ptrW tszDesc(mir_a2u(description));
  	wchar_t *desc = TranslateW_LP(tszDesc, _hLang);
 @@ -414,7 +414,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch  	MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int flags, int _hLang)
  {
  	if (IsEmpty(name) || IsEmpty(description))
 -		return 0;
 +		return nullptr;
  	ptrW tszDesc(mir_a2u(description));
  	wchar_t *desc = TranslateW_LP(tszDesc, _hLang);
 @@ -422,7 +422,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch  	BaseExtraIcon *extra = GetExtraIconByName(name);
  	if (extra != nullptr) {
  		if (extra->getType() != EXTRAICON_TYPE_ICOLIB)
 -			return 0;
 +			return nullptr;
  		// Found one, now merge it
  		if (mir_wstrcmpi(extra->getDescription(), desc)) {
 diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp index 53d35856df..eddc2ade65 100644 --- a/src/mir_app/src/filter.cpp +++ b/src/mir_app/src/filter.cpp @@ -151,7 +151,7 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, wchar_t *p  	if (tab)   AddFilterString(key, tab);
  	if (name)  AddFilterString(key, name);
 -	if ((enableKeywordFiltering) && (hWnd != 0)) {
 +	if ((enableKeywordFiltering) && (hWnd != nullptr)) {
  		AddDialogString(hWnd, key);
  		EnumChildWindows(hWnd, GetDialogStringsCallback, (LPARAM)key);
 diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 7112774f6f..f01f633ef2 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #define M_SETGROUPVISIBILITIES  (WM_USER+11)  static HWND hwndFindAdd = nullptr; -static HANDLE hHookModulesLoaded = 0; +static HANDLE hHookModulesLoaded = nullptr;  static HGENMENU hMainMenuItem = nullptr;  static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam); @@ -121,7 +121,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot)  	if (*throbbing) {  		/* create memdc */ -		HDC hMemDC = CreateCompatibleDC(0); +		HDC hMemDC = CreateCompatibleDC(nullptr);  		HBITMAP hBitmap = (HBITMAP)SelectObject(hMemDC, CreateCompatibleBitmap(hdc, width, height));  		/* flush it */  		RECT rc; @@ -224,7 +224,7 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat)  		if (dat->hwndAdvSearch != nullptr)  			mir_subclassWindow(dat->hwndAdvSearch, AdvancedSearchDlgSubclassProc);  		GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc); -		SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); +		SetWindowPos(dat->hwndAdvSearch, nullptr, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);  	}  	AnimateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE | AW_SLIDE | AW_HOR_POSITIVE); @@ -246,7 +246,7 @@ static void ReposTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat)  	pt.x = rc.left;  	pt.y = rc.top;  	ScreenToClient(hwndDlg, &pt); -	SetWindowPos(dat->hwndTinySearch, 0, pt.x + 5, pt.y + 15, rc.right - rc.left - 10, rc.bottom - rc.top - 30, SWP_NOZORDER); +	SetWindowPos(dat->hwndTinySearch, nullptr, pt.x + 5, pt.y + 15, rc.right - rc.left - 10, rc.bottom - rc.top - 30, SWP_NOZORDER);  }  static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) @@ -445,7 +445,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP  	case WM_MOVE:  		if (dat && dat->hwndAdvSearch) {  			GetWindowRect(hwndList, &rc); -			SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); +			SetWindowPos(dat->hwndAdvSearch, nullptr, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);  		}  		break; @@ -543,7 +543,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP  			GetWindowRect(hwndDlg, &rc);  			if (rc.bottom - rc.top < mmi.ptMinTrackSize.y) -				SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, mmi.ptMinTrackSize.y, SWP_NOZORDER | SWP_NOMOVE); +				SetWindowPos(hwndDlg, nullptr, 0, 0, rc.right - rc.left, mmi.ptMinTrackSize.y, SWP_NOZORDER | SWP_NOMOVE);  		}  		break; diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp index 6a7d423cde..4d0419ca87 100644 --- a/src/mir_app/src/headerbar.cpp +++ b/src/mir_app/src/headerbar.cpp @@ -99,7 +99,7 @@ static void MHeaderbar_FillRect(HDC hdc, int x, int y, int width, int height, CO  	COLORREF oldColor = SetBkColor(hdc, cl);
  	RECT rc; SetRect(&rc, x, y, x+width, y+height);
 -	ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, 0);
 +	ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
  	SetBkMode(hdc, oldMode);
  	SetBkColor(hdc, oldColor);
 @@ -119,7 +119,7 @@ static void MHeaderbar_DrawGradient(HDC hdc, int x, int y, int width, int height  		rc.top = rc.bottom = i;
  		++rc.bottom;
  		SetBkColor(hdc, color);
 -		ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, 0);
 +		ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
  	}
  	SetBkMode(hdc, oldMode);
 @@ -281,7 +281,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT  msg, WPARAM wParam  		{
  			HWND hParent = GetParent(hwndDlg);
  			RECT rcWnd; GetWindowRect(hwndDlg, &rcWnd);
 -			itc->controlsToRedraw = 0;
 +			itc->controlsToRedraw = nullptr;
  			itc->nControlsToRedraw = 0;
  			for (HWND hChild = FindWindowEx(hParent, nullptr, nullptr, nullptr); hChild; hChild = FindWindowEx(hParent, hChild, nullptr, nullptr)) {
  				if (hChild != hwndDlg) {
 diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index 8359fd7b89..2be554b0f1 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -43,7 +43,7 @@ static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2)  LIST<THotkeyItem> hotkeys(10, sttCompareHotkeys);
  DWORD g_pid = 0, g_hkid = 1;
  HWND g_hwndHotkeyHost = nullptr, g_hwndHkOptions = nullptr;
 -HANDLE hEvChanged = 0;
 +HANDLE hEvChanged = nullptr;
  static BOOL bModuleInitialized = FALSE;
  static HHOOK hhkKeyboard = nullptr;
 @@ -157,7 +157,7 @@ MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *desc, int _hLangpack)  		p->Enabled = !db_get_b(0, DBMODULENAME "Off", p->pszName, 0);
  	}
 -	p->pszService = desc->pszService ? mir_strdup(desc->pszService) : 0;
 +	p->pszService = desc->pszService ? mir_strdup(desc->pszService) : nullptr;
  	p->DefHotkey = desc->DefHotKey & ~HKF_MIRANDA_LOCAL;
  	p->Hotkey = db_get_w(0, DBMODULENAME, p->pszName, p->DefHotkey);
  	p->type = p->pszService ?
 @@ -343,7 +343,7 @@ int LoadSkinHotkeys(void)  	g_pid = GetCurrentProcessId();
  	g_hwndHotkeyHost = CreateWindow(L"MirandaHotkeyHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr);
 -	SetWindowPos(g_hwndHotkeyHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
 +	SetWindowPos(g_hwndHotkeyHost, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
  	hhkKeyboard = SetWindowsHookEx(WH_KEYBOARD, sttKeyboardProc, nullptr, hMainThreadId);
 diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 53ee612839..529c4c6c49 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -172,7 +172,7 @@ static int InternalGetDIB(HBITMAP bitmap, HPALETTE palette, void *bitmapInfo, vo  {
  	if (InitializeBitmapInfoHeader(bitmap, (BITMAPINFOHEADER*)bitmapInfo)) return 1; // Failure
 -	HDC DC = CreateCompatibleDC(0);
 +	HDC DC = CreateCompatibleDC(nullptr);
  	HPALETTE oldPal;
  	if (palette) {
  		oldPal = SelectPalette(DC, palette, FALSE);
 @@ -246,8 +246,8 @@ int IconSourceItem::getIconData(HICON hIcon)  		ColorInfo((BYTE*)mir_calloc(ColorInfoSize)),
  		ColorBits((BYTE*)mir_calloc(ColorBitsSize));
 -	if (InternalGetDIB(iconInfo.hbmMask, 0, MonoInfo, MonoBits)
 -		|| InternalGetDIB(iconInfo.hbmColor, 0, ColorInfo, ColorBits)) {
 +	if (InternalGetDIB(iconInfo.hbmMask, nullptr, MonoInfo, MonoBits)
 +		|| InternalGetDIB(iconInfo.hbmColor, nullptr, ColorInfo, ColorBits)) {
  		DeleteObject(iconInfo.hbmColor);
  		DeleteObject(iconInfo.hbmMask);
  		return 1; // Failure
 @@ -415,7 +415,7 @@ static void IcoLib_RemoveSection(SectionItem *section)  IcolibItem* IcoLib_FindIcon(const char *pszIconName)
  {
  	int indx = iconList.getIndex((IcolibItem*)&pszIconName);
 -	return (indx != -1) ? iconList[indx] : 0;
 +	return (indx != -1) ? iconList[indx] : nullptr;
  }
  IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
 diff --git a/src/mir_app/src/iconheader.cpp b/src/mir_app/src/iconheader.cpp index ec7312a0ad..30351633f9 100644 --- a/src/mir_app/src/iconheader.cpp +++ b/src/mir_app/src/iconheader.cpp @@ -129,7 +129,7 @@ static void MIcoTab_FillRect(HDC hdc, int x, int y, int width, int height, COLOR  	COLORREF oldColor = SetBkColor(hdc, cl);
  	RECT rc; SetRect(&rc, x, y, x + width, y + height);
 -	ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, 0);
 +	ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
  	SetBkMode(hdc, oldMode);
  	SetBkColor(hdc, oldColor);
 @@ -151,7 +151,7 @@ static void MIcoTab_DrawGradient(HDC hdc, int x, int y, int width, int height, R  		rc.top = rc.bottom = i;
  		++rc.bottom;
  		SetBkColor(hdc, color);
 -		ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, 0);
 +		ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
  	}
  	SetBkMode(hdc, oldMode);
 diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 2c70ef2fce..85cb5468a9 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -35,7 +35,7 @@ static void ReloadOptions(void *hWnd)  	while (IsWindow((HWND)hWnd))
  		Sleep(50);
 -	CallFunctionAsync(OpenOptions, 0);
 +	CallFunctionAsync(OpenOptions, nullptr);
  }
  MIR_CORE_DLL(int) LoadLangPackDescr(const wchar_t *szLangPack, LANGPACK_INFO *lpInfo);
 @@ -132,7 +132,7 @@ void CLangpackDlg::LoadLangpacks()  		if (GetModuleFileName(nullptr, pack.tszFullPath, _countof(pack.tszFullPath))) {
  			mir_wstrcpy(pack.tszFileName, L"default");
 -			HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
 +			HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
  			if (hFile != INVALID_HANDLE_VALUE) {
  				GetFileTime(hFile, nullptr, nullptr, &pack.ftFileDate);
  				CloseHandle(hFile);
 diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 631944a56a..ef9cbe3281 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -172,7 +172,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi)  {
  	MainMenuExecParam *mmep = (MainMenuExecParam*)mir_alloc(sizeof(MainMenuExecParam));
  	if (mmep == nullptr)
 -		return 0;
 +		return nullptr;
  	//we need just one parametr.
  	mmep->szServiceName = mir_strdup(pmi->pszService);
 @@ -718,7 +718,7 @@ static int MenuIconsChanged(WPARAM, LPARAM)  {
  	// just rebuild menu
  	RebuildMenuOrder();
 -	cli.pfnCluiProtocolStatusChanged(0, 0);
 +	cli.pfnCluiProtocolStatusChanged(0, nullptr);
  	return 0;
  }
 @@ -1122,7 +1122,7 @@ void InitCustomMenus(void)  	InitGenMenu();
  	// main menu
 -	hMainMenuObject = Menu_AddObject("MainMenu", LPGEN("Main menu"), 0, "MainMenuExecService");
 +	hMainMenuObject = Menu_AddObject("MainMenu", LPGEN("Main menu"), nullptr, "MainMenuExecService");
  	Menu_ConfigureObject(hMainMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
  	Menu_ConfigureObject(hMainMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");
 diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index 8dd63adbf1..1fd344ccc3 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -56,7 +56,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *g  {
  	GroupMenuExecParam *mmep = (GroupMenuExecParam*)mir_calloc(sizeof(GroupMenuExecParam));
  	if (mmep == nullptr)
 -		return 0;
 +		return nullptr;
  	// we need just one parametr.
  	mmep->szServiceName = mir_strdup(pmi->pszService);
 @@ -135,7 +135,7 @@ static INT_PTR CreateGroupHelper(WPARAM, LPARAM)  {
  	SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
  	SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
 -	Clist_GroupCreate(0, 0);
 +	Clist_GroupCreate(0, nullptr);
  	return 0;
  }
 @@ -184,7 +184,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam  {
  	SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam*)mir_calloc(sizeof(SubGroupMenuExecParam));
  	if (mmep == nullptr)
 -		return 0;
 +		return nullptr;
  	// we need just one parametr.
  	mmep->szServiceName = mir_strdup(pmi->pszService);
 @@ -252,7 +252,7 @@ static HGENMENU hHideOfflineUsersHereMenuItem;  static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
  {
  	ClcGroup *group = (ClcGroup*)wParam;
 -	if (group != 0) // contact->group
 +	if (group != nullptr) // contact->group
  		Menu_SetChecked(hHideOfflineUsersHereMenuItem, group->hideOffline != 0);
  	return 0;
  }
 @@ -280,7 +280,7 @@ void InitGroupMenus(void)  	hEventPreBuildGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
  	HookEvent(ME_CLIST_PREBUILDGROUPMENU, OnBuildGroupMenu);
 -	hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
 +	hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), nullptr, "CLISTMENUSGroup/ExecService");
  	Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
  	Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
  	Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuOnAddService");
 @@ -341,7 +341,7 @@ void InitGroupMenus(void)  	hEventPreBuildSubGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
  	HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu);
 -	hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
 +	hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), nullptr, "CLISTMENUSSubGroup/ExecService");
  	Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
  	Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
  	Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");
 @@ -359,7 +359,7 @@ void InitGroupMenus(void)  		SET_UID(mi, 0xd85f5ff0, 0x12ca, 0x464d, 0x86, 0x51, 0x53, 0x36, 0x9f, 0x1d, 0x80, 0x45);
  		mi.position = 1001;
 -		mi.hIcolibItem = 0;
 +		mi.hIcolibItem = nullptr;
  		mi.name.a = LPGEN("&Hide offline users in here");
  		gmp.wParam = POPUP_GROUPHIDEOFFLINE;
  		hHideOfflineUsersHereMenuItem = Menu_AddSubGroupMenuItem(&mi, &gmp);
 diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index b94f0e8185..ee60b96bc5 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -367,7 +367,7 @@ public:  		PD->name = mir_wstrdup(STR_SEPARATOR);  		PD->pos = ((MenuItemOptData *)tvi.lParam)->pos - 1; -		TVINSERTSTRUCT tvis = { 0 }; +		TVINSERTSTRUCT tvis = {};  		tvis.item.lParam = (LPARAM)PD;  		tvis.item.pszText = PD->name;  		tvis.item.iImage = tvis.item.iSelectedImage = 1; @@ -405,7 +405,7 @@ public:  		PD->pos = pimi->mi.position;  		PD->pimi = pimi; -		TVINSERTSTRUCT tvis = { 0 }; +		TVINSERTSTRUCT tvis = {};  		tvis.item.lParam = (LPARAM)PD;  		tvis.item.pszText = PD->name;  		tvis.item.iImage = tvis.item.iSelectedImage = 1; diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp index 025a0692da..b020836cf9 100644 --- a/src/mir_app/src/menu_tray.cpp +++ b/src/mir_app/src/menu_tray.cpp @@ -110,7 +110,7 @@ void InitTrayMenus(void)  	hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
  	// Tray menu
 -	hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
 +	hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), nullptr, "CLISTMENUSTRAY/ExecService");
  	Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
  	Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
  	Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuOnAddService");
 diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 05bb9445c9..5ba68d384c 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -220,7 +220,7 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key)  MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis)
  {
  	if (pThis == nullptr)
 -		return 0;
 +		return nullptr;
  	if (db_get_b(0, "CList", "MoveProtoMenus", TRUE)) {
  		if (pThis->m_hMainMenuItem != nullptr) {
 @@ -747,7 +747,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs  		if (pmi->uid != miid_last && pRoot->mi.uid == miid_last) {
  			char szUid[100];
  			bin2hex(&pmi->uid, sizeof(pmi->uid), szUid);
 -			Netlib_Logf(0, "[MENU]: fake UUID added to menu item %s", szUid);
 +			Netlib_Logf(nullptr, "[MENU]: fake UUID added to menu item %s", szUid);
  			pRoot->mi.uid = pmi->uid;
  			pRoot->mi.uid.d[7]--; // and make it slightly different
 @@ -1197,7 +1197,7 @@ int OnIconLibChanges(WPARAM, LPARAM)  		mir_cslock lck(csMenuHook);
  		for (int mo = 0; mo < g_menus.getCount(); mo++)
  			if (hStatusMenuObject != g_menus[mo]->id) //skip status menu
 -				MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_ReloadIcon, 0);
 +				MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_ReloadIcon, nullptr);
  	}
  	cli.pfnReloadProtoMenus();
 @@ -1235,7 +1235,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)  		}
  	}
 -	SKINICONDESC sid = { 0 };
 +	SKINICONDESC sid = {};
  	sid.flags = SIDF_UNICODE;
  	sid.section.w = sectionName;
  	sid.pszName = iconame;
 @@ -1259,7 +1259,7 @@ int RegisterAllIconsInIconLib()  		if (hStatusMenuObject == g_menus[mo]->id) //skip status menu
  			continue;
 -		MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_RegisterIcon, 0);
 +		MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_RegisterIcon, nullptr);
  	}
  	return 0;
 @@ -1272,7 +1272,7 @@ int posttimerid;  static VOID CALLBACK PostRegisterIcons(HWND, UINT, UINT_PTR, DWORD)
  {
 -	KillTimer(0, posttimerid);
 +	KillTimer(nullptr, posttimerid);
  	RegisterAllIconsInIconLib();
  }
 diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 7695ed0b98..0d40feaab0 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -336,7 +336,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara  			case IDC_BTN_SETDEFAULT:
  				sel = ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED | LVNI_SELECTED);
 -				InvalidateRect(hwndList, 0, TRUE);
 +				InvalidateRect(hwndList, nullptr, TRUE);
  				g_data.hDefaultContact = g_data.hContact[sel];
  				SendMessage(hwndDlg, WMU_SETTITLE, 0, (LPARAM)g_data.hContact[sel]);
 @@ -348,7 +348,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara  			case IDC_BTN_SETOFFLINE:
  				sel = ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED | LVNI_SELECTED);
 -				InvalidateRect(hwndList, 0, TRUE);
 +				InvalidateRect(hwndList, nullptr, TRUE);
  				if (g_data.hContact[sel] != g_data.hOfflineContact)
  					g_data.hOfflineContact = g_data.hContact[sel];
  				else
 diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index f072e66bb7..ce279883c1 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -72,7 +72,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM)  	// Assign the contact to the MetaContact just created (and make default).
  	if (!Meta_Assign(wParam, hMetaContact, TRUE)) {
 -		MessageBox(0, TranslateT("There was a problem in assigning the contact to the metacontact"), TranslateT("Error"), MB_ICONEXCLAMATION);
 +		MessageBox(nullptr, TranslateT("There was a problem in assigning the contact to the metacontact"), TranslateT("Error"), MB_ICONEXCLAMATION);
  		db_delete_contact(hMetaContact);
  		return 0;
  	}
 @@ -207,7 +207,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)  			return 2;
  		if (cc->nSubs == 1) {
 -			if (IDYES == MessageBox(0, TranslateW(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1))
 +			if (IDYES == MessageBox(nullptr, TranslateW(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1))
  				Meta_Delete(cc->contactID, 1);
  			return 0;
 @@ -405,7 +405,7 @@ void InitMenus()  	SET_UID(mi, 0xd31e772d, 0xf85a, 0x45e9, 0xb3, 0xa8, 0xf7, 0xa5, 0xf4, 0xfc, 0xf9, 0x6e);
  	mi.position = -99000;
  	mi.flags = CMIF_HIDDEN;
 -	mi.hIcolibItem = 0;
 +	mi.hIcolibItem = nullptr;
  	mi.name.a = LPGEN("Subcontacts");
  	hMenuRoot = Menu_AddContactMenuItem(&mi);
 diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 350b30187f..f1dbaa3124 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  extern "C" MIR_CORE_DLL(void) db_mc_notifyDefChange(WPARAM wParam, LPARAM lParam);
 -char *pendingACK = 0;    // Name of the protocol in which an ACK is about to come.
 +char *pendingACK = nullptr;    // Name of the protocol in which an ACK is about to come.
  int previousMode,        // Previous status of the MetaContacts Protocol
  mcStatus;             // Current status of the MetaContacts Protocol
 @@ -144,7 +144,7 @@ void CALLBACK SetStatusThread(HWND, UINT, UINT_PTR, DWORD)  	mcStatus = ID_STATUS_ONLINE;
  	ProtoBroadcastAck(META_PROTO, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
 -	KillTimer(0, setStatusTimerId);
 +	KillTimer(nullptr, setStatusTimerId);
  }
  /** Changes the status and notifies everybody
 @@ -157,7 +157,7 @@ INT_PTR Meta_SetStatus(WPARAM wParam, LPARAM)  	// firstSetOnline starts out true - used to delay metacontact's 'onlineness' to prevent double status notifications on startup
  	if (mcStatus == ID_STATUS_OFFLINE && firstSetOnline) {
  		// causes crash on exit if miranda is closed in under options.set_status_from_offline milliseconds!
 -		setStatusTimerId = SetTimer(0, 0, g_metaOptions.set_status_from_offline_delay, SetStatusThread);
 +		setStatusTimerId = SetTimer(nullptr, 0, g_metaOptions.set_status_from_offline_delay, SetStatusThread);
  		firstSetOnline = FALSE;
  	}
  	else {
 @@ -306,7 +306,7 @@ int Meta_HandleACK(WPARAM, LPARAM lParam)  				return ProtoBroadcastAck(META_PROTO, cc->contactID, ack->type, ack->result, (HANDLE)&ai, ack->lParam);
  			}
 -			return ProtoBroadcastAck(META_PROTO, cc->contactID, ack->type, ack->result, 0, ack->lParam);
 +			return ProtoBroadcastAck(META_PROTO, cc->contactID, ack->type, ack->result, nullptr, ack->lParam);
  		}
  	}
 @@ -823,7 +823,7 @@ int Meta_PreShutdown(WPARAM, LPARAM)  	Meta_SetStatus(ID_STATUS_OFFLINE, 0);
  	Meta_SuppressStatus(FALSE);
  	if (setStatusTimerId)
 -		KillTimer(0, setStatusTimerId);
 +		KillTimer(nullptr, setStatusTimerId);
  	return 0;
  }
 diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index b59e268b1a..9faf308c9f 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -65,7 +65,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)  	char *szProto = GetContactProto(hSub);
  	if (szProto == nullptr) {
 -		MessageBox(0, TranslateT("Could not retrieve contact protocol"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +		MessageBox(nullptr, TranslateT("Could not retrieve contact protocol"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  		return FALSE;
  	}
 @@ -73,19 +73,19 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)  	char *field = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
  	DBVARIANT dbv;
  	if (db_get(hSub, szProto, field, &dbv)) {
 -		MessageBox(0, TranslateT("Could not get unique ID of contact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +		MessageBox(nullptr, TranslateT("Could not get unique ID of contact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  		return FALSE;
  	}
  	// Check that is is 'on the list'
  	if (db_get_b(hSub, "CList", "NotOnList", 0) == 1) {
 -		MessageBox(0, TranslateT("Contact is 'not on list' - please add the contact to your contact list before assigning."), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +		MessageBox(nullptr, TranslateT("Contact is 'not on list' - please add the contact to your contact list before assigning."), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  		db_free(&dbv);
  		return FALSE;
  	}
  	if (ccDest->nSubs >= MAX_CONTACTS) {
 -		MessageBox(0, TranslateT("Metacontact is full"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +		MessageBox(nullptr, TranslateT("Metacontact is full"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  		db_free(&dbv);
  		return FALSE;
  	}
 @@ -94,7 +94,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)  	char buffer[512];
  	mir_snprintf(buffer, "Protocol%d", ccDest->nSubs);
  	if (db_set_s(hMeta, META_PROTO, buffer, szProto)) {
 -		MessageBox(0, TranslateT("Could not write contact protocol to metacontact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +		MessageBox(nullptr, TranslateT("Could not write contact protocol to metacontact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  		db_free(&dbv);
  		return FALSE;
  	}
 @@ -102,7 +102,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)  	// write the login
  	mir_snprintf(buffer, "Login%d", ccDest->nSubs);
  	if (db_set(hMeta, META_PROTO, buffer, &dbv)) {
 -		MessageBox(0, TranslateT("Could not write unique ID of contact to metacontact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +		MessageBox(nullptr, TranslateT("Could not write unique ID of contact to metacontact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  		db_free(&dbv);
  		return FALSE;
  	}
 @@ -114,7 +114,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)  		// write the nickname
  		mir_snprintf(buffer, "Nick%d", ccDest->nSubs);
  		if (db_set(hMeta, META_PROTO, buffer, &dbv)) {
 -			MessageBox(0, TranslateT("Could not write nickname of contact to metacontact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
 +			MessageBox(nullptr, TranslateT("Could not write nickname of contact to metacontact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
  			db_free(&dbv);
  			return FALSE;
  		}
 diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 9070274cd1..16babee8e5 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -273,7 +273,7 @@ int WINAPI mir_main(LPTSTR cmdLine)  			getBufferedPaintBits = (pfnGetBufferedPaintBits)GetProcAddress(hThemeAPI, "GetBufferedPaintBits");
  		}
  	}
 -	else hDwmApi = hThemeAPI = 0;
 +	else hDwmApi = hThemeAPI = nullptr;
  	if (bufferedPaintInit)
  		bufferedPaintInit();
 diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index 0481c118aa..a1336a27f2 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "stdafx.h"
 -static HGENMENU hMoveToGroupItem = 0, hPriorityItem = 0, hFloatingItem = 0;
 +static HGENMENU hMoveToGroupItem = nullptr, hPriorityItem = nullptr, hFloatingItem = nullptr;
  static LIST<HANDLE> lphGroupsItems(5);
  #define MTG_MOVE "MoveToGroup/Move"
 diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index a6e59fc49b..faa1b44cac 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -139,7 +139,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu)  {
  	if (nlu == nullptr || nlu->szSettingsModule == nullptr || (!(nlu->flags & NUF_NOOPTIONS) && nlu->szDescriptiveName.w == nullptr)) {
  		SetLastError(ERROR_INVALID_PARAMETER);
 -		return 0;
 +		return nullptr;
  	}
  	HNETLIBUSER thisUser = (HNETLIBUSER)mir_calloc(sizeof(NetlibUser));
 @@ -154,7 +154,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu)  	if (idx != -1) {
  		mir_free(thisUser);
  		SetLastError(ERROR_DUP_NAME);
 -		return 0;
 +		return nullptr;
  	}
  	if (nlu->szDescriptiveName.w)
 @@ -166,7 +166,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu)  	{
  		mir_free(thisUser);
  		SetLastError(ERROR_OUTOFMEMORY);
 -		return 0;
 +		return nullptr;
  	}
  	if (nlu->szHttpGatewayHello)
  		thisUser->user.szHttpGatewayHello = mir_strdup(nlu->szHttpGatewayHello);
 @@ -320,7 +320,7 @@ MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib)  MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HNETLIBCONN hConnection)
  {
  	SOCKET s;
 -	if (hConnection == 0) {
 +	if (hConnection == nullptr) {
  		s = INVALID_SOCKET;
  		SetLastError(ERROR_INVALID_PARAMETER);
  	}
 diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp index eb1ecb92b6..3700a7a4b9 100644 --- a/src/mir_app/src/netlibbind.cpp +++ b/src/mir_app/src/netlibbind.cpp @@ -168,7 +168,7 @@ static void NetlibBindAcceptThread(void* param)  	}
  	NetlibUPnPDeletePortMapping(nlbp->wExPort, "TCP");
 -	nlbp->hThread = 0;
 +	nlbp->hThread = nullptr;
  	Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread: (%p) thread for port %u closed", nlbp->s, nlbp->wPort);
  }
 diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index 2b06b8816a..137907481f 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -821,7 +821,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHT  		nlhr->szUrl == nullptr || nlhr->szUrl[0] == 0)
  	{
  		SetLastError(ERROR_INVALID_PARAMETER);
 -		return 0;
 +		return nullptr;
  	}
  	if (nlhr->nlc != nullptr && GetNetlibHandleType(nlhr->nlc) != NLH_CONNECTION)
 @@ -829,7 +829,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHT  	NetlibConnection *nlc = NetlibHttpProcessUrl(nlhr, nlu, (NetlibConnection*)nlhr->nlc);
  	if (nlc == nullptr)
 -		return 0;
 +		return nullptr;
  	NETLIBHTTPREQUEST nlhrSend = *nlhr;
  	nlhrSend.flags |= NLHRF_SMARTREMOVEHOST;
 @@ -869,7 +869,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHT  		if (!doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
  		nlhr->resultCode = nlhrSend.resultCode;
  		Netlib_CloseHandle(nlc);
 -		return 0;
 +		return nullptr;
  	}
  	if (!doneUserAgentHeader || !doneAcceptEncoding)
  		mir_free(nlhrSend.headers);
 diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp index cfd56e8b92..b08196bfcb 100644 --- a/src/mir_app/src/netliblog.cpp +++ b/src/mir_app/src/netliblog.cpp @@ -44,7 +44,7 @@ struct {  	int textDumps, autoDetectText;
  	CMStringW tszFile, tszUserFile;
  }
 -static logOptions = { 0 };
 +static logOptions = {};
  struct LOGMSG
  {
 @@ -122,7 +122,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa  			HWND hwndFilter = GetDlgItem(hwndDlg, IDC_FILTER);
  			SetWindowLongPtr(hwndFilter, GWL_STYLE, GetWindowLongPtr(hwndFilter, GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
 -			TVINSERTSTRUCT tvis = { 0 };
 +			TVINSERTSTRUCT tvis = {};
  			tvis.hInsertAfter = TVI_SORT;
  			tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
  			tvis.item.stateMask = TVIS_STATEIMAGEMASK;
 diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index 12e0cf7a79..57514b824c 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -67,7 +67,7 @@ int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check)  	FD_ZERO(&readfd);  	FD_SET(s, &readfd); -	int result = select(0, &readfd, 0, 0, &tv); +	int result = select(0, &readfd, nullptr, nullptr, &tv);  	if (result == 0 && !check) SetLastError(ERROR_TIMEOUT);  	return result;  } @@ -83,7 +83,7 @@ int WaitUntilWritable(SOCKET s, DWORD dwTimeout)  	FD_ZERO(&writefd);  	FD_SET(s, &writefd); -	switch(select(0, 0, &writefd, 0, &tv)) { +	switch(select(0, nullptr, &writefd, nullptr, &tv)) {  	case 0:  		SetLastError(ERROR_TIMEOUT);  	case SOCKET_ERROR: @@ -774,7 +774,7 @@ bool NetlibDoConnect(NetlibConnection *nlc)  	Netlib_Logf(nlu, "(%d) Connected to %s:%d", nlc->s, nloc->szHost, nloc->wPort);  	if (NLOCF_SSL & nloc->flags) -		return Netlib_StartSsl(nlc, 0) != 0; +		return Netlib_StartSsl(nlc, nullptr) != 0;  	return true;  } @@ -840,7 +840,7 @@ MIR_APP_DLL(HNETLIBCONN) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPEN  	if (!NetlibDoConnect(nlc)) {  		FreePartiallyInitedConnection(nlc); -		return 0; +		return nullptr;  	}  	if (iUPnPCleanup == 0) { diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp index 20ed26b7df..93ad70943f 100644 --- a/src/mir_app/src/netlibupnp.cpp +++ b/src/mir_app/src/netlibupnp.cpp @@ -192,7 +192,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath)  static void LongLog(char* szData)
  {
 -	Netlib_Logf(0, szData);
 +	Netlib_Logf(nullptr, szData);
  }
  static void closeRouterConnection(void)
 diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index ed8b47670c..72cf664159 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -921,5 +921,5 @@ void UnloadNewPluginsModule(void)  	if (hPluginListHeap)
  		HeapDestroy(hPluginListHeap);
 -	hPluginListHeap = 0;
 +	hPluginListHeap = nullptr;
  }
 diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 33962626fb..2ec51ee4cb 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -263,7 +263,7 @@ struct OptionsPageData : public MZeroedObject  	void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWndParent)
  	{
 -		HWND hWnd = 0;
 +		HWND hWnd = nullptr;
  		if (enableKeywordFiltering) {
  			if (current)
  				hWnd = getHwnd();
 diff --git a/src/mir_app/src/options_ei.cpp b/src/mir_app/src/options_ei.cpp index 490c1769b0..986520b831 100644 --- a/src/mir_app/src/options_ei.cpp +++ b/src/mir_app/src/options_ei.cpp @@ -29,7 +29,7 @@ int SortFunc(const ExtraIcon *p1, const ExtraIcon *p2);  struct intlist
  {
 -	intlist() : count(0), data(0) {}
 +	intlist() : count(0), data(nullptr) {}
  	~intlist() { mir_free(data); }
  	void add(int val)
 @@ -97,7 +97,7 @@ class CExtraIconOptsDlg : public CDlgBase  		intlist *ids = new intlist();
  		ids->add(extra->getID());
 -		TVINSERTSTRUCT tvis = { 0 };
 +		TVINSERTSTRUCT tvis = {};
  		tvis.hInsertAfter = hAfter;
  		tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
  		tvis.item.stateMask = TVIS_STATEIMAGEMASK;
 @@ -125,7 +125,7 @@ class CExtraIconOptsDlg : public CDlgBase  			desc += extra->getDescription();
  		}
 -		TVINSERTSTRUCT tvis = { 0 };
 +		TVINSERTSTRUCT tvis = {};
  		tvis.hInsertAfter = hAfter;
  		tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
  		tvis.item.stateMask = TVIS_STATEIMAGEMASK;
 @@ -291,7 +291,7 @@ public:  			else Tree_AddExtraIcon((BaseExtraIcon *)extra, extra->isEnabled());
  		}
 -		TVSORTCB sort = { 0 };
 +		TVSORTCB sort = {};
  		sort.hParent = nullptr;
  		sort.lParam = 0;
  		sort.lpfnCompare = CompareFunc;
 diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index 6d69012470..5c97c7efde 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -286,7 +286,7 @@ XCHAR *ReplaceVariables(const XCHAR *str, MCONTACT hContact, REPLACEVARSARRAY *v  	if (!str)
  		return nullptr;
 -	const XCHAR *varStart = 0, *p;
 +	const XCHAR *varStart = nullptr, *p;
  	size_t length = 0;
  	bool bFree;
 @@ -302,7 +302,7 @@ XCHAR *ReplaceVariables(const XCHAR *str, MCONTACT hContact, REPLACEVARSARRAY *v  				else // variable not found
  					length += p-varStart+2;
 -				varStart = 0;
 +				varStart = nullptr;
  			}
  			else varStart = p+1;
  		}
 @@ -331,7 +331,7 @@ XCHAR *ReplaceVariables(const XCHAR *str, MCONTACT hContact, REPLACEVARSARRAY *v  					_xcsncpy(q, varStart-1, p-varStart+2);
  					q += p-varStart+2;
  				}
 -				varStart = 0;
 +				varStart = nullptr;
  			}
  			else varStart = p+1;
  		}
 diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 081ecbcd73..696300befd 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -241,7 +241,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP  						ListView_EnsureVisible(hwnd, idx, FALSE);
  						if (timerID != 0)
  							KillTimer(hwnd, timerID);
 -						timerID = SetTimer(hwnd, 1, 1500, 0);
 +						timerID = SetTimer(hwnd, 1, 1500, nullptr);
  						return TRUE;
  					}
  				}
 diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index 6093275ec0..ffecb64982 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -74,7 +74,7 @@ static int findProfiles(wchar_t *szProfileDir, ENUMPROFILECALLBACK callback, LPA  static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, LPARAM lParam)  {  	if (msg == WM_CHAR) { -		if (wcschr(L".?/\\#' ", (wchar_t)wParam) != 0) +		if (wcschr(L".?/\\#' ", (wchar_t)wParam) != nullptr)  			return 0;  		PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0);  	} @@ -102,7 +102,7 @@ class CCreateProfileDlg : public CDlgBase  				return 0;  			// move the file -			SHFILEOPSTRUCT sf = { 0 }; +			SHFILEOPSTRUCT sf = {};  			sf.wFunc = FO_DELETE;  			sf.pFrom = buf;  			sf.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; @@ -348,7 +348,7 @@ class CChooseProfileDlg : public CDlgBase  		mir_snwprintf(profilef, L"%s\\%s%c", m_pd->ptszProfileDir, profile, 0); -		SHFILEOPSTRUCT sf = { 0 }; +		SHFILEOPSTRUCT sf = {};  		sf.wFunc = FO_DELETE;  		sf.pFrom = profilef;  		sf.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_ALLOWUNDO; diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index bf5603a41c..817f947f56 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -226,7 +226,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE  		ccs.wParam = (WPARAM)mir_u2a(szDescription);
  		ccs.lParam = (LPARAM)Proto_FilesMatrixA(ppszFiles);
  		HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
 -		if (res == 0) FreeFilesMatrix((wchar_t***)&ccs.lParam);
 +		if (res == nullptr) FreeFilesMatrix((wchar_t***)&ccs.lParam);
  		mir_free((char*)ccs.wParam);
  		return res;
  	}
 diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 9bd0d101bf..b40c692c77 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -296,7 +296,7 @@ class CAccountManagerDlg : public CDlgBase  				m_btnEdit.Enable(!pa->bOldProto && !pa->bDynDisabled);
  				m_btnRemove.Enable(true);
  				m_btnUpgrade.Enable(pa->bOldProto || pa->bDynDisabled);
 -				m_btnOptions.Enable(pa->ppro != 0);
 +				m_btnOptions.Enable(pa->ppro != nullptr);
  				if (m_iSelected >= 0) {
  					PROTOACCOUNT *pa_old = (PROTOACCOUNT *)m_accList.GetItemData(m_iSelected);
 diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 97cc49279e..b20ad38017 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -190,7 +190,7 @@ static void BeginSearchFailed(void *arg)  		mir_free((char*)arg);
  	}
  	else mir_wstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
 -	MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
 +	MessageBox(nullptr, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
  }
  int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams)
 diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index ce57bb3403..a5a5e2d3e2 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -406,7 +406,7 @@ class CIcoLibOptsDlg : public CDlgBase  				hItem = FindNamedTreeItemAt(hSection, pItemName);
  				if (!sectionName || !hItem) {
  					if (!hItem) {
 -						TVINSERTSTRUCT tvis = { 0 };
 +						TVINSERTSTRUCT tvis = {};
  						TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
  						treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE);
  						treeItem->paramName = mir_u2a(itemName);
 @@ -441,7 +441,7 @@ class CIcoLibOptsDlg : public CDlgBase  		ShowWindow(m_categoryList.GetHwnd(), SW_SHOW);
 -		m_categoryList.SelectItem(FindNamedTreeItemAt(0, nullptr));
 +		m_categoryList.SelectItem(FindNamedTreeItemAt(nullptr, nullptr));
  	}
  	int OpenPopupMenu()
 diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 065c09aebd..485b172d54 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -36,62 +36,62 @@ struct StandardIconDescription  static struct StandardIconDescription mainIcons[] =
  {
 -	{ SKINICON_OTHER_MIRANDA,         LPGEN("Miranda NG"),            -IDI_MIRANDA,        0, 0 }, // 0
 -	{ SKINICON_EVENT_MESSAGE,         LPGEN("Message"),               -IDI_RECVMSG,        0, 0 }, // 1
 -	{ SKINICON_EVENT_URL,             LPGEN("URL"),                   -IDI_URL,            0, 0 }, // 2
 -	{ SKINICON_EVENT_FILE,            LPGEN("File"),                  -IDI_FILE,           0, 0 }, // 3
 -	{ SKINICON_OTHER_USERONLINE,      LPGEN("User online"),           -IDI_USERONLINE,     0, 0 }, // 4
 -	{ SKINICON_OTHER_GROUPOPEN,       LPGEN("Group (open)"),          -IDI_GROUPOPEN,      0, 0 }, // 5
 -	{ SKINICON_OTHER_GROUPSHUT,       LPGEN("Group (closed)"),        -IDI_GROUPSHUT,      0, 0 }, // 6
 -	{ SKINICON_OTHER_CONNECTING,      LPGEN("Connecting"),            -IDI_LOAD,           0, 0 }, // 7
 -	{ SKINICON_OTHER_ADDCONTACT,      LPGEN("Add contact"),           -IDI_ADDCONTACT,     0, 0 }, // 8
 -	{ SKINICON_OTHER_USERDETAILS,     LPGEN("User details"),          -IDI_USERDETAILS,    0, 0 }, // 9
 -	{ SKINICON_OTHER_HISTORY,         LPGEN("History"),               -IDI_HISTORY,        0, 0 }, // 10
 -	{ SKINICON_OTHER_DOWNARROW,       LPGEN("Down arrow"),            -IDI_DOWNARROW,      0, 0 }, // 11
 -	{ SKINICON_OTHER_FINDUSER,        LPGEN("Find user"),             -IDI_FINDUSER,       0, 0 }, // 12
 -	{ SKINICON_OTHER_OPTIONS,         LPGEN("Options"),               -IDI_OPTIONS,        0, 0 }, // 13
 -	{ SKINICON_OTHER_SENDEMAIL,       LPGEN("Send e-mail"),           -IDI_SENDEMAIL,      0, 0 }, // 14
 -	{ SKINICON_OTHER_DELETE,          LPGEN("Delete"),                -IDI_DELETE,         0, 0 }, // 15
 -	{ SKINICON_OTHER_RENAME,          LPGEN("Rename"),                -IDI_RENAME,         0, 0 }, // 16
 -	{ SKINICON_OTHER_SMS,             LPGEN("SMS"),                   -IDI_SMS,            0, 0 }, // 17
 -	{ SKINICON_OTHER_SEARCHALL,       LPGEN("Search all"),            -IDI_SEARCHALL,      0, 0 }, // 18
 -	{ SKINICON_OTHER_TICK,            LPGEN("Tick"),                  -IDI_TICK,           0, 0 }, // 19
 -	{ SKINICON_OTHER_NOTICK,          LPGEN("No tick"),               -IDI_NOTICK,         0, 0 }, // 20
 -	{ SKINICON_OTHER_HELP,            LPGEN("Help"),                  -IDI_HELP,           0, 0 }, // 21
 -	{ SKINICON_OTHER_MIRANDAWEB,      LPGEN("Miranda website"),       -IDI_MIRANDAWEBSITE, 0, 0 }, // 22
 -	{ SKINICON_OTHER_TYPING,          LPGEN("Typing"),                -IDI_TYPING,         0, 0 }, // 23
 -	{ SKINICON_OTHER_SMALLDOT,        LPGEN("Small dot"),             -IDI_SMALLDOT,       0, 0 }, // 24
 -	{ SKINICON_OTHER_FILLEDBLOB,      LPGEN("Filled blob"),           -IDI_FILLEDBLOB,     0, 0 }, // 25
 -	{ SKINICON_OTHER_EMPTYBLOB,       LPGEN("Empty blob"),            -IDI_EMPTYBLOB,      0, 0 }, // 26
 -	{ SKINICON_OTHER_UNICODE,         LPGEN("Unicode plugin"),        -IDI_UNICODE,        0, 0 }, // 27
 -	{ SKINICON_OTHER_ANSI,            LPGEN("ANSI plugin"),           -IDI_ANSI,           0, 0 }, // 28
 -	{ SKINICON_OTHER_LOADED,          LPGEN("Running plugin"),        -IDI_LOADED,         0, 0 }, // 29
 -	{ SKINICON_OTHER_NOTLOADED,       LPGEN("Unloaded plugin"),       -IDI_NOTLOADED,      0, 0 }, // 30
 -	{ SKINICON_OTHER_UNDO, 	          LPGEN("Undo"),                  -IDI_UNDO,           0, 0 }, // 31
 -	{ SKINICON_OTHER_WINDOW,          LPGEN("Window"),                -IDI_WINDOW,         0, 0 }, // 32
 -	{ SKINICON_OTHER_WINDOWS,         LPGEN("System"),                -IDI_WINDOWS,        0, 0 }, // 33
 -	{ SKINICON_OTHER_ACCMGR,          LPGEN("Accounts"),              -IDI_ACCMGR,         0, 0 }, // 34
 -	{ SKINICON_OTHER_SHOWHIDE,        LPGEN("Show/Hide"),             -IDI_SHOWHIDE,       0, 0 }, // 35
 -	{ SKINICON_OTHER_EXIT,            LPGEN("Exit"),                  -IDI_EXIT,           0, 0 }, // 36
 -	{ SKINICON_OTHER_MAINMENU,        LPGEN("Main menu"),             -IDI_MAINMENU,       0, 0 }, // 37
 -	{ SKINICON_OTHER_STATUS,          LPGEN("Status"),                -IDI_ONLINE,         0, 0 }, // 38
 -	{ SKINICON_CHAT_JOIN,             LPGEN("Join chat"),             -IDI_JOINCHAT,       0, 0 }, // 39
 -	{ SKINICON_CHAT_LEAVE,            LPGEN("Leave chat"),            -IDI_LEAVECHAT,      0, 0 }, // 40
 -	{ SKINICON_OTHER_GROUP,           LPGEN("Move to group"),         -IDI_MOVETOGROUP,    0, 0 }, // 41
 -	{ SKINICON_OTHER_ON,              LPGEN("On"),                    -IDI_ON,             0, 0 }, // 42
 -	{ SKINICON_OTHER_OFF,             LPGEN("Off"),                   -IDI_OFF,            0, 0 }, // 43
 -	{ SKINICON_OTHER_LOADEDGRAY,      LPGEN("Running core plugin"),   -IDI_LOADED_GRAY,    0, 0 }, // 44
 -	{ SKINICON_OTHER_NOTLOADEDGRAY,   LPGEN("Non-loadable plugin"),   -IDI_NOTLOADED_GRAY, 0, 0 }, // 45
 -	{ SKINICON_OTHER_FRAME,           LPGEN("Frames"),                -IDI_FRAME,          0, 0 }, // 46
 -	{ SKINICON_OTHER_GROUPADD,        LPGEN("Add group"),             -IDI_ADDGROUP,       0, 0 }, // 47
 -	{ SKINICON_AUTH_ADD,              LPGEN("Add to list"),           -IDI_AUTH_ADD,       0, 0 }, // 48
 -	{ SKINICON_AUTH_REQUEST,          LPGEN("Request authorization"), -IDI_AUTH_REQUEST,   0, 0 }, // 49
 -	{ SKINICON_AUTH_GRANT,            LPGEN("Grant authorization"),   -IDI_AUTH_GRANT,     0, 0 }, // 50
 -	{ SKINICON_AUTH_REVOKE,           LPGEN("Revoke authorization"),  -IDI_AUTH_REVOKE,    0, 0 }, // 51
 -	{ SKINICON_FATAL,                 LPGEN("Fatal error"),           -IDI_MFATAL,         0, 0 }, // 52
 -	{ SKINICON_ERROR,                 LPGEN("Error"),                 -IDI_MERROR,         0, 0 }, // 53
 -	{ SKINICON_WARNING,               LPGEN("Warning"),               -IDI_MWARNING,       0, 0 }, // 54
 -	{ SKINICON_INFORMATION,           LPGEN("Information"),           -IDI_MINFO,          0, 0 }, // 55
 +	{ SKINICON_OTHER_MIRANDA,         LPGEN("Miranda NG"),            -IDI_MIRANDA,        0, nullptr }, // 0
 +	{ SKINICON_EVENT_MESSAGE,         LPGEN("Message"),               -IDI_RECVMSG,        0, nullptr }, // 1
 +	{ SKINICON_EVENT_URL,             LPGEN("URL"),                   -IDI_URL,            0, nullptr }, // 2
 +	{ SKINICON_EVENT_FILE,            LPGEN("File"),                  -IDI_FILE,           0, nullptr }, // 3
 +	{ SKINICON_OTHER_USERONLINE,      LPGEN("User online"),           -IDI_USERONLINE,     0, nullptr }, // 4
 +	{ SKINICON_OTHER_GROUPOPEN,       LPGEN("Group (open)"),          -IDI_GROUPOPEN,      0, nullptr }, // 5
 +	{ SKINICON_OTHER_GROUPSHUT,       LPGEN("Group (closed)"),        -IDI_GROUPSHUT,      0, nullptr }, // 6
 +	{ SKINICON_OTHER_CONNECTING,      LPGEN("Connecting"),            -IDI_LOAD,           0, nullptr }, // 7
 +	{ SKINICON_OTHER_ADDCONTACT,      LPGEN("Add contact"),           -IDI_ADDCONTACT,     0, nullptr }, // 8
 +	{ SKINICON_OTHER_USERDETAILS,     LPGEN("User details"),          -IDI_USERDETAILS,    0, nullptr }, // 9
 +	{ SKINICON_OTHER_HISTORY,         LPGEN("History"),               -IDI_HISTORY,        0, nullptr }, // 10
 +	{ SKINICON_OTHER_DOWNARROW,       LPGEN("Down arrow"),            -IDI_DOWNARROW,      0, nullptr }, // 11
 +	{ SKINICON_OTHER_FINDUSER,        LPGEN("Find user"),             -IDI_FINDUSER,       0, nullptr }, // 12
 +	{ SKINICON_OTHER_OPTIONS,         LPGEN("Options"),               -IDI_OPTIONS,        0, nullptr }, // 13
 +	{ SKINICON_OTHER_SENDEMAIL,       LPGEN("Send e-mail"),           -IDI_SENDEMAIL,      0, nullptr }, // 14
 +	{ SKINICON_OTHER_DELETE,          LPGEN("Delete"),                -IDI_DELETE,         0, nullptr }, // 15
 +	{ SKINICON_OTHER_RENAME,          LPGEN("Rename"),                -IDI_RENAME,         0, nullptr }, // 16
 +	{ SKINICON_OTHER_SMS,             LPGEN("SMS"),                   -IDI_SMS,            0, nullptr }, // 17
 +	{ SKINICON_OTHER_SEARCHALL,       LPGEN("Search all"),            -IDI_SEARCHALL,      0, nullptr }, // 18
 +	{ SKINICON_OTHER_TICK,            LPGEN("Tick"),                  -IDI_TICK,           0, nullptr }, // 19
 +	{ SKINICON_OTHER_NOTICK,          LPGEN("No tick"),               -IDI_NOTICK,         0, nullptr }, // 20
 +	{ SKINICON_OTHER_HELP,            LPGEN("Help"),                  -IDI_HELP,           0, nullptr }, // 21
 +	{ SKINICON_OTHER_MIRANDAWEB,      LPGEN("Miranda website"),       -IDI_MIRANDAWEBSITE, 0, nullptr }, // 22
 +	{ SKINICON_OTHER_TYPING,          LPGEN("Typing"),                -IDI_TYPING,         0, nullptr }, // 23
 +	{ SKINICON_OTHER_SMALLDOT,        LPGEN("Small dot"),             -IDI_SMALLDOT,       0, nullptr }, // 24
 +	{ SKINICON_OTHER_FILLEDBLOB,      LPGEN("Filled blob"),           -IDI_FILLEDBLOB,     0, nullptr }, // 25
 +	{ SKINICON_OTHER_EMPTYBLOB,       LPGEN("Empty blob"),            -IDI_EMPTYBLOB,      0, nullptr }, // 26
 +	{ SKINICON_OTHER_UNICODE,         LPGEN("Unicode plugin"),        -IDI_UNICODE,        0, nullptr }, // 27
 +	{ SKINICON_OTHER_ANSI,            LPGEN("ANSI plugin"),           -IDI_ANSI,           0, nullptr }, // 28
 +	{ SKINICON_OTHER_LOADED,          LPGEN("Running plugin"),        -IDI_LOADED,         0, nullptr }, // 29
 +	{ SKINICON_OTHER_NOTLOADED,       LPGEN("Unloaded plugin"),       -IDI_NOTLOADED,      0, nullptr }, // 30
 +	{ SKINICON_OTHER_UNDO, 	          LPGEN("Undo"),                  -IDI_UNDO,           0, nullptr }, // 31
 +	{ SKINICON_OTHER_WINDOW,          LPGEN("Window"),                -IDI_WINDOW,         0, nullptr }, // 32
 +	{ SKINICON_OTHER_WINDOWS,         LPGEN("System"),                -IDI_WINDOWS,        0, nullptr }, // 33
 +	{ SKINICON_OTHER_ACCMGR,          LPGEN("Accounts"),              -IDI_ACCMGR,         0, nullptr }, // 34
 +	{ SKINICON_OTHER_SHOWHIDE,        LPGEN("Show/Hide"),             -IDI_SHOWHIDE,       0, nullptr }, // 35
 +	{ SKINICON_OTHER_EXIT,            LPGEN("Exit"),                  -IDI_EXIT,           0, nullptr }, // 36
 +	{ SKINICON_OTHER_MAINMENU,        LPGEN("Main menu"),             -IDI_MAINMENU,       0, nullptr }, // 37
 +	{ SKINICON_OTHER_STATUS,          LPGEN("Status"),                -IDI_ONLINE,         0, nullptr }, // 38
 +	{ SKINICON_CHAT_JOIN,             LPGEN("Join chat"),             -IDI_JOINCHAT,       0, nullptr }, // 39
 +	{ SKINICON_CHAT_LEAVE,            LPGEN("Leave chat"),            -IDI_LEAVECHAT,      0, nullptr }, // 40
 +	{ SKINICON_OTHER_GROUP,           LPGEN("Move to group"),         -IDI_MOVETOGROUP,    0, nullptr }, // 41
 +	{ SKINICON_OTHER_ON,              LPGEN("On"),                    -IDI_ON,             0, nullptr }, // 42
 +	{ SKINICON_OTHER_OFF,             LPGEN("Off"),                   -IDI_OFF,            0, nullptr }, // 43
 +	{ SKINICON_OTHER_LOADEDGRAY,      LPGEN("Running core plugin"),   -IDI_LOADED_GRAY,    0, nullptr }, // 44
 +	{ SKINICON_OTHER_NOTLOADEDGRAY,   LPGEN("Non-loadable plugin"),   -IDI_NOTLOADED_GRAY, 0, nullptr }, // 45
 +	{ SKINICON_OTHER_FRAME,           LPGEN("Frames"),                -IDI_FRAME,          0, nullptr }, // 46
 +	{ SKINICON_OTHER_GROUPADD,        LPGEN("Add group"),             -IDI_ADDGROUP,       0, nullptr }, // 47
 +	{ SKINICON_AUTH_ADD,              LPGEN("Add to list"),           -IDI_AUTH_ADD,       0, nullptr }, // 48
 +	{ SKINICON_AUTH_REQUEST,          LPGEN("Request authorization"), -IDI_AUTH_REQUEST,   0, nullptr }, // 49
 +	{ SKINICON_AUTH_GRANT,            LPGEN("Grant authorization"),   -IDI_AUTH_GRANT,     0, nullptr }, // 50
 +	{ SKINICON_AUTH_REVOKE,           LPGEN("Revoke authorization"),  -IDI_AUTH_REVOKE,    0, nullptr }, // 51
 +	{ SKINICON_FATAL,                 LPGEN("Fatal error"),           -IDI_MFATAL,         0, nullptr }, // 52
 +	{ SKINICON_ERROR,                 LPGEN("Error"),                 -IDI_MERROR,         0, nullptr }, // 53
 +	{ SKINICON_WARNING,               LPGEN("Warning"),               -IDI_MWARNING,       0, nullptr }, // 54
 +	{ SKINICON_INFORMATION,           LPGEN("Information"),           -IDI_MINFO,          0, nullptr }, // 55
  	{ SKINICON_OTHER_VISIBLE_ALL,     LPGEN("Always visible"),        -IDI_ALWAYSVIS,     0, LPGEN("Contact list") },
  	{ SKINICON_OTHER_INVISIBLE_ALL,   LPGEN("Always invisible"),      -IDI_NEVERVIS,      0, LPGEN("Contact list") },
 @@ -280,7 +280,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)  			wchar_t tszSection[MAX_PATH];
  			mir_snwprintf(tszSection, _T(PROTOCOLS_PREFIX)L"/%s", pa->tszAccountName);
 -			SKINICONDESC sid = { 0 };
 +			SKINICONDESC sid = {};
  			sid.section.w = tszSection;
  			sid.flags = SIDF_ALL_UNICODE;
 @@ -383,7 +383,7 @@ int LoadSkinIcons(void)  	GetModuleFileName(g_hInst, modulePath, _countof(modulePath));
  	char iconName[MAX_PATH];
 -	SKINICONDESC sid = { 0 };
 +	SKINICONDESC sid = {};
  	sid.defaultFile.w = modulePath;
  	sid.flags = SIDF_PATH_UNICODE;
  	sid.pszName = iconName;
 diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 41b854e354..c77f68bfd4 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -81,11 +81,11 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si  }  CSrmmBaseDialog::CSrmmBaseDialog(const CSrmmBaseDialog&) : -	CDlgBase(0, 0), -	m_btnColor(0, 0), m_btnBkColor(0, 0), -	m_btnBold(0, 0), m_btnItalic(0, 0), m_btnUnderline(0, 0), -	m_btnFilter(0, 0), m_btnChannelMgr(0, 0), m_btnHistory(0, 0), m_btnNickList(0, 0), -	m_nickList(0, 0), m_log(0, 0), m_message(0, 0) +	CDlgBase(nullptr, 0), +	m_btnColor(nullptr, 0), m_btnBkColor(nullptr, 0), +	m_btnBold(nullptr, 0), m_btnItalic(nullptr, 0), m_btnUnderline(nullptr, 0), +	m_btnFilter(nullptr, 0), m_btnChannelMgr(nullptr, 0), m_btnHistory(nullptr, 0), m_btnNickList(nullptr, 0), +	m_nickList(nullptr, 0), m_log(nullptr, 0), m_message(nullptr, 0)  {  } diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 9d05d9c202..82758f7478 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -435,7 +435,7 @@ MIR_APP_DLL(void) Srmm_RedrawToolbarIcons(HWND hwndDlg)  		CustomButtonData *cbd = arButtonsList[i];  		HWND hwnd = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);  		if (hwnd) -			InvalidateRect(hwnd, 0, TRUE); +			InvalidateRect(hwnd, nullptr, TRUE);  	}  } @@ -852,10 +852,10 @@ void LoadSrmmToolbarModule()  	hHookButtonPressedEvt = CreateHookableEvent(ME_MSG_BUTTONPRESSED);  	hHookToolBarLoadedEvt = CreateHookableEvent(ME_MSG_TOOLBARLOADED); -	HDC hScrnDC = GetDC(0); +	HDC hScrnDC = GetDC(nullptr);  	g_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0;  	g_DPIscaleY = GetDeviceCaps(hScrnDC, LOGPIXELSY) / 96.0; -	ReleaseDC(0, hScrnDC); +	ReleaseDC(nullptr, hScrnDC);  	// old data? convert them  	if (db_get_dw(0, "Tab" MODULENAME, "SeparatorsCount", -1) != -1) { diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp index 7048ad65b6..26add898ee 100644 --- a/src/mir_app/src/xmlParser.cpp +++ b/src/mir_app/src/xmlParser.cpp @@ -2100,7 +2100,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma  		case eNodeChild:  			{  				// Recursively add child nodes -				nResult += CreateXMLStringR(pEntry->pChild[j>>2].d, lpszMarker ? lpszMarker + nResult : 0, nChildFormat); +				nResult += CreateXMLStringR(pEntry->pChild[j>>2].d, lpszMarker ? lpszMarker + nResult : nullptr, nChildFormat);  				break;  			}  		default: break; @@ -2178,7 +2178,7 @@ XMLSTR XMLNode::createXMLString(int nFormat, int *pnSize) const  	// Recursively Calculate the size of the XML string  	if (!dropWhiteSpace) nFormat = 0;  	nFormat = nFormat ? 0 : -1; -	cbStr = CreateXMLStringR(d, 0, nFormat); +	cbStr = CreateXMLStringR(d, nullptr, nFormat);  	// Alllocate memory for the XML string + the nullptr terminator and  	// create the recursively XML string.  	lpszResult = (XMLSTR)malloc((cbStr+1)*sizeof(XMLCHAR)); diff --git a/src/mir_core/src/CCtrlTreeView.cpp b/src/mir_core/src/CCtrlTreeView.cpp index 1144bd2864..24a80d35d7 100644 --- a/src/mir_core/src/CCtrlTreeView.cpp +++ b/src/mir_core/src/CCtrlTreeView.cpp @@ -62,7 +62,7 @@ HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter,  		return hItem;  	wchar_t name[128]; -	TVINSERTSTRUCT tvis = { 0 }; +	TVINSERTSTRUCT tvis = {};  	tvis.itemex.mask = (UINT)-1;  	tvis.itemex.pszText = name;  	tvis.itemex.cchTextMax = _countof(name); @@ -319,7 +319,7 @@ void CCtrlTreeView::TranslateTree()  	while (hItem) {  		TranslateItem(hItem); -		HTREEITEM hItemTmp = 0; +		HTREEITEM hItemTmp = nullptr;  		if (hItemTmp = GetChild(hItem))  			hItem = hItemTmp;  		else if (hItemTmp = GetNextSibling(hItem)) diff --git a/src/mir_core/src/CDbLink.cpp b/src/mir_core/src/CDbLink.cpp index cd276eccd7..a428d1e9e6 100644 --- a/src/mir_core/src/CDbLink.cpp +++ b/src/mir_core/src/CDbLink.cpp @@ -31,7 +31,7 @@ CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, DWORD i  	m_szModule = mir_strdup(szModule);
  	m_szSetting = mir_strdup(szSetting);
  	m_iDefault = iValue;
 -	m_szDefault = 0;
 +	m_szDefault = nullptr;
  	dbv.type = DBVT_DELETED;
  }
 diff --git a/src/mir_core/src/binbuffer.cpp b/src/mir_core/src/binbuffer.cpp index a418a4326c..29cc6b636a 100644 --- a/src/mir_core/src/binbuffer.cpp +++ b/src/mir_core/src/binbuffer.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.  #include "stdafx.h"  MBinBuffer::MBinBuffer() : -	m_buf(NULL), +	m_buf(nullptr),  	m_len(0)  {  } @@ -30,7 +30,7 @@ MBinBuffer::~MBinBuffer()  void MBinBuffer::append(void *pBuf, size_t bufLen)  { -	if (pBuf == NULL || bufLen == 0) +	if (pBuf == nullptr || bufLen == 0)  		return;  	m_buf = (char*)mir_realloc(m_buf, bufLen + m_len); @@ -43,7 +43,7 @@ void MBinBuffer::append(void *pBuf, size_t bufLen)  void MBinBuffer::appendBefore(void *pBuf, size_t bufLen)  { -	if (pBuf == NULL || bufLen == 0) +	if (pBuf == nullptr || bufLen == 0)  		return;  	m_buf = (char*)mir_realloc(m_buf, bufLen + m_len); @@ -62,7 +62,7 @@ void MBinBuffer::remove(size_t sz)  	if (m_len == sz) {  		m_len = 0; -		mir_free(m_buf); m_buf = NULL; +		mir_free(m_buf); m_buf = nullptr;  	}  	else {  		memmove(m_buf, m_buf + sz, m_len - sz); diff --git a/src/mir_core/src/bitmaps.cpp b/src/mir_core/src/bitmaps.cpp index 6d0084628e..2269af1ee0 100644 --- a/src/mir_core/src/bitmaps.cpp +++ b/src/mir_core/src/bitmaps.cpp @@ -32,14 +32,14 @@ MIR_CORE_DLL(HBITMAP) Bitmap_Load(const wchar_t *ptszFileName)  		wcsncpy_s(szFilename, ptszFileName, _TRUNCATE);
  	if (!ServiceExists(MS_IMG_LOAD))
 -		return NULL;
 +		return nullptr;
  	return (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFilename, IMGL_WCHAR);
  }
  MIR_CORE_DLL(void) Bitmap_GetFilter(wchar_t *dest, size_t destLen)
  {
 -	if (dest == NULL)
 +	if (dest == nullptr)
  		return;
  	mir_snwprintf(dest, destLen,
 diff --git a/src/mir_core/src/cmdline.cpp b/src/mir_core/src/cmdline.cpp index 61570068ef..d03c5b36ef 100644 --- a/src/mir_core/src/cmdline.cpp +++ b/src/mir_core/src/cmdline.cpp @@ -60,7 +60,7 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine)  		else continue;  // skip a text that isn't an option
  		wchar_t *pOptionName = p+1;
 -		if ((p = wcspbrk(pOptionName, L" \t=:")) == NULL) { // no more text in string
 +		if ((p = wcspbrk(pOptionName, L" \t=:")) == nullptr) { // no more text in string
  			arParams.insert(new CmdLineParam(pOptionName, L""));
  			break;
  		}
 @@ -74,7 +74,7 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine)  		// parameter with value
  		*p = 0;
  		arParams.insert(new CmdLineParam(pOptionName, ++p));
 -		if ((p = wcspbrk(p, L" \t")) == NULL) // no more text in string
 +		if ((p = wcspbrk(p, L" \t")) == nullptr) // no more text in string
  			break;
  		p--; // the cycle will wipe this space automatically
 @@ -83,7 +83,7 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine)  MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(const wchar_t* ptszParameter)
  {
 -	CmdLineParam tmp(ptszParameter, 0);
 +	CmdLineParam tmp(ptszParameter, nullptr);
  	int idx = arParams.getIndex(&tmp);
 -	return (idx == -1) ? NULL : arParams[idx].value;
 +	return (idx == -1) ? nullptr : arParams[idx].value;
  }
 diff --git a/src/mir_core/src/colourpicker.cpp b/src/mir_core/src/colourpicker.cpp index a202c58630..d0041aa116 100644 --- a/src/mir_core/src/colourpicker.cpp +++ b/src/mir_core/src/colourpicker.cpp @@ -41,7 +41,7 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wPar  	case CPM_SETCOLOUR:
  		SetWindowLongPtr(hwnd, 0, lParam);
 -		InvalidateRect(hwnd, NULL, FALSE);
 +		InvalidateRect(hwnd, nullptr, FALSE);
  		break;
  	case CPM_GETCOLOUR:
 @@ -62,13 +62,13 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wPar  			if (ChooseColor(&cc)) {
  				SetWindowLongPtr(hwnd, 0, cc.rgbResult);
  				SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), CPN_COLOURCHANGED), (LPARAM)hwnd);
 -				InvalidateRect(hwnd, NULL, FALSE);
 +				InvalidateRect(hwnd, nullptr, FALSE);
  			}
  		}
  		break;
  	case WM_ENABLE:
 -		InvalidateRect(hwnd, NULL, FALSE);
 +		InvalidateRect(hwnd, nullptr, FALSE);
  		break;
  	case WM_NCPAINT:
 diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 9afe8177f1..ccd0cd1e9d 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "stdafx.h"
 -MIDatabase *currDb = NULL;
 +MIDatabase *currDb = nullptr;
  /////////////////////////////////////////////////////////////////////////////////////////
  // database functions
 @@ -70,7 +70,7 @@ MIR_CORE_DLL(int) db_delete_module(MCONTACT hContact, const char *szModuleName)  MIR_CORE_DLL(MCONTACT) db_add_contact(void)
  {
  	MCONTACT hNew = (currDb) ? currDb->AddContact() : 0;
 -	Netlib_Logf(NULL, "New contact created: %d", hNew);
 +	Netlib_Logf(nullptr, "New contact created: %d", hNew);
  	return hNew;
  }
 @@ -80,7 +80,7 @@ MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact)  	if (wszPhoto != NULL)
  		DeleteFile(wszPhoto);
 -	Netlib_Logf(NULL, "Contact deleted: %d", hContact);
 +	Netlib_Logf(nullptr, "Contact deleted: %d", hContact);
  	return (currDb) ? currDb->DeleteContact(hContact) : 0;
  }
 @@ -112,7 +112,7 @@ EXTERN_C MIR_CORE_DLL(int) db_enum_settings(MCONTACT hContact, DBSETTINGENUMPROC  MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue)
  {
 -	if (currDb != NULL) {
 +	if (currDb != nullptr) {
  		DBVARIANT dbv;
  		if (!currDb->GetContactSetting(hContact, szModule, szSetting, &dbv))
  		{
 @@ -129,7 +129,7 @@ MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, const char *szModule, const char *  MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue)
  {
 -	if (currDb != NULL) {
 +	if (currDb != nullptr) {
  		DBVARIANT dbv;
  		if (!currDb->GetContactSetting(hContact, szModule, szSetting, &dbv)) {
  			switch(dbv.type) {
 @@ -145,7 +145,7 @@ MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, const char *szModule, const char *  MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, const char *szModule, const char *szSetting, DWORD errorValue)
  {
 -	if (currDb != NULL) {
 +	if (currDb != nullptr) {
  		DBVARIANT dbv;
  		if (!currDb->GetContactSetting(hContact, szModule, szSetting, &dbv)) {
  			switch(dbv.type) {
 @@ -162,7 +162,7 @@ MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, const char *szModule, const cha  MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
  {
 -	if (currDb == NULL)
 +	if (currDb == nullptr)
  		return 1;
  	return currDb->GetContactSetting(hContact, szModule, szSetting, dbv);
 @@ -170,7 +170,7 @@ MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, const char *szModule, const char  MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType)
  {
 -	if (currDb == NULL)
 +	if (currDb == nullptr)
  		return 1;
  	dbv->type = (BYTE)nType;
 @@ -179,20 +179,20 @@ MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const ch  MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, const char *szModule, const char *szSetting)
  {
 -	if (currDb == NULL)
 -		return NULL;
 +	if (currDb == nullptr)
 +		return nullptr;
  	DBVARIANT dbv = { DBVT_ASCIIZ };
 -	return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? NULL : dbv.pszVal;
 +	return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? nullptr : dbv.pszVal;
  }
  MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const char *szSetting)
  {
 -	if (currDb == NULL)
 -		return NULL;
 +	if (currDb == nullptr)
 +		return nullptr;
  	DBVARIANT dbv = { DBVT_WCHAR };
 -	return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? NULL : dbv.pwszVal;
 +	return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? nullptr : dbv.pwszVal;
  }
  /////////////////////////////////////////////////////////////////////////////////////////
 @@ -200,7 +200,7 @@ MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const  MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest)
  {
 -	if (currDb == NULL)
 +	if (currDb == nullptr)
  		return 1;
  	DBVARIANT dbv;
 @@ -212,7 +212,7 @@ MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, const char *szModule, const c  MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest)
  {
 -	if (currDb == NULL)
 +	if (currDb == nullptr)
  		return 1;
  	DBVARIANT dbv;
 @@ -224,7 +224,7 @@ MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, const char *szModule, con  MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, const char *szModule, const char *szSetting, WCHAR *pDest, int cbDest)
  {
 -	if (currDb == NULL)
 +	if (currDb == nullptr)
  		return 1;
  	DBVARIANT dbv;
 @@ -239,7 +239,7 @@ MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, const char *szModule, const  MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
 @@ -250,7 +250,7 @@ MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, const char *szModule, const char  MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, const char *szModule, const char *szSetting, BYTE val)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
 @@ -262,7 +262,7 @@ MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, const char *szModule, const ch  MIR_CORE_DLL(INT_PTR) db_set_w(MCONTACT hContact, const char *szModule, const char *szSetting, WORD val)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
 @@ -274,7 +274,7 @@ MIR_CORE_DLL(INT_PTR) db_set_w(MCONTACT hContact, const char *szModule, const ch  MIR_CORE_DLL(INT_PTR) db_set_dw(MCONTACT hContact, const char *szModule, const char *szSetting, DWORD val)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
 @@ -286,43 +286,43 @@ MIR_CORE_DLL(INT_PTR) db_set_dw(MCONTACT hContact, const char *szModule, const c  MIR_CORE_DLL(INT_PTR) db_set_s(MCONTACT hContact, const char *szModule, const char *szSetting, const char *val)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
  	cws.szSetting = szSetting;
  	cws.value.type = DBVT_ASCIIZ;
 -	cws.value.pszVal = (char*)(val == NULL ? "" : val);
 +	cws.value.pszVal = (char*)(val == nullptr ? "" : val);
  	return currDb->WriteContactSetting(hContact, &cws);
  }
  MIR_CORE_DLL(INT_PTR) db_set_ws(MCONTACT hContact, const char *szModule, const char *szSetting, const WCHAR *val)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
  	cws.szSetting = szSetting;
  	cws.value.type = DBVT_WCHAR;
 -	cws.value.pwszVal = (WCHAR*)(val == NULL ? L"" : val);
 +	cws.value.pwszVal = (WCHAR*)(val == nullptr ? L"" : val);
  	return currDb->WriteContactSetting(hContact, &cws);
  }
  MIR_CORE_DLL(INT_PTR) db_set_utf(MCONTACT hContact, const char *szModule, const char *szSetting, const char *val)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
  	cws.szSetting = szSetting;
  	cws.value.type = DBVT_UTF8;
 -	cws.value.pszVal = (char*)(val == NULL ? "" : val);
 +	cws.value.pszVal = (char*)(val == nullptr ? "" : val);
  	return currDb->WriteContactSetting(hContact, &cws);
  }
  MIR_CORE_DLL(INT_PTR) db_set_blob(MCONTACT hContact, const char *szModule, const char *szSetting, void *val, unsigned len)
  {
 -	if (currDb == NULL) return 1;
 +	if (currDb == nullptr) return 1;
  	DBCONTACTWRITESETTING cws;
  	cws.szModule = szModule;
 @@ -338,62 +338,62 @@ MIR_CORE_DLL(INT_PTR) db_set_blob(MCONTACT hContact, const char *szModule, const  MIR_CORE_DLL(MEVENT) db_event_add(MCONTACT hContact, DBEVENTINFO *dbei)
  {
 -	return (currDb == NULL) ? 0 : currDb->AddEvent(hContact, dbei);
 +	return (currDb == nullptr) ? 0 : currDb->AddEvent(hContact, dbei);
  }
  MIR_CORE_DLL(int) db_event_count(MCONTACT hContact)
  {
 -	return (currDb == NULL) ? 0 : currDb->GetEventCount(hContact);
 +	return (currDb == nullptr) ? 0 : currDb->GetEventCount(hContact);
  }
  MIR_CORE_DLL(int) db_event_delete(MCONTACT hContact, MEVENT hDbEvent)
  {
 -	return (currDb == NULL) ? 0 : currDb->DeleteEvent(hContact, hDbEvent);
 +	return (currDb == nullptr) ? 0 : currDb->DeleteEvent(hContact, hDbEvent);
  }
  MIR_CORE_DLL(MEVENT) db_event_first(MCONTACT hContact)
  {
 -	return (currDb == NULL) ? 0 : currDb->FindFirstEvent(hContact);
 +	return (currDb == nullptr) ? 0 : currDb->FindFirstEvent(hContact);
  }
  MIR_CORE_DLL(MEVENT) db_event_firstUnread(MCONTACT hContact)
  {
 -	return (currDb == NULL) ? 0 : currDb->FindFirstUnreadEvent(hContact);
 +	return (currDb == nullptr) ? 0 : currDb->FindFirstUnreadEvent(hContact);
  }
  MIR_CORE_DLL(int) db_event_get(MEVENT hDbEvent, DBEVENTINFO *dbei)
  {
 -	return (currDb == NULL) ? 1 : currDb->GetEvent(hDbEvent, dbei);
 +	return (currDb == nullptr) ? 1 : currDb->GetEvent(hDbEvent, dbei);
  }
  MIR_CORE_DLL(int) db_event_getBlobSize(MEVENT hDbEvent)
  {
 -	return (currDb == NULL) ? 0 : currDb->GetBlobSize(hDbEvent);
 +	return (currDb == nullptr) ? 0 : currDb->GetBlobSize(hDbEvent);
  }
  MIR_CORE_DLL(MCONTACT) db_event_getContact(MEVENT hDbEvent)
  {
 -	return (currDb == NULL) ? 0 : currDb->GetEventContact(hDbEvent);
 +	return (currDb == nullptr) ? 0 : currDb->GetEventContact(hDbEvent);
  }
  MIR_CORE_DLL(MEVENT) db_event_last(MCONTACT hContact)
  {
 -	return (currDb == NULL) ? 0 : currDb->FindLastEvent(hContact);
 +	return (currDb == nullptr) ? 0 : currDb->FindLastEvent(hContact);
  }
  MIR_CORE_DLL(int) db_event_markRead(MCONTACT hContact, MEVENT hDbEvent)
  {
 -	return (currDb == NULL) ? 0 : currDb->MarkEventRead(hContact, hDbEvent);
 +	return (currDb == nullptr) ? 0 : currDb->MarkEventRead(hContact, hDbEvent);
  }
  MIR_CORE_DLL(MEVENT) db_event_next(MCONTACT hContact, MEVENT hDbEvent)
  {
 -	return (currDb == NULL) ? 0 : currDb->FindNextEvent(hContact, hDbEvent);
 +	return (currDb == nullptr) ? 0 : currDb->FindNextEvent(hContact, hDbEvent);
  }
  MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent)
  {
 -	return (currDb == NULL) ? 0 : currDb->FindPrevEvent(hContact, hDbEvent);
 +	return (currDb == nullptr) ? 0 : currDb->FindPrevEvent(hContact, hDbEvent);
  }
  /////////////////////////////////////////////////////////////////////////////////////////
 @@ -401,12 +401,12 @@ MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent)  MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv)
  {
 -	return (currDb == NULL) ? 1 : currDb->FreeVariant(dbv);
 +	return (currDb == nullptr) ? 1 : currDb->FreeVariant(dbv);
  }
  MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, const char *szModule, const char *szSetting)
  {
 -	if (currDb == NULL)
 +	if (currDb == nullptr)
  		return 1;
  	return currDb->DeleteContactSetting(hContact, szModule, szSetting);
 @@ -414,17 +414,17 @@ MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, const char *szModule, const ch  MIR_CORE_DLL(DBCachedContact*) db_get_contact(MCONTACT hContact)
  {
 -	return (currDb == NULL) ? NULL : currDb->m_cache->GetCachedContact(hContact);
 +	return (currDb == nullptr) ? nullptr : currDb->m_cache->GetCachedContact(hContact);
  }
  MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto)
  {
 -	return (currDb == NULL) ? NULL : currDb->FindFirstContact(szProto);
 +	return (currDb == nullptr) ? NULL : currDb->FindFirstContact(szProto);
  }
  MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto)
  {
 -	return (currDb == NULL) ? NULL : currDb->FindNextContact(hContact, szProto);
 +	return (currDb == nullptr) ? NULL : currDb->FindNextContact(hContact, szProto);
  }
  extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase *_db)
 @@ -441,7 +441,7 @@ extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase *_db)  MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable)
  {
 -	if (currDb == NULL || szModule == NULL || szService == NULL)
 +	if (currDb == nullptr || szModule == nullptr || szService == nullptr)
  		return FALSE;
  	char str[MAXMODULELABELLENGTH * 2];
 diff --git a/src/mir_core/src/http.cpp b/src/mir_core/src/http.cpp index 1d276f647b..3b9140c1e9 100755 --- a/src/mir_core/src/http.cpp +++ b/src/mir_core/src/http.cpp @@ -23,8 +23,8 @@ static const char szHexDigits[] = "0123456789ABCDEF";  MIR_CORE_DLL(char*) mir_urlEncode(const char *szUrl)
  {
 -	if (szUrl == NULL)
 -		return NULL;
 +	if (szUrl == nullptr)
 +		return nullptr;
  	const BYTE *s;
  	int outputLen;
 @@ -37,8 +37,8 @@ MIR_CORE_DLL(char*) mir_urlEncode(const char *szUrl)  	}
  	char *szOutput = (char*)mir_alloc(outputLen+1);
 -	if (szOutput == NULL)
 -		return NULL;
 +	if (szOutput == nullptr)
 +		return nullptr;
  	char *d = szOutput;
  	for (s = (const BYTE*)szUrl; *s; s++) {
 @@ -63,24 +63,24 @@ static char cb64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345  MIR_CORE_DLL(char*) mir_base64_encode(const BYTE *input, unsigned inputLen)
  {
 -	if (input == NULL)
 -		return NULL;
 +	if (input == nullptr)
 +		return nullptr;
  	unsigned outputLen = mir_base64_encode_bufsize(inputLen);
  	char *output = (char*)mir_alloc(outputLen);
 -	if (output == NULL)
 -		return NULL;
 +	if (output == nullptr)
 +		return nullptr;
  	return mir_base64_encodebuf(input, inputLen, output, outputLen);
  }
  MIR_CORE_DLL(char*) mir_base64_encodebuf(const BYTE *input, unsigned inputLen, char *output, unsigned outputLen)
  {
 -	if (input == NULL)
 -		return NULL;
 +	if (input == nullptr)
 +		return nullptr;
  	if (outputLen < mir_base64_encode_bufsize(inputLen))
 -		return NULL;
 +		return nullptr;
  	char *p = output;
  	for (unsigned i=0; i < inputLen; ) {
 @@ -128,8 +128,8 @@ static BYTE Base64DecodeTable[] =  MIR_CORE_DLL(void*) mir_base64_decode(const char *input, unsigned *outputLen)
  {
 -	if (input == NULL)
 -		return NULL;
 +	if (input == nullptr)
 +		return nullptr;
  	size_t length = strlen(input);
  	size_t nLength = (length / 4) * 3;
 @@ -161,7 +161,7 @@ MIR_CORE_DLL(void*) mir_base64_decode(const char *input, unsigned *outputLen)  	*p = 0;
 -	if (outputLen != NULL)
 +	if (outputLen != nullptr)
  		*outputLen = p - output;
  	return output;
 diff --git a/src/mir_core/src/hyperlink.cpp b/src/mir_core/src/hyperlink.cpp index 7e777e41ad..52766da083 100644 --- a/src/mir_core/src/hyperlink.cpp +++ b/src/mir_core/src/hyperlink.cpp @@ -55,14 +55,14 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  	switch (msg) {
  	case WM_NCCREATE:
  		dat = (struct HyperlinkWndData*)mir_calloc(sizeof(struct HyperlinkWndData));
 -		if (dat == NULL)
 +		if (dat == nullptr)
  			return FALSE; /* fail creation */
  		SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); /* always succeeds */
  		/* fall thru */
  	case WM_SYSCOLORCHANGE:
  		if (!(dat->flags&HLKF_HASENABLECOLOR)) {
 -			if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor = RGB(0, 0, 255);
 +			if (GetSysColorBrush(COLOR_HOTLIGHT) == nullptr) dat->enableColor = RGB(0, 0, 255);
  			else dat->enableColor = GetSysColor(COLOR_HOTLIGHT);
  			dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2);
  		}
 @@ -72,7 +72,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  	case WM_SETFOCUS:
  	case WM_KILLFOCUS:
 -		RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
 +		RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
  		break;
  	case WM_MOUSEACTIVATE:
 @@ -113,14 +113,14 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  		return 0;
  	case WM_SETFONT:
 -		if ((HFONT)wParam == NULL) { /* use default system color */
 -			dat->hEnableFont = dat->hDisableFont = NULL;
 +		if ((HFONT)wParam == nullptr) { /* use default system color */
 +			dat->hEnableFont = dat->hDisableFont = nullptr;
  			return 0;
  		}
  		if (GetObject((HFONT)wParam, sizeof(lf), &lf)) {
  			lf.lfUnderline = 1;
  			hFont = CreateFontIndirect(&lf);
 -			if (hFont != NULL) {
 +			if (hFont != nullptr) {
  				dat->hEnableFont = hFont;
  				dat->hDisableFont = (HFONT)wParam;
  				if (LOWORD(lParam)) SendMessage(hwnd, HLK_INVALIDATE, 0, 0);
 @@ -139,7 +139,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  			pt.y = rc.top;
  			HWND hwndParent = GetParent(hwnd);
 -			if (hwndParent == NULL)
 +			if (hwndParent == nullptr)
  				hwndParent = hwnd;
  			if (!ScreenToClient(hwndParent, &pt))
  				break;
 @@ -164,13 +164,13 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  	case WM_SETTEXT:
  		hdc = GetDC(hwnd);
 -		if (hdc == NULL)  /* text change failed */
 +		if (hdc == nullptr)  /* text change failed */
  			return 0;
  		else {
  			BOOL fMeasured = FALSE;
 -			HFONT hPrevFont = NULL;
 -			if (dat->hEnableFont != NULL) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
 -			if (dat->hEnableFont == NULL || hPrevFont != NULL) { /* select failed? */
 +			HFONT hPrevFont = nullptr;
 +			if (dat->hEnableFont != nullptr) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
 +			if (dat->hEnableFont == nullptr || hPrevFont != nullptr) { /* select failed? */
  				SIZE textSize;
  				if (GetTextExtentPoint32(hdc, (wchar_t*)lParam, (int)mir_wstrlen((wchar_t*)lParam), &textSize)) {
  					if (GetClientRect(hwnd, &rc)) {
 @@ -185,7 +185,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  					}
  				}
  			}
 -			if (dat->hEnableFont != NULL && hPrevFont != NULL)
 +			if (dat->hEnableFont != nullptr && hPrevFont != nullptr)
  				SelectObject(hdc, hPrevFont);
  			ReleaseDC(hwnd, hdc);
  			if (!fMeasured) /* text change failed */
 @@ -200,10 +200,10 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  		if (!ScreenToClient(hwnd, &pt)) return FALSE;
  		if (PtInRect(&dat->rcText, pt)) {
  			hCursor = (HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR);
 -			if (hCursor == NULL)
 -				hCursor = LoadCursor(NULL, IDC_HAND); /* Win2000+ */
 +			if (hCursor == nullptr)
 +				hCursor = LoadCursor(nullptr, IDC_HAND); /* Win2000+ */
  		}
 -		else hCursor = LoadCursor(NULL, IDC_ARROW);
 +		else hCursor = LoadCursor(nullptr, IDC_ARROW);
  		SetCursor(hCursor);
  		return TRUE;
 @@ -226,7 +226,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  	case WM_PAINT:
  		PAINTSTRUCT ps;
  		hdc = BeginPaint(hwnd, &ps);
 -		if (hdc != NULL) {
 +		if (hdc != nullptr) {
  			HFONT hPrevFont;
  			COLORREF textColor;
  			if (IsWindowEnabled(hwnd)) {
 @@ -249,13 +249,13 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  				UINT alignFlag = (GetWindowLongPtr(hwnd, GWL_STYLE) & (SS_CENTER | SS_RIGHT | SS_LEFT));
  				DrawText(hdc, szText, -1, &rc, alignFlag | DT_NOPREFIX | DT_SINGLELINE | DT_TOP);
  			}
 -			if (hPrevFont != NULL) SelectObject(hdc, hPrevFont);
 +			if (hPrevFont != nullptr) SelectObject(hdc, hPrevFont);
  			EndPaint(hwnd, &ps);
  		}
  		return 0;
  	case WM_NCDESTROY:
 -		if (dat->hEnableFont != NULL) DeleteObject(dat->hEnableFont);
 +		if (dat->hEnableFont != nullptr) DeleteObject(dat->hEnableFont);
  		mir_free(dat);
  		break;
  	}
 @@ -264,8 +264,8 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA  void InitHyperlink(void)
  {
 -	g_hCursorNS = LoadCursor(NULL, IDC_SIZENS);
 -	g_hCursorWE = LoadCursor(NULL, IDC_SIZEWE);
 +	g_hCursorNS = LoadCursor(nullptr, IDC_SIZENS);
 +	g_hCursorWE = LoadCursor(nullptr, IDC_SIZEWE);
  	WNDCLASS wcl = { 0 };
  	wcl.lpfnWndProc = HyperlinkWndProc;
 diff --git a/src/mir_core/src/icons.cpp b/src/mir_core/src/icons.cpp index 85de384d43..28fc3d8b93 100644 --- a/src/mir_core/src/icons.cpp +++ b/src/mir_core/src/icons.cpp @@ -28,7 +28,7 @@ MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconIte  	wchar_t szFile[MAX_PATH];
  	GetModuleFileName(hInst, szFile, MAX_PATH);
 -	SKINICONDESC sid = { 0 };
 +	SKINICONDESC sid = {};
  	sid.defaultFile.w = szFile;
  	sid.section.a = (char*)szSection;
  	sid.flags = SIDF_PATH_UNICODE;
 @@ -53,7 +53,7 @@ MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t *szSection, Ico  	wchar_t szFile[MAX_PATH];
  	GetModuleFileName(hInst, szFile, MAX_PATH);
 -	SKINICONDESC sid = { 0 };
 +	SKINICONDESC sid = {};
  	sid.defaultFile.w = szFile;
  	sid.section.w = (wchar_t*)szSection;
  	sid.flags = SIDF_ALL_UNICODE;
 diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp index fe02a5540b..81a4f2ea7b 100644 --- a/src/mir_core/src/langpack.cpp +++ b/src/mir_core/src/langpack.cpp @@ -34,8 +34,8 @@ static int CompareMuuids(const MUUID *p1, const MUUID *p2)  }
  static LIST<MUUID> lMuuids(10, CompareMuuids);
 -static MUUID *pCurrentMuuid = NULL;
 -static HANDLE hevChanged = 0;
 +static MUUID *pCurrentMuuid = nullptr;
 +static HANDLE hevChanged = nullptr;
  static BOOL bModuleInitialized = FALSE;
 @@ -134,7 +134,7 @@ MIR_CORE_DLL(unsigned int) mir_hash(const void * key, unsigned int len)  static unsigned int __fastcall hashstrW(const char *key)
  {
 -	if (key == NULL) return 0;
 +	if (key == nullptr) return 0;
  	const unsigned int len = (unsigned int)wcslen((const wchar_t*)key);
  	char *buf = (char*)alloca(len + 1);
  	for (unsigned i = 0; i <= len; ++i)
 @@ -203,7 +203,7 @@ static bool EnterMuuid(const char *p, MUUID &result)  static void LoadLangPackFile(FILE *fp, char *line)
  {
  	while (!feof(fp)) {
 -		if (fgets(line, LANGPACK_BUF_SIZE, fp) == NULL)
 +		if (fgets(line, LANGPACK_BUF_SIZE, fp) == nullptr)
  			break;
  		if (IsEmpty(line) || line[0] == ';' || line[0] == 0)
 @@ -257,7 +257,7 @@ static void LoadLangPackFile(FILE *fp, char *line)  		size_t cbLen = strlen(line) - 1;
  		if (cFirst == '[' && line[cbLen] == ']') {
 -			if (g_entryCount && g_pEntries[g_entryCount-1].wszLocal == NULL)
 +			if (g_entryCount && g_pEntries[g_entryCount-1].wszLocal == nullptr)
  				g_entryCount--;
  			char *pszLine = line + 1;
 @@ -269,10 +269,10 @@ static void LoadLangPackFile(FILE *fp, char *line)  			LangPackEntry *E = &g_pEntries[g_entryCount - 1];
  			E->englishHash = mir_hashstr(pszLine);
 -			E->szLocal = NULL;
 -			E->wszLocal = NULL;
 +			E->szLocal = nullptr;
 +			E->wszLocal = nullptr;
  			E->pMuuid = pCurrentMuuid;
 -			E->pNext = NULL;
 +			E->pNext = nullptr;
  			continue;
  		}
 @@ -280,8 +280,8 @@ static void LoadLangPackFile(FILE *fp, char *line)  			continue;
  		LangPackEntry *E = &g_pEntries[g_entryCount - 1];
 -		int iNeeded = MultiByteToWideChar(CP_UTF8, 0, line, -1, 0, 0), iOldLen;
 -		if (E->wszLocal == NULL) {
 +		int iNeeded = MultiByteToWideChar(CP_UTF8, 0, line, -1, nullptr, 0), iOldLen;
 +		if (E->wszLocal == nullptr) {
  			iOldLen = 0;
  			E->wszLocal = (wchar_t *)mir_alloc((iNeeded + 1) * sizeof(wchar_t));
  			MultiByteToWideChar(CP_UTF8, 0, line, -1, E->wszLocal, iNeeded);
 @@ -315,7 +315,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start  	// headers
  	while (!feof(fp)) {
  		startOfLine = ftell(fp);
 -		if (fgets(line, LANGPACK_BUF_SIZE, fp) == NULL)
 +		if (fgets(line, LANGPACK_BUF_SIZE, fp) == nullptr)
  			break;
  		lrtrim(line);
 @@ -326,7 +326,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start  			break;
  		char *pszColon = strchr(line, ':');
 -		if (pszColon == NULL)
 +		if (pszColon == nullptr)
  			return 3;
  		*pszColon++ = 0;
 @@ -365,16 +365,16 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start  	if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, _countof(lpinfo.tszLanguage))) {
  		wchar_t *p = wcschr(lpinfo.tszFileName, '_');
 -		wcsncpy_s(lpinfo.tszLanguage, ((p != NULL) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE);
 +		wcsncpy_s(lpinfo.tszLanguage, ((p != nullptr) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE);
  		p = wcsrchr(lpinfo.tszLanguage, '.');
 -		if (p != NULL) *p = '\0';
 +		if (p != nullptr) *p = '\0';
  	}
  	return 0;
  }
  MIR_CORE_DLL(int) LoadLangPack(const wchar_t *ptszLangPack)
  {
 -	if (ptszLangPack == NULL || !mir_wstrcmpi(ptszLangPack, L""))
 +	if (ptszLangPack == nullptr || !mir_wstrcmpi(ptszLangPack, L""))
  		return 1;
  	// ensure that a lang's name is a full file name
 @@ -400,11 +400,11 @@ MIR_CORE_DLL(int) LoadLangPack(const wchar_t *ptszLangPack)  	// copy the full file name and extract a file name from it
  	wcsncpy_s(langPack.tszFullPath, tszFullPath, _TRUNCATE);
  	wchar_t *p = wcsrchr(langPack.tszFullPath, '\\');
 -	wcsncpy_s(langPack.tszFileName, (p == NULL) ? tszFullPath : p + 1, _TRUNCATE);
 +	wcsncpy_s(langPack.tszFileName, (p == nullptr) ? tszFullPath : p + 1, _TRUNCATE);
  	CharLower(langPack.tszFileName);
  	FILE *fp = _wfopen(tszFullPath, L"rt");
 -	if (fp == NULL)
 +	if (fp == nullptr)
  		return 1;
  	char line[LANGPACK_BUF_SIZE] = "";
 @@ -419,7 +419,7 @@ MIR_CORE_DLL(int) LoadLangPack(const wchar_t *ptszLangPack)  	LoadLangPackFile(fp, line);
  	fclose(fp);
 -	pCurrentMuuid = NULL;
 +	pCurrentMuuid = nullptr;
  	qsort(g_pEntries, g_entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc);
  	return 0;
 @@ -427,16 +427,16 @@ MIR_CORE_DLL(int) LoadLangPack(const wchar_t *ptszLangPack)  MIR_CORE_DLL(int) LoadLangPackDescr(const wchar_t *ptszLangPack, LANGPACK_INFO *lpInfo)
  {
 -	if (lpInfo == NULL)
 +	if (lpInfo == nullptr)
  		return 1;
  	wcsncpy_s(lpInfo->tszFullPath, ptszLangPack, _TRUNCATE);
  	wchar_t *p = wcsrchr(lpInfo->tszFullPath, '\\');
 -	wcsncpy_s(lpInfo->tszFileName, (p == NULL) ? ptszLangPack : p+1, _TRUNCATE);
 +	wcsncpy_s(lpInfo->tszFileName, (p == nullptr) ? ptszLangPack : p+1, _TRUNCATE);
  	CharLower(lpInfo->tszFileName);
  	FILE *fp = _wfopen(ptszLangPack, L"rt");
 -	if (fp == NULL)
 +	if (fp == nullptr)
  		return 1;
  	char line[LANGPACK_BUF_SIZE] = "";
 @@ -457,18 +457,18 @@ static int SortLangPackHashesProc2(LangPackEntry *arg1, LangPackEntry *arg2)  char* LangPackTranslateString(MUUID *pUuid, const char *szEnglish, const int W)
  {
 -	if (g_entryCount == 0 || szEnglish == NULL)
 +	if (g_entryCount == 0 || szEnglish == nullptr)
  		return (char*)szEnglish;
  	LangPackEntry key, *entry;
  	key.englishHash = W ? hashstrW(szEnglish) : mir_hashstr(szEnglish);
  	entry = (LangPackEntry*)bsearch(&key, g_pEntries, g_entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc2);
 -	if (entry == NULL)
 +	if (entry == nullptr)
  		return (char*)szEnglish;
  	// try to find the exact match, otherwise the first entry will be returned
  	if (pUuid) {
 -		for (LangPackEntry *p = entry->pNext; p != NULL; p = p->pNext) {
 +		for (LangPackEntry *p = entry->pNext; p != nullptr; p = p->pNext) {
  			if (p->pMuuid == pUuid) {
  				entry = p;
  				break;
 @@ -479,7 +479,7 @@ char* LangPackTranslateString(MUUID *pUuid, const char *szEnglish, const int W)  	if (W)
  		return (char*)entry->wszLocal;
 -	if (entry->szLocal == NULL && entry->wszLocal != NULL)
 +	if (entry->szLocal == nullptr && entry->wszLocal != nullptr)
  		entry->szLocal = mir_u2a_cp(entry->wszLocal, langPack.codepage);
  	return entry->szLocal;
  }
 @@ -496,8 +496,8 @@ MIR_CORE_DLL(int) Langpack_GetDefaultLocale()  MIR_CORE_DLL(wchar_t*) Langpack_PcharToTchar(const char *pszStr)
  {
 -	if (pszStr == NULL)
 -		return NULL;
 +	if (pszStr == nullptr)
 +		return nullptr;
  	int len = (int)strlen(pszStr);
  	wchar_t *result = (wchar_t*)alloca((len + 1)*sizeof(wchar_t));
 @@ -541,7 +541,7 @@ MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int _hLangpack)  			}
  		}
 -		if (mii.hSubMenu != NULL)
 +		if (mii.hSubMenu != nullptr)
  			TranslateMenu_LP(mii.hSubMenu, _hLangpack);
  	}
  }
 @@ -583,7 +583,7 @@ MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int _hLangpack)  MIR_CORE_DLL(MUUID*) Langpack_LookupUuid(WPARAM wParam)
  {
  	int idx = (wParam >> 16) & 0xFFFF;
 -	return (idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[idx - 1] : NULL;
 +	return (idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[idx - 1] : nullptr;
  }
  MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX *pInfo)
 @@ -693,7 +693,7 @@ MIR_CORE_DLL(void) mir_getLP(const PLUGININFOEX *pInfo, int *_hLang)  MIR_CORE_DLL(void) ReloadLangpack(wchar_t *pszStr)
  {
 -	if (pszStr == NULL)
 +	if (pszStr == nullptr)
  		pszStr = NEWWSTR_ALLOCA(langPack.tszFileName);
  	UnloadLangPackModule();
 @@ -731,8 +731,8 @@ void UnloadLangPackModule()  	LangPackEntry *p = g_pEntries;
  	for (i = 0; i < g_entryCount; i++, p++) {
 -		if (p->pNext != NULL) {
 -			for (LangPackEntry *p1 = p->pNext; p1 != NULL;) {
 +		if (p->pNext != nullptr) {
 +			for (LangPackEntry *p1 = p->pNext; p1 != nullptr;) {
  				LangPackEntry *p2 = p1; p1 = p1->pNext;
  				mir_free(p2->szLocal);
  				mir_free(p2->wszLocal);
 @@ -746,7 +746,7 @@ void UnloadLangPackModule()  	if (g_entryCount) {
  		mir_free(g_pEntries);
 -		g_pEntries = 0;
 +		g_pEntries = nullptr;
  		g_entryCount = g_entriesAlloced = 0;
  	}
 diff --git a/src/mir_core/src/lists.cpp b/src/mir_core/src/lists.cpp index 431da56081..310b53f4ae 100644 --- a/src/mir_core/src/lists.cpp +++ b/src/mir_core/src/lists.cpp @@ -29,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  MIR_CORE_DLL(SortedList*) List_Create(int p_limit, int p_increment)
  {
  	SortedList* result = (SortedList*)mir_calloc(sizeof(SortedList));
 -	if (result == NULL)
 -		return(NULL);
 +	if (result == nullptr)
 +		return(nullptr);
  	result->increment = p_increment;
  	result->limit = p_limit;
 @@ -39,12 +39,12 @@ MIR_CORE_DLL(SortedList*) List_Create(int p_limit, int p_increment)  MIR_CORE_DLL(void) List_Destroy(SortedList* p_list)
  {
 -	if (p_list == NULL)
 +	if (p_list == nullptr)
  		return;
 -	if (p_list->items != NULL) {
 +	if (p_list->items != nullptr) {
  		mir_free(p_list->items);
 -		p_list->items = NULL;
 +		p_list->items = nullptr;
  	}
  	p_list->realCount = p_list->limit = 0;
 @@ -54,7 +54,7 @@ MIR_CORE_DLL(void*) List_Find(SortedList* p_list, void* p_value)  {
  	int idx;
  	if (!List_GetIndex(p_list, p_value, &idx))
 -		return NULL;
 +		return nullptr;
  	return p_list->items[idx];
  }
 @@ -65,7 +65,7 @@ MIR_CORE_DLL(void*) List_Find(SortedList* p_list, void* p_value)  MIR_CORE_DLL(int) List_GetIndex(SortedList* p_list, void* p_value, int* p_index)
  {
 -	if (p_value == NULL || p_list->sortFunc == NULL) {
 +	if (p_value == nullptr || p_list->sortFunc == nullptr) {
  		*p_index = -1;
  		return 0;
  	}
 @@ -155,7 +155,7 @@ MIR_CORE_DLL(int) List_GetIndex(SortedList* p_list, void* p_value, int* p_index)  MIR_CORE_DLL(int) List_IndexOf(SortedList* p_list, void* p_value)
  {
 -	if (p_value == NULL)
 +	if (p_value == nullptr)
  		return -1;
  	for (int i = 0; i < p_list->realCount; i++)
 @@ -171,7 +171,7 @@ MIR_CORE_DLL(int) List_IndexOf(SortedList* p_list, void* p_value)  MIR_CORE_DLL(int) List_Insert(SortedList* p_list, void* p_value, int p_index)
  {
 -	if (p_value == NULL || p_index > p_list->realCount)
 +	if (p_value == nullptr || p_index > p_list->realCount)
  		return 0;
  	if (p_list->realCount == p_list->limit) {
 @@ -190,11 +190,11 @@ MIR_CORE_DLL(int) List_Insert(SortedList* p_list, void* p_value, int p_index)  MIR_CORE_DLL(int) List_InsertPtr(SortedList* list, void* p)
  {
 -	if (p == NULL)
 +	if (p == nullptr)
  		return -1;
  	int idx;
 -	if (list->sortFunc == 0)
 +	if (list->sortFunc == nullptr)
  		idx = list->realCount;
  	else
  		List_GetIndex(list, p, &idx);
 @@ -209,7 +209,7 @@ MIR_CORE_DLL(int) List_Remove(SortedList* p_list, int index)  	p_list->realCount--;
  	if (p_list->realCount > index) {
  		memmove(p_list->items + index, p_list->items + index + 1, sizeof(void*)*(p_list->realCount - index));
 -		p_list->items[p_list->realCount] = NULL;
 +		p_list->items[p_list->realCount] = nullptr;
  	}
  	return 1;
 diff --git a/src/mir_core/src/logger.cpp b/src/mir_core/src/logger.cpp index 561d34f1f1..0b5d858fc3 100644 --- a/src/mir_core/src/logger.cpp +++ b/src/mir_core/src/logger.cpp @@ -34,7 +34,7 @@ struct Logger  		m_fileName(mir_wstrdup(ptszFilename)),
  		m_options(options),
  		m_signature(SECRET_SIGNATURE),
 -		m_out(NULL),
 +		m_out(nullptr),
  		m_lastwrite(0)
  	{
  	}
 @@ -85,7 +85,7 @@ void CheckLogs()  		mir_cslock lck(p.m_cs);
  		if (p.m_out && li.QuadPart - p.m_lastwrite > llIdlePeriod) {
  			fclose(p.m_out);
 -			p.m_out = NULL;
 +			p.m_out = nullptr;
  		}
  		else fflush(p.m_out);
  	}
 @@ -95,12 +95,12 @@ void CheckLogs()  MIR_CORE_DLL(HANDLE) mir_createLog(const char* pszName, const wchar_t *ptszDescr, const wchar_t *ptszFile, unsigned options)
  {
 -	if (ptszFile == NULL)
 -		return NULL;
 +	if (ptszFile == nullptr)
 +		return nullptr;
  	Logger *result = new Logger(pszName, ptszDescr, ptszFile, options);
 -	if (result == NULL)
 -		return NULL;
 +	if (result == nullptr)
 +		return nullptr;
  	int idx = arLoggers.getIndex(result);
  	if (idx != -1) {
 @@ -109,7 +109,7 @@ MIR_CORE_DLL(HANDLE) mir_createLog(const char* pszName, const wchar_t *ptszDescr  	}
  	FILE *fp = _wfopen(ptszFile, L"ab");
 -	if (fp == NULL) {
 +	if (fp == nullptr) {
  		wchar_t tszPath[MAX_PATH];
  		wcsncpy_s(tszPath, ptszFile, _TRUNCATE);
  		CreatePathToFileW(tszPath);
 @@ -125,17 +125,17 @@ MIR_CORE_DLL(HANDLE) mir_createLog(const char* pszName, const wchar_t *ptszDescr  static Logger* prepareLogger(HANDLE hLogger)
  {
 -	if (hLogger == NULL)
 -		return NULL;
 +	if (hLogger == nullptr)
 +		return nullptr;
  	Logger *p = (Logger*)hLogger;
 -	return (p->m_signature == SECRET_SIGNATURE) ? p : NULL;
 +	return (p->m_signature == SECRET_SIGNATURE) ? p : nullptr;
  }
  MIR_CORE_DLL(void) mir_closeLog(HANDLE hLogger)
  {
  	Logger *p = prepareLogger(hLogger);
 -	if (p != NULL)
 +	if (p != nullptr)
  		arLoggers.remove(p);
  }
 @@ -144,12 +144,12 @@ MIR_CORE_DLL(void) mir_closeLog(HANDLE hLogger)  MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE hLogger, const char *format, ...)
  {
  	Logger *p = prepareLogger(hLogger);
 -	if (p == NULL)
 +	if (p == nullptr)
  		return 1;
  	mir_cslock lck(p->m_cs);
 -	if (p->m_out == NULL)
 -		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == NULL)
 +	if (p->m_out == nullptr)
 +		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == nullptr)
  			return 2;
  	va_list args;
 @@ -166,12 +166,12 @@ MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE hLogger, const char *format, ...)  MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE hLogger, const WCHAR *format, ...)
  {
  	Logger *p = prepareLogger(hLogger);
 -	if (p == NULL)
 +	if (p == nullptr)
  		return 1;
  	mir_cslock lck(p->m_cs);
 -	if (p->m_out == NULL)
 -		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == NULL)
 +	if (p->m_out == nullptr)
 +		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == nullptr)
  			return 2;
  	va_list args;
 @@ -190,12 +190,12 @@ MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE hLogger, const WCHAR *format, ...)  MIR_CORE_DLL(int) mir_writeLogVA(HANDLE hLogger, const char *format, va_list args)
  {
  	Logger *p = prepareLogger(hLogger);
 -	if (p == NULL)
 +	if (p == nullptr)
  		return 1;
  	mir_cslock lck(p->m_cs);
 -	if (p->m_out == NULL)
 -		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == NULL)
 +	if (p->m_out == nullptr)
 +		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == nullptr)
  			return 2;
  	vfprintf(p->m_out, format, args);
 @@ -209,12 +209,12 @@ MIR_CORE_DLL(int) mir_writeLogVA(HANDLE hLogger, const char *format, va_list arg  MIR_CORE_DLL(int) mir_writeLogVW(HANDLE hLogger, const WCHAR *format, va_list args)
  {
  	Logger *p = prepareLogger(hLogger);
 -	if (p == NULL)
 +	if (p == nullptr)
  		return 1;
  	mir_cslock lck(p->m_cs);
 -	if (p->m_out == NULL)
 -		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == NULL)
 +	if (p->m_out == nullptr)
 +		if ((p->m_out = _wfopen(p->m_fileName, L"ab")) == nullptr)
  			return 2;
  	vfwprintf(p->m_out, format, args);
 diff --git a/src/mir_core/src/mc.cpp b/src/mir_core/src/mc.cpp index 919024e1da..01c710137e 100644 --- a/src/mir_core/src/mc.cpp +++ b/src/mir_core/src/mc.cpp @@ -36,10 +36,10 @@ void InitMetaContacts()  DBCachedContact* CheckMeta(MCONTACT hMeta)
  {
  	if (!g_bEnabled)
 -		return NULL;
 +		return nullptr;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
 -	return (cc == NULL || cc->nSubs == -1) ? NULL : cc;
 +	return (cc == nullptr || cc->nSubs == -1) ? nullptr : cc;
  }
  int Meta_GetContactNumber(DBCachedContact *cc, MCONTACT hContact)
 @@ -77,25 +77,25 @@ MIR_CORE_DLL(void) db_mc_enable(BOOL bEnabled)  MIR_CORE_DLL(BOOL) db_mc_isMeta(MCONTACT hContact)
  {
 -	if (currDb == NULL || !g_bEnabled) return FALSE;
 +	if (currDb == nullptr || !g_bEnabled) return FALSE;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
 -	return (cc == NULL) ? FALSE : cc->nSubs != -1;
 +	return (cc == nullptr) ? FALSE : cc->nSubs != -1;
  }
  MIR_CORE_DLL(BOOL) db_mc_isSub(MCONTACT hContact)
  {
 -	if (currDb == NULL || !g_bEnabled) return FALSE;
 +	if (currDb == nullptr || !g_bEnabled) return FALSE;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
 -	return (cc == NULL) ? FALSE : cc->parentID != 0;
 +	return (cc == nullptr) ? FALSE : cc->parentID != 0;
  }
  //returns a handle to the default contact, or null on failure
  MIR_CORE_DLL(MCONTACT) db_mc_getDefault(MCONTACT hMetaContact)
  {
  	DBCachedContact *cc = CheckMeta(hMetaContact);
 -	if (cc == NULL)
 +	if (cc == nullptr)
  		return 0;
  	return (cc->nDefault != -1) ? Meta_GetContactHandle(cc, cc->nDefault) : 0;
 @@ -105,32 +105,32 @@ MIR_CORE_DLL(MCONTACT) db_mc_getDefault(MCONTACT hMetaContact)  MIR_CORE_DLL(int) db_mc_getDefaultNum(MCONTACT hMetaContact)
  {
  	DBCachedContact *cc = CheckMeta(hMetaContact);
 -	return (cc == NULL) ? -1 : cc->nDefault;
 +	return (cc == nullptr) ? -1 : cc->nDefault;
  }
  //returns the number of subcontacts, or -1 on failure
  MIR_CORE_DLL(int) db_mc_getSubCount(MCONTACT hMetaContact)
  {
  	DBCachedContact *cc = CheckMeta(hMetaContact);
 -	return (cc == NULL) ? -1 : cc->nSubs;
 +	return (cc == nullptr) ? -1 : cc->nSubs;
  }
  // returns parent hContact for a subcontact or NULL if it's not a sub
  MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact)
  {
 -	if (currDb == NULL) return NULL;
 +	if (currDb == nullptr) return NULL;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hSubContact);
 -	return (cc == NULL) ? NULL : cc->parentID;
 +	return (cc == nullptr) ? NULL : cc->parentID;
  }
  // returns parent hContact for a subcontact or hContact itself if it's not a sub
  MIR_CORE_DLL(MCONTACT) db_mc_tryMeta(MCONTACT hContact)
  {
 -	if (currDb == NULL) return hContact;
 +	if (currDb == nullptr) return hContact;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
 -	if (cc == NULL) return hContact;
 +	if (cc == nullptr) return hContact;
  	return (cc->IsSub()) ? cc->parentID : hContact;
  }
 @@ -139,14 +139,14 @@ MIR_CORE_DLL(MCONTACT) db_mc_tryMeta(MCONTACT hContact)  MIR_CORE_DLL(MCONTACT) db_mc_getSub(MCONTACT hMetaContact, int iNum)
  {
  	DBCachedContact *cc = CheckMeta(hMetaContact);
 -	return (cc == NULL) ? 0 : Meta_GetContactHandle(cc, iNum);
 +	return (cc == nullptr) ? 0 : Meta_GetContactHandle(cc, iNum);
  }
  //sets the default contact, using the subcontact's handle
  MIR_CORE_DLL(int) db_mc_setDefault(MCONTACT hMetaContact, MCONTACT hSub, BOOL bWriteDb)
  {
  	DBCachedContact *cc = CheckMeta(hMetaContact);
 -	if (cc == NULL)
 +	if (cc == nullptr)
  		return 1;
  	int contact_number = Meta_GetContactNumber(cc, hSub);
 @@ -167,7 +167,7 @@ MIR_CORE_DLL(int) db_mc_setDefault(MCONTACT hMetaContact, MCONTACT hSub, BOOL bW  MIR_CORE_DLL(int) db_mc_setDefaultNum(MCONTACT hMetaContact, int iNum, BOOL bWriteDb)
  {
  	DBCachedContact *cc = CheckMeta(hMetaContact);
 -	if (cc == NULL)
 +	if (cc == nullptr)
  		return 1;
  	if (iNum >= cc->nSubs || iNum < 0)
  		return 1;
 diff --git a/src/mir_core/src/md5.cpp b/src/mir_core/src/md5.cpp index 817cd68b9a..6cb8419249 100644 --- a/src/mir_core/src/md5.cpp +++ b/src/mir_core/src/md5.cpp @@ -146,7 +146,7 @@ static void md5_process(mir_md5_state_t *pms, const BYTE *data /*[64]*/)  			* On little-endian machines, we can process properly aligned
  			* data without copying it.
  			*/
 -			if ( !((data - (const BYTE *)0) & 3)) {
 +			if ( !((data - (const BYTE *)nullptr) & 3)) {
  				/* data are properly aligned */
  				X = (const UINT32 *)data;
  			} else {
 diff --git a/src/mir_core/src/memory.cpp b/src/mir_core/src/memory.cpp index 9a600a83e1..1d404ca313 100644 --- a/src/mir_core/src/memory.cpp +++ b/src/mir_core/src/memory.cpp @@ -67,15 +67,15 @@ static int CheckBlock(void* blk)  MIR_C_CORE_DLL(void*) mir_alloc(size_t size)
  {
  	if (size == 0)
 -		return NULL;
 +		return nullptr;
  	char *p = (char*)malloc(size + sizeof(DWORD)* 3);
 -	if (p == NULL) {
 +	if (p == nullptr) {
  		OutputDebugStringA("memory overflow\n");
  		#if defined(_DEBUG)
  			DebugBreak();
  		#endif
 -		return NULL;
 +		return nullptr;
  	}
  	*(DWORD*)p = (DWORD)size;
 @@ -89,7 +89,7 @@ MIR_C_CORE_DLL(void*) mir_alloc(size_t size)  MIR_C_CORE_DLL(void*) mir_calloc(size_t size)
  {
  	void* p = mir_alloc(size);
 -	if (p != NULL)
 +	if (p != nullptr)
  		memset(p, 0, size);
  	return p;
  }
 @@ -100,20 +100,20 @@ MIR_C_CORE_DLL(void*) mir_realloc(void* ptr, size_t size)  {
  	char *p;
 -	if (ptr != NULL) {
 +	if (ptr != nullptr) {
  		if (!CheckBlock(ptr))
 -			return NULL;
 +			return nullptr;
  		p = (char*)ptr - sizeof(DWORD)*2;
  	}
 -	else p = NULL;
 +	else p = nullptr;
  	p = (char*)realloc(p, size + sizeof(DWORD)*3);
 -	if (p == NULL) {
 +	if (p == nullptr) {
  		OutputDebugStringA("memory overflow\n");
  		#if defined(_DEBUG)
  			DebugBreak();
  		#endif
 -		return NULL;
 +		return nullptr;
  	}
  	*(DWORD*)p = (DWORD)size;
 @@ -129,7 +129,7 @@ MIR_C_CORE_DLL(void) mir_free(void* ptr)  	char* p;
  	DWORD size;
 -	if (ptr == NULL)
 +	if (ptr == nullptr)
  		return;
  	if (!CheckBlock(ptr))
  		return;
 @@ -146,8 +146,8 @@ MIR_C_CORE_DLL(void) mir_free(void* ptr)  MIR_CORE_DLL(char*) mir_strdup(const char *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	char *p = (char*)mir_alloc(strlen(str)+1);
  	if (p)
 @@ -157,8 +157,8 @@ MIR_CORE_DLL(char*) mir_strdup(const char *str)  MIR_CORE_DLL(WCHAR*) mir_wstrdup(const WCHAR *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	WCHAR *p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(wcslen(str)+1));
  	if (p)
 @@ -170,8 +170,8 @@ MIR_CORE_DLL(WCHAR*) mir_wstrdup(const WCHAR *str)  MIR_CORE_DLL(char*) mir_strndup(const char *str, size_t len)
  {
 -	if (str == NULL || len == 0)
 -		return NULL;
 +	if (str == nullptr || len == 0)
 +		return nullptr;
  	char *p = (char*)mir_alloc(len+1);
  	if (p) {
 @@ -183,8 +183,8 @@ MIR_CORE_DLL(char*) mir_strndup(const char *str, size_t len)  MIR_CORE_DLL(WCHAR*) mir_wstrndup(const WCHAR *str, size_t len)
  {
 -	if (str == NULL || len == 0)
 -		return NULL;
 +	if (str == nullptr || len == 0)
 +		return nullptr;
  	WCHAR *p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(len+1));
  	if (p) {
 @@ -240,13 +240,13 @@ MIR_CORE_DLL(int) mir_vsnwprintf(WCHAR *buffer, size_t count, const WCHAR* fmt,  MIR_CORE_DLL(wchar_t*) mir_a2u_cp(const char* src, int codepage)
  {
 -	if (src == NULL)
 -		return NULL;
 +	if (src == nullptr)
 +		return nullptr;
 -	int cbLen = MultiByteToWideChar(codepage, 0, src, -1, NULL, 0);
 +	int cbLen = MultiByteToWideChar(codepage, 0, src, -1, nullptr, 0);
  	wchar_t* result = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen+1));
 -	if (result == NULL)
 -		return NULL;
 +	if (result == nullptr)
 +		return nullptr;
  	MultiByteToWideChar(codepage, 0, src, -1, result, cbLen);
  	result[cbLen] = 0;
 @@ -264,15 +264,15 @@ MIR_CORE_DLL(wchar_t*) mir_a2u(const char* src)  MIR_CORE_DLL(char*) mir_u2a_cp(const wchar_t* src, int codepage)
  {
 -	if (src == NULL)
 -		return NULL;
 +	if (src == nullptr)
 +		return nullptr;
 -	int cbLen = WideCharToMultiByte(codepage, 0, src, -1, NULL, 0, NULL, NULL);
 +	int cbLen = WideCharToMultiByte(codepage, 0, src, -1, nullptr, 0, nullptr, nullptr);
  	char* result = (char*)mir_alloc(cbLen+1);
 -	if (result == NULL)
 -		return NULL;
 +	if (result == nullptr)
 +		return nullptr;
 -	WideCharToMultiByte(codepage, 0, src, -1, result, cbLen, NULL, NULL);
 +	WideCharToMultiByte(codepage, 0, src, -1, result, cbLen, nullptr, nullptr);
  	result[cbLen] = 0;
  	return result;
  }
 diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp index 28a9a99c63..79abdf9d4c 100644 --- a/src/mir_core/src/miranda.cpp +++ b/src/mir_core/src/miranda.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "stdafx.h"
 -HWND hAPCWindow = NULL;
 +HWND hAPCWindow = nullptr;
  int  InitPathUtils(void);
  void RecalculateTime(void);
 @@ -41,7 +41,7 @@ void InitTimeZones();  void InitWinver();
  int hLangpack = 0;
 -HINSTANCE g_hInst = 0;
 +HINSTANCE g_hInst = nullptr;
  HCURSOR g_hCursorNS, g_hCursorWE;
  HANDLE hStackMutex, hThreadQueueEmpty;
 @@ -55,7 +55,7 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM lParam)  	if (lParam)
  		wcsncpy_s(mirandaPath, (const wchar_t*)lParam, _TRUNCATE);
  	else
 -		GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
 +		GetModuleFileName(nullptr, mirandaPath, _countof(mirandaPath));
  	if (wParam) {
  		VARSW profilename(L"%miranda_profilename%");
 @@ -68,7 +68,7 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM lParam)  	PROCESS_INFORMATION pi;
  	STARTUPINFO startupInfo = { 0 };
  	startupInfo.cb = sizeof(startupInfo);
 -	CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &pi);
 +	CreateProcess(mirandaPath, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startupInfo, &pi);
  	return 0;
  }
 @@ -99,15 +99,15 @@ static void LoadCoreModule(void)  	icce.dwICC = ICC_WIN95_CLASSES | ICC_USEREX_CLASSES;
  	InitCommonControlsEx(&icce);
 -	hAPCWindow = CreateWindowEx(0, L"ComboLBox", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
 +	hAPCWindow = CreateWindowEx(0, L"ComboLBox", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
  	SetClassLongPtr(hAPCWindow, GCL_STYLE, GetClassLongPtr(hAPCWindow, GCL_STYLE) | CS_DROPSHADOW);
  	DestroyWindow(hAPCWindow);
 -	hAPCWindow = CreateWindowEx(0, L"STATIC", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
 +	hAPCWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
  	SetWindowLongPtr(hAPCWindow, GWLP_WNDPROC, (LONG_PTR)APCWndProc);
 -	SetTimer(hAPCWindow, 1, 1000, NULL);
 -	hStackMutex = CreateMutex(NULL, FALSE, NULL);
 -	hThreadQueueEmpty = CreateEvent(NULL, TRUE, TRUE, NULL);
 +	SetTimer(hAPCWindow, 1, 1000, nullptr);
 +	hStackMutex = CreateMutex(nullptr, FALSE, nullptr);
 +	hThreadQueueEmpty = CreateEvent(nullptr, TRUE, TRUE, nullptr);
  	InitWinver();
  	InitPathUtils();
 diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp index 34fa24fec9..d287f01319 100644 --- a/src/mir_core/src/modules.cpp +++ b/src/mir_core/src/modules.cpp @@ -84,8 +84,8 @@ static int    sttHookId = 1;  __forceinline HANDLE getThreadEvent()  {  	HANDLE pData = (HANDLE)TlsGetValue(mir_tls); -	if (pData == NULL) { -		pData = CreateEvent(NULL, FALSE, FALSE, NULL); +	if (pData == nullptr) { +		pData = CreateEvent(nullptr, FALSE, FALSE, nullptr);  		TlsSetValue(mir_tls, pData);  	}  	return pData; @@ -105,8 +105,8 @@ static int QueueMainThread(PAPCFUNC pFunc, void* pParam, HANDLE hDoneEvent)  MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name)  { -	if (name == NULL) -		return NULL; +	if (name == nullptr) +		return nullptr;  	mir_cslock lck(csHooks); @@ -118,8 +118,8 @@ MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name)  	strncpy(newItem->name, name, sizeof(newItem->name)); newItem->name[MAXMODULELABELLENGTH - 1] = 0;  	newItem->id = sttHookId++;  	newItem->subscriberCount = 0; -	newItem->subscriber = NULL; -	newItem->pfnHook = NULL; +	newItem->subscriber = nullptr; +	newItem->pfnHook = nullptr;  	newItem->secretSignature = HOOK_SECRET_SIGNATURE;  	InitializeCriticalSection(&newItem->csHook);  	hooks.insert(newItem); @@ -128,7 +128,7 @@ MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name)  MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent)  { -	if (hEvent == NULL) +	if (hEvent == nullptr)  		return 1;  	mir_cslock lck(csHooks); @@ -141,7 +141,7 @@ MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent)  	p->secretSignature = 0;  	if (p->subscriberCount) {  		mir_free(p->subscriber); -		p->subscriber = NULL; +		p->subscriber = nullptr;  		p->subscriberCount = 0;  	}  	hooks.remove(idx); @@ -163,7 +163,7 @@ MIR_CORE_DLL(int) SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnH  MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam)  {  	THook *p = (THook*)hEvent; -	if (p == NULL || hInst == NULL) +	if (p == nullptr || hInst == nullptr)  		return -1;  	mir_cslock lck(p->csHook); @@ -185,7 +185,7 @@ MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wPa  			return returnVal;  	} -	if (p->subscriberCount == 0 && p->pfnHook != 0) +	if (p->subscriberCount == 0 && p->pfnHook != nullptr)  		return p->pfnHook(wParam, lParam);  	return 0; @@ -193,7 +193,7 @@ MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wPa  static int CallHookSubscribers(THook *p, WPARAM wParam, LPARAM lParam)  { -	if (p == NULL) +	if (p == nullptr)  		return -1;  	mir_cslock lck(p->csHook); @@ -216,7 +216,7 @@ static int CallHookSubscribers(THook *p, WPARAM wParam, LPARAM lParam)  	}  	// call the default hook if any -	if (p->pfnHook != 0) +	if (p->pfnHook != nullptr)  		return p->pfnHook(wParam, lParam);  	return 0; @@ -226,14 +226,14 @@ enum { hookOk, hookEmpty, hookInvalid };  int checkHook(THook *p)  { -	if (p == NULL) +	if (p == nullptr)  		return hookInvalid;  	int ret;  	__try {  		if (p->secretSignature != HOOK_SECRET_SIGNATURE)  			ret = hookInvalid; -		else if (p->subscriberCount == 0 && p->pfnHook == NULL) +		else if (p->subscriberCount == 0 && p->pfnHook == nullptr)  			ret = hookEmpty;  		else  			ret = hookOk; @@ -297,7 +297,7 @@ static HANDLE HookEventInt(int type, const char *name, MIRANDAHOOK hookProc, voi  	int idx;  	if ((idx = hooks.getIndex((THook*)name)) == -1) -		return NULL; +		return nullptr;  	THook *p = hooks[idx];  	p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount + 1)); @@ -315,12 +315,12 @@ static HANDLE HookEventInt(int type, const char *name, MIRANDAHOOK hookProc, voi  MIR_CORE_DLL(HANDLE) HookEvent(const char *name, MIRANDAHOOK hookProc)  { -	return HookEventInt(1, name, hookProc, 0, 0); +	return HookEventInt(1, name, hookProc, nullptr, 0);  }  MIR_CORE_DLL(HANDLE) HookEventParam(const char *name, MIRANDAHOOKPARAM hookProc, LPARAM lParam)  { -	return HookEventInt(2, name, (MIRANDAHOOK)hookProc, 0, lParam); +	return HookEventInt(2, name, (MIRANDAHOOK)hookProc, nullptr, lParam);  }  MIR_CORE_DLL(HANDLE) HookEventObj(const char *name, MIRANDAHOOKOBJ hookProc, void* object) @@ -341,7 +341,7 @@ MIR_CORE_DLL(HANDLE) HookTemporaryEvent(const char *name, MIRANDAHOOK hookProc)  	if ((idx = hooks.getIndex((THook*)name)) == -1) {  		lck.unlock();  		hookProc(0, 0); -		return NULL; +		return nullptr;  	}  	THook *p = hooks[idx]; @@ -363,7 +363,7 @@ MIR_CORE_DLL(HANDLE) HookEventMessage(const char *name, HWND hwnd, UINT message)  	int idx;  	if ((idx = hooks.getIndex((THook*)name)) == -1) -		return NULL; +		return nullptr;  	THook *p = hooks[idx];  	p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount + 1)); @@ -376,7 +376,7 @@ MIR_CORE_DLL(HANDLE) HookEventMessage(const char *name, HWND hwnd, UINT message)  MIR_CORE_DLL(int) UnhookEvent(HANDLE hHook)  { -	if (hHook == NULL) +	if (hHook == nullptr)  		return 0;  	int hookId = (INT_PTR)hHook >> 16; @@ -384,27 +384,27 @@ MIR_CORE_DLL(int) UnhookEvent(HANDLE hHook)  	mir_cslock lck(csHooks); -	THook *p = NULL; +	THook *p = nullptr;  	for (int i = 0; i < hooks.getCount(); i++)  		if (hooks[i]->id == hookId) {  			p = hooks[i];  			break;  		} -	if (p == NULL) +	if (p == nullptr)  		return 1;  	if (subscriberId >= p->subscriberCount || subscriberId < 0)  		return 1;  	p->subscriber[subscriberId].type = 0; -	p->subscriber[subscriberId].pfnHook = NULL; -	p->subscriber[subscriberId].hOwner = NULL; +	p->subscriber[subscriberId].pfnHook = nullptr; +	p->subscriber[subscriberId].hOwner = nullptr;  	while (p->subscriberCount && p->subscriber[p->subscriberCount - 1].type == 0)  		p->subscriberCount--;  	if (p->subscriberCount == 0) {  		mir_free(p->subscriber); -		p->subscriber = NULL; +		p->subscriber = nullptr;  	}  	return 0;  } @@ -471,8 +471,8 @@ static __inline TService* FindServiceByName(const char *name)  static HANDLE CreateServiceInt(int type, const char *name, MIRANDASERVICE serviceProc, void* object, LPARAM lParam)  { -	if (name == NULL) -		return NULL; +	if (name == nullptr) +		return nullptr;  	TService tmp;  	tmp.nameHash = mir_hashstr(name); @@ -480,7 +480,7 @@ static HANDLE CreateServiceInt(int type, const char *name, MIRANDASERVICE servic  	mir_cslock lck(csServices);  	if (services.getIndex(&tmp) != -1) -		return NULL; +		return nullptr;  	TService* p = (TService*)mir_alloc(sizeof(*p) + strlen(name));  	strcpy(p->name, name); @@ -497,12 +497,12 @@ static HANDLE CreateServiceInt(int type, const char *name, MIRANDASERVICE servic  MIR_CORE_DLL(HANDLE) CreateServiceFunction(const char *name, MIRANDASERVICE serviceProc)  { -	return CreateServiceInt(0, name, serviceProc, 0, 0); +	return CreateServiceInt(0, name, serviceProc, nullptr, 0);  }  MIR_CORE_DLL(HANDLE) CreateServiceFunctionParam(const char *name, MIRANDASERVICEPARAM serviceProc, LPARAM lParam)  { -	return CreateServiceInt(1, name, (MIRANDASERVICE)serviceProc, 0, lParam); +	return CreateServiceInt(1, name, (MIRANDASERVICE)serviceProc, nullptr, lParam);  }  MIR_CORE_DLL(HANDLE) CreateServiceFunctionObj(const char *name, MIRANDASERVICEOBJ serviceProc, void* object) @@ -538,22 +538,22 @@ MIR_CORE_DLL(int) DestroyServiceFunction(HANDLE hService)  MIR_CORE_DLL(bool) ServiceExists(const char *name)  { -	if (name == NULL) +	if (name == nullptr)  		return FALSE;  	mir_cslock lck(csServices); -	return FindServiceByName(name) != NULL; +	return FindServiceByName(name) != nullptr;  }  MIR_CORE_DLL(INT_PTR) CallService(const char *name, WPARAM wParam, LPARAM lParam)  { -	if (name == NULL) +	if (name == nullptr)  		return CALLSERVICE_NOTFOUND;  	TService *pService;  	{  		mir_cslock lck(csServices); -		if ((pService = FindServiceByName(name)) == NULL) +		if ((pService = FindServiceByName(name)) == nullptr)  			return CALLSERVICE_NOTFOUND;  	} @@ -578,7 +578,7 @@ static void CALLBACK CallServiceToMainAPCFunc(ULONG_PTR dwParam)  MIR_CORE_DLL(INT_PTR) CallServiceSync(const char *name, WPARAM wParam, LPARAM lParam)  { -	if (name == NULL) +	if (name == nullptr)  		return CALLSERVICE_NOTFOUND;  	// the service is looked up within the main thread, since the time it takes @@ -603,7 +603,7 @@ MIR_CORE_DLL(int) CallFunctionAsync(void(__stdcall *func)(void *), void *arg)  	if (GetCurrentThreadId() == mainThreadId)  		func(arg);  	else -		QueueMainThread((PAPCFUNC)func, arg, 0); +		QueueMainThread((PAPCFUNC)func, arg, nullptr);  	return 0;  } @@ -691,7 +691,7 @@ MIR_CORE_DLL(void) UnregisterModule(HINSTANCE hInst)  MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr)  {  	if (pluginListAddr.getCount() == 0) -		return NULL; +		return nullptr;  	int idx;  	List_GetIndex((SortedList*)&pluginListAddr, codePtr, &idx); @@ -702,7 +702,7 @@ MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr)  	if (result < g_hInst && codePtr > g_hInst)  		result = g_hInst;  	else if (idx == 0 && codePtr < (void*)result) -		result = NULL; +		result = nullptr;  	return result;  } diff --git a/src/mir_core/src/mstring.cpp b/src/mir_core/src/mstring.cpp index c5b70d6e74..78d82b1648 100644 --- a/src/mir_core/src/mstring.cpp +++ b/src/mir_core/src/mstring.cpp @@ -45,7 +45,7 @@ CNilMStringData::CNilMStringData()  	achNil[1] = 0;
  }
 -static CNilMStringData *m_nil = NULL;
 +static CNilMStringData *m_nil = nullptr;
  /////////////////////////////////////////////////////////////////////////////////////////
  // CMBaseString
 @@ -57,8 +57,8 @@ MIR_CORE_DLL(CMStringData*) mirstr_allocate(int nChars, int nCharSize)  	size_t nTotalSize = nDataBytes + sizeof(CMStringData);
  	CMStringData *pData = static_cast<CMStringData*>(malloc(nTotalSize));
 -	if (pData == NULL)
 -		return NULL;
 +	if (pData == nullptr)
 +		return nullptr;
  	pData->nRefs = 1;
  	pData->nAllocLength = nChars - 1;
 @@ -78,8 +78,8 @@ MIR_CORE_DLL(CMStringData*) mirstr_realloc(CMStringData* pData, int nChars, int  	ULONG nTotalSize = nDataBytes + sizeof(CMStringData);
  	CMStringData *pNewData = static_cast<CMStringData*>(realloc(pData, nTotalSize));
 -	if (pNewData == NULL)
 -		return NULL;
 +	if (pNewData == nullptr)
 +		return nullptr;
  	pNewData->nAllocLength = nChars - 1;
  	return pNewData;
 @@ -87,7 +87,7 @@ MIR_CORE_DLL(CMStringData*) mirstr_realloc(CMStringData* pData, int nChars, int  MIR_CORE_DLL(CMStringData*) mirstr_getNil()
  {
 -	if (m_nil == NULL)
 +	if (m_nil == nullptr)
  		m_nil = new CNilMStringData();
  	m_nil->AddRef();
  	return m_nil;
 diff --git a/src/mir_core/src/openurl.cpp b/src/mir_core/src/openurl.cpp index 11b761233d..6875b77bdf 100644 --- a/src/mir_core/src/openurl.cpp +++ b/src/mir_core/src/openurl.cpp @@ -58,9 +58,9 @@ static void OpenURLThread(void *arg)  	// check user defined browser for opening urls
  	ptrW tszBrowser(db_get_wsa(NULL, "Miranda", "OpenUrlBrowser"));
  	if (tszBrowser)
 -		ShellExecute(NULL, L"open", tszBrowser, tszUrl, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
 +		ShellExecute(nullptr, L"open", tszBrowser, tszUrl, nullptr, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
  	else
 -		ShellExecute(NULL, L"open", tszUrl, NULL, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
 +		ShellExecute(nullptr, L"open", tszUrl, nullptr, nullptr, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
  	delete hUrlInfo;
  }
 diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp index 2faabd8219..6eca1f1329 100644 --- a/src/mir_core/src/path.cpp +++ b/src/mir_core/src/path.cpp @@ -45,7 +45,7 @@ MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut, const char *pBase  	if (!PathIsAbsolute(pSrc))
  		strncpy_s(pOut, MAX_PATH, pSrc, _TRUNCATE);
  	else {
 -		if (pBase == NULL)
 +		if (pBase == nullptr)
  			pBase = szMirandaPath;
  		size_t cbBaseLen = strlen(pBase);
 @@ -70,24 +70,24 @@ MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char *base)  		strncpy_s(pOut, MAX_PATH, pSrc, _TRUNCATE);
  	if (PathIsAbsolute(pSrc))
 -		return GetFullPathNameA(pSrc, MAX_PATH, pOut, NULL);
 +		return GetFullPathNameA(pSrc, MAX_PATH, pOut, nullptr);
 -	if (base == NULL)
 +	if (base == nullptr)
  		base = szMirandaPath;
  	if (pSrc[0] == '\\')
  		pSrc++;
  	mir_snprintf(buf, "%s%s", base, pSrc);
 -	return GetFullPathNameA(buf, _countof(buf), pOut, NULL);
 +	return GetFullPathNameA(buf, _countof(buf), pOut, nullptr);
  }
  MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath)
  {
 -	if (szFilePath == NULL)
 +	if (szFilePath == nullptr)
  		return;
  	char *pszLastBackslash = strrchr(szFilePath, '\\');
 -	if (pszLastBackslash == NULL)
 +	if (pszLastBackslash == nullptr)
  		return;
  	*pszLastBackslash = '\0';
 @@ -97,7 +97,7 @@ MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath)  MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir)
  {
 -	if (szDir == NULL)
 +	if (szDir == nullptr)
  		return 1;
  	char szTestDir[MAX_PATH];
 @@ -108,13 +108,13 @@ MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir)  		return 0;
  	char *pszLastBackslash = strrchr(szTestDir, '\\');
 -	if (pszLastBackslash == NULL)
 +	if (pszLastBackslash == nullptr)
  		return 0;
  	*pszLastBackslash = '\0';
  	CreateDirectoryTree(szTestDir);
  	*pszLastBackslash = '\\';
 -	return (CreateDirectoryA(szTestDir, NULL) == 0) ? GetLastError() : 0;
 +	return (CreateDirectoryA(szTestDir, nullptr) == 0) ? GetLastError() : 0;
  }
  /////////////////////////////////////////////////////////////////////////////////////////
 @@ -135,7 +135,7 @@ MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *p  	if (!PathIsAbsoluteW(pSrc))
  		wcsncpy_s(pOut, MAX_PATH, pSrc, _TRUNCATE);
  	else {
 -		if (pBase == NULL)
 +		if (pBase == nullptr)
  			pBase = szMirandaPathW;
  		size_t cbBaseLen = wcslen(pBase);
 @@ -159,25 +159,25 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *b  		return mir_snwprintf(pOut, MAX_PATH, L"%s", pSrc);
  	if (PathIsAbsoluteW(pSrc))
 -		return GetFullPathName(pSrc, MAX_PATH, pOut, NULL);
 +		return GetFullPathName(pSrc, MAX_PATH, pOut, nullptr);
 -	if (base == NULL)
 +	if (base == nullptr)
  		base = szMirandaPathW;
  	if (pSrc[0] == '\\')
  		pSrc++;
  	mir_snwprintf(buf, MAX_PATH, L"%s%s", base, pSrc);
 -	return GetFullPathName(buf, MAX_PATH, pOut, NULL);
 +	return GetFullPathName(buf, MAX_PATH, pOut, nullptr);
  }
  MIR_CORE_DLL(void) CreatePathToFileW(WCHAR *wszFilePath)
  {
 -	if (wszFilePath == NULL)
 +	if (wszFilePath == nullptr)
  		return;
  	WCHAR *pszLastBackslash = wcsrchr(wszFilePath, '\\');
 -	if (pszLastBackslash == NULL)
 +	if (pszLastBackslash == nullptr)
  		return;
  	*pszLastBackslash = '\0';
 @@ -187,7 +187,7 @@ MIR_CORE_DLL(void) CreatePathToFileW(WCHAR *wszFilePath)  MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR *szDir)
  {
 -	if (szDir == NULL)
 +	if (szDir == nullptr)
  		return 1;
  	WCHAR szTestDir[MAX_PATH];
 @@ -198,23 +198,23 @@ MIR_CORE_DLL(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;
  }
  int InitPathUtils(void)
  {
 -	GetModuleFileNameA(NULL, szMirandaPath, _countof(szMirandaPath));
 +	GetModuleFileNameA(nullptr, szMirandaPath, _countof(szMirandaPath));
  	char *p = strrchr(szMirandaPath, '\\');
  	if (p)
  		p[1] = 0;
 -	GetModuleFileNameW(NULL, szMirandaPathW, _countof(szMirandaPathW));
 +	GetModuleFileNameW(nullptr, szMirandaPathW, _countof(szMirandaPathW));
  	WCHAR *tp = wcsrchr(szMirandaPathW, '\\');
  	if (tp)
  		tp[1] = 0;
 diff --git a/src/mir_core/src/resizer.cpp b/src/mir_core/src/resizer.cpp index 2ad2e98bc5..faa3911749 100644 --- a/src/mir_core/src/resizer.cpp +++ b/src/mir_core/src/resizer.cpp @@ -143,8 +143,8 @@ MIR_CORE_DLL(int) Utils_ResizeDialog(HWND hwndDlg, HINSTANCE hInstance, LPCSTR l  		}
  		HWND hCtrl = GetDlgItem(hwndDlg, urc.wId);
 -		if (hCtrl != NULL)
 -			hDwp = DeferWindowPos(hDwp, hCtrl, 0, urc.rcItem.left, urc.rcItem.top, urc.rcItem.right - urc.rcItem.left, urc.rcItem.bottom - urc.rcItem.top, SWP_NOZORDER);
 +		if (hCtrl != nullptr)
 +			hDwp = DeferWindowPos(hDwp, hCtrl, nullptr, urc.rcItem.left, urc.rcItem.top, urc.rcItem.right - urc.rcItem.left, urc.rcItem.bottom - urc.rcItem.top, SWP_NOZORDER);
  	}
  	EndDeferWindowPos(hDwp);
  	return 0;
 diff --git a/src/mir_core/src/sha256.cpp b/src/mir_core/src/sha256.cpp index 42b7043f50..69821977e4 100644 --- a/src/mir_core/src/sha256.cpp +++ b/src/mir_core/src/sha256.cpp @@ -197,7 +197,7 @@ MIR_CORE_DLL(void) mir_sha256_write(SHA256_CONTEXT *hd, const void *inbuf_arg, s  	if (hd->count) {
  		for (; inlen && hd->count < 64; inlen--)
  			hd->buf[hd->count++] = *inbuf++;
 -		mir_sha256_write(hd, NULL, 0);
 +		mir_sha256_write(hd, nullptr, 0);
  		if (!inlen)
  			return;
  	}
 @@ -223,7 +223,7 @@ MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *hd, BYTE hashout[MIR_SHA256_  {
  	UINT32 t, msb, lsb;
 -	mir_sha256_write(hd, NULL, 0); /* flush */;
 +	mir_sha256_write(hd, nullptr, 0); /* flush */;
  	t = hd->nblocks;
  	/* multiply by 64 to make a BYTE count */
 @@ -248,7 +248,7 @@ MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *hd, BYTE hashout[MIR_SHA256_  		hd->buf[hd->count++] = 0x80; /* pad character */
  		while (hd->count < 64)
  			hd->buf[hd->count++] = 0;
 -		mir_sha256_write(hd, NULL, 0);  /* flush */;
 +		mir_sha256_write(hd, nullptr, 0);  /* flush */;
  		memset(hd->buf, 0, 56); /* fill next block with zeroes */
  	}
  	/* append the 64 bit count */
 diff --git a/src/mir_core/src/subclass.cpp b/src/mir_core/src/subclass.cpp index d5853e6228..c0d4fd9cdc 100644 --- a/src/mir_core/src/subclass.cpp +++ b/src/mir_core/src/subclass.cpp @@ -38,7 +38,7 @@ static LIST<MSubclassData> arSubclass(10, HandleKeySortT);  static LRESULT CALLBACK MSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  {
  	MSubclassData *p = arSubclass.find((MSubclassData*)&hwnd);
 -	if (p != NULL) {
 +	if (p != nullptr) {
  		if (p->m_iHooks)
  			return p->m_hooks[p->m_iHooks-1](hwnd, uMsg, wParam, lParam);
 @@ -62,7 +62,7 @@ MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc)  		return;
  	MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
 -	if (p == NULL) {
 +	if (p == nullptr) {
  		p = new MSubclassData;
  		p->m_hWnd = hWnd;
  		p->m_origWndProc = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)MSubclassWndProc);
 @@ -89,7 +89,7 @@ MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc)  MIR_CORE_DLL(void) mir_subclassWindowFull(HWND hWnd, WNDPROC wndProc, WNDPROC oldWndProc)
  {
  	MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
 -	if (p == NULL) {
 +	if (p == nullptr) {
  		p = new MSubclassData;
  		p->m_hWnd = hWnd;
  		p->m_origWndProc = oldWndProc;
 @@ -133,7 +133,7 @@ static WNDPROC finalizeSubclassing(HWND hWnd, MSubclassData *p)  MIR_CORE_DLL(void) mir_unsubclassWindow(HWND hWnd, WNDPROC wndProc)
  {
  	MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
 -	if (p == NULL)
 +	if (p == nullptr)
  		return;
  	for (int i = 0; i < p->m_iHooks; i++) {
 @@ -152,7 +152,7 @@ MIR_CORE_DLL(void) mir_unsubclassWindow(HWND hWnd, WNDPROC wndProc)  MIR_CORE_DLL(LRESULT) mir_callNextSubclass(HWND hWnd, WNDPROC wndProc, UINT uMsg, WPARAM wParam, LPARAM lParam)
  {
  	MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
 -	if (p == NULL)
 +	if (p == nullptr)
  		return DefWindowProc(hWnd, uMsg, wParam, lParam);
  	for (int i = p->m_iHooks - 1; i >= 0; i--) {
 diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp index 94e5c853c2..97d3dcd06d 100644 --- a/src/mir_core/src/threads.cpp +++ b/src/mir_core/src/threads.cpp @@ -43,8 +43,8 @@ static int MirandaWaitForMutex(HANDLE hEvent)  		DWORD rc = MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
  		if (rc == WAIT_OBJECT_0 + 1) {
  			MSG msg;
 -			while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
 -				if (msg.hwnd != NULL && IsDialogMessage(msg.hwnd, &msg)) /* Wine fix. */
 +			while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
 +				if (msg.hwnd != nullptr && IsDialogMessage(msg.hwnd, &msg)) /* Wine fix. */
  					continue;
  				TranslateMessage(&msg);
  				DispatchMessage(&msg);
 @@ -76,7 +76,7 @@ MIR_CORE_DLL(pfnExceptionFilter) GetExceptionFilter()  MIR_CORE_DLL(pfnExceptionFilter) SetExceptionFilter(pfnExceptionFilter _mirandaExceptFilter)
  {
  	pfnExceptionFilter oldOne = pMirandaExceptFilter;
 -	if (_mirandaExceptFilter != 0)
 +	if (_mirandaExceptFilter != nullptr)
  		pMirandaExceptFilter = _mirandaExceptFilter;
  	return oldOne;
  }
 @@ -128,13 +128,13 @@ DWORD WINAPI forkthread_r(void *arg)  MIR_CORE_DLL(HANDLE) mir_forkthread(void(__cdecl *threadcode)(void*), void *arg)
  {
  	FORK_ARG fa;
 -	fa.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 +	fa.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
  	fa.threadcode = threadcode;
  	fa.arg = arg;
  	DWORD threadID;
 -	fa.hThread = CreateThread(NULL, 0, forkthread_r, &fa, 0, &threadID);
 -	if (fa.hThread != NULL)
 +	fa.hThread = CreateThread(nullptr, 0, forkthread_r, &fa, 0, &threadID);
 +	if (fa.hThread != nullptr)
  		WaitForSingleObject(fa.hEvent, INFINITE);
  	CloseHandle(fa.hEvent);
 @@ -167,17 +167,17 @@ DWORD WINAPI forkthreadex_r(void * arg)  MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void* arg, unsigned *pThreadID)
  {
 -	struct FORK_ARG fa = { 0 };
 +	struct FORK_ARG fa = {};
  	fa.threadcodeex = aFunc;
  	fa.arg = arg;
 -	fa.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 +	fa.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
  	DWORD threadID = 0;
 -	HANDLE hThread = CreateThread(NULL, 0, forkthreadex_r, &fa, 0, &threadID);
 -	if (hThread != NULL)
 +	HANDLE hThread = CreateThread(nullptr, 0, forkthreadex_r, &fa, 0, &threadID);
 +	if (hThread != nullptr)
  		WaitForSingleObject(fa.hEvent, INFINITE);
 -	if (pThreadID != NULL)
 +	if (pThreadID != nullptr)
  		*pThreadID = threadID;
  	CloseHandle(fa.hEvent);
 @@ -186,18 +186,18 @@ MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void* arg, unsigned *  MIR_CORE_DLL(HANDLE) mir_forkthreadowner(pThreadFuncOwner aFunc, void *owner, void *arg, unsigned *pThreadID)
  {
 -	struct FORK_ARG fa = { 0 };
 +	struct FORK_ARG fa = {};
  	fa.threadcodeex = (pThreadFuncEx)aFunc;
  	fa.arg = arg;
  	fa.owner = owner;
 -	fa.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 +	fa.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
  	DWORD threadID = 0;
 -	HANDLE hThread = CreateThread(NULL, 0, forkthreadex_r, &fa, 0, &threadID);
 -	if (hThread != NULL)
 +	HANDLE hThread = CreateThread(nullptr, 0, forkthreadex_r, &fa, 0, &threadID);
 +	if (hThread != nullptr)
  		WaitForSingleObject(fa.hEvent, INFINITE);
 -	if (pThreadID != NULL)
 +	if (pThreadID != nullptr)
  		*pThreadID = threadID;
  	CloseHandle(fa.hEvent);
 @@ -208,7 +208,7 @@ MIR_CORE_DLL(HANDLE) mir_forkthreadowner(pThreadFuncOwner aFunc, void *owner, vo  MIR_CORE_DLL(void) KillObjectThreads(void* owner)
  {
 -	if (owner == NULL)
 +	if (owner == nullptr)
  		return;
  	WaitForSingleObject(hStackMutex, INFINITE);
 @@ -233,7 +233,7 @@ MIR_CORE_DLL(void) KillObjectThreads(void* owner)  				if (p->pObject == owner) {
  					char szModuleName[MAX_PATH];
  					GetModuleFileNameA(p->hOwner, szModuleName, sizeof(szModuleName));
 -					Netlib_Logf(0, "Killing object thread %s:%p", szModuleName, p->dwThreadId);
 +					Netlib_Logf(nullptr, "Killing object thread %s:%p", szModuleName, p->dwThreadId);
  					TerminateThread(p->hThread, 9999);
  					CloseHandle(p->hThread);
  					threads.remove(j);
 @@ -254,7 +254,7 @@ static void CALLBACK KillAllThreads(HWND, UINT, UINT_PTR, DWORD)  			THREAD_WAIT_ENTRY *p = threads[j];
  			char szModuleName[MAX_PATH];
  			GetModuleFileNameA(p->hOwner, szModuleName, sizeof(szModuleName));
 -			Netlib_Logf(0, "Killing thread %s:%p (%p)", szModuleName, p->dwThreadId, p->pEntryPoint);
 +			Netlib_Logf(nullptr, "Killing thread %s:%p (%p)", szModuleName, p->dwThreadId, p->pEntryPoint);
  			TerminateThread(p->hThread, 9999);
  			CloseHandle(p->hThread);
  			mir_free(p);
 @@ -277,7 +277,7 @@ MIR_CORE_DLL(void) Thread_Wait(void)  	}
  	// give all unclosed threads 5 seconds to close
 -	SetTimer(NULL, 0, 5000, KillAllThreads);
 +	SetTimer(nullptr, 0, 5000, KillAllThreads);
  	// wait til the thread list is empty
  	MirandaWaitForMutex(hThreadQueueEmpty);
 @@ -291,20 +291,20 @@ typedef LONG (WINAPI *pNtQIT)(HANDLE, LONG, PVOID, ULONG, PULONG);  static void* GetCurrentThreadEntryPoint()
  {
  	pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(GetModuleHandle(L"ntdll.dll"), "NtQueryInformationThread");
 -	if (NtQueryInformationThread == NULL)
 -		return 0;
 +	if (NtQueryInformationThread == nullptr)
 +		return nullptr;
  	HANDLE hDupHandle, hCurrentProcess = GetCurrentProcess();
  	if (!DuplicateHandle(hCurrentProcess, GetCurrentThread(), hCurrentProcess, &hDupHandle, THREAD_QUERY_INFORMATION, FALSE, 0)) {
  		SetLastError(ERROR_ACCESS_DENIED);
 -		return NULL;
 +		return nullptr;
  	}
  	DWORD_PTR dwStartAddress;
 -	LONG ntStatus = NtQueryInformationThread(hDupHandle, ThreadQuerySetWin32StartAddress, &dwStartAddress, sizeof(DWORD_PTR), NULL);
 +	LONG ntStatus = NtQueryInformationThread(hDupHandle, ThreadQuerySetWin32StartAddress, &dwStartAddress, sizeof(DWORD_PTR), nullptr);
  	CloseHandle(hDupHandle);
 -	return (ntStatus != ERROR_SUCCESS) ? NULL : (void*)dwStartAddress;
 +	return (ntStatus != ERROR_SUCCESS) ? nullptr : (void*)dwStartAddress;
  }
  MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner)
 @@ -319,7 +319,7 @@ MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner)  		if (pluginListAddr.getIndex(hInst) != -1)
  			p->hOwner = hInst;
  		else
 -			p->hOwner = GetInstByAddress((hInst != NULL) ? (PVOID)hInst : GetCurrentThreadEntryPoint());
 +			p->hOwner = GetInstByAddress((hInst != nullptr) ? (PVOID)hInst : GetCurrentThreadEntryPoint());
  		p->pEntryPoint = hInst;
  		threads.insert(p);
 diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp index a973d7fbd0..66f912db8a 100644 --- a/src/mir_core/src/timezones.cpp +++ b/src/mir_core/src/timezones.cpp @@ -84,7 +84,7 @@ mir_time FileTimeToUnixTime(LPFILETIME pft)  void FormatTime(const SYSTEMTIME *st, const wchar_t *szFormat, wchar_t *szDest, size_t cbDest)
  {
 -	if (szDest == NULL || cbDest == 0) return;
 +	if (szDest == nullptr || cbDest == 0) return;
  	CMStringW tszTemp;
 @@ -130,11 +130,11 @@ void FormatTime(const SYSTEMTIME *st, const wchar_t *szFormat, wchar_t *szDest,  		if (iso)
  			tszTemp.AppendFormat(L"%d-%02d-%02dT%02d:%02d:%02dZ", st->wYear, st->wMonth, st->wDay, st->wHour, st->wMinute, st->wSecond);
  		else if (date) {
 -			GetDateFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, _countof(dateTimeStr));
 +			GetDateFormat(LOCALE_USER_DEFAULT, fmt, st, nullptr, dateTimeStr, _countof(dateTimeStr));
  			tszTemp.Append(dateTimeStr);
  		}
  		else {
 -			GetTimeFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, _countof(dateTimeStr));
 +			GetTimeFormat(LOCALE_USER_DEFAULT, fmt, st, nullptr, dateTimeStr, _countof(dateTimeStr));
  			tszTemp.Append(dateTimeStr);
  		}
  	}
 @@ -144,7 +144,7 @@ void FormatTime(const SYSTEMTIME *st, const wchar_t *szFormat, wchar_t *szDest,  MIR_CORE_DLL(int) TimeZone_GetTimeZoneTime(HANDLE hTZ, SYSTEMTIME *st)
  {
 -	if (st == NULL) return 1;
 +	if (st == nullptr) return 1;
  	MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
  	if (tz == UTC_TIME_HANDLE)
 @@ -163,7 +163,7 @@ MIR_CORE_DLL(int) TimeZone_GetTimeZoneTime(HANDLE hTZ, SYSTEMTIME *st)  MIR_CORE_DLL(LPCTSTR) TimeZone_GetName(HANDLE hTZ)
  {
  	MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
 -	if (tz == NULL)
 +	if (tz == nullptr)
  		return myInfo.myTZ.tszName;
  	else if (tz == UTC_TIME_HANDLE)
  		return L"UTC";
 @@ -208,38 +208,38 @@ static bool IsSameTime(MIM_TIMEZONE *tz)  		return true;
  	TimeZone_GetTimeZoneTime(tz, &stl);
 -	TimeZone_GetTimeZoneTime(NULL, &st);
 +	TimeZone_GetTimeZoneTime(nullptr, &st);
  	return st.wHour == stl.wHour && st.wMinute == stl.wMinute;
  }
  MIR_CORE_DLL(HANDLE) TimeZone_CreateByName(LPCTSTR tszName, DWORD dwFlags)
  {
 -	if (tszName == NULL)
 -		return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
 +	if (tszName == nullptr)
 +		return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? nullptr : &myInfo.myTZ;
  	if (mir_wstrcmp(myInfo.myTZ.tszName, tszName) == 0)
 -		return (dwFlags & TZF_DIFONLY) ? NULL : &myInfo.myTZ;
 +		return (dwFlags & TZF_DIFONLY) ? nullptr : &myInfo.myTZ;
  	MIM_TIMEZONE tzsearch;
  	tzsearch.hash = mir_hashstrT(tszName);
  	MIM_TIMEZONE *tz = g_timezones.find(&tzsearch);
 -	if (tz == NULL)
 -		return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
 +	if (tz == nullptr)
 +		return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? nullptr : &myInfo.myTZ;
  	if (dwFlags & TZF_DIFONLY)
 -		return IsSameTime(tz) ? NULL : tz;
 +		return IsSameTime(tz) ? nullptr : tz;
  	return tz;
  }
  MIR_CORE_DLL(HANDLE) TimeZone_CreateByContact(MCONTACT hContact, LPCSTR szModule, DWORD dwFlags)
  {
 -	if (hContact == NULL && szModule == NULL)
 -		return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
 +	if (hContact == NULL && szModule == nullptr)
 +		return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? nullptr : &myInfo.myTZ;
 -	if (szModule == NULL) szModule = "UserInfo";
 +	if (szModule == nullptr) szModule = "UserInfo";
  	DBVARIANT dbv;
  	if (!db_get_ws(hContact, szModule, "TzName", &dbv)) {
 @@ -263,7 +263,7 @@ MIR_CORE_DLL(HANDLE) TimeZone_CreateByContact(MCONTACT hContact, LPCSTR szModule  		MIM_TIMEZONE tzsearch;
  		tzsearch.tzi.Bias = timezone * 30;
  		if (myInfo.myTZ.tzi.Bias == tzsearch.tzi.Bias) {
 -			if (dwFlags & TZF_DIFONLY) return NULL;
 +			if (dwFlags & TZF_DIFONLY) return nullptr;
  			return &myInfo.myTZ;
  		}
 @@ -281,15 +281,15 @@ MIR_CORE_DLL(HANDLE) TimeZone_CreateByContact(MCONTACT hContact, LPCSTR szModule  		if (i >= 0) {
  			MIM_TIMEZONE *tz = g_timezonesBias[i];
 -			return ((dwFlags & TZF_DIFONLY) && IsSameTime(tz)) ? NULL : tz;
 +			return ((dwFlags & TZF_DIFONLY) && IsSameTime(tz)) ? nullptr : tz;
  		}
  	}
 -	return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
 +	return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? nullptr : &myInfo.myTZ;
  }
  MIR_CORE_DLL(void) TimeZone_StoreByContact(MCONTACT hContact, LPCSTR szModule, HANDLE hTZ)
  {
 -	if (szModule == NULL) szModule = "UserInfo";
 +	if (szModule == nullptr) szModule = "UserInfo";
  	MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
  	if (tz) {
 @@ -305,7 +305,7 @@ MIR_CORE_DLL(void) TimeZone_StoreByContact(MCONTACT hContact, LPCSTR szModule, H  MIR_CORE_DLL(int) TimeZone_PrintDateTime(HANDLE hTZ, LPCTSTR szFormat, LPTSTR szDest, size_t cbDest, DWORD dwFlags)
  {
  	MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
 -	if (tz == NULL && (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)))
 +	if (tz == nullptr && (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)))
  		return 1;
  	SYSTEMTIME st;
 @@ -319,10 +319,10 @@ MIR_CORE_DLL(int) TimeZone_PrintDateTime(HANDLE hTZ, LPCTSTR szFormat, LPTSTR sz  MIR_CORE_DLL(int) TimeZone_PrintTimeStamp(HANDLE hTZ, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, size_t cbDest, DWORD dwFlags)
  {
  	MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
 -	if (tz == NULL && (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)))
 +	if (tz == nullptr && (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)))
  		return 1;
 -	if (tz == NULL)
 +	if (tz == nullptr)
  		tz = &myInfo.myTZ;
  	FILETIME ft;
 @@ -351,7 +351,7 @@ MIR_CORE_DLL(LPTIME_ZONE_INFORMATION) TimeZone_GetInfo(HANDLE hTZ)  MIR_CORE_DLL(mir_time) TimeZone_UtcToLocal(HANDLE hTZ, mir_time ts)
  {
  	MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ;
 -	if (tz == NULL)
 +	if (tz == nullptr)
  		tz = &myInfo.myTZ;
  	if (tz == UTC_TIME_HANDLE)
 @@ -375,8 +375,8 @@ static const ListMessages cbMessages = { CB_ADDSTRING, CB_GETCURSEL, CB_SETCURSE  static const ListMessages* GetListMessages(HWND hWnd, DWORD dwFlags)
  {
 -	if (hWnd == NULL)
 -		return NULL;
 +	if (hWnd == nullptr)
 +		return nullptr;
  	if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) {
  		wchar_t	tszClassName[128];
 @@ -391,7 +391,7 @@ static const ListMessages* GetListMessages(HWND hWnd, DWORD dwFlags)  	else if (dwFlags & TZF_PLF_LB)
  		return &lbMessages;
  	else
 -		return NULL;
 +		return nullptr;
  }
  ///////////////////////////////////////////////////////////////////////////////
 @@ -399,10 +399,10 @@ static const ListMessages* GetListMessages(HWND hWnd, DWORD dwFlags)  MIR_CORE_DLL(int) TimeZone_SelectListItem(MCONTACT hContact, LPCSTR szModule, HWND hWnd, DWORD dwFlags)
  {
  	const ListMessages *lstMsg = GetListMessages(hWnd, dwFlags);
 -	if (lstMsg == NULL)
 +	if (lstMsg == nullptr)
  		return -1;
 -	if (szModule == NULL) szModule = "UserInfo";
 +	if (szModule == nullptr) szModule = "UserInfo";
  	int iSelection = 0;
  	ptrW tszName(db_get_wsa(hContact, szModule, "TzName"));
 @@ -435,7 +435,7 @@ MIR_CORE_DLL(int) TimeZone_SelectListItem(MCONTACT hContact, LPCSTR szModule, HW  MIR_CORE_DLL(int) TimeZone_PrepareList(MCONTACT hContact, LPCSTR szModule, HWND hWnd, DWORD dwFlags)
  {
  	const ListMessages *lstMsg = GetListMessages(hWnd, dwFlags);
 -	if (lstMsg == NULL)
 +	if (lstMsg == nullptr)
  		return 0;
  	SendMessage(hWnd, lstMsg->addStr, 0, (LPARAM)TranslateT("<unspecified>"));
 @@ -452,17 +452,17 @@ MIR_CORE_DLL(int) TimeZone_PrepareList(MCONTACT hContact, LPCSTR szModule, HWND  MIR_CORE_DLL(void) TimeZone_StoreListResult(MCONTACT hContact, LPCSTR szModule, HWND hWnd, DWORD dwFlags)
  {
 -	if (szModule == NULL) szModule = "UserInfo";
 +	if (szModule == nullptr) szModule = "UserInfo";
  	const ListMessages *lstMsg = GetListMessages(hWnd, dwFlags);
  	if (lstMsg) {
  		LRESULT offset = SendMessage(hWnd, lstMsg->getSel, 0, 0);
  		if (offset > 0) {
  			MIM_TIMEZONE *tz = (MIM_TIMEZONE*)SendMessage(hWnd, lstMsg->getData, offset, 0);
 -			if ((INT_PTR)tz != CB_ERR && tz != NULL)
 +			if ((INT_PTR)tz != CB_ERR && tz != nullptr)
  				TimeZone_StoreByContact(hContact, szModule, tz);
  		}
 -		else TimeZone_StoreByContact(hContact, szModule, NULL);
 +		else TimeZone_StoreByContact(hContact, szModule, nullptr);
  	}
  }
 @@ -470,20 +470,20 @@ MIR_CORE_DLL(void) TimeZone_StoreListResult(MCONTACT hContact, LPCSTR szModule,  MIR_CORE_DLL(DWORD) TimeZone_ToLocal(DWORD timeVal)
  {
 -	return TimeZone_UtcToLocal(NULL, (mir_time)timeVal);
 +	return TimeZone_UtcToLocal(nullptr, (mir_time)timeVal);
  }
  MIR_CORE_DLL(char*) TimeZone_ToString(mir_time timeVal, const char *szFormat, char *szDest, size_t cchDest)
  {
  	wchar_t *szTemp = (wchar_t*)alloca(cchDest*sizeof(wchar_t));
 -	TimeZone_PrintTimeStamp(NULL, timeVal, _A2T(szFormat), szTemp, cchDest, 0);
 -	WideCharToMultiByte(CP_ACP, 0, szTemp, -1, szDest, (int)cchDest, NULL, NULL);
 +	TimeZone_PrintTimeStamp(nullptr, timeVal, _A2T(szFormat), szTemp, cchDest, 0);
 +	WideCharToMultiByte(CP_ACP, 0, szTemp, -1, szDest, (int)cchDest, nullptr, nullptr);
  	return szDest;
  }
  MIR_CORE_DLL(wchar_t*) TimeZone_ToStringW(mir_time timeVal, const wchar_t *wszFormat, wchar_t *wszDest, size_t cchDest)
  {
 -	TimeZone_PrintTimeStamp(NULL, timeVal, wszFormat, wszDest, cchDest, 0);
 +	TimeZone_PrintTimeStamp(nullptr, timeVal, wszFormat, wszDest, cchDest, 0);
  	return wszDest;
  }
 @@ -492,14 +492,14 @@ MIR_CORE_DLL(wchar_t*) TimeZone_ToStringW(mir_time timeVal, const wchar_t *wszFo  void GetLocalizedString(HKEY hSubKey, const wchar_t *szName, wchar_t *szBuf, DWORD cbLen)
  {
  	DWORD dwLength = cbLen * sizeof(wchar_t);
 -	RegQueryValueEx(hSubKey, szName, NULL, NULL, (unsigned char *)szBuf, &dwLength);
 +	RegQueryValueEx(hSubKey, szName, nullptr, nullptr, (unsigned char *)szBuf, &dwLength);
  	szBuf[min(dwLength / sizeof(wchar_t), cbLen - 1)] = 0;
  }
  void RecalculateTime(void)
  {
  	GetTimeZoneInformation(&myInfo.myTZ.tzi);
 -	myInfo.timestamp = time(NULL);
 +	myInfo.timestamp = time(nullptr);
  	myInfo.myTZ.offset = INT_MIN;
  	bool found = false;
 @@ -545,12 +545,12 @@ void InitTimeZones(void)  		wchar_t	tszName[MIM_TZ_NAMELEN];
  		DWORD dwSize = _countof(tszName);
 -		while (ERROR_NO_MORE_ITEMS != RegEnumKeyEx(hKey, dwIndex++, tszName, &dwSize, NULL, NULL, 0, NULL)) {
 +		while (ERROR_NO_MORE_ITEMS != RegEnumKeyEx(hKey, dwIndex++, tszName, &dwSize, nullptr, nullptr, nullptr, nullptr)) {
  			if (ERROR_SUCCESS == RegOpenKeyEx(hKey, tszName, 0, KEY_QUERY_VALUE, &hSubKey)) {
  				dwSize = sizeof(tszName);
  				DWORD dwLength = sizeof(tzi);
 -				if (ERROR_SUCCESS != RegQueryValueEx(hSubKey, L"TZI", NULL, NULL, (unsigned char *)&tzi, &dwLength))
 +				if (ERROR_SUCCESS != RegQueryValueEx(hSubKey, L"TZI", nullptr, nullptr, (unsigned char *)&tzi, &dwLength))
  					continue;
  				MIM_TIMEZONE *tz = new MIM_TIMEZONE;
 diff --git a/src/mir_core/src/utf.cpp b/src/mir_core/src/utf.cpp index 06b815ac48..f0aad890e1 100644 --- a/src/mir_core/src/utf.cpp +++ b/src/mir_core/src/utf.cpp @@ -90,7 +90,7 @@ static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen)  MIR_CORE_DLL(int) Ucs2toUtf8Len(const wchar_t *src)
  {
 -	if (src == 0)
 +	if (src == nullptr)
  		return 0;
  	return Ucs2toUtf8Len(src, (int)wcslen(src));
 @@ -241,16 +241,16 @@ MIR_CORE_DLL(int) Utf8toUcs2(const char *src, size_t srclen, wchar_t *dst, size_  MIR_CORE_DLL(char*) Utf8DecodeCP(char *str, int codepage, wchar_t **ucs2)
  {
  	bool needs_free = false;
 -	wchar_t* tempBuf = NULL;
 +	wchar_t* tempBuf = nullptr;
  	if (ucs2)
 -		*ucs2 = NULL;
 +		*ucs2 = nullptr;
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	size_t len = strlen(str);
  	if (len < 2) {
 -		if (ucs2 != NULL) {
 +		if (ucs2 != nullptr) {
  			*ucs2 = tempBuf = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
  			MultiByteToWideChar(codepage, 0, str, (int)len, tempBuf, (int)len);
  			tempBuf[len] = 0;
 @@ -260,28 +260,28 @@ MIR_CORE_DLL(char*) Utf8DecodeCP(char *str, int codepage, wchar_t **ucs2)  	int destlen = Utf8toUcs2Len(str, len);
  	if (destlen < 0)
 -		return NULL;
 +		return nullptr;
 -	if (ucs2 == NULL) {
 +	if (ucs2 == nullptr) {
  		__try {
  			tempBuf = (wchar_t*)alloca((destlen + 1) * sizeof(wchar_t));
  		}
  		__except (EXCEPTION_EXECUTE_HANDLER)
  		{
 -			tempBuf = NULL;
 +			tempBuf = nullptr;
  			needs_free = true;
  		}
  	}
 -	if (tempBuf == NULL) {
 +	if (tempBuf == nullptr) {
  		tempBuf = (wchar_t*)mir_alloc((destlen + 1) * sizeof(wchar_t));
 -		if (tempBuf == NULL)
 -			return NULL;
 +		if (tempBuf == nullptr)
 +			return nullptr;
  	}
  	Utf8toUcs2(str, len, tempBuf, destlen);
  	tempBuf[destlen] = 0;
 -	WideCharToMultiByte(codepage, 0, tempBuf, -1, str, (int)len + 1, "?", NULL);
 +	WideCharToMultiByte(codepage, 0, tempBuf, -1, str, (int)len + 1, "?", nullptr);
  	if (ucs2)
  		*ucs2 = tempBuf;
 @@ -298,18 +298,18 @@ MIR_CORE_DLL(char*) Utf8Decode(char *str, wchar_t **ucs2)  MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	size_t len = strlen(str);
  	int destlen = Utf8toUcs2Len(str, len);
  	if (destlen < 0)
 -		return NULL;
 +		return nullptr;
  	wchar_t* ucs2 = (wchar_t*)mir_alloc((destlen + 1) * sizeof(wchar_t));
 -	if (ucs2 == NULL)
 -		return NULL;
 +	if (ucs2 == nullptr)
 +		return nullptr;
  	if (Utf8toUcs2(str, len, ucs2, destlen) >= 0) {
  		ucs2[destlen] = 0;
 @@ -318,7 +318,7 @@ MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char *str)  	mir_free(ucs2);
 -	return NULL;
 +	return nullptr;
  }
  /////////////////////////////////////////////////////////////////////////////////////////
 @@ -328,11 +328,11 @@ MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage)  {
  	int len;
  	bool needs_free = false;
 -	char* result = NULL;
 +	char* result = nullptr;
  	wchar_t* tempBuf;
 -	if (src == NULL)
 -		return NULL;
 +	if (src == nullptr)
 +		return nullptr;
  	len = (int)strlen(src);
 @@ -342,7 +342,7 @@ MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage)  	__except (EXCEPTION_EXECUTE_HANDLER)
  	{
  		tempBuf = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
 -		if (tempBuf == NULL) return NULL;
 +		if (tempBuf == nullptr) return nullptr;
  		needs_free = true;
  	}
 @@ -373,17 +373,17 @@ MIR_CORE_DLL(char*) Utf8Encode(const char* src)  MIR_CORE_DLL(char*) Utf8EncodeW(const wchar_t* src)
  {
 -	if (src == NULL)
 -		return NULL;
 +	if (src == nullptr)
 +		return nullptr;
  	int len = (int)wcslen(src);
  	int destlen = Ucs2toUtf8Len(src, len);
 -	if (destlen < 0) return NULL;
 +	if (destlen < 0) return nullptr;
  	char* result = (char*)mir_alloc(destlen + 1);
 -	if (result == NULL)
 -		return NULL;
 +	if (result == nullptr)
 +		return nullptr;
  	Ucs2toUtf8(src, len, result, destlen);
  	result[destlen] = 0;
 diff --git a/src/mir_core/src/utils.cpp b/src/mir_core/src/utils.cpp index 8a9f3366c0..94ff07c7d1 100644 --- a/src/mir_core/src/utils.cpp +++ b/src/mir_core/src/utils.cpp @@ -26,24 +26,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  MIR_CORE_DLL(char*) replaceStr(char* &dest, const char *src)
  {
 -	if (dest != NULL)
 +	if (dest != nullptr)
  		mir_free(dest);
 -	return dest = (src != NULL) ? mir_strdup(src) : NULL;
 +	return dest = (src != nullptr) ? mir_strdup(src) : nullptr;
  }
  MIR_CORE_DLL(WCHAR*) replaceStrW(WCHAR* &dest, const WCHAR *src)
  {
 -	if (dest != NULL)
 +	if (dest != nullptr)
  		mir_free(dest);
 -	return dest = (src != NULL) ? mir_wstrdup(src) : NULL;
 +	return dest = (src != nullptr) ? mir_wstrdup(src) : nullptr;
  }
  MIR_CORE_DLL(char*) rtrim(char *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	char* p = strchr(str, 0);
  	while (--p >= str) {
 @@ -59,8 +59,8 @@ MIR_CORE_DLL(char*) rtrim(char *str)  MIR_CORE_DLL(WCHAR*) rtrimw(WCHAR *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	WCHAR *p = wcschr(str, 0);
  	while (--p >= str) {
 @@ -76,8 +76,8 @@ MIR_CORE_DLL(WCHAR*) rtrimw(WCHAR *str)  MIR_CORE_DLL(char*) ltrim(char *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	char* p = str;
  	for (;;) {
 @@ -93,8 +93,8 @@ MIR_CORE_DLL(char*) ltrim(char *str)  MIR_CORE_DLL(WCHAR*) ltrimw(WCHAR *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	WCHAR *p = str;
  	for (;;) {
 @@ -110,8 +110,8 @@ MIR_CORE_DLL(WCHAR*) ltrimw(WCHAR *str)  MIR_CORE_DLL(char*) ltrimp(char *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	char *p = str;
  	for (;;) {
 @@ -126,8 +126,8 @@ MIR_CORE_DLL(char*) ltrimp(char *str)  MIR_CORE_DLL(WCHAR*) ltrimpw(WCHAR *str)
  {
 -	if (str == NULL)
 -		return NULL;
 +	if (str == nullptr)
 +		return nullptr;
  	WCHAR *p = str;
  	for (;;) {
 @@ -166,10 +166,10 @@ MIR_CORE_DLL(wchar_t*) strdelw(wchar_t *str, size_t len)  MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask)
  {
 -	if (name == NULL || mask == NULL)
 +	if (name == nullptr || mask == nullptr)
  		return false;
 -	const char *last = '\0';
 +	const char *last = nullptr;
  	for (;; mask++, name++) {
  		if (*mask != '?' && *mask != *name) break;
  		if (*name == '\0') return ((BOOL)!*mask);
 @@ -187,10 +187,10 @@ MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask)  MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask)
  {
 -	if (name == NULL || mask == NULL)
 +	if (name == nullptr || mask == nullptr)
  		return false;
 -	const WCHAR* last = '\0';
 +	const WCHAR* last = nullptr;
  	for (;; mask++, name++) {
  		if (*mask != '?' && *mask != *name) break;
  		if (*name == '\0') return ((BOOL)!*mask);
 @@ -210,10 +210,10 @@ MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask)  MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask)
  {
 -	if (name == NULL || mask == NULL)
 +	if (name == nullptr || mask == nullptr)
  		return false;
 -	const char *last = NULL;
 +	const char *last = nullptr;
  	for (;; mask++, name++) {
  		if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break;
  		if (*name == '\0') return ((BOOL)!*mask);
 @@ -231,10 +231,10 @@ MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask)  MIR_CORE_DLL(int) wildcmpiw(const WCHAR *name, const WCHAR *mask)
  {
 -	if (name == NULL || mask == NULL)
 +	if (name == nullptr || mask == nullptr)
  		return false;
 -	const WCHAR* last = NULL;
 +	const WCHAR* last = nullptr;
  	for (;; mask++, name++) {
  		if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break;
  		if (*name == '\0') return ((BOOL)!*mask);
 @@ -295,7 +295,7 @@ static int hex2dec(int iHex)  MIR_CORE_DLL(bool) hex2bin(const char *pSrc, void *pData, size_t len)
  {
 -	if (pSrc == NULL || pData == NULL || len == 0)
 +	if (pSrc == nullptr || pData == nullptr || len == 0)
  		return false;
  	size_t bufLen = strlen(pSrc)/2;
 @@ -314,7 +314,7 @@ MIR_CORE_DLL(bool) hex2bin(const char *pSrc, void *pData, size_t len)  MIR_CORE_DLL(bool) hex2binW(const wchar_t *pSrc, void *pData, size_t len)
  {
 -	if (pSrc == NULL || pData == NULL || len == 0)
 +	if (pSrc == nullptr || pData == nullptr || len == 0)
  		return false;
  	size_t bufLen = wcslen(pSrc)/2;
 @@ -348,10 +348,10 @@ MIR_CORE_DLL(size_t) mir_wstrlen(const wchar_t *p)  MIR_CORE_DLL(char*) mir_strcpy(char *dest, const char *src)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL) {
 +	if (src == nullptr) {
  		*dest = 0;
  		return dest;
  	}
 @@ -361,10 +361,10 @@ MIR_CORE_DLL(char*) mir_strcpy(char *dest, const char *src)  MIR_CORE_DLL(wchar_t*) mir_wstrcpy(wchar_t *dest, const wchar_t *src)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL) {
 +	if (src == nullptr) {
  		*dest = 0;
  		return dest;
  	}
 @@ -374,10 +374,10 @@ MIR_CORE_DLL(wchar_t*) mir_wstrcpy(wchar_t *dest, const wchar_t *src)  MIR_CORE_DLL(char*) mir_strncpy(char *dest, const char *src, size_t len)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL)
 +	if (src == nullptr)
  		*dest = 0;
  	else
  		strncpy_s(dest, len, src, _TRUNCATE);
 @@ -386,10 +386,10 @@ MIR_CORE_DLL(char*) mir_strncpy(char *dest, const char *src, size_t len)  MIR_CORE_DLL(wchar_t*) mir_wstrncpy(wchar_t *dest, const wchar_t *src, size_t len)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL)
 +	if (src == nullptr)
  		*dest = 0;
  	else
  		wcsncpy_s(dest, len, src, _TRUNCATE);
 @@ -398,10 +398,10 @@ MIR_CORE_DLL(wchar_t*) mir_wstrncpy(wchar_t *dest, const wchar_t *src, size_t le  MIR_CORE_DLL(char*) mir_strcat(char *dest, const char *src)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL) {
 +	if (src == nullptr) {
  		*dest = 0;
  		return dest;
  	}
 @@ -411,10 +411,10 @@ MIR_CORE_DLL(char*) mir_strcat(char *dest, const char *src)  MIR_CORE_DLL(wchar_t*) mir_wstrcat(wchar_t *dest, const wchar_t *src)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL) {
 +	if (src == nullptr) {
  		*dest = 0;
  		return dest;
  	}
 @@ -424,10 +424,10 @@ MIR_CORE_DLL(wchar_t*) mir_wstrcat(wchar_t *dest, const wchar_t *src)  MIR_CORE_DLL(char*) mir_strncat(char *dest, const char *src, size_t len)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL)
 +	if (src == nullptr)
  		*dest = 0;
  	else
  		strncat_s(dest, len, src, _TRUNCATE);
 @@ -436,10 +436,10 @@ MIR_CORE_DLL(char*) mir_strncat(char *dest, const char *src, size_t len)  MIR_CORE_DLL(wchar_t*) mir_wstrncat(wchar_t *dest, const wchar_t *src, size_t len)
  {
 -	if (dest == NULL)
 -		return NULL;
 +	if (dest == nullptr)
 +		return nullptr;
 -	if (src == NULL)
 +	if (src == nullptr)
  		*dest = 0;
  	else
  		wcsncat_s(dest, len, src, _TRUNCATE);
 @@ -448,72 +448,72 @@ MIR_CORE_DLL(wchar_t*) mir_wstrncat(wchar_t *dest, const wchar_t *src, size_t le  MIR_CORE_DLL(int) mir_strcmp(const char *p1, const char *p2)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return strcmp(p1, p2);
  }
  MIR_CORE_DLL(int) mir_wstrcmp(const wchar_t *p1, const wchar_t *p2)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return wcscmp(p1, p2);
  }
  MIR_CORE_DLL(int) mir_strcmpi(const char *p1, const char *p2)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return stricmp(p1, p2);
  }
  MIR_CORE_DLL(int) mir_wstrcmpi(const wchar_t *p1, const wchar_t *p2)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return wcsicmp(p1, p2);
  }
  MIR_CORE_DLL(int) mir_strncmp(const char *p1, const char *p2, size_t n)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return strncmp(p1, p2, n);
  }
  MIR_CORE_DLL(int) mir_wstrncmp(const wchar_t *p1, const wchar_t *p2, size_t n)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return wcsncmp(p1, p2, n);
  }
  MIR_CORE_DLL(int) mir_strncmpi(const char *p1, const char *p2, size_t n)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return strnicmp(p1, p2, n);
  }
  MIR_CORE_DLL(int) mir_wstrncmpi(const wchar_t *p1, const wchar_t *p2, size_t n)
  {
 -	if (p1 == NULL)
 -		return (p2 == NULL) ? 0 : -1;
 -	if (p2 == NULL)
 +	if (p1 == nullptr)
 +		return (p2 == nullptr) ? 0 : -1;
 +	if (p2 == nullptr)
  		return 1;
  	return wcsnicmp(p1, p2, n);
  }
 @@ -527,10 +527,10 @@ MIR_CORE_DLL(void) Utils_GetRandom(void *pszDest, size_t cbLen)  	if (pszDest == nullptr || cbLen == 0)
  		return;
 -	if (pfnRtlGenRandom != NULL)
 +	if (pfnRtlGenRandom != nullptr)
  		pfnRtlGenRandom(pszDest, (ULONG)cbLen);
  	else {
 -		srand(time(NULL));
 +		srand(time(nullptr));
  		BYTE *p = (BYTE*)pszDest;
  		for (size_t i = 0; i < cbLen; i++)
  			p[i] = rand() & 0xFF;
 diff --git a/src/mir_core/src/windowlist.cpp b/src/mir_core/src/windowlist.cpp index 7af092dc1d..a945710dd5 100644 --- a/src/mir_core/src/windowlist.cpp +++ b/src/mir_core/src/windowlist.cpp @@ -55,7 +55,7 @@ MIR_CORE_DLL(void) WindowList_Destroy(MWindowList &hList)  MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact)
  {
 -	if (hList == NULL)
 +	if (hList == nullptr)
  		return 1;
  	hList->insert(new TWindowListItem(hContact, hwnd));
 @@ -64,7 +64,7 @@ MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact  MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd)
  {
 -	if (hList == NULL) return 1;
 +	if (hList == nullptr) return 1;
  	for (int i = 0; i < hList->getCount(); i++) {
  		if ((*hList)[i].hWnd == hwnd) {
 @@ -77,16 +77,16 @@ MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd)  MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact)
  {
 -	if (hList == NULL)
 -		return NULL;
 +	if (hList == nullptr)
 +		return nullptr;
  	TWindowListItem *p = hList->find((TWindowListItem*)&hContact);
 -	return (p == NULL) ? NULL : p->hWnd;
 +	return (p == nullptr) ? nullptr : p->hWnd;
  }
  MIR_CORE_DLL(int) WindowList_Broadcast(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam)
  {
 -	if (hList == NULL)
 +	if (hList == nullptr)
  		return NULL;
  	for (int i = hList->getCount()-1; i >= 0; i--)
 @@ -96,7 +96,7 @@ MIR_CORE_DLL(int) WindowList_Broadcast(MWindowList hList, UINT message, WPARAM w  MIR_CORE_DLL(int) WindowList_BroadcastAsync(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam)
  {
 -	if (hList == NULL)
 +	if (hList == nullptr)
  		return NULL;
  	for (int i = hList->getCount()-1; i >= 0; i--)
 diff --git a/src/mir_core/src/winutil.cpp b/src/mir_core/src/winutil.cpp index bc8e20a2a7..0397aa04ff 100644 --- a/src/mir_core/src/winutil.cpp +++ b/src/mir_core/src/winutil.cpp @@ -91,7 +91,7 @@ EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hCont  MIR_CORE_DLL(int) Utils_AssertInsideScreen(RECT *rc)
  {
 -	if (rc == NULL)
 +	if (rc == nullptr)
  		return -1;
  	RECT rcScreen;
 diff --git a/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp index 09edd739ba..15b70343a3 100644 --- a/src/mir_core/src/winver.cpp +++ b/src/mir_core/src/winver.cpp @@ -90,7 +90,7 @@ MIR_CORE_DLL(BOOL) IsFullScreen()  MIR_CORE_DLL(BOOL) IsWorkstationLocked(void)
  {
  	HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
 -	if (hDesk == NULL)
 +	if (hDesk == nullptr)
  		return true;
  	wchar_t tszName[100];
 @@ -200,7 +200,7 @@ typedef LPCSTR(WINAPI *WGV)(void);  MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize)
  {
 -	if (buf == NULL || bufSize == 0)
 +	if (buf == nullptr || bufSize == 0)
  		return 0;
  	buf[0] = 0;
 @@ -263,7 +263,7 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize)  		DWORD dwType = 0;
  		HMODULE hKernel = GetModuleHandle(L"kernel32.dll");
  		PGPI pGPI = (PGPI)GetProcAddress(hKernel, "GetProductInfo");
 -		if (pGPI != NULL)
 +		if (pGPI != nullptr)
  			pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
  		switch (dwType) {
 diff --git a/src/miranda32/src/miranda.cpp b/src/miranda32/src/miranda.cpp index 1f94f8587c..5440cb5fb6 100644 --- a/src/miranda32/src/miranda.cpp +++ b/src/miranda32/src/miranda.cpp @@ -62,7 +62,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int)  		HINSTANCE hZlib = LoadLibraryW(L"Libs\\zlib.mir");
  		if (hZlib == nullptr) {
  			if (IDYES == MessageBoxW(nullptr, wszQuestion, L"Missing runtime library", MB_ICONERROR | MB_YESNOCANCEL)) {
 -				ShellExecuteW(nullptr, L"open", wszRuntimeUrl, NULL, NULL, SW_NORMAL);
 +				ShellExecuteW(nullptr, L"open", wszRuntimeUrl, nullptr, nullptr, SW_NORMAL);
  				retVal = 3;
  			}
  		}
  | 
