diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/NewsAggregator | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/NewsAggregator')
-rw-r--r-- | plugins/NewsAggregator/Src/Authentication.cpp | 2 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/CheckFeed.cpp | 68 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/ExportImport.cpp | 34 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Icons.cpp | 2 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Menus.cpp | 4 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/NewsAggregator.cpp | 8 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Options.cpp | 16 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Services.cpp | 24 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Update.cpp | 32 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Utils.cpp | 52 |
10 files changed, 121 insertions, 121 deletions
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index 62cd91361f..4d01851929 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg)
{
- wchar_t *tlogin = NULL, *tpass = NULL;
+ wchar_t *tlogin = nullptr, *tpass = nullptr;
if (hContact && db_get_b(hContact, MODULE, "UseAuth", 0)) {
tlogin = db_get_wsa(hContact, MODULE, "Login");
tpass = db_get_wsa(hContact, MODULE, "Password");
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 2be3a3d965..11e482f5e0 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -22,18 +22,18 @@ Boston, MA 02111-1307, USA. LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg)
{
Netlib_LogfW(hNetlibUser, L"Started validating feed %s.", tszURL);
- char *szData = NULL;
+ char *szData = nullptr;
GetNewsData(tszURL, &szData, NULL, hwndDlg);
if (szData) {
wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
tszData = mir_a2u(szData);
int bytesParsed = 0;
- HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
+ HXML hXml = xmlParseString(tszData, &bytesParsed, nullptr);
mir_free(tszData);
mir_free(szData);
- if (hXml != NULL) {
- LPCTSTR codepage = NULL;
+ if (hXml != nullptr) {
+ LPCTSTR codepage = nullptr;
int childcount = 0;
HXML node;
HXML tmpnode = xmlGetFirstChild(hXml);
@@ -107,7 +107,7 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) wchar_t mes[MAX_PATH];
mir_snwprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR);
- return NULL;
+ return nullptr;
}
static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStringW &descr, CMStringW &author, CMStringW &comments, CMStringW &guid, CMStringW &category, time_t stamp)
@@ -176,7 +176,7 @@ static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStr if (!MesExist) {
if (stamp == 0)
- stamp = time(NULL);
+ stamp = time(nullptr);
T2Utf pszMessage(message);
@@ -194,13 +194,13 @@ void CheckCurrentFeed(MCONTACT hContact) return;
wchar_t *szURL = db_get_wsa(hContact, MODULE, "URL");
- if (szURL == NULL)
+ if (szURL == nullptr)
return;
Netlib_LogfW(hNetlibUser, L"Started checking feed %s.", szURL);
- char *szData = NULL;
- GetNewsData(szURL, &szData, hContact, NULL);
+ char *szData = nullptr;
+ GetNewsData(szURL, &szData, hContact, nullptr);
mir_free(szURL);
if (szData) {
@@ -208,13 +208,13 @@ void CheckCurrentFeed(MCONTACT hContact) if (!tszData)
tszData = mir_a2u(szData);
int bytesParsed = 0;
- HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
+ HXML hXml = xmlParseString(tszData, &bytesParsed, nullptr);
mir_free(tszData);
mir_free(szData);
CMStringW szValue;
- if (hXml != NULL) {
- LPCTSTR codepage = NULL;
+ if (hXml != nullptr) {
+ LPCTSTR codepage = nullptr;
int childcount = 0;
HXML node;
HXML tmpnode = xmlGetFirstChild(hXml);
@@ -265,7 +265,7 @@ void CheckCurrentFeed(MCONTACT hContact) HXML child = xmlGetChild(chan, j);
LPCTSTR childName = xmlGetName(child);
if (!mir_wstrcmpi(childName, L"title")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -277,7 +277,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "FirstName", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"link")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -289,7 +289,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "Homepage", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"description")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -304,7 +304,7 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
else if (!mir_wstrcmpi(childName, L"language")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -316,7 +316,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "Language1", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"managingEditor")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -328,7 +328,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "e-mail", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"category")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -340,7 +340,7 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ws(hContact, MODULE, "Interest0Text", ClearText(szValue, szChildText));
}
else if (!mir_wstrcmpi(childName, L"copyright")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -382,7 +382,7 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
else if (!mir_wstrcmpi(childName, L"lastBuildDate")) {
- LPCTSTR szChildText = NULL;
+ LPCTSTR szChildText = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
@@ -392,10 +392,10 @@ void CheckCurrentFeed(MCONTACT hContact) szChildText = xmlGetText(child);
if (szChildText) {
time_t stamp = DateToUnixTime(szChildText, 0);
- double deltaupd = difftime(time(NULL), stamp);
- double deltacheck = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double deltaupd = difftime(time(nullptr), stamp);
+ double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
xmlDestroyNode(hXml);
return;
}
@@ -407,7 +407,7 @@ void CheckCurrentFeed(MCONTACT hContact) for (int z = 0; z < xmlGetChildCount(child); z++) {
HXML itemval = xmlGetChild(child, z);
LPCTSTR itemName = xmlGetName(itemval);
- LPCTSTR value = NULL;
+ LPCTSTR value = nullptr;
if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(itemval)), -1, buf, _countof(buf));
@@ -525,10 +525,10 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) {
wchar_t *lastupdtime = (wchar_t *)szChildText;
time_t stamp = DateToUnixTime(lastupdtime, 1);
- double deltaupd = difftime(time(NULL), stamp);
- double deltacheck = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double deltaupd = difftime(time(nullptr), stamp);
+ double deltacheck = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (deltaupd - deltacheck >= 0) {
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
xmlDestroyNode(hXml);
return;
}
@@ -601,7 +601,7 @@ void CheckCurrentFeed(MCONTACT hContact) xmlDestroyNode(hXml);
}
}
- db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", (DWORD)time(nullptr));
}
void CheckCurrentFeedAvatar(MCONTACT hContact)
@@ -610,24 +610,24 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) return;
wchar_t *szURL = db_get_wsa(hContact, MODULE, "URL");
- if (szURL == NULL)
+ if (szURL == nullptr)
return;
- char *szData = NULL;
- GetNewsData(szURL, &szData, hContact, NULL);
+ char *szData = nullptr;
+ GetNewsData(szURL, &szData, hContact, nullptr);
mir_free(szURL);
- if (szData == NULL)
+ if (szData == nullptr)
return;
wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
tszData = mir_a2u(szData);
int bytesParsed = 0;
- HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
+ HXML hXml = xmlParseString(tszData, &bytesParsed, nullptr);
mir_free(tszData);
mir_free(szData);
- if (hXml == NULL)
+ if (hXml == nullptr)
return;
int childcount = 0;
diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index e959797d1b..b2c22b55d3 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -43,8 +43,8 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t FileName[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, _countof(FileName));
int bytesParsed = 0;
- HXML hXml = xmlParseFile(FileName, &bytesParsed, NULL);
- if(hXml != NULL) {
+ HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
+ if(hXml != nullptr) {
HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
bool isTextUTF = false, isURLUTF = false, isSiteURLUTF = false, isGroupUTF = false;
HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
@@ -74,7 +74,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else if (!xmlUrl && outlineChildsCount)
node = xmlGetFirstChild(node);
else if (xmlUrl) {
- wchar_t *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL;
+ wchar_t *text = nullptr, *url = nullptr, *siteurl = nullptr, *group = nullptr;
BYTE NeedToImport = FALSE;
for (int i = 0; i < outlineAttr; i++) {
if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
@@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM parent = xmlGetParent(parent);
}
- wchar_t *ptszGroup = NULL;
+ wchar_t *ptszGroup = nullptr;
if (group) {
ptszGroup = mir_utf8decodeW(_T2A(group));
if ( !ptszGroup) {
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t tmp[MAX_PATH];
mir_snwprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -227,8 +227,8 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (GetOpenFileName(&ofn)) {
int bytesParsed = 0;
- HXML hXml = xmlParseFile(FileName, &bytesParsed, NULL);
- if(hXml != NULL) {
+ HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
+ if(hXml != nullptr) {
HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
if ( !node)
node = xmlGetChildByPath(hXml, L"body/outline", 0);
@@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "ExportDlg");
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
wchar_t *message = db_get_wsa(hContact, MODULE, "Nick");
- if (message != NULL) {
+ if (message != nullptr) {
SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)message);
mir_free(message);
}
@@ -479,7 +479,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t tmp[MAX_PATH];
mir_snwprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -489,11 +489,11 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.lpstrDefExt = L"";
if (GetSaveFileName(&ofn)) {
- HXML hXml = xmlCreateNode(L"opml", NULL, FALSE);
+ HXML hXml = xmlCreateNode(L"opml", nullptr, FALSE);
xmlAddAttr(hXml, L"version", L"1.0");
- HXML header = xmlAddChild(hXml, L"head", NULL);
+ HXML header = xmlAddChild(hXml, L"head", nullptr);
xmlAddChild(header, L"title", L"Miranda NG NewsAggregator plugin export");
- header = xmlAddChild(hXml, L"body", NULL);
+ header = xmlAddChild(hXml, L"body", nullptr);
int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0);
for (int i = 0; i < count; i++) {
@@ -510,23 +510,23 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (group)
{
wchar_t *section = wcstok(group, L"\\");
- while (section != NULL)
+ while (section != nullptr)
{
HXML existgroup = xmlGetChildByAttrValue(header, L"outline", L"title", section);
if ( !existgroup)
{
- elem = xmlAddChild(elem, L"outline", NULL);
+ elem = xmlAddChild(elem, L"outline", nullptr);
xmlAddAttr(elem, L"title", section);
xmlAddAttr(elem, L"text", section);
} else {
elem = existgroup;
}
- section = wcstok(NULL, L"\\");
+ section = wcstok(nullptr, L"\\");
}
- elem = xmlAddChild(elem, L"outline", NULL);
+ elem = xmlAddChild(elem, L"outline", nullptr);
}
else
- elem = xmlAddChild(elem, L"outline", NULL);
+ elem = xmlAddChild(elem, L"outline", nullptr);
xmlAddAttr(elem, L"text", title);
xmlAddAttr(elem, L"title", title);
xmlAddAttr(elem, L"type", L"rss");
diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp index 8cfd2716e2..763890c580 100644 --- a/plugins/NewsAggregator/Src/Icons.cpp +++ b/plugins/NewsAggregator/Src/Icons.cpp @@ -49,5 +49,5 @@ HANDLE GetIconHandle(const char *name) if ( !mir_strcmp(iconList[i].szName, name))
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index 76cb73248a..73128cf5be 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -67,7 +67,7 @@ void InitMenu() // adding contact menu items
SET_UID(mi, 0x92be499c, 0x928c, 0x4789, 0x8f, 0x36, 0x28, 0xa2, 0x9f, 0xb7, 0x1a, 0x97);
- mi.root = NULL;
+ mi.root = nullptr;
mi.position = -0x7FFFFFFA;
mi.hIcolibItem = GetIconHandle("checkfeed");
mi.name.w = LPGENW("Check feed");
@@ -79,5 +79,5 @@ void InitMenu() mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED;
hService2[6] = Menu_AddContactMenuItem(&mi, MODULE);
- Menu_ModifyItem(hService2[0], NULL, GetIconHandle(db_get_b(NULL, MODULE, "AutoUpdate", 1) ? "enabled" : "disabled"));
+ Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(db_get_b(NULL, MODULE, "AutoUpdate", 1) ? "enabled" : "disabled"));
}
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index 44c9e4d035..01a57f1ac1 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -19,12 +19,12 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
int hLangpack;
-HANDLE hPrebuildMenuHook = NULL;
+HANDLE hPrebuildMenuHook = nullptr;
HWND hAddFeedDlg;
-MWindowList hChangeFeedDlgList = NULL;
+MWindowList hChangeFeedDlgList = nullptr;
wchar_t tszRoot[MAX_PATH] = {0};
HANDLE hUpdateMutex;
@@ -62,7 +62,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, NewsAggrInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, NewsAggrPreShutdown);
- hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
+ hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr);
hChangeFeedDlgList = WindowList_Create();
// register weather protocol
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index d9868930f3..e5061b1e38 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -62,7 +62,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
db_set_ws(hContact, MODULE, "URL", str);
db_set_b(hContact, MODULE, "CheckState", 1);
- db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
+ db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ws(hContact, MODULE, "MsgFormat", str);
db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
@@ -115,7 +115,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
wchar_t tszURL[MAX_PATH] = { 0 };
- wchar_t *tszTitle = NULL;
+ wchar_t *tszTitle = nullptr;
if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0)
tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
else
@@ -132,7 +132,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_DESTROY:
- hAddFeedDlg = 0;
+ hAddFeedDlg = nullptr;
Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "AddDlg");
break;
}
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_ws(SelItem->hContact, MODULE, "URL", str);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ws(SelItem->hContact, MODULE, "Nick", str);
- db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
+ db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ws(SelItem->hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
@@ -374,7 +374,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_ws(hContact, MODULE, "URL", str);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ws(hContact, MODULE, "Nick", str);
- db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
+ db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ws(hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
@@ -474,14 +474,14 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_ADD:
- if (hAddFeedDlg == 0)
+ if (hAddFeedDlg == nullptr)
hAddFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcAddFeedOpts, (LPARAM)hwndList);
return FALSE;
case IDC_CHANGE:
sel = ListView_GetSelectionMark(hwndList);
{
- ItemInfo SelItem = { 0 };
+ ItemInfo SelItem = {};
ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
SelItem.hwndList = hwndList;
@@ -552,7 +552,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case NM_DBLCLK:
sel = ListView_GetHotItem(hwndList);
if (sel != -1) {
- ItemInfo SelItem = { 0 };
+ ItemInfo SelItem = {};
ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
SelItem.hwndList = hwndList;
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 2ca891def2..ef78723338 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. int g_nStatus = ID_STATUS_ONLINE;
UINT_PTR timerId = 0;
-HANDLE hTBButton = NULL, hNewsAggregatorFolder = NULL;
+HANDLE hTBButton = nullptr, hNewsAggregatorFolder = nullptr;
void SetContactStatus(MCONTACT hContact, int nNewStatus)
{
@@ -44,7 +44,7 @@ int NewsAggrInit(WPARAM, LPARAM) for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
- db_set_dw(hContact, MODULE, "LastCheck", time(NULL));
+ db_set_dw(hContact, MODULE, "LastCheck", time(nullptr));
SetContactStatus(hContact, ID_STATUS_ONLINE);
}
@@ -55,7 +55,7 @@ int NewsAggrInit(WPARAM, LPARAM) HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
// timer for the first update
- timerId = SetTimer(NULL, 0, 10000, timerProc2); // first update is 10 sec after load
+ timerId = SetTimer(nullptr, 0, 10000, timerProc2); // first update is 10 sec after load
return 0;
}
@@ -67,7 +67,7 @@ int NewsAggrPreShutdown(WPARAM, LPARAM) WindowList_Broadcast(hChangeFeedDlgList, WM_CLOSE, 0, 0);
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
NetlibUnInit();
return 0;
}
@@ -151,15 +151,15 @@ INT_PTR CheckAllFeeds(WPARAM, LPARAM lParam) UpdateListAdd(hContact);
}
if (!ThreadRunning)
- mir_forkthread(UpdateThreadProc, 0);
+ mir_forkthread(UpdateThreadProc, nullptr);
return 0;
}
INT_PTR AddFeed(WPARAM, LPARAM)
{
- if (hAddFeedDlg == 0)
- hAddFeedDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ADDFEED), NULL, DlgProcAddFeedOpts);
+ if (hAddFeedDlg == nullptr)
+ hAddFeedDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ADDFEED), nullptr, DlgProcAddFeedOpts);
ShowWindow(hAddFeedDlg, SW_SHOW);
return 0;
}
@@ -168,7 +168,7 @@ INT_PTR ChangeFeed(WPARAM hContact, LPARAM) {
HWND hChangeFeedDlg = WindowList_Find(hChangeFeedDlgList, hContact);
if (!hChangeFeedDlg) {
- hChangeFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), NULL, DlgProcChangeFeedMenu, hContact);
+ hChangeFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), nullptr, DlgProcChangeFeedMenu, hContact);
ShowWindow(hChangeFeedDlg, SW_SHOW);
} else {
SetForegroundWindow(hChangeFeedDlg);
@@ -179,13 +179,13 @@ INT_PTR ChangeFeed(WPARAM hContact, LPARAM) INT_PTR ImportFeeds(WPARAM, LPARAM)
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), NULL, DlgProcImportOpts);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), nullptr, DlgProcImportOpts);
return 0;
}
INT_PTR ExportFeeds(WPARAM, LPARAM)
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), NULL, DlgProcExportOpts);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), nullptr, DlgProcExportOpts);
return 0;
}
@@ -212,7 +212,7 @@ INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam, LPARAM lParam) mir_forkthread(UpdateThreadProc, (void *)TRUE);
wchar_t *ptszImageURL = db_get_wsa(pai->hContact, MODULE, "ImageURL");
- if(ptszImageURL == NULL)
+ if(ptszImageURL == nullptr)
return GAIR_NOAVATAR;
mir_free(ptszImageURL);
@@ -246,7 +246,7 @@ INT_PTR EnableDisable(WPARAM, LPARAM) int OnToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.name = LPGEN("Enable/disable auto update");
ttb.pszService = MS_NEWSAGGREGATOR_ENABLED;
ttb.pszTooltipUp = LPGEN("Auto Update Enabled");
diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp index 245229e698..07489d7dd8 100644 --- a/plugins/NewsAggregator/Src/Update.cpp +++ b/plugins/NewsAggregator/Src/Update.cpp @@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. // check if Feed is currently updating
bool ThreadRunning;
-UPDATELIST *UpdateListHead = NULL;
-UPDATELIST *UpdateListTail = NULL;
+UPDATELIST *UpdateListHead = nullptr;
+UPDATELIST *UpdateListTail = nullptr;
// main auto-update timer
void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
@@ -32,7 +32,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) bool HaveUpdates = FALSE;
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) {
- double diff = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
+ double diff = difftime(time(nullptr), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0));
if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) {
UpdateListAdd(hContact);
HaveUpdates = TRUE;
@@ -40,7 +40,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) }
}
if (!ThreadRunning && HaveUpdates)
- mir_forkthread(UpdateThreadProc, 0);
+ mir_forkthread(UpdateThreadProc, nullptr);
}
}
@@ -48,13 +48,13 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) // when this is run, it kill the old startup timer and create the permenant one above
void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
ThreadRunning = FALSE;
if (db_get_b(NULL, MODULE, "AutoUpdate", 1) && !Miranda_IsTerminated()) {
if (db_get_b(NULL, MODULE, "StartupRetrieve", 1))
CheckAllFeeds(0, 1);
- timerId = SetTimer(NULL, 0, 30000, (TIMERPROC)timerProc);
+ timerId = SetTimer(nullptr, 0, 30000, (TIMERPROC)timerProc);
}
}
@@ -62,11 +62,11 @@ void UpdateListAdd(MCONTACT hContact) {
UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST));
newItem->hContact = hContact;
- newItem->next = NULL;
+ newItem->next = nullptr;
WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListTail == NULL)
+ if (UpdateListTail == nullptr)
UpdateListHead = newItem;
else UpdateListTail->next = newItem;
UpdateListTail = newItem;
@@ -80,14 +80,14 @@ MCONTACT UpdateGetFirst() WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListHead != NULL) {
+ if (UpdateListHead != nullptr) {
UPDATELIST* Item = UpdateListHead;
hContact = Item->hContact;
UpdateListHead = Item->next;
mir_free(Item);
- if (UpdateListHead == NULL)
- UpdateListTail = NULL;
+ if (UpdateListHead == nullptr)
+ UpdateListTail = nullptr;
}
ReleaseMutex(hUpdateMutex);
@@ -101,13 +101,13 @@ void DestroyUpdateList(void) // free the list one by one
UPDATELIST *temp = UpdateListHead;
- while (temp != NULL) {
+ while (temp != nullptr) {
UpdateListHead = temp->next;
mir_free(temp);
temp = UpdateListHead;
}
// make sure the entire list is clear
- UpdateListTail = NULL;
+ UpdateListTail = nullptr;
ReleaseMutex(hUpdateMutex);
}
@@ -122,11 +122,11 @@ void UpdateThreadProc(void *AvatarCheck) ThreadRunning = TRUE; // prevent 2 instance of this thread running
ReleaseMutex(hUpdateMutex);
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
// update news by getting the first station from the queue until the queue is empty
- while (UpdateListHead != NULL && !Miranda_IsTerminated()) {
- if (AvatarCheck != NULL)
+ while (UpdateListHead != nullptr && !Miranda_IsTerminated()) {
+ if (AvatarCheck != nullptr)
CheckCurrentFeedAvatar(UpdateGetFirst());
else
CheckCurrentFeed(UpdateGetFirst());
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index c456ef21d9..db6f67eab5 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -19,14 +19,14 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HNETLIBUSER hNetlibUser = NULL;
+HNETLIBUSER hNetlibUser = nullptr;
HNETLIBCONN hNetlibHttp;
bool UpdateListFlag = FALSE;
bool IsMyContact(MCONTACT hContact)
{
const char *szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(MODULE, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(MODULE, szProto) == 0;
}
void NetlibInit()
@@ -41,7 +41,7 @@ void NetlibInit() void NetlibUnInit()
{
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
}
void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg)
@@ -53,7 +53,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
- if (wcsstr(tszUrl, L"https://") != NULL)
+ if (wcsstr(tszUrl, L"https://") != nullptr)
nlhr.flags |= NLHRF_SSL;
char *szUrl = mir_u2a(tszUrl);
nlhr.szUrl = szUrl;
@@ -93,7 +93,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg }
else if (nlhrReply->resultCode == 401) {
Netlib_LogfW(hNetlibUser, L"Code 401: feed %s needs auth data.", tszUrl);
- ItemInfo SelItem = { 0 };
+ ItemInfo SelItem = {};
SelItem.hwndList = hwndDlg;
SelItem.hContact = hContact;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AUTHENTICATION), hwndDlg, AuthenticationProc, (LPARAM)&SelItem) == IDOK)
@@ -175,7 +175,7 @@ time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType) int i, y;
time_t t;
- if (stamp == NULL)
+ if (stamp == nullptr)
return 0;
wchar_t *p = NEWWSTR_ALLOCA(stamp);
@@ -195,7 +195,7 @@ time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType) int day, month = 0, year, hour, min, sec, timezoneh, timezonem;
if (wcsstr(p, L",")) {
weekday = wcstok(p, L",");
- p = wcstok(NULL, L",");
+ p = wcstok(nullptr, L",");
swscanf(p + 1, L"%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem);
if (!mir_wstrcmpi(monthstr, L"Jan"))
month = 1;
@@ -308,7 +308,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
if (pReply) {
if ((200 == pReply->resultCode) && (pReply->dataLength > 0)) {
- char *date = NULL, *size = NULL;
+ char *date = nullptr, *size = nullptr;
for (int i = 0; i < pReply->headersCount; i++) {
if (!mir_strcmpi(pReply->headers[i].szName, "Last-Modified")) {
date = pReply->headers[i].szValue;
@@ -319,7 +319,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) continue;
}
}
- if (date != NULL && size != NULL) {
+ if (date != nullptr && size != nullptr) {
wchar_t *tdate = mir_a2u(date);
wchar_t *tsize = mir_a2u(size);
struct _stat buf;
@@ -331,8 +331,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) time_t filemodtime = mktime(localtime(&buf.st_atime));
if (modtime > filemodtime && buf.st_size != _wtoi(tsize)) {
DWORD dwBytes;
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -341,8 +341,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) }
else {
DWORD dwBytes;
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -352,8 +352,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) }
else {
DWORD dwBytes;
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
+ HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, nullptr);
ret = true;
if (hFile)
CloseHandle(hFile);
@@ -371,23 +371,23 @@ typedef HRESULT(MarkupCallback)(IHTMLDocument3 *, BSTR &message); HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &message)
{
- IHTMLDocument3 *pHtmlDocRoot = NULL;
+ IHTMLDocument3 *pHtmlDocRoot = nullptr;
// Create the root document -- a "workspace" for parsing.
- HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pHtmlDocRoot));
+ HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pHtmlDocRoot));
if (SUCCEEDED(hr) && pHtmlDocRoot) {
- IPersistStreamInit *pPersistStreamInit = NULL;
+ IPersistStreamInit *pPersistStreamInit = nullptr;
hr = pHtmlDocRoot->QueryInterface(IID_PPV_ARGS(&pPersistStreamInit));
if (SUCCEEDED(hr)) {
// Initialize the root document to a default state -- ready for parsing.
pPersistStreamInit->InitNew();
- IMarkupServices *pMarkupServices = NULL;
+ IMarkupServices *pMarkupServices = nullptr;
hr = pHtmlDocRoot->QueryInterface(IID_PPV_ARGS(&pMarkupServices));
if (SUCCEEDED(hr)) {
- IMarkupPointer *pMarkupBegin = NULL;
- IMarkupPointer *pMarkupEnd = NULL;
+ IMarkupPointer *pMarkupBegin = nullptr;
+ IMarkupPointer *pMarkupEnd = nullptr;
// These markup pointers indicate the insertion point.
hr = pMarkupServices->CreateMarkupPointer(&pMarkupBegin);
@@ -395,13 +395,13 @@ HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &messa hr = pMarkupServices->CreateMarkupPointer(&pMarkupEnd);
if (SUCCEEDED(hr) && pMarkupBegin && pMarkupEnd) {
- IMarkupContainer *pMarkupContainer = NULL;
+ IMarkupContainer *pMarkupContainer = nullptr;
// Parse the string -- the markup container contains the parsed HTML.
// Markup pointers are updated to point to begining and end of new container.
hr = pMarkupServices->ParseString(bstrHtml, 0, &pMarkupContainer, pMarkupBegin, pMarkupEnd);
if (SUCCEEDED(hr) && pMarkupContainer) {
- IHTMLDocument3 *pHtmlDoc = NULL;
+ IHTMLDocument3 *pHtmlDoc = nullptr;
// Retrieve the document interface to the markup container.
hr = pMarkupContainer->QueryInterface(IID_PPV_ARGS(&pHtmlDoc));
@@ -429,15 +429,15 @@ HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &messa HRESULT TestDocumentText(IHTMLDocument3 *pHtmlDoc, BSTR &message)
{
- IHTMLDocument2 *pDoc = NULL;
- IHTMLElement *pElem = NULL;
+ IHTMLDocument2 *pDoc = nullptr;
+ IHTMLElement *pElem = nullptr;
BSTR bstrId = SysAllocString(L"test");
HRESULT hr = pHtmlDoc->QueryInterface(IID_PPV_ARGS(&pDoc));
if (SUCCEEDED(hr) && pDoc) {
hr = pDoc->get_body(&pElem);
if (SUCCEEDED(hr) && pElem) {
- BSTR bstrText = NULL;
+ BSTR bstrText = nullptr;
pElem->get_innerText(&bstrText);
message = SysAllocString(bstrText);
SysFreeString(bstrText);
|