diff options
Diffstat (limited to 'plugins/BasicHistory')
| -rw-r--r-- | plugins/BasicHistory/src/BasicHistory.cpp | 30 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/BinaryExport.cpp | 6 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/DatExport.cpp | 4 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/EventList.cpp | 28 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/ExportManager.cpp | 20 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/HistoryWindow.cpp | 118 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/ImageDataObject.cpp | 20 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/Options.cpp | 48 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/PlainHtmlExport.cpp | 2 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/RichHtmlExport.cpp | 32 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/Scheduler.cpp | 142 | ||||
| -rw-r--r-- | plugins/BasicHistory/src/Searcher.cpp | 2 | 
12 files changed, 226 insertions, 226 deletions
| diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 8b42954c44..b017c33188 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -25,16 +25,16 @@ HINSTANCE hInst;  #define MS_HISTORY_EXECUTE_TASK       "BasicHistory/ExecuteTask"
  HCURSOR     hCurSplitNS, hCurSplitWE;
 -HANDLE  g_hMainThread = NULL;
 +HANDLE  g_hMainThread = nullptr;
 -HANDLE *hEventIcons = NULL;
 +HANDLE *hEventIcons = nullptr;
  int iconsNum = 3;
  HANDLE hToolbarButton;
  HGENMENU hContactMenu, hDeleteContactMenu;
  HGENMENU hTaskMainMenu;
  std::vector<HGENMENU> taskMenus;
  bool g_SmileyAddAvail = false;
 -char* metaContactProto = NULL;
 +char* metaContactProto = nullptr;
  const IID IID_ITextDocument = { 0x8CC497C0, 0xA1DF, 0x11ce, {0x80, 0x98, 0x00, 0xAA, 0x00, 0x47, 0xBE, 0x5D} };
  #define MODULE "BasicHistory"
 @@ -85,7 +85,7 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM)  int ToolbarModuleLoaded(WPARAM, LPARAM)
  {
 -	TTBButton ttb = { 0 };
 +	TTBButton ttb = {};
  	ttb.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
  	ttb.name = ttb.pszTooltipUp = LPGEN("Open History");
  	ttb.dwFlags = TTBBF_SHOWTOOLTIP;
 @@ -122,7 +122,7 @@ void InitMenuItems()  void InitTaskMenuItems()
  {
  	if (Options::instance->taskOptions.size() > 0) {
 -		if (hTaskMainMenu == NULL) {
 +		if (hTaskMainMenu == nullptr) {
  			CMenuItem mi;
  			SET_UID(mi, 0xbf66499, 0x1b39, 0x47a2, 0x9b, 0x74, 0xa6, 0xae, 0x89, 0x95, 0x59, 0x59);
  			mi.position = 500060005;
 @@ -151,7 +151,7 @@ void InitTaskMenuItems()  			taskMenus.push_back(menu);
  		}
  	}
 -	else if (hTaskMainMenu != NULL)
 +	else if (hTaskMainMenu != nullptr)
  		Menu_ShowItem(hTaskMainMenu, false);
  }
 @@ -178,7 +178,7 @@ HICON LoadIconEx(int iconId, bool big)  		if (iconList[i].defIconID == iconId)
  			return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
 -	return 0;
 +	return nullptr;
  }
  INT_PTR ShowContactHistory(WPARAM hContact, LPARAM)
 @@ -205,12 +205,12 @@ int ModulesLoaded(WPARAM, LPARAM)  	InitMenuItems();
  	wchar_t ftpExe[MAX_PATH];
 -	if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe))) {
 +	if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILES, nullptr, SHGFP_TYPE_CURRENT, ftpExe))) {
  		wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe");
  		DWORD atr = GetFileAttributes(ftpExe);
  		if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY) {
  			#ifdef _WIN64
 -			if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, SHGFP_TYPE_CURRENT, ftpExe))) {
 +			if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILESX86, nullptr, SHGFP_TYPE_CURRENT, ftpExe))) {
  				wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe");
  				atr = GetFileAttributes(ftpExe);
  				if (!(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY))
 @@ -246,11 +246,11 @@ extern "C" int __declspec(dllexport) Load(void)  	mir_getLP(&pluginInfo);
  	pcli = Clist_GetInterface();
 -	hTaskMainMenu = NULL;
 +	hTaskMainMenu = nullptr;
  	DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
 -	hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
 -	hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
 +	hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS);
 +	hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE);
  	CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowContactHistory);
  	CreateServiceFunction(MS_HISTORY_DELETEALLCONTACTHISTORY, HistoryWindow::DeleteAllUserHistory);
 @@ -271,16 +271,16 @@ extern "C" int __declspec(dllexport) Unload(void)  {
  	if (g_hMainThread)
  		CloseHandle(g_hMainThread);
 -	g_hMainThread = NULL;
 +	g_hMainThread = nullptr;
  	HistoryWindow::Deinit();
  	DestroyCursor(hCurSplitNS);
  	DestroyCursor(hCurSplitWE);
 -	if (Options::instance != NULL) {
 +	if (Options::instance != nullptr) {
  		delete Options::instance;
 -		Options::instance = NULL;
 +		Options::instance = nullptr;
  	}
  	delete[] hEventIcons;
 diff --git a/plugins/BasicHistory/src/BinaryExport.cpp b/plugins/BasicHistory/src/BinaryExport.cpp index 619a9de152..bc67e95756 100644 --- a/plugins/BasicHistory/src/BinaryExport.cpp +++ b/plugins/BasicHistory/src/BinaryExport.cpp @@ -52,9 +52,9 @@ BinaryExport::~BinaryExport()  void BinaryExport::WriteString(const std::wstring &str)
  {
 -	int conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL);
 +	int conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, nullptr, 0, nullptr, nullptr);
  	char* buf = new char[conv];
 -	conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, buf, conv, NULL, NULL);
 +	conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, buf, conv, nullptr, nullptr);
  	EXP_FILE.write(buf, conv);
  	delete[] buf;
  }
 @@ -95,7 +95,7 @@ bool BinaryExport::ReadString(std::wstring &str)  	if (totalSize == 0)
  		return true;
 -	int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, NULL, 0);
 +	int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, nullptr, 0);
  	str.resize(sizeW);
  	MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, (wchar_t*)str.c_str(), sizeW);
  	return true;
 diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 7c8f5af157..c21a030abe 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -58,11 +58,11 @@ DatExport::~DatExport()  int DatExport::WriteString(const std::wstring &str)
  {
 -	int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL);
 +	int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, nullptr, 0, nullptr, nullptr);
  	if (conv > (int)memBuf.size())
  		memBuf.resize(conv);
 -	conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, (char*)memBuf.c_str(), conv, NULL, NULL);
 +	conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, (char*)memBuf.c_str(), conv, nullptr, nullptr);
  	return conv;
  }
 diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 9378fab352..460fcddac0 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -30,9 +30,9 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true);  std::wstring GetName(const std::wstring &path);
  HistoryEventList::HistoryEventList() :
 -	m_hWnd(NULL),
 +	m_hWnd(nullptr),
  	m_isWnd(false),
 -	m_hContact(NULL),
 +	m_hContact(0),
  	m_deltaTime(0),
  	m_isFlat(false),
  	m_useImportedMessages(true)
 @@ -42,7 +42,7 @@ HistoryEventList::HistoryEventList() :  }
  HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter) :
 -	m_hWnd(NULL),
 +	m_hWnd(nullptr),
  	m_isWnd(false),
  	m_hContact(_hContact),
  	m_deltaTime(0),
 @@ -242,7 +242,7 @@ void HistoryEventList::RefreshEventList()  			if (it != m_contactFileMap.end()) {
  				ExportManager imp(m_hWnd, m_hContact, 1);
  				imp.SetAutoImport(it->second.file);
 -				if (!imp.Import(it->second.type, messages, NULL))
 +				if (!imp.Import(it->second.type, messages, nullptr))
  					messages.clear();
  			}
  		}
 @@ -310,7 +310,7 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, wchar_t *strFind, Comp  			if (it != m_contactFileMap.end()) {
  				ExportManager imp(m_hWnd, hContact, 1);
  				imp.SetAutoImport(it->second.file);
 -				if (!imp.Import(it->second.type, messages, NULL))
 +				if (!imp.Import(it->second.type, messages, nullptr))
  					messages.clear();
  			}
  		}
 @@ -364,7 +364,7 @@ void HistoryEventList::AddGroup(const EventIndex& ev)  	wchar_t eventText[256];
  	int i;
  	eventText[0] = 0;
 -	TimeZone_PrintTimeStamp(NULL, data.timestamp, L"d t", eventText, 64, 0);
 +	TimeZone_PrintTimeStamp(nullptr, data.timestamp, L"d t", eventText, 64, 0);
  	std::wstring time = eventText;
  	std::wstring user;
  	if (data.isMe)
 @@ -404,9 +404,9 @@ inline std::wstring GetProtocolName(MCONTACT hContact)  {
  	char* ac = Proto_GetBaseAccountName(hContact);
  	std::wstring proto1;
 -	if (ac != NULL) {
 +	if (ac != nullptr) {
  		PROTOACCOUNT* acnt = Proto_GetAccount(ac);
 -		if (acnt != NULL && acnt->szModuleName != NULL) {
 +		if (acnt != nullptr && acnt->szModuleName != nullptr) {
  			wchar_t* proto = mir_a2u(acnt->szProtoName);
  			proto1 = proto;
  			mir_free(proto);
 @@ -424,7 +424,7 @@ std::wstring HistoryEventList::GetProtocolName()  std::string HistoryEventList::GetBaseProtocol()
  {
  	char* proto = GetContactProto(m_hContact);
 -	return proto == NULL ? "" : proto;
 +	return proto == nullptr ? "" : proto;
  }
  std::wstring HistoryEventList::GetMyId()
 @@ -511,9 +511,9 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage>  			// For now I do not convert event data from string to blob, and event type must be message to handle it properly
  			dbei.eventType = EVENTTYPE_MESSAGE;
  			UINT cp = dbei.flags & DBEF_UTF ? CP_UTF8 : CP_ACP;
 -			dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, NULL, 0, NULL, NULL);
 +			dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, nullptr, 0, nullptr, nullptr);
  			char* buf = new char[dbei.cbBlob];
 -			dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, NULL, NULL);
 +			dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, nullptr, nullptr);
  			dbei.pBlob = (PBYTE)buf;
  			db_event_add(m_hContact, &dbei);
  			delete[] buf;
 @@ -564,12 +564,12 @@ void HistoryEventList::GetExtEventDBei(const EventIndex& ev)  HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev)
  {
  	if (ev.isExternal)
 -		return NULL;
 +		return nullptr;
  	HICON ico = DbEvent_GetIcon(&m_dbei, LR_SHARED);
  	HICON icoMsg = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
  	if (icoMsg == ico)
 -		return NULL;
 +		return nullptr;
  	return ico;
  }
 @@ -614,7 +614,7 @@ void HistoryEventList::Init()  	m_contactFileDir = temp;
  	m_contactFileDir += L"BasicHistoryImportDir\\";
  	DeleteDirectory(m_contactFileDir.c_str());
 -	CreateDirectory(m_contactFileDir.c_str(), NULL);
 +	CreateDirectory(m_contactFileDir.c_str(), nullptr);
  }
  int HistoryEventList::GetContactMessageNumber(MCONTACT hContact)
 diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 820abcf64b..111a813ed7 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -90,7 +90,7 @@ std::wstring ReplaceExt(const std::wstring& file, const wchar_t* ext)  bool ExportManager::Export(IExport::ExportType type)
  {
 -	m_exp = NULL;
 +	m_exp = nullptr;
  	UINT cp;
  	std::wstring encoding;
  	bool isBin = false;
 @@ -180,7 +180,7 @@ bool ExportManager::Export(IExport::ExportType type)  const wchar_t* ExportManager::GetExt(IImport::ImportType type)
  {
 -	IImport *imp = NULL;
 +	IImport *imp = nullptr;
  	switch (type) {
  	case IImport::Binary:
  		imp = new BinaryExport();
 @@ -199,7 +199,7 @@ const wchar_t* ExportManager::GetExt(IImport::ImportType type)  int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>& contacts)
  {
 -	IImport *imp = NULL;
 +	IImport *imp = nullptr;
  	switch (type) {
  	case IImport::Binary:
  		imp = new BinaryExport();
 @@ -238,7 +238,7 @@ int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>&  bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err, bool* differentContact, std::vector<MCONTACT>* contacts)
  {
 -	IImport *imp = NULL;
 +	IImport *imp = nullptr;
  	switch (type) {
  	case IImport::Binary:
  		imp = new BinaryExport();
 @@ -269,10 +269,10 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern  	int contInFile = imp->IsContactInFile(v);
  	if (contInFile == -1) {
  		ret = false;
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("File does not contain selected contact");
 -		if (contacts != NULL && differentContact != NULL) {
 +		if (contacts != nullptr && differentContact != nullptr) {
  			contInFile = imp->IsContactInFile(*contacts);
  			if (contInFile >= 0) {
  				*differentContact = true;
 @@ -282,12 +282,12 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern  	}
  	else if (contInFile == 0 || contInFile == -3) {
  		ret = imp->GetEventList(eventList);
 -		if (!ret && err != NULL)
 +		if (!ret && err != nullptr)
  			*err = TranslateT("File is corrupted");
  	}
  	else {
  		ret = false;
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("File is corrupted");
  	}
  	stream->close();
 @@ -298,7 +298,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern  void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int)
  {
 -	if (m_exp == NULL)
 +	if (m_exp == nullptr)
  		return;
  	m_exp->WriteGroup(isMe, time, user, eventText);
 @@ -371,7 +371,7 @@ void ExportManager::DeleteExportedEvents()  void ExportManager::SetDeleteWithoutExportEvents(int deltaTime, DWORD now)
  {
 -	m_exp = NULL;
 +	m_exp = nullptr;
  	m_deltaTime = deltaTime;
  	m_now = now;
  	RefreshEventList();
 diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index b12eafe799..f24c7792c3 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -44,22 +44,22 @@ HistoryWindow::HistoryWindow(MCONTACT hContact) :  	splitterOrgY(0),
  	splitterX(0),
  	splitterOrgX(0),
 -	plusIco(NULL),
 -	minusIco(NULL),
 -	findNextIco(NULL),
 -	findPrevIco(NULL),
 -	configIco(NULL),
 -	deleteIco(NULL),
 +	plusIco(nullptr),
 +	minusIco(nullptr),
 +	findNextIco(nullptr),
 +	findPrevIco(nullptr),
 +	configIco(nullptr),
 +	deleteIco(nullptr),
  	isContactList(false),
  	isLoading(false),
  	isGroupImages(false),
  	allIconNumber(0),
 -	eventIcons(NULL),
 -	bkBrush(NULL),
 -	bkFindBrush(NULL),
 +	eventIcons(nullptr),
 +	bkBrush(nullptr),
 +	bkFindBrush(nullptr),
  	hSystem(NULL),
 -	splitterXhWnd(NULL),
 -	splitterYhWnd(NULL),
 +	splitterXhWnd(nullptr),
 +	splitterYhWnd(nullptr),
  	isStartSelect(true)
  {
  	searcher.SetContect(this);
 @@ -78,36 +78,36 @@ HistoryWindow::HistoryWindow(MCONTACT hContact) :  HistoryWindow::~HistoryWindow()
  {
 -	if (eventIcons != NULL) {
 +	if (eventIcons != nullptr) {
  		for (int i = 0; i < iconsNum; ++i)
 -			if (eventIcons[i] != NULL)
 +			if (eventIcons[i] != nullptr)
  				IcoLib_ReleaseIcon(eventIcons[i]);
  		delete[] eventIcons;
  	}
 -	if (plusIco != NULL)
 +	if (plusIco != nullptr)
  		IcoLib_ReleaseIcon(plusIco);
 -	if (minusIco != NULL)
 +	if (minusIco != nullptr)
  		IcoLib_ReleaseIcon(minusIco);
 -	if (findNextIco != NULL)
 +	if (findNextIco != nullptr)
  		IcoLib_ReleaseIcon(findNextIco);
 -	if (findPrevIco != NULL)
 +	if (findPrevIco != nullptr)
  		IcoLib_ReleaseIcon(findPrevIco);
 -	if (himlSmall != NULL)
 +	if (himlSmall != nullptr)
  		ImageList_Destroy(himlSmall);
 -	if (himlNone != NULL)
 +	if (himlNone != nullptr)
  		ImageList_Destroy(himlNone);
 -	if (bkBrush != NULL)
 +	if (bkBrush != nullptr)
  		DeleteObject(bkBrush);
 -	if (bkFindBrush != NULL)
 +	if (bkFindBrush != nullptr)
  		DeleteObject(bkFindBrush);
  }
 @@ -235,7 +235,7 @@ void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow)  void HistoryWindow::Show()
  {
 -	CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryWindow::DlgProcHistory, (LPARAM)this);
 +	CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryWindow::DlgProcHistory, (LPARAM)this);
  }
  void HistoryWindow::Focus()
 @@ -264,10 +264,10 @@ int HistoryWindow::FontsChanged(WPARAM, LPARAM)  void HistoryWindow::FontsChanged()
  {
 -	if (bkBrush != NULL)
 +	if (bkBrush != nullptr)
  		DeleteObject(bkBrush);
 -	if (bkFindBrush != NULL)
 +	if (bkFindBrush != nullptr)
  		DeleteObject(bkFindBrush);
  	bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground));
 @@ -281,8 +281,8 @@ void HistoryWindow::FontsChanged()  	LOGFONT font;
  	ListView_SetTextColor(listWindow, Options::instance->GetFont(Options::GroupList, &font));
 -	InvalidateRect(listWindow, NULL, TRUE);
 -	InvalidateRect(m_hWnd, NULL, TRUE);
 +	InvalidateRect(listWindow, nullptr, TRUE);
 +	InvalidateRect(m_hWnd, nullptr, TRUE);
  	SelectEventGroup(selected);
  }
 @@ -359,7 +359,7 @@ void HistoryWindow::OptionsSearchingChanged()  INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)
  {
 -	HWND hWnd = NULL;
 +	HWND hWnd = nullptr;
  	int count = HistoryEventList::GetContactMessageNumber(hContact);
  	if (!count)
  		return FALSE;
 @@ -367,7 +367,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)  	for (auto it = windows.begin(); it != windows.end(); ++it) {
  		if (!it->second->isDestroyed) {
  			if (it->second->m_hContact == hContact) {
 -				if (hWnd == NULL) {
 +				if (hWnd == nullptr) {
  					hWnd = it->second->m_hWnd;
  				}
  				else if (GetForegroundWindow() == it->second->m_hWnd) {
 @@ -380,7 +380,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)  	for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
  		if (!(*it)->isDestroyed) {
  			if ((*it)->m_hContact == hContact) {
 -				if (hWnd == NULL)
 +				if (hWnd == nullptr)
  					hWnd = (*it)->m_hWnd;
  				else if (GetForegroundWindow() == (*it)->m_hWnd)
  					hWnd = (*it)->m_hWnd;
 @@ -535,7 +535,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP  			DlgReturn(TRUE);
  		case IDM_CONFIG:
 -			Options_Open(NULL, LPGENW("History"));
 +			Options_Open(nullptr, LPGENW("History"));
  			DlgReturn(TRUE);
  		case IDM_DELETE:
 @@ -576,7 +576,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP  		switch (pNmhdr->idFrom) {
  		case IDC_LIST_CONTACTS:
  			if (pNmhdr->code == CLN_LISTREBUILT) {
 -				if (historyWindow != NULL)
 +				if (historyWindow != nullptr)
  					historyWindow->ReloadContacts();
  				DlgReturn(TRUE);
 @@ -646,7 +646,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP  						SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg);
  					HMENU hPopupMenu = CreatePopupMenu();
 -					if (hPopupMenu != NULL) {
 +					if (hPopupMenu != nullptr) {
  						if (chf.dwEffects & CFE_LINK) {
  							AppendMenu(hPopupMenu, MF_STRING, IDM_OPENNEW, TranslateT("Open in &new window"));
  							AppendMenu(hPopupMenu, MF_STRING, IDM_OPENEXISTING, TranslateT("&Open in existing window"));
 @@ -655,14 +655,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP  						else {
  							AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy"));
  							AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete"));
 -							AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
 +							AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
  							AppendMenu(hPopupMenu, MF_STRING, IDM_MESSAGE, TranslateT("Send Message"));
  							AppendMenu(hPopupMenu, MF_STRING, IDM_QUOTE, TranslateT("Reply &Quoted"));
  							AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
  							AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
  						}
 -						int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, 0);
 +						int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, nullptr);
  						switch (selected) {
  						case IDM_COPY:
  							if (chrg.cpMax == chrg.cpMin && historyWindow->currentGroup.size() > 0) {
 @@ -831,14 +831,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP  				if (newSel >= 0) {
  					HMENU hPopupMenu = CreatePopupMenu();
 -					if (hPopupMenu != NULL) {
 +					if (hPopupMenu != nullptr) {
  						AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy"));
  						AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
 -						AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
 +						AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
  						AppendMenu(hPopupMenu, MF_STRING, IDM_MESSAGE, TranslateT("Send Message"));
  						AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
 -						int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, 0);
 +						int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, nullptr);
  						switch (selected) {
  						case IDM_COPY:
  							{
 @@ -1073,8 +1073,8 @@ void HistoryWindow::Initialise()  	SetDefFilter(Options::instance->defFilter);
 -	InvalidateRect(listWindow, NULL, TRUE);
 -	InvalidateRect(m_hWnd, NULL, TRUE);
 +	InvalidateRect(listWindow, nullptr, TRUE);
 +	InvalidateRect(m_hWnd, nullptr, TRUE);
  	SendMessage(m_hWnd, DM_SETDEFID, IDM_FIND, 0);
  	SendMessage(m_hWnd, WM_SIZE, 0, 0);
  	SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
 @@ -1306,7 +1306,7 @@ void HistoryWindow::SelectEventGroup(int sel)  	SendMessage(editWindow, EM_SETREADONLY, FALSE, 0);
  	TextDocument->Freeze(&cnt);
  	TextDocument->GetSelection(&TextSelection);
 -	HDC hDC = GetDC(NULL);
 +	HDC hDC = GetDC(nullptr);
  	int caps = GetDeviceCaps(hDC, LOGPIXELSY);
  	std::deque<EventIndex> revDeq;
  	std::deque<EventIndex> &deq = m_eventList[sel];
 @@ -1338,7 +1338,7 @@ void HistoryWindow::SelectEventGroup(int sel)  					ico = eventIcons[imId];
  				else {
  					ico = GetEventCoreIcon(hDbEvent);
 -					if (ico == NULL)
 +					if (ico == nullptr)
  						ico = eventIcons[imId];
  				}
 @@ -1429,7 +1429,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM  {
  	HWND hwndParent = GetParent(hwnd);
  	HistoryWindow *dat = (HistoryWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
 -	if (dat == NULL)
 +	if (dat == nullptr)
  		return FALSE;
  	switch (msg) {
 @@ -1462,7 +1462,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM  	case WM_LBUTTONUP:
  		ReleaseCapture();
  		SendMessage(hwndParent, WM_SIZE, 0, 0);
 -		RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
 +		RedrawWindow(hwndParent, nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
  		return 0;
  	}
 @@ -1497,21 +1497,21 @@ void HistoryWindow::ReloadContacts()  	}
  	for (MCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) {
 -		if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || !db_mc_isSub(_hContact))) {
 +		if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == nullptr || !db_mc_isSub(_hContact))) {
  			HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
 -			if (hItem == NULL)
 +			if (hItem == nullptr)
  				SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)_hContact, 0);
  		}
  		else {
  			HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
 -			if (hItem != NULL)
 +			if (hItem != nullptr)
  				SendMessage(contactList, CLM_DELETEITEM, (WPARAM)_hContact, 0);
  		}
  	}
  	if (m_hContact != NULL) {
  		HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, m_hContact, 0);
 -		if (hItem != NULL) {
 +		if (hItem != nullptr) {
  			SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
  			SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
  		}
 @@ -1656,17 +1656,17 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)  	SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
  	MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
  	HMENU hPopupMenu = CreatePopupMenu();
 -	if (hPopupMenu != NULL) {
 +	if (hPopupMenu != nullptr) {
  		AppendMenu(hPopupMenu, MF_STRING, IDM_FINDNEXT, TranslateT("Find Next"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_FINDPREV, TranslateT("Find Previous"));
 -		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
 +		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
  		AppendMenu(hPopupMenu, searcher.IsMatchCase() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_MATCHCASE, TranslateT("Match Case"));
  		AppendMenu(hPopupMenu, searcher.IsMatchWholeWords() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_MATCHWHOLE, TranslateT("Match Whole Word"));
  		AppendMenu(hPopupMenu, searcher.IsOnlyIn() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYIN, TranslateT("Only Incoming Messages"));
  		AppendMenu(hPopupMenu, searcher.IsOnlyOut() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYOUT, TranslateT("Only Outgoing Messages"));
  		AppendMenu(hPopupMenu, searcher.IsOnlyGroup() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYGROUP, TranslateT("Only Selected Group"));
  		AppendMenu(hPopupMenu, searcher.IsAllUsers() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ALLUSERS, TranslateT("All Contacts"));
 -		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
 +		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
  		HMENU hFilterMenu = CreatePopupMenu();
  		int filter = GetFilterNr();
  		AppendMenu(hFilterMenu, filter == 0 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERDEF, TranslateT("Default history events"));
 @@ -1684,7 +1684,7 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)  		else
  			SetMenuDefaultItem(hPopupMenu, IDM_FINDNEXT, FALSE);
 -		int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
 +		int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr);
  		switch (iResult) {
  		case IDM_FINDNEXT:
  			searcher.ChangeFindDirection(false);
 @@ -1737,12 +1737,12 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB)  	SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
  	MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
  	HMENU hPopupMenu = CreatePopupMenu();
 -	if (hPopupMenu != NULL) {
 +	if (hPopupMenu != nullptr) {
  		AppendMenu(hPopupMenu, MF_STRING, IDM_OPTIONS, TranslateT("Options"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_FONTS, TranslateT("Fonts and colors"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_ICONS, TranslateT("Icons"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_HOTKEYS, TranslateT("Hotkeys"));
 -		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
 +		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
  		HMENU hExportMenu = CreatePopupMenu();
  		AppendMenu(hExportMenu, MF_STRING, IDM_EXPORTRHTML, TranslateT("Rich Html"));
 @@ -1758,12 +1758,12 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB)  		AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hExportMenu, TranslateT("Export"));
  		AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hImportMenu, TranslateT("Import"));
 -		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL);
 +		AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr);
  		AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOS, TranslateT("Save window position as default"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOSALL, TranslateT("Save window position for all contacts"));
  		SetMenuDefaultItem(hPopupMenu, IDM_OPTIONS, FALSE);
 -		int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
 +		int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr);
  		switch (iResult) {
  		case IDM_OPTIONS:
  			SendMessage(m_hWnd, WM_COMMAND, IDM_CONFIG, 0);
 @@ -1871,13 +1871,13 @@ void HistoryWindow::DeleteToolbarClicked(LPNMTOOLBAR lpnmTB)  	SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
  	MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
  	HMENU hPopupMenu = CreatePopupMenu();
 -	if (hPopupMenu != NULL) {
 +	if (hPopupMenu != nullptr) {
  		AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
  		AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
  		SetMenuDefaultItem(hPopupMenu, IDM_DELETE, FALSE);
 -		int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
 +		int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr);
  		switch (iResult) {
  		case IDM_DELETE:
  			Delete(0);
 @@ -2016,7 +2016,7 @@ void HistoryWindow::FormatQuote(std::wstring "e, const MessageData &md, cons  	else
  		quote += m_contactName;
  	wchar_t str[32];
 -	TimeZone_PrintTimeStamp(NULL, md.timestamp, L"d t", str, 32, 0);
 +	TimeZone_PrintTimeStamp(nullptr, md.timestamp, L"d t", str, 32, 0);
  	quote += L", ";
  	quote += str;
  	quote += L"\n";
 @@ -2090,7 +2090,7 @@ void HistoryWindow::SelectContact(MCONTACT hContact)  		HWND contactList = GetDlgItem(m_hWnd, IDC_LIST_CONTACTS);
  		if (hContact != NULL) {
  			HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, hContact, 0);
 -			if (hItem != NULL) {
 +			if (hItem != nullptr) {
  				SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
  				SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
  			}
 diff --git a/plugins/BasicHistory/src/ImageDataObject.cpp b/plugins/BasicHistory/src/ImageDataObject.cpp index d0cbc85843..481c91f8de 100644 --- a/plugins/BasicHistory/src/ImageDataObject.cpp +++ b/plugins/BasicHistory/src/ImageDataObject.cpp @@ -28,15 +28,15 @@ HBITMAP CacheIconToBMP(HICON hIcon, COLORREF backgroundColor, int sizeX, int siz  	rc.top = rc.left = 0;
  	rc.right = sizeY;
  	rc.bottom = sizeX;
 -	HDC hdc = GetDC(0);
 +	HDC hdc = GetDC(nullptr);
  	HBITMAP hBmp = CreateCompatibleBitmap(hdc, sizeY, sizeX);
  	HDC hdcMem = CreateCompatibleDC(hdc);
  	HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
  	FillRect(hdcMem, &rc, hBkgBrush);
 -	DrawIconEx(hdcMem, 0, 0, hIcon, sizeY, sizeX, 0, NULL, DI_NORMAL);
 +	DrawIconEx(hdcMem, 0, 0, hIcon, sizeY, sizeX, 0, nullptr, DI_NORMAL);
  	SelectObject(hdcMem, hoBmp);
  	DeleteDC(hdcMem);
 -	ReleaseDC(NULL, hdc);
 +	ReleaseDC(nullptr, hdc);
  	DeleteObject(hBkgBrush);
  	return hBmp;
  }
 @@ -72,8 +72,8 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)  	// Initialize a Storage Object
  	//
 -	LPLOCKBYTES lpLockBytes = NULL;
 -	SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
 +	LPLOCKBYTES lpLockBytes = nullptr;
 +	SCODE sc = ::CreateILockBytesOnHGlobal(nullptr, TRUE, &lpLockBytes);
  	if (sc != S_OK) {
  		pOleClientSite->Release();
  		return false;
 @@ -82,7 +82,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)  	IStorage *pStorage;
  	sc = ::StgCreateDocfileOnILockBytes(lpLockBytes, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
  	if (sc != S_OK) {
 -		lpLockBytes = NULL;
 +		lpLockBytes = nullptr;
  		pOleClientSite->Release();
  		return false;
  	}
 @@ -90,7 +90,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)  	//
  	IOleObject *pOleObject;
  	pOleObject = pods->GetOleObject(pOleClientSite, pStorage);
 -	if (pOleObject == NULL) {
 +	if (pOleObject == nullptr) {
  		pStorage->Release();
  		pOleClientSite->Release();
  		return false;
 @@ -142,11 +142,11 @@ void ImageDataObject::SetBitmap(HBITMAP hBitmap)  	STGMEDIUM stgm;
  	stgm.tymed = TYMED_GDI;                 // Storage medium = HBITMAP handle
  	stgm.hBitmap = hBitmap;
 -	stgm.pUnkForRelease = NULL;       // Use ReleaseStgMedium
 +	stgm.pUnkForRelease = nullptr;       // Use ReleaseStgMedium
  	FORMATETC fm;
  	fm.cfFormat = CF_BITMAP;                // Clipboard format = CF_BITMAP
 -	fm.ptd = NULL;                              // Target Device = Screen
 +	fm.ptd = nullptr;                              // Target Device = Screen
  	fm.dwAspect = DVASPECT_CONTENT; // Level of detail = Full content
  	fm.lindex = -1;                             // Index = Not applicaple
  	fm.tymed = TYMED_GDI;                     // Storage medium = HBITMAP handle
 @@ -160,6 +160,6 @@ IOleObject *ImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStora  	IOleObject *pOleObject;
  	SCODE sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, &m_format, pOleClientSite, pStorage, (void **)& pOleObject);
  	if (sc != S_OK)
 -		pOleObject = NULL;
 +		pOleObject = nullptr;
  	return pOleObject;
  }
 diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 61b0da8e06..cb54dcad5d 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -207,24 +207,24 @@ static ColorOptionsList g_ColorOptionsList[] = {  static HotkeyOptionsList g_HotkeyOptionsList[] = {
  	{ "basichistory_hot_showall", LPGENW("Open global history"), LPGENW("History"), MS_HISTORY_SHOWCONTACTHISTORY, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'H') | HKF_MIRANDA_LOCAL, 0 },
 -	{ "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), 0, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND },
 -	{ "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), 0, VK_F3, HISTORY_HK_FINDNEXT },
 -	{ "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), 0, VK_F2, HISTORY_HK_FINDPREV },
 -	{ "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHCASE },
 -	{ "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHWHOLE },
 -	{ "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_SHOWCONTACTS },
 -	{ "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYIN },
 -	{ "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYOUT },
 -	{ "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYGROUP },
 -	{ "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_ALLCONTACTS },
 -	{ "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), 0, VK_DELETE, HISTORY_HK_DELETE },
 -	{ "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXRHTML },
 -	{ "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXPHTML },
 -	{ "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), 0, 0, HISTORY_HK_EXTXT },
 -	{ "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), 0, 0, HISTORY_HK_EXBIN },
 -	{ "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), 0, 0, HISTORY_HK_IMPBIN },
 -	{ "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_EXDAT },
 -	{ "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_IMPDAT },
 +	{ "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND },
 +	{ "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), nullptr, VK_F3, HISTORY_HK_FINDNEXT },
 +	{ "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), nullptr, VK_F2, HISTORY_HK_FINDPREV },
 +	{ "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), nullptr, 0, HISTORY_HK_MATCHCASE },
 +	{ "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), nullptr, 0, HISTORY_HK_MATCHWHOLE },
 +	{ "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), nullptr, 0, HISTORY_HK_SHOWCONTACTS },
 +	{ "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYIN },
 +	{ "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYOUT },
 +	{ "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYGROUP },
 +	{ "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), nullptr, 0, HISTORY_HK_ALLCONTACTS },
 +	{ "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), nullptr, VK_DELETE, HISTORY_HK_DELETE },
 +	{ "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXRHTML },
 +	{ "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXPHTML },
 +	{ "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXTXT },
 +	{ "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXBIN },
 +	{ "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), nullptr, 0, HISTORY_HK_IMPBIN },
 +	{ "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXDAT },
 +	{ "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), nullptr, 0, HISTORY_HK_IMPDAT },
  };
  const int g_fontsSize = _countof(g_FontOptionsList);
 @@ -237,7 +237,7 @@ void Options::Load(void)  {
  	FontIDW fid = { 0 };
  	ColourIDW cid = { 0 };
 -	HOTKEYDESC hid = { 0 };
 +	HOTKEYDESC hid = {};
  	fid.cbSize = sizeof(FontIDW);
  	cid.cbSize = sizeof(ColourIDW);
  	strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE);
 @@ -335,7 +335,7 @@ void Options::Load(void)  			while (eventsV.pszVal[k]) {
  				if (eventsV.pszVal[k] == ';') {
  					eventsV.pszVal[k] = 0;
 -					fo.events.push_back(strtol(id, NULL, 16));
 +					fo.events.push_back(strtol(id, nullptr, 16));
  					id = eventsV.pszVal + k + 1;
  				}
 @@ -729,7 +729,7 @@ int GetEventCB(HWND hwndCB, bool errorReport, int &eventId)  	if (selCpIdx < 0) {
  		wchar_t text[24];
  		ComboBox_GetText(hwndCB, text, 24);
 -		wchar_t * stopOn = NULL;
 +		wchar_t * stopOn = nullptr;
  		long cp = wcstol(text, &stopOn, 10);
  		if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0)) {
  			MessageBox(GetParent(hwndCB), TranslateT("Invalid event number"), TranslateT("Error"), MB_OK | MB_ICONERROR);
 @@ -1300,7 +1300,7 @@ unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int, const st  			name = str.substr(pos + 1);
  		}
 -		wchar_t * stopOn = NULL;
 +		wchar_t * stopOn = nullptr;
  		long cp = wcstol(text, &stopOn, 10);
  		if ((pos >= str.length() || name.empty() || stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) {
  			if (errorReport) {
 @@ -1569,7 +1569,7 @@ void SaveList(HWND hwnd, MCONTACT hSystem, TaskOptions* to)  	}
  }
 -bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL);
 +bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr);
  #ifndef LOCALE_SSHORTTIME
  #define LOCALE_SSHORTTIME             0x00000079
 @@ -1808,7 +1808,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,  					break;
  				}
 -				toCp.lastExport = time(NULL);
 +				toCp.lastExport = time(nullptr);
  				*to = toCp;
  				EndDialog(hwndDlg, IDOK);
 diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp index 1f00085b7a..b3eb92f664 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.cpp +++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp @@ -25,7 +25,7 @@ PlainHtmlExport::~PlainHtmlExport()  {
  }
 -extern std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = NULL);
 +extern std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = nullptr);
  extern std::wstring UrlHighlightHtml(const std::wstring& message, bool& isUrl);
  void PlainHtmlExport::WriteHeader(const std::wstring&, const std::wstring &filterName, const std::wstring &myName, const std::wstring &myId, const std::wstring &name1, const std::wstring &proto1, const std::wstring &id1, const std::string&, const std::wstring& encoding)
 diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 125aa51a5d..68ab4257b9 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -29,7 +29,7 @@ RichHtmlExport::~RichHtmlExport()  extern HINSTANCE hInst;
  extern bool g_SmileyAddAvail;
 -std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = NULL)
 +std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = nullptr)
  {
  	std::wstring ret;
  	std::wstring search = L"&<>\t\r\n";
 @@ -57,7 +57,7 @@ std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<si  		}
  		start = find + 1;
 -		if (positionMap != NULL) {
 +		if (positionMap != nullptr) {
  			size_t len = ret.length() - start - currentAdd;
  			if (len != 0) {
  				positionMap->push(std::pair<size_t, size_t>(start + currentAdd, len));
 @@ -123,12 +123,12 @@ std::wstring GetName(const std::wstring &path)  void ExtractFile(short int iRes, const std::wstring &fileName)
  {
  	HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(iRes), MAKEINTRESOURCE(CUSTOMRES));
 -	if (rSrc != NULL) {
 +	if (rSrc != nullptr) {
  		HGLOBAL res = LoadResource(hInst, rSrc);
  		int size = SizeofResource(hInst, rSrc);
 -		if (res != NULL) {
 +		if (res != nullptr) {
  			char* resData = (char*)LockResource(res);
 -			if (resData != NULL) {
 +			if (resData != nullptr) {
  				std::ofstream stream(fileName.c_str(), std::ios_base::binary);
  				if (stream.is_open()) {
  					stream.write(resData, size);
 @@ -196,13 +196,13 @@ void IcoSave(const std::wstring &fileName, HICON hicon)  		MYBITMAPINFO info1 = { 0 };
  		MYBITMAPINFO info2 = { 0 };
 -		HDC hDC = CreateCompatibleDC(NULL);
 +		HDC hDC = CreateCompatibleDC(nullptr);
  		info1.bmiHeader.biSize = sizeof(info1.bmiHeader);
  		info1.bmiHeader.biWidth = bmiColor.bmWidth;
  		info1.bmiHeader.biHeight = bmiColor.bmHeight;
  		info1.bmiHeader.biPlanes = 1;
  		info1.bmiHeader.biBitCount = bmiColor.bmBitsPixel;
 -		unsigned int size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, NULL, (BITMAPINFO*)&info1, DIB_RGB_COLORS);
 +		unsigned int size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, nullptr, (BITMAPINFO*)&info1, DIB_RGB_COLORS);
  		char* bits1 = new char[info1.bmiHeader.biSizeImage];
  		size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, bits1, (BITMAPINFO*)&info1, DIB_RGB_COLORS);
  		info2.bmiHeader.biSize = sizeof(info2.bmiHeader);
 @@ -210,7 +210,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon)  		info2.bmiHeader.biHeight = bmiMask.bmHeight;
  		info2.bmiHeader.biPlanes = 1;
  		info2.bmiHeader.biBitCount = bmiMask.bmBitsPixel;
 -		size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, NULL, (BITMAPINFO*)&info2, DIB_RGB_COLORS);
 +		size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, nullptr, (BITMAPINFO*)&info2, DIB_RGB_COLORS);
  		char* bits2 = new char[info2.bmiHeader.biSizeImage];
  		size = GetDIBits(hDC, hbmMask, 0, info2.bmiHeader.biHeight, bits2, (BITMAPINFO*)&info2, DIB_RGB_COLORS);
 @@ -263,18 +263,18 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true)  	pszFrom[len + 1] = 0;
  	SHFILEOPSTRUCT fileop;
 -	fileop.hwnd = NULL;    // no status display
 +	fileop.hwnd = nullptr;    // no status display
  	fileop.wFunc = FO_DELETE;  // delete operation
  	fileop.pFrom = pszFrom;  // source file name as double null terminated string
 -	fileop.pTo = NULL;    // no destination needed
 +	fileop.pTo = nullptr;    // no destination needed
  	fileop.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;  // do not prompt the user
  	if (!noRecycleBin)
  		fileop.fFlags |= FOF_ALLOWUNDO;
  	fileop.fAnyOperationsAborted = FALSE;
 -	fileop.lpszProgressTitle = NULL;
 -	fileop.hNameMappings = NULL;
 +	fileop.lpszProgressTitle = nullptr;
 +	fileop.hNameMappings = nullptr;
  	int ret = SHFileOperation(&fileop);
  	delete[] pszFrom;
 @@ -287,7 +287,7 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin  	folder = RemoveExt(fileName) + L"_files";
  	folderName = GetName(folder);
  	DeleteDirectory(folder.c_str());
 -	CreateDirectory(folder.c_str(), NULL);
 +	CreateDirectory(folder.c_str(), nullptr);
  	std::wstring css = folder + L"\\history.css";
  	BOOL cssCopied = FALSE;
  	if (!Options::instance->extCssHtml2.empty())
 @@ -410,14 +410,14 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg,  	SMADD_BATCHPARSE2 sp = { 0 };
  	SMADD_BATCHPARSERES *spr;
  	sp.cbSize = sizeof(sp);
 -	sp.Protocolname = baseProto.length() == 0 ? NULL : baseProto.c_str();
 +	sp.Protocolname = baseProto.length() == 0 ? nullptr : baseProto.c_str();
  	sp.str = msgbuf;
  	sp.flag = SAFL_TCHAR | SAFL_PATH | (isMe ? SAFL_OUTGOING : 0);
  	spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
  	delete[] msgbuf;
  	// Did not find a simley
 -	if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND)
 +	if (spr == nullptr || (INT_PTR)spr == CALLSERVICE_NOTFOUND)
  		return UrlHighlightHtml(MakeTextHtmled(msg), isUrl);
  	std::queue<std::pair<size_t, size_t> > positionMap;
 @@ -457,7 +457,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg,  		size_t size = endChar - startChar;
 -		if (spr[i].filepath != NULL) { // For deffective smileypacks
 +		if (spr[i].filepath != nullptr) { // For deffective smileypacks
  			// Add text
  			if (startChar - last_pos > 0) {
  				smileyMsg += newMsg.substr(last_pos, startChar - last_pos);
 diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index f0adc1f203..2601eeacfa 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.  extern HANDLE  g_hMainThread;
  bool bPopupsEnabled;
  bool DoTask(TaskOptions& to);
 -bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL);
 +bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr);
  std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, std::map<std::wstring, bool>& existingContacts, bool replaceContact);
  std::wstring GetDirectoryName(const std::wstring &path);
  std::wstring GetName(const std::wstring &path);
 @@ -37,7 +37,7 @@ time_t GetNextExportTime(TaskOptions& to);  void SchedulerThreadFunc(void*);
  volatile bool finishThread = false;
  bool initTask = false;
 -HANDLE hThread = NULL;
 +HANDLE hThread = nullptr;
  HANDLE hThreadEvent;
  time_t nextExportTime;
  void StartThread(bool init);
 @@ -99,15 +99,15 @@ int DoLastTask(WPARAM, LPARAM)  bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err, std::wstring* errDescr)
  {
  	if (to.taskName.empty()) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Name");
  		return false;
  	}
 -	if (top != NULL) {
 +	if (top != nullptr) {
  		for (std::list<TaskOptions>::iterator it = top->begin(); it != top->end(); ++it) {
  			if (it->taskName == to.taskName) {
 -				if (err != NULL)
 +				if (err != nullptr)
  					*err = TranslateT("Name");
  				return false;
  			}
 @@ -115,9 +115,9 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err  	}
  	if (!to.isSystem && to.contacts.size() == 0) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Contacts");
 -		if (errDescr != NULL)
 +		if (errDescr != nullptr)
  			*errDescr = TranslateT("At least one contact should be selected.");
  		return false;
  	}
 @@ -135,7 +135,7 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err  			}
  			if (filter < 2) {
 -				if (err != NULL)
 +				if (err != nullptr)
  					*err = TranslateT("Filter");
  				return false;
  			}
 @@ -143,7 +143,7 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err  			to.filterId = filter;
  		}
  		else if (to.filterId < 0) {
 -			if (err != NULL)
 +			if (err != nullptr)
  				*err = TranslateT("Filter");
  			return false;
  		}
 @@ -153,63 +153,63 @@ bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err  		return true;
  	if (!Options::FTPAvail() && to.useFtp) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Upload to FTP");
  		return false;
  	}
  	if (to.filePath.empty()) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Path to output file");
  		return false;
  	}
  	if (to.useFtp && to.ftpName.empty()) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Session name");
 -		if (errDescr != NULL)
 +		if (errDescr != nullptr)
  			*errDescr = TranslateT("To create session open WinSCP, click New Session, enter data and save with specific name. Remember if FTP server using password you should save it in WinSCP.");
  		return false;
  	}
  	if (to.useFtp && (to.filePath.find('\\') < to.filePath.length() || to.filePath.find(':') < to.filePath.length() || to.filePath[0] != L'/')) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Path to file");
 -		if (errDescr != NULL)
 +		if (errDescr != nullptr)
  			*errDescr = TranslateT("FTP path must contain '/' instead '\\' and start with '/'.");
  		return false;
  	}
  	if (isImportTask && to.filePath.find(L"<date>") < to.filePath.length()) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Path to file");
 -		if (errDescr != NULL)
 +		if (errDescr != nullptr)
  			*errDescr = TranslateT("FTP path cannot contain <date> in import task.");
  		return false;
  	}
  	if (!isImportTask && (to.exportType < IExport::RichHtml || to.exportType > IExport::Dat)) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Export to");
  		return false;
  	}
  	if (isImportTask && (to.importType < IImport::Binary || to.importType > IImport::Dat)) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Import from");
  		return false;
  	}
  	if ((to.trigerType == TaskOptions::Daily || to.trigerType == TaskOptions::Weekly || to.trigerType == TaskOptions::Monthly) && (to.dayTime < 0 || to.dayTime >= 24 * 60)) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Time");
  		return false;
  	}
  	if (to.trigerType == TaskOptions::Weekly && (to.dayOfWeek < 0 || to.dayOfWeek >= 7)) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Day of week");
  		return false;
  	}
  	if (to.trigerType == TaskOptions::Monthly && (to.dayOfMonth <= 0 || to.dayOfMonth >= 32)) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Day");
  		return false;
  	}
  	if ((to.trigerType == TaskOptions::DeltaMin || to.trigerType == TaskOptions::DeltaHour) && (to.deltaTime < 0 || to.deltaTime >= 10000)) {
 -		if (err != NULL)
 +		if (err != nullptr)
  			*err = TranslateT("Delta time");
  		return false;
  	}
 @@ -231,7 +231,7 @@ bool DoTask(TaskOptions& to)  {
  	std::wstring err;
  	std::wstring errDescr;
 -	if (!IsValidTask(to, NULL, &err, &errDescr)) {
 +	if (!IsValidTask(to, nullptr, &err, &errDescr)) {
  		wchar_t msg[256];
  		if (err.empty())
  			wcscpy_s(msg, TranslateT("Some value is invalid"));
 @@ -244,7 +244,7 @@ bool DoTask(TaskOptions& to)  		return true;
  	}
 -	DWORD now = time(NULL);
 +	DWORD now = time(nullptr);
  	long long int t = to.eventDeltaTime * 60;
  	if (to.eventUnit > TaskOptions::Minute)
  		t *= 60LL;
 @@ -260,20 +260,20 @@ bool DoTask(TaskOptions& to)  	std::list<ExportManager*> managers;
  	if (to.type == TaskOptions::Delete) {
  		if (to.isSystem) {
 -			ExportManager *exp = new ExportManager(NULL, NULL, to.filterId);
 +			ExportManager *exp = new ExportManager(nullptr, NULL, to.filterId);
  			exp->SetDeleteWithoutExportEvents(t, now);
  			managers.push_back(exp);
  		}
  		for (size_t i = 0; i < to.contacts.size(); ++i) {
 -			ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId);
 +			ExportManager *exp = new ExportManager(nullptr, to.contacts[i], to.filterId);
  			exp->SetDeleteWithoutExportEvents(t, now);
  			managers.push_back(exp);
  		}
  	}
  	else if (to.type == TaskOptions::Import || to.type == TaskOptions::ImportAndMarge) {
  		std::map<std::wstring, bool> existingContacts1;
 -		ExportManager mExp = ExportManager(NULL, NULL, 1);
 +		ExportManager mExp = ExportManager(nullptr, NULL, 1);
  		std::wstring filePath = to.filePath;
  		std::wstring dir;
  		std::list<std::wstring> files;
 @@ -292,7 +292,7 @@ bool DoTask(TaskOptions& to)  				dir = dir.substr(0, pos);
  			DeleteDirectory(dir.c_str());
 -			CreateDirectory(dir.c_str(), NULL);
 +			CreateDirectory(dir.c_str(), nullptr);
  		}
  		const wchar_t* ext = ExportManager::GetExt(to.importType);
 @@ -384,7 +384,7 @@ bool DoTask(TaskOptions& to)  					}
  					else {
  						std::vector<IImport::ExternalMessage> messages;
 -						if (mExp.Import(to.importType, messages, NULL)) {
 +						if (mExp.Import(to.importType, messages, nullptr)) {
  							mExp.MargeMessages(messages);
  							contactList.push_back(mExp.m_hContact);
  						}
 @@ -430,7 +430,7 @@ bool DoTask(TaskOptions& to)  		if (!to.useFtp && !to.compress) {
  			dir = GetDirectoryName(filePath);
  			if (!dir.empty())
 -				CreateDirectory(dir.c_str(), NULL);
 +				CreateDirectory(dir.c_str(), nullptr);
  		}
  		else {
  			filePath = GetName(filePath);
 @@ -446,11 +446,11 @@ bool DoTask(TaskOptions& to)  				dir = dir.substr(0, pos);
  			DeleteDirectory(dir.c_str());
 -			CreateDirectory(dir.c_str(), NULL);
 +			CreateDirectory(dir.c_str(), nullptr);
  			filePath = dir + L"\\" + filePath;
  		}
  		if (to.isSystem) {
 -			ExportManager *exp = new ExportManager(NULL, NULL, to.filterId);
 +			ExportManager *exp = new ExportManager(nullptr, NULL, to.filterId);
  			exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now);
  			exp->m_useImportedMessages = to.exportImported;
  			if (!exp->Export(to.exportType)) {
 @@ -472,7 +472,7 @@ bool DoTask(TaskOptions& to)  		if (!error) {
  			for (size_t i = 0; i < to.contacts.size(); ++i) {
 -				ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId);
 +				ExportManager *exp = new ExportManager(nullptr, to.contacts[i], to.filterId);
  				exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now);
  				exp->m_useImportedMessages = to.exportImported;
  				if (!exp->Export(to.exportType)) {
 @@ -503,7 +503,7 @@ bool DoTask(TaskOptions& to)  			if (!to.useFtp) {
  				zipDir = GetDirectoryName(zipFilePath);
  				if (!zipDir.empty())
 -					CreateDirectory(zipDir.c_str(), NULL);
 +					CreateDirectory(zipDir.c_str(), nullptr);
  			}
  			else {
  				zipFilePath = GetName(zipFilePath);
 @@ -514,7 +514,7 @@ bool DoTask(TaskOptions& to)  				zipDir += L"zip<date>";
  				zipDir = GetFileName(zipDir, L"", existingContacts, true);
  				DeleteDirectory(zipDir.c_str());
 -				CreateDirectory(zipDir.c_str(), NULL);
 +				CreateDirectory(zipDir.c_str(), nullptr);
  				zipFilePath = zipDir + L"\\" + zipFilePath;
  			}
  			error = ZipFiles(dir + L"\\", zipFilePath, to.zipPassword);
 @@ -715,7 +715,7 @@ void SchedulerThreadFunc(void*)  	while (!finishThread) {
  		DWORD timeWait;
 -		time_t now = time(NULL);
 +		time_t now = time(nullptr);
  		while (nextExportTime <= now)
  			if (!ExecuteCurrentTask(now))
  				return;
 @@ -732,25 +732,25 @@ void StartThread(bool init)  	StopThread();
  	initTask = false;
 -	bool isExport = GetNextExportTime(init, time(NULL));
 +	bool isExport = GetNextExportTime(init, time(nullptr));
  	if (isExport) {
  		finishThread = false;
 -		hThreadEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 -		hThread = mir_forkthread(SchedulerThreadFunc, NULL);
 +		hThreadEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
 +		hThread = mir_forkthread(SchedulerThreadFunc, nullptr);
  	}
  }
  void StopThread()
  {
 -	if (hThread == NULL)
 +	if (hThread == nullptr)
  		return;
  	finishThread = true;
  	SetEvent(hThreadEvent);
  	WaitForSingleObject(hThread, INFINITE);
  	CloseHandle(hThreadEvent);
 -	hThread = NULL;
 -	hThreadEvent = NULL;
 +	hThread = nullptr;
 +	hThreadEvent = nullptr;
  }
  bool GetNextExportTime(bool init, time_t now)
 @@ -791,7 +791,7 @@ bool GetNextExportTime(bool init, time_t now)  static void CALLBACK DoTaskFinishInMainAPCFunc(ULONG_PTR dwParam)
  {
  	wchar_t *item = (wchar_t*)dwParam;
 -	MessageBox(NULL, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION);
 +	MessageBox(nullptr, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION);
  	delete[] item;
  }
 @@ -803,7 +803,7 @@ bool ExecuteCurrentTask(time_t now)  		mir_cslock lck(Options::instance->criticalSection);
  		for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
  			if (it->forceExecute) {
 -				it->lastExport = time(NULL);
 +				it->lastExport = time(nullptr);
  				Options::instance->SaveTaskTime(*it);
  				to = *it;
  				isExport = true;
 @@ -812,7 +812,7 @@ bool ExecuteCurrentTask(time_t now)  			else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) {
  				time_t t = GetNextExportTime(*it);
  				if (t <= now) {
 -					it->lastExport = time(NULL);
 +					it->lastExport = time(nullptr);
  					Options::instance->SaveTaskTime(*it);
  					to = *it;
  					isExport = true;
 @@ -869,11 +869,11 @@ bool GetFileCrc(const wchar_t *filenameinzip, unsigned char *buf, unsigned long,  {
  	unsigned long calculate_crc = 0;
  	bool error = true;
 -	HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
 +	HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
  	if (hFile != INVALID_HANDLE_VALUE) {
  		DWORD readed;
  		do {
 -			if (!ReadFile(hFile, buf, 1024, &readed, NULL)) {
 +			if (!ReadFile(hFile, buf, 1024, &readed, nullptr)) {
  				error = false;
  				break;
  			}
 @@ -900,8 +900,8 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri  		fill_win32_filefunc(&pzlib_filefunc_def);
  		zipFilePath = GetFileName(zipFilePath, L"", existingContacts, true);
  		zipFilePath = ReplaceExt(zipFilePath, L"zip");
 -		zipFile zf = zipOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), APPEND_STATUS_CREATE, NULL, &pzlib_filefunc_def);
 -		if (zf != NULL) {
 +		zipFile zf = zipOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), APPEND_STATUS_CREATE, nullptr, &pzlib_filefunc_def);
 +		if (zf != nullptr) {
  			unsigned char buf[1024];
  			char bufF[MAX_PATH + 20];
  			while (files.size() > 0) {
 @@ -915,15 +915,15 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri  				}
  				BOOL badChar;
 -				WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, &badChar);
 +				WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, nullptr, &badChar);
  				int flag = 0;
  				if (badChar) {
  					flag = 0x800; // UTF
 -					WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, NULL);
 +					WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, nullptr, nullptr);
  				}
  				unsigned long calculate_crc = 0;
 -				const char* passwordCh = NULL;
 +				const char* passwordCh = nullptr;
  				if (password.size() > 0) {
  					if (!GetFileCrc(localDir.c_str(), buf, 1024, &calculate_crc)) {
  						error = true;
 @@ -933,15 +933,15 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri  					passwordCh = password.c_str();
  				}
 -				int err = zipOpenNewFileInZip4_64(zf, bufF, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0,
 +				int err = zipOpenNewFileInZip4_64(zf, bufF, &zi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0,
  					-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, passwordCh, calculate_crc, 0, flag, 0);
  				if (err == ZIP_OK) {
 -					HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
 +					HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
  					if (hFile != INVALID_HANDLE_VALUE) {
  						DWORD readed;
  						do {
  							err = ZIP_OK;
 -							if (!ReadFile(hFile, buf, 1024, &readed, NULL)) {
 +							if (!ReadFile(hFile, buf, 1024, &readed, nullptr)) {
  								error = true;
  								break;
  							}
 @@ -965,7 +965,7 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri  				files.pop_front();
  			}
 -			zipClose(zf, NULL);
 +			zipClose(zf, nullptr);
  		}
  		else error = true;
  	}
 @@ -984,14 +984,14 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s  	zipFilePath = GetFileName(zipFilePath, L"", existingContacts, true);
  	zipFilePath = ReplaceExt(zipFilePath, L"zip");
  	unzFile zf = unzOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), &pzlib_filefunc_def);
 -	if (zf == NULL)
 +	if (zf == nullptr)
  		return true;
  	char buf[8192];
  	char bufF[MAX_PATH + 20];
  	unz_file_info file_info;
  	do {
 -		int err = unzGetCurrentFileInfo(zf, &file_info, bufF, MAX_PATH + 20, buf, 8192, NULL, 0);
 +		int err = unzGetCurrentFileInfo(zf, &file_info, bufF, MAX_PATH + 20, buf, 8192, nullptr, 0);
  		if (err == UNZ_OK) {
  			UINT cp = CP_OEMCP;
  			if (file_info.flag & 0x800)// UTF
 @@ -1019,7 +1019,7 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s  			}
  			int sizeC = (int)mir_strlen(bufF);
 -			int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, NULL, 0);
 +			int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, nullptr, 0);
  			fileNameInZip.resize(sizeW);
  			MultiByteToWideChar(cp, 0, bufF, sizeC, (wchar_t*)fileNameInZip.c_str(), sizeW);
  			fileNameInZip = dir + L"\\" + fileNameInZip;
 @@ -1030,14 +1030,14 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s  			if (file_info.external_fa & FILE_ATTRIBUTE_DIRECTORY)
  				CreatePath(fileNameInZip.c_str());
  			else {
 -				const char* passwordCh = NULL;
 +				const char* passwordCh = nullptr;
  				if (password.size() > 0)
  					passwordCh = password.c_str();
  				err = unzOpenCurrentFilePassword(zf, passwordCh);
  				if (err == UNZ_OK) {
  					CreatePath(GetDirectoryName(fileNameInZip).c_str());
 -					HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
 +					HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, 0, nullptr);
  					if (hFile != INVALID_HANDLE_VALUE) {
  						DWORD writed;
  						for (;;) {
 @@ -1116,7 +1116,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::  			stream.close();
  			std::wstring &log = Options::instance->ftpLogPath;
 -			CreateDirectory(GetDirectoryName(log).c_str(), NULL);
 +			CreateDirectory(GetDirectoryName(log).c_str(), nullptr);
  			DeleteFile(log.c_str());
  			wchar_t cmdLine[MAX_PATH];
 @@ -1126,7 +1126,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::  			startupInfo.cb = sizeof(STARTUPINFO);
  			PROCESS_INFORMATION processInfo;
 -			if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) {
 +			if (CreateProcess(nullptr, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, dir.c_str(), &startupInfo, &processInfo)) {
  				WaitForSingleObject(processInfo.hProcess, INFINITE);
  				CloseHandle(processInfo.hThread);
  				CloseHandle(processInfo.hProcess);
 @@ -1208,14 +1208,14 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,  		stream.close();
  		std::wstring &log = Options::instance->ftpLogPath;
 -		CreateDirectory(GetDirectoryName(log).c_str(), NULL);
 +		CreateDirectory(GetDirectoryName(log).c_str(), nullptr);
  		DeleteFile(log.c_str());
  		wchar_t cmdLine[MAX_PATH];
  		mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str());
  		STARTUPINFO				startupInfo = { 0 };
  		PROCESS_INFORMATION		processInfo;
  		startupInfo.cb = sizeof(STARTUPINFO);
 -		if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) {
 +		if (CreateProcess(nullptr, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, dir.c_str(), &startupInfo, &processInfo)) {
  			WaitForSingleObject(processInfo.hProcess, INFINITE);
  			CloseHandle(processInfo.hThread);
  			CloseHandle(processInfo.hProcess);
 @@ -1246,14 +1246,14 @@ void CreatePath(const wchar_t *szDir)  		return;
  	pszLastBackslash = wcsrchr(szTestDir, '\\');
 -	if (pszLastBackslash == NULL)
 +	if (pszLastBackslash == nullptr)
  		return;
  	*pszLastBackslash = '\0';
  	CreatePath(szTestDir);
  	*pszLastBackslash = '\\';
 -	CreateDirectory(szTestDir, NULL);
 +	CreateDirectory(szTestDir, nullptr);
  }
  INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM)
 @@ -1283,13 +1283,13 @@ void DoError(const TaskOptions& to, const std::wstring _error)  		DBEVENTINFO dbei = {};
  		dbei.szModule = MODULE;
  		dbei.flags = DBEF_UTF | DBEF_READ;
 -		dbei.timestamp = time(NULL);
 +		dbei.timestamp = time(nullptr);
  		// For now I do not convert event data from string to blob, and event type must be message to handle it properly
  		dbei.eventType = EVENTTYPE_MESSAGE;
  		int len = (int)error.length() + 1;
 -		dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, NULL, 0, NULL, NULL);
 +		dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, nullptr, 0, nullptr, nullptr);
  		char* buf = new char[dbei.cbBlob];
 -		dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, NULL, NULL);
 +		dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, nullptr, nullptr);
  		dbei.pBlob = (PBYTE)buf;
  		db_event_add(NULL, &dbei);
  	}
 diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index e47007893b..092d927adb 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -27,7 +27,7 @@ Searcher::Searcher()  	matchWholeWords(false),
  	onlyIn(false),
  	onlyOut(false),
 -	context(NULL)
 +	context(nullptr)
  {
  }
 | 
