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/IEView/src | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/IEView/src')
-rw-r--r-- | plugins/IEView/src/ChatHTMLBuilder.cpp | 12 | ||||
-rw-r--r-- | plugins/IEView/src/HTMLBuilder.cpp | 76 | ||||
-rw-r--r-- | plugins/IEView/src/HistoryHTMLBuilder.cpp | 16 | ||||
-rw-r--r-- | plugins/IEView/src/IEView.cpp | 152 | ||||
-rw-r--r-- | plugins/IEView/src/MUCCHTMLBuilder.cpp | 14 | ||||
-rw-r--r-- | plugins/IEView/src/Options.cpp | 110 | ||||
-rw-r--r-- | plugins/IEView/src/ScriverHTMLBuilder.cpp | 20 | ||||
-rw-r--r-- | plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 24 | ||||
-rw-r--r-- | plugins/IEView/src/Template.cpp | 60 | ||||
-rw-r--r-- | plugins/IEView/src/TemplateHTMLBuilder.cpp | 106 | ||||
-rw-r--r-- | plugins/IEView/src/TextToken.cpp | 68 | ||||
-rw-r--r-- | plugins/IEView/src/Utils.cpp | 8 | ||||
-rw-r--r-- | plugins/IEView/src/external_funcs.cpp | 4 | ||||
-rw-r--r-- | plugins/IEView/src/ieview_main.cpp | 2 | ||||
-rw-r--r-- | plugins/IEView/src/ieview_services.cpp | 14 |
15 files changed, 343 insertions, 343 deletions
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 12c0308a3e..d3f5cf2847 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -41,7 +41,7 @@ static const char *classNames[] = { ChatHTMLBuilder::ChatHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
+ setLastEventTime(time(nullptr));
}
void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
@@ -98,7 +98,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color;
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getChatMode() == Options::MODE_TEMPLATE)
@@ -110,9 +110,9 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
COLORREF bkgColor = db_get_dw(NULL, CHATMOD, "BackgroundLog", 0xFFFFFF);
@@ -161,7 +161,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
DWORD iconFlags = db_get_dw(NULL, CHATMOD, CHAT_ICON_FLAGS, 0);
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
const char *iconFile = "";
DWORD dwData = eventData->dwData;
bool isSent = eventData->bIsMe != 0;
@@ -256,7 +256,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) void ChatHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings != NULL)
+ if (protoSettings != nullptr)
appendEventNonTemplate(view, event);
}
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 232cc4c203..b9d8106bb0 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -28,23 +28,23 @@ HTMLBuilder::HTMLBuilder() lastIEViewEvent.cbSize = sizeof(IEVIEWEVENT);
lastIEViewEvent.iType = IEE_LOG_MEM_EVENTS;
lastIEViewEvent.codepage = CP_ACP;
- lastIEViewEvent.pszProto = NULL;
+ lastIEViewEvent.pszProto = nullptr;
lastIEViewEvent.count = 0;
lastIEViewEvent.dwFlags = 0;
lastIEViewEvent.hContact = NULL;
- lastIEViewEvent.hwnd = NULL;
- lastIEViewEvent.eventData = NULL;
+ lastIEViewEvent.hwnd = nullptr;
+ lastIEViewEvent.eventData = nullptr;
}
HTMLBuilder::~HTMLBuilder()
{
- if (lastIEViewEvent.pszProto != NULL)
+ if (lastIEViewEvent.pszProto != nullptr)
mir_free((void*)lastIEViewEvent.pszProto);
}
bool HTMLBuilder::encode(MCONTACT hContact, const char *proto, const wchar_t *text, CMStringW &str, int level, int flags, bool isSent)
{
- TextToken *token = NULL, *token2;
+ TextToken *token = nullptr, *token2;
switch (level) {
case 0:
if (flags & ENF_CHAT_FORMATTING) {
@@ -66,8 +66,8 @@ bool HTMLBuilder::encode(MCONTACT hContact, const char *proto, const wchar_t *te token = TextToken::tokenizeSmileys(hContact, proto, text, isSent);
break;
}
- if (token != NULL) {
- for (token2 = token; token != NULL; token = token2) {
+ if (token != nullptr) {
+ for (token2 = token; token != nullptr; token = token2) {
bool skip = false;
token2 = token->getNext();
if (token->getType() == TextToken::TEXT)
@@ -83,8 +83,8 @@ bool HTMLBuilder::encode(MCONTACT hContact, const char *proto, const wchar_t *te char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const wchar_t *wtext, int flags, bool isSent)
{
- if (wtext == NULL)
- return NULL;
+ if (wtext == nullptr)
+ return nullptr;
CMStringW str;
encode(hContact, proto, wtext, str, 0, flags, isSent);
@@ -93,16 +93,16 @@ char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const wchar_ char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const char *text, int flags, bool isSent)
{
- if (text == NULL)
- return NULL;
+ if (text == nullptr)
+ return nullptr;
return encodeUTF8(hContact, proto, _A2T(text), flags, isSent);
}
char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const char *text, int cp, int flags, bool isSent)
{
- if (text == NULL)
- return NULL;
+ if (text == nullptr)
+ return nullptr;
ptrW wtext(mir_a2u_cp(text, cp));
return encodeUTF8(hContact, proto, wtext, flags, isSent);
@@ -115,7 +115,7 @@ char* HTMLBuilder::getProto(MCONTACT hContact) char* HTMLBuilder::getProto(const char *proto, MCONTACT hContact)
{
- if (proto != NULL)
+ if (proto != nullptr)
return mir_strdup(proto);
return mir_strdup(GetContactProto(hContact));
@@ -124,10 +124,10 @@ char* HTMLBuilder::getProto(const char *proto, MCONTACT hContact) char* HTMLBuilder::getRealProto(MCONTACT hContact)
{
if (hContact == NULL)
- return NULL;
+ return nullptr;
char *szProto = mir_strdup(GetContactProto(hContact));
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO)) {
hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL)
replaceStr(szProto, GetContactProto(hContact));
@@ -137,7 +137,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact) char* HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto)
{
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO)) {
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO)) {
hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL)
return mir_strdup(GetContactProto(hContact));
@@ -148,7 +148,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto) MCONTACT HTMLBuilder::getRealContact(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, META_PROTO))
+ if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO))
hContact = db_mc_getMostOnline(hContact);
return hContact;
}
@@ -194,15 +194,15 @@ void HTMLBuilder::getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut) wchar_t* HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto)
{
wchar_t *str = Contact_GetInfo(CNF_DISPLAY, hContact, szProto);
- if (str != NULL)
+ if (str != nullptr)
return str;
str = Contact_GetInfo(CNF_UNIQUEID, hContact, szProto);
- if (str != NULL)
+ if (str != nullptr)
return str;
str = pcli->pfnGetContactDisplayName(hContact, 0);
- if (str != NULL)
+ if (str != nullptr)
return mir_wstrdup(str);
return mir_wstrdup(TranslateT("(Unknown Contact)"));
@@ -223,12 +223,12 @@ void HTMLBuilder::appendEventNew(IEView *view, IEVIEWEVENT *event) void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
{
- IEVIEWEVENTDATA *prevEventData = NULL;
+ IEVIEWEVENTDATA *prevEventData = nullptr;
MEVENT hDbEvent = event->hDbEventFirst;
event->hDbEventFirst = NULL;
ptrA szProto;
- if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != NULL)
+ if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != nullptr)
szProto = mir_strdup(event->pszProto);
else
szProto = getProto(event->hContact);
@@ -243,7 +243,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) newEvent.dwFlags = event->dwFlags;
newEvent.hContact = event->hContact;
newEvent.hwnd = event->hwnd;
- newEvent.eventData = NULL;
+ newEvent.eventData = nullptr;
for (int eventIdx = 0; hDbEvent != NULL && (eventIdx < event->count || event->count == -1); eventIdx++) {
DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
@@ -271,9 +271,9 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) eventData->dwFlags |= IEEDF_RTL;
eventData->time = dbei.timestamp;
- eventData->pszNickW = NULL;
- eventData->pszTextW = NULL;
- eventData->pszText2W = NULL;
+ eventData->pszNickW = nullptr;
+ eventData->pszTextW = nullptr;
+ eventData->pszText2W = nullptr;
if (dbei.flags & DBEF_SENT) {
eventData->pszNickW = getContactName(NULL, szProto);
eventData->bIsMe = TRUE;
@@ -317,8 +317,8 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) eventData->iType = IEED_EVENT_MESSAGE;
}
free(dbei.pBlob);
- eventData->next = NULL;
- if (prevEventData != NULL)
+ eventData->next = nullptr;
+ if (prevEventData != nullptr)
prevEventData->next = eventData;
else
newEvent.eventData = eventData;
@@ -329,7 +329,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) hDbEvent = db_event_next(event->hContact, hDbEvent);
}
appendEventNew(view, &newEvent);
- for (IEVIEWEVENTDATA* eventData2 = newEvent.eventData; eventData2 != NULL;) {
+ for (IEVIEWEVENTDATA* eventData2 = newEvent.eventData; eventData2 != nullptr;) {
IEVIEWEVENTDATA *eventData = eventData2->next;
mir_free((void*)eventData2->pszTextW);
mir_free((void*)eventData2->pszText2W);
@@ -342,7 +342,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(const char *protocolName)
{
ProtocolSettings *protoSettings = Options::getProtocolSettings(protocolName);
- if (protoSettings == NULL || !protoSettings->isSRMMEnable())
+ if (protoSettings == nullptr || !protoSettings->isSRMMEnable())
protoSettings = Options::getProtocolSettings();
return protoSettings;
@@ -356,7 +356,7 @@ ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(MCONTACT hContact) ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(const char *protocolName)
{
ProtocolSettings *protoSettings = Options::getProtocolSettings(protocolName);
- if (protoSettings == NULL || !protoSettings->isHistoryEnable())
+ if (protoSettings == nullptr || !protoSettings->isHistoryEnable())
protoSettings = Options::getProtocolSettings();
return protoSettings;
@@ -373,7 +373,7 @@ ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(MCONTACT hContact) ProtocolSettings* HTMLBuilder::getChatProtocolSettings(const char *protocolName)
{
ProtocolSettings *protoSettings = Options::getProtocolSettings(protocolName);
- if (protoSettings == NULL || !protoSettings->isChatEnable())
+ if (protoSettings == nullptr || !protoSettings->isChatEnable())
protoSettings = Options::getProtocolSettings();
return protoSettings;
@@ -396,11 +396,11 @@ void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event) lastIEViewEvent.dwFlags = event->dwFlags;
lastIEViewEvent.hContact = event->hContact;
lastIEViewEvent.hwnd = event->hwnd;
- lastIEViewEvent.eventData = NULL;
- if (lastIEViewEvent.pszProto != NULL)
+ lastIEViewEvent.eventData = nullptr;
+ if (lastIEViewEvent.pszProto != nullptr)
mir_free((void*)lastIEViewEvent.pszProto);
- if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != NULL)
+ if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != nullptr)
lastIEViewEvent.pszProto = mir_strdup(event->pszProto);
else
lastIEViewEvent.pszProto = getProto(event->hContact);
@@ -408,10 +408,10 @@ void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event) void HTMLBuilder::clear(IEView *view, IEVIEWEVENT *event)
{
- if (event != NULL) {
+ if (event != nullptr) {
setLastIEViewEvent(event);
- if (lastIEViewEvent.pszProto != NULL || event->hContact == NULL)
+ if (lastIEViewEvent.pszProto != nullptr || event->hContact == NULL)
buildHead(view, &lastIEViewEvent);
}
}
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 5885305f4d..abbc3f3065 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -65,8 +65,8 @@ static const char *dbSpanSettingNames[] = { HistoryHTMLBuilder::HistoryHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
- startedTime = time(NULL);
+ setLastEventTime(time(nullptr));
+ startedTime = time(nullptr);
}
bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
@@ -149,7 +149,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color, bkgColor;
ProtocolSettings *protoSettings = getHistoryProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getHistoryMode() == Options::MODE_TEMPLATE) {
@@ -199,7 +199,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) lf.lfItalic ? "font-style: italic;" : "");
}
for (i = 0; i < SPAN_FONT_NUM; i++) {
- loadMsgDlgFont(dbSpanSettingNames[i], &lf, &color, NULL);
+ loadMsgDlgFont(dbSpanSettingNames[i], &lf, &color, nullptr);
str.AppendFormat("%s {float: %s; font-family: %s; font-size: %dpt; font-weight: %s; color: #%06X; %s }\n",
spanClassNames[i],
i < 2 ? "left" : "right; clear: right;",
@@ -223,7 +223,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event DWORD dwFlags = db_get_b(NULL, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
ptrA szRealProto(getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
CMStringA str;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE ||
@@ -241,7 +241,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event szText = encodeUTF8(event->hContact, szRealProto, eventData->pszText, event->codepage, eventData->iType == IEED_EVENT_MESSAGE ? ENF_ALL : 0, isSent);
/* History++-specific formatting */
- const char *iconFile = NULL;
+ const char *iconFile = nullptr;
switch (eventData->iType) {
case IEED_EVENT_SYSTEM:
str.AppendFormat("<div class=\"%s\">", "divSystem");
@@ -258,7 +258,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event iconFile = "message.gif";
str.AppendFormat("<div class=\"%s\">", isSent ? "divMessageOut" : "divMessageIn");
}
- if (dwFlags & SMF_LOG_SHOWICONS && iconFile != NULL)
+ if (dwFlags & SMF_LOG_SHOWICONS && iconFile != nullptr)
Utils::appendIcon(str, iconFile);
else
str.Append(" ");
@@ -286,7 +286,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event void HistoryHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getHistoryProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getHistoryMode() & Options::MODE_TEMPLATE)
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index febf370288..4fa21b9e8a 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DISPID_NAVIGATECOMPLETE2 252 // UIActivate new document
#define DISPID_DOCUMENTCOMPLETE 259 // new document goes ReadyState_Complete
-IEView* IEView::list = NULL;
+IEView* IEView::list = nullptr;
mir_cs IEView::mutex;
static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
IEView *view = IEView::get(GetParent(GetParent(hwnd)));
- if (view != NULL) {
+ if (view != nullptr) {
switch (message) {
case WM_KEYUP:
if (LOWORD(wParam) == VK_ESCAPE && !(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000))
@@ -73,7 +73,7 @@ static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPA static LRESULT CALLBACK IEViewDocWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
IEView *view = IEView::get(GetParent(hwnd));
- if (view != NULL) {
+ if (view != nullptr) {
WNDPROC oldWndProc = view->getDocWndProc();
if (message == WM_PARENTNOTIFY && wParam == WM_CREATE) {
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
@@ -87,7 +87,7 @@ static LRESULT CALLBACK IEViewDocWindowProcedure(HWND hwnd, UINT message, WPARAM static LRESULT CALLBACK IEViewWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
IEView *view = IEView::get(hwnd);
- if (view != NULL) {
+ if (view != nullptr) {
WNDPROC oldWndProc = view->getMainWndProc();
if (message == WM_PARENTNOTIFY && wParam == WM_CREATE) {
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
@@ -107,7 +107,7 @@ IEViewSink::~IEViewSink() {} STDMETHODIMP IEViewSink::QueryInterface(REFIID riid, PVOID *ppv)
{
- *ppv = NULL;
+ *ppv = nullptr;
if (IID_IUnknown == riid)
*ppv = (IUnknown *)this;
@@ -117,7 +117,7 @@ STDMETHODIMP IEViewSink::QueryInterface(REFIID riid, PVOID *ppv) if (DIID_DWebBrowserEvents2 == riid)
*ppv = (DWebBrowserEvents2*)this;
- if (NULL != *ppv) {
+ if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
@@ -231,7 +231,7 @@ void IEView::setBorder() if (oldStyle != style) {
SetWindowLongPtr(hwnd, GWL_EXSTYLE, style);
- SetWindowPos(getHWND(), NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+ SetWindowPos(getHWND(), nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
}
}
@@ -244,19 +244,19 @@ IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy rcClient.top = y;
rcClient.right = x + cx;
rcClient.bottom = y + cy;
- if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC))) {
+ if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, nullptr, CLSCTX_INPROC))) {
CComPtr<IOleObject> pOleObject;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject))) {
pOleObject->SetClientSite(this);
pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, this->parent, &rcClient);
}
- else MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
+ else MessageBox(nullptr, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
CComPtr<IOleInPlaceObject> pOleInPlace;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleInPlace)))
pOleInPlace->GetWindow(&hwnd);
else
- MessageBox(NULL, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
+ MessageBox(nullptr, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
setBorder();
CComPtr<IConnectionPointContainer> pCPContainer;
@@ -269,7 +269,7 @@ IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy // want to sink its events.
sink = new IEViewSink(this);
if (FAILED(m_pConnectionPoint->Advise(sink, &m_dwCookie)))
- MessageBox(NULL, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
+ MessageBox(nullptr, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
}
}
setMainWndProc((WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)IEViewWindowProcedure));
@@ -277,7 +277,7 @@ IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy {
mir_cslock lck(mutex);
next = list;
- if (next != NULL)
+ if (next != nullptr)
next->prev = this;
list = this;
}
@@ -291,33 +291,33 @@ IEView::~IEView() mir_cslock lck(mutex);
if (list == this)
list = next;
- else if (prev != NULL)
+ else if (prev != nullptr)
prev->next = next;
- if (next != NULL)
+ if (next != nullptr)
next->prev = prev;
- prev = NULL;
- next = NULL;
+ prev = nullptr;
+ next = nullptr;
}
CComPtr<IOleObject> pOleObject;
if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject)))
- pOleObject->SetClientSite(NULL);
+ pOleObject->SetClientSite(nullptr);
else
- MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
+ MessageBox(nullptr, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
- if (builder != NULL) {
+ if (builder != nullptr) {
delete builder;
- builder = NULL;
+ builder = nullptr;
}
- if (m_pConnectionPoint != NULL)
+ if (m_pConnectionPoint != nullptr)
m_pConnectionPoint->Unadvise(m_dwCookie);
mir_free(selectedText);
- if (sink != NULL)
+ if (sink != nullptr)
delete sink;
DestroyWindow(hwnd);
}
@@ -325,21 +325,21 @@ IEView::~IEView() void IEView::release()
{
mir_cslock lck(mutex);
- while (list != NULL)
+ while (list != nullptr)
delete list;
- list = NULL;
+ list = nullptr;
}
IEView* IEView::get(HWND hwnd)
{
- if (list == NULL) return NULL;
+ if (list == nullptr) return nullptr;
mir_cslock lock(mutex);
- for (IEView *ptr = list; ptr != NULL; ptr = ptr->next)
+ for (IEView *ptr = list; ptr != nullptr; ptr = ptr->next)
if (ptr->hwnd == hwnd)
return ptr;
- return NULL;
+ return nullptr;
}
void IEView::setMainWndProc(WNDPROC wndProc)
@@ -375,7 +375,7 @@ WNDPROC IEView::getServerWndProc() // IUnknown
STDMETHODIMP IEView::QueryInterface(REFIID riid, PVOID *ppv)
{
- *ppv = NULL;
+ *ppv = nullptr;
if (IID_IUnknown == riid)
*ppv = this;
if (IID_IOleClientSite == riid)
@@ -391,7 +391,7 @@ STDMETHODIMP IEView::QueryInterface(REFIID riid, PVOID *ppv) if (IID_IDispatch == riid)
*ppv = (IDispatch*)this;
- if (NULL != *ppv) {
+ if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
@@ -413,7 +413,7 @@ STDMETHODIMP_(ULONG) IEView::Release(void) // IDispatch
STDMETHODIMP IEView::GetTypeInfoCount(UINT *pctinfo)
{
- if (pctinfo == NULL) return E_INVALIDARG;
+ if (pctinfo == nullptr) return E_INVALIDARG;
*pctinfo = 4;
return S_OK;
}
@@ -643,10 +643,10 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge ppt->y,
0,
hwnd,
- (RECT*)NULL);
+ (RECT*)nullptr);
DestroyMenu(hMenu);
if (iSelection == ID_MENU_CLEARLOG)
- clear(NULL);
+ clear(nullptr);
else
SendMessage(hSPWnd, WM_COMMAND, iSelection, (LPARAM)NULL);
}
@@ -657,7 +657,7 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge STDMETHODIMP IEView::GetHostInfo(DOCHOSTUIINFO *pInfo)
{
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER;// | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE;
- if (builder == NULL) {
+ if (builder == nullptr) {
pInfo->dwFlags |= DOCHOSTUIFLAG_DIALOG;
}
return S_OK;
@@ -678,7 +678,7 @@ STDMETHODIMP IEView::TranslateAccelerator(LPMSG, const GUID *, DWORD) { return S STDMETHODIMP IEView::GetOptionKeyPath(LPOLESTR *, DWORD) { return E_NOTIMPL; }
STDMETHODIMP IEView::GetDropTarget(IDropTarget *, IDropTarget **ppDropTarget)
{
- *ppDropTarget = NULL;
+ *ppDropTarget = nullptr;
return S_OK;
// return E_NOTIMPL;
}
@@ -699,7 +699,7 @@ STDMETHODIMP IEView::QueryService(REFGUID guidService, REFIID riid, void** ppvOb return (HRESULT)this->QueryInterface(riid, ppvObject);
}
else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
}
return E_NOINTERFACE;
}
@@ -718,7 +718,7 @@ STDMETHODIMP IEView::GetSecuritySite(IInternetSecurityMgrSite **) STDMETHODIMP IEView::MapUrlToZone(LPCWSTR pwszUrl, DWORD *pdwZone, DWORD)
{
- if (pdwZone != NULL && pwszUrl != NULL && !mir_wstrcmp(pwszUrl, L"about:blank")) {
+ if (pdwZone != nullptr && pwszUrl != nullptr && !mir_wstrcmp(pwszUrl, L"about:blank")) {
*pdwZone = URLZONE_LOCAL_MACHINE;
return S_OK;
}
@@ -733,7 +733,7 @@ STDMETHODIMP IEView::GetSecurityId(LPCWSTR, BYTE *, DWORD *, DWORD_PTR) STDMETHODIMP IEView::ProcessUrlAction(LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *, DWORD, DWORD, DWORD)
{
DWORD dwPolicy = URLPOLICY_ALLOW;
- if (pwszUrl != NULL && !mir_wstrcmp(pwszUrl, L"about:blank")) {
+ if (pwszUrl != nullptr && !mir_wstrcmp(pwszUrl, L"about:blank")) {
if (dwAction <= URLACTION_ACTIVEX_MAX && dwAction >= URLACTION_ACTIVEX_MIN) {
//dwPolicy = URLPOLICY_DISALLOW;
//dwPolicy = URLPOLICY_ALLOW;
@@ -780,13 +780,13 @@ STDMETHODIMP IEView::GetZoneMappings(DWORD, IEnumString **, DWORD) IHTMLDocument2* IEView::getDocument()
{
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != NULL) {
+ if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != nullptr) {
CComPtr<IHTMLDocument2> document;
dispatch.QueryInterface(&document);
return document.Detach();
}
- return NULL;
+ return nullptr;
}
void IEView::setWindowPos(int x, int y, int cx, int cy)
@@ -809,7 +809,7 @@ void IEView::scrollToTop() CComPtr<IHTMLDocument2> document = getDocument();
if (document) {
CComPtr<IHTMLWindow2> pWindow;
- if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != NULL)
+ if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x01FFFFFF, -0x01FFFFFF);
}
}
@@ -819,7 +819,7 @@ void IEView::scrollToBottomSoft() CComPtr<IHTMLDocument2> document = getDocument();
if (document) {
CComPtr<IHTMLWindow2> pWindow;
- if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != NULL)
+ if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x01FFFFFF, 0x01FFFFFF);
}
}
@@ -827,11 +827,11 @@ void IEView::scrollToBottomSoft() void IEView::scrollToBottom()
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return;
CComPtr<IHTMLElementCollection> collection;
- if (SUCCEEDED(document->get_all(&collection)) && collection != NULL) {
+ if (SUCCEEDED(document->get_all(&collection)) && collection != nullptr) {
long len;
if (SUCCEEDED(collection->get_length(&len))) {
VARIANT variant;
@@ -839,9 +839,9 @@ void IEView::scrollToBottom() variant.lVal = len - 1;
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(collection->item(variant, variant, &dispatch)) && dispatch != NULL) {
+ if (SUCCEEDED(collection->item(variant, variant, &dispatch)) && dispatch != nullptr) {
CComPtr<IHTMLElement> element;
- if (SUCCEEDED(dispatch.QueryInterface(&element)) && element != NULL) {
+ if (SUCCEEDED(dispatch.QueryInterface(&element)) && element != nullptr) {
variant.vt = VT_BOOL;
variant.boolVal = VARIANT_FALSE;
element->scrollIntoView(variant);
@@ -851,18 +851,18 @@ void IEView::scrollToBottom() }
CComPtr<IHTMLWindow2> pWindow;
- if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != NULL)
+ if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x0000FFFF, 0x0000FFFF);
}
void IEView::write(const wchar_t *text)
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return;
SAFEARRAY *safe_array = ::SafeArrayCreateVector(VT_VARIANT, 0, 1);
- if (safe_array != NULL) {
+ if (safe_array != nullptr) {
VARIANT *variant;
::SafeArrayAccessData(safe_array, (LPVOID *)&variant);
variant->vt = VT_BSTR;
@@ -894,12 +894,12 @@ void IEView::writef(const char *fmt, ...) void IEView::navigate(const char *url)
{
- pWebBrowser->Navigate(BSTR_PTR(_A2T(url)), NULL, NULL, NULL, NULL);
+ pWebBrowser->Navigate(BSTR_PTR(_A2T(url)), nullptr, nullptr, nullptr, nullptr);
}
void IEView::navigate(const wchar_t *url)
{
- pWebBrowser->Navigate(BSTR_PTR(url), NULL, NULL, NULL, NULL);
+ pWebBrowser->Navigate(BSTR_PTR(url), nullptr, nullptr, nullptr, nullptr);
}
void IEView::documentClose()
@@ -922,7 +922,7 @@ void IEView::appendEventOld(IEVIEWEVENT *event) if (clearRequired)
clear(event);
- if (builder != NULL)
+ if (builder != nullptr)
builder->appendEventOld(this, event);
getFocus = false;
@@ -933,10 +933,10 @@ void IEView::appendEvent(IEVIEWEVENT *event) if (clearRequired)
clear(event);
- if (event->eventData == NULL)
+ if (event->eventData == nullptr)
return;
- if (builder != NULL)
+ if (builder != nullptr)
builder->appendEventNew(this, event);
getFocus = false;
@@ -945,14 +945,14 @@ void IEView::appendEvent(IEVIEWEVENT *event) void IEView::clear(IEVIEWEVENT *event)
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL) {
- pWebBrowser->Navigate(BSTR_PTR(L"about:blank"), NULL, NULL, NULL, NULL);
+ if (document == nullptr) {
+ pWebBrowser->Navigate(BSTR_PTR(L"about:blank"), nullptr, nullptr, nullptr, nullptr);
HRESULT hr = S_OK;
CComPtr<IHTMLDocument2> doc2;
- while ((doc2 == NULL) && (hr == S_OK)) {
+ while ((doc2 == nullptr) && (hr == S_OK)) {
Sleep(0);
CComPtr<IDispatch> dispatch;
- if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != NULL)
+ if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != nullptr)
dispatch.QueryInterface(&doc2);
}
}
@@ -969,7 +969,7 @@ void IEView::clear(IEVIEWEVENT *event) CComPtr<IDispatch> open_window;
document->open(BSTR_PTR(L"text/html"), open_name, open_features, open_replace, &open_window);
}
- if (builder != NULL)
+ if (builder != nullptr)
builder->clear(this, event);
clearRequired = false;
@@ -982,7 +982,7 @@ void* IEView::getSelection(IEVIEWEVENT *event) mir_free(selectedText);
selectedText = getSelection();
if (mir_wstrlen(selectedText) == 0)
- return NULL;
+ return nullptr;
if (event->dwFlags & IEEF_NO_UNICODE) {
int cp = CP_ACP;
@@ -1025,24 +1025,24 @@ void IEView::translateAccelerator(UINT uMsg, WPARAM wParam, LPARAM lParam) WCHAR* IEView::getSelection()
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
- return NULL;
+ if (document == nullptr)
+ return nullptr;
CComPtr<IHTMLSelectionObject> pSelection;
- if (FAILED(document->get_selection(&pSelection)) || pSelection == NULL)
- return NULL;
+ if (FAILED(document->get_selection(&pSelection)) || pSelection == nullptr)
+ return nullptr;
CComPtr<IDispatch> pDisp;
- if (FAILED(pSelection->createRange(&pDisp)) || pDisp == NULL)
- return NULL;
+ if (FAILED(pSelection->createRange(&pDisp)) || pDisp == nullptr)
+ return nullptr;
CComPtr<IHTMLTxtRange> pRange;
if (FAILED(pDisp.QueryInterface(&pRange)))
- return NULL;
+ return nullptr;
- BSTR text = NULL;
+ BSTR text = nullptr;
if (FAILED(pRange->get_text(&text)))
- return NULL;
+ return nullptr;
WCHAR *res = mir_wstrdup(text);
::SysFreeString(text);
@@ -1055,13 +1055,13 @@ WCHAR* IEView::getSelection() **/
WCHAR* IEView::getHrefFromAnchor(CComPtr<IHTMLElement> element)
{
- if (element == NULL)
- return NULL;
+ if (element == nullptr)
+ return nullptr;
CComPtr<IHTMLAnchorElement> pAnchor;
if (FAILED(element.QueryInterface(&pAnchor))) {
VARIANT variant;
- WCHAR *url = NULL;
+ WCHAR *url = nullptr;
if (SUCCEEDED(element->getAttribute(BSTR_PTR(L"href"), 2, &variant)) && variant.vt == VT_BSTR) {
url = mir_wstrdup(variant.bstrVal);
::SysFreeString(variant.bstrVal);
@@ -1071,10 +1071,10 @@ WCHAR* IEView::getHrefFromAnchor(CComPtr<IHTMLElement> element) }
CComPtr<IHTMLElement> pParent;
- if (SUCCEEDED(element->get_parentElement(&pParent)) && pParent != NULL)
+ if (SUCCEEDED(element->get_parentElement(&pParent)) && pParent != nullptr)
return getHrefFromAnchor(pParent);
- return NULL;
+ return nullptr;
}
bool IEView::mouseActivate()
@@ -1091,11 +1091,11 @@ bool IEView::mouseClick(POINT pt) getFocus = true;
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return false;
CComPtr<IHTMLElement> element;
- if (SUCCEEDED(document->elementFromPoint(pt.x, pt.y, &element)) && element != NULL) {
+ if (SUCCEEDED(document->elementFromPoint(pt.x, pt.y, &element)) && element != nullptr) {
ptrW url(getHrefFromAnchor(element));
if (url != NULL) {
if ((GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000))
@@ -1123,7 +1123,7 @@ bool IEView::setFocus(HWND) void IEView::saveDocument()
{
CComPtr<IHTMLDocument2> document = getDocument();
- if (document == NULL)
+ if (document == nullptr)
return;
VARIANT vValue;
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index 9fd96db78d..38a3d64089 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -37,7 +37,7 @@ static const char *classNames[] = { MUCCHTMLBuilder::MUCCHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
+ setLastEventTime(time(nullptr));
}
void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
@@ -86,7 +86,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check) szResult[0] = '\0';
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
@@ -116,7 +116,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) LOGFONTA lf;
COLORREF color;
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getChatMode() == Options::MODE_TEMPLATE)
@@ -128,9 +128,9 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
COLORREF bkgColor = db_get_dw(NULL, MUCCMOD, "BackgroundLog", 0xFFFFFF);
@@ -181,7 +181,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
DWORD dwData = eventData->dwData;
bool isSent = eventData->bIsMe != 0;
CMStringA str, style;
@@ -270,7 +270,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) void MUCCHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto);
- if (protoSettings != NULL)
+ if (protoSettings != nullptr)
appendEventNonTemplate(view, event);
}
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 59723e6c5f..36b9726dd4 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -28,11 +28,11 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
#define OPTIONS_PAGES 4
-static ProtocolSettings *srmmCurrentProtoItem = NULL;
-static ProtocolSettings *chatCurrentProtoItem = NULL;
-static ProtocolSettings *historyCurrentProtoItem = NULL;
-static HIMAGELIST hProtocolImageList = NULL;
-static HIMAGELIST hImageList = NULL;
+static ProtocolSettings *srmmCurrentProtoItem = nullptr;
+static ProtocolSettings *chatCurrentProtoItem = nullptr;
+static ProtocolSettings *historyCurrentProtoItem = nullptr;
+static HIMAGELIST hProtocolImageList = nullptr;
+static HIMAGELIST hImageList = nullptr;
struct
{
@@ -52,14 +52,14 @@ static LPARAM GetItemParam(HWND hwndTreeView, HTREEITEM hItem) {
TVITEM tvi = { 0 };
tvi.mask = TVIF_PARAM;
- tvi.hItem = hItem == NULL ? TreeView_GetSelection(hwndTreeView) : hItem;
+ tvi.hItem = hItem == nullptr ? TreeView_GetSelection(hwndTreeView) : hItem;
TreeView_GetItem(hwndTreeView, &tvi);
return tvi.lParam;
}
static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
char path[MAX_PATH];
int i = Options::MODE_COMPATIBLE;
if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
@@ -89,7 +89,7 @@ static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto) static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
char path[MAX_PATH];
int i = Options::MODE_COMPATIBLE;
if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
@@ -119,7 +119,7 @@ static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto) static void SaveHistoryProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
char path[MAX_PATH];
int i = Options::MODE_COMPATIBLE;
if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
@@ -181,14 +181,14 @@ static void SetIcon(HWND hwnd, DWORD id, int index, bool condition) hIcon = ImageList_GetIcon(hImageList, index + 0, ILD_NORMAL);
hIcon = (HICON)SendDlgItemMessage(hwnd, id, STM_SETICON, (WPARAM)hIcon, 0);
- if (hIcon != NULL)
+ if (hIcon != nullptr)
DestroyIcon(hIcon);
}
static void UpdateTemplateIcons(HWND hwnd, const char *path)
{
TemplateMap *tmap = TemplateMap::loadTemplates(path, path, true);
- if (tmap != NULL) {
+ if (tmap != nullptr) {
SetIcon(hwnd, IDC_GROUPSUPPORT, 0, tmap->isGrouping());
SetIcon(hwnd, IDC_RTLSUPPORT, 2, tmap->isRTL());
delete tmap;
@@ -201,7 +201,7 @@ static void UpdateTemplateIcons(HWND hwnd, const char *path) static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isSRMMEnableTemp());
CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getSRMMModeTemp() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
@@ -216,19 +216,19 @@ static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto) CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getSRMMFlagsTemp() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getSRMMFlagsTemp() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getSRMMFlagsTemp() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
- if (proto->getSRMMBackgroundFilenameTemp() != NULL) {
+ if (proto->getSRMMBackgroundFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getSRMMBackgroundFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, "");
}
- if (proto->getSRMMCssFilename() != NULL) {
+ if (proto->getSRMMCssFilename() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getSRMMCssFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, "");
}
- if (proto->getSRMMTemplateFilenameTemp() != NULL) {
+ if (proto->getSRMMTemplateFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getSRMMTemplateFilenameTemp());
}
else {
@@ -242,7 +242,7 @@ static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto) static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isChatEnableTemp());
CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getChatModeTemp() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
@@ -257,19 +257,19 @@ static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto) CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getChatFlagsTemp() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getChatFlagsTemp() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getChatFlagsTemp() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
- if (proto->getChatBackgroundFilenameTemp() != NULL) {
+ if (proto->getChatBackgroundFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getChatBackgroundFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, "");
}
- if (proto->getChatCssFilename() != NULL) {
+ if (proto->getChatCssFilename() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getChatCssFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, "");
}
- if (proto->getChatTemplateFilenameTemp() != NULL) {
+ if (proto->getChatTemplateFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getChatTemplateFilenameTemp());
}
else {
@@ -283,7 +283,7 @@ static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto) static void UpdateHistoryProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != NULL) {
+ if (proto != nullptr) {
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isHistoryEnableTemp());
CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getHistoryModeTemp() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
@@ -298,19 +298,19 @@ static void UpdateHistoryProtoInfo(HWND hwndDlg, ProtocolSettings *proto) CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getHistoryFlagsTemp() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getHistoryFlagsTemp() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getHistoryFlagsTemp() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
- if (proto->getHistoryBackgroundFilenameTemp() != NULL) {
+ if (proto->getHistoryBackgroundFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getHistoryBackgroundFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, "");
}
- if (proto->getHistoryCssFilename() != NULL) {
+ if (proto->getHistoryCssFilename() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getHistoryCssFilenameTemp());
}
else {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, "");
}
- if (proto->getHistoryTemplateFilenameTemp() != NULL) {
+ if (proto->getHistoryTemplateFilenameTemp() != nullptr) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getHistoryTemplateFilenameTemp());
}
else {
@@ -326,25 +326,25 @@ static void RefreshProtoIcons() {
int i;
ProtocolSettings *proto;
- if (hProtocolImageList != NULL) {
+ if (hProtocolImageList != nullptr) {
ImageList_RemoveAll(hProtocolImageList);
}
else {
- for (i = 0, proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext(), i++);
+ for (i = 0, proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext(), i++);
hProtocolImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
ILC_MASK | ILC_COLOR32, i, 0);
}
- for (i = 0, proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext(), i++) {
- HICON hIcon = NULL;
+ for (i = 0, proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext(), i++) {
+ HICON hIcon = nullptr;
if (i > 0) {
hIcon = (HICON)CallProtoService(proto->getProtocolName(), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- if (hIcon == NULL) {
+ if (hIcon == nullptr) {
hIcon = (HICON)CallProtoService(proto->getProtocolName(), PS_LOADICON, PLI_PROTOCOL, 0);
}
ImageList_AddIcon(hProtocolImageList, hIcon);
DestroyIcon(hIcon);
}
- if (hIcon == NULL) {
+ if (hIcon == nullptr) {
hIcon = (HICON)Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
ImageList_AddIcon(hProtocolImageList, hIcon);
IcoLib_ReleaseIcon(hIcon);
@@ -354,7 +354,7 @@ static void RefreshProtoIcons() static void RefreshIcons()
{
- if (hImageList != NULL) {
+ if (hImageList != nullptr) {
ImageList_RemoveAll(hImageList);
}
else {
@@ -369,14 +369,14 @@ static void RefreshIcons() static void RefreshProtoList(HWND hwndDlg, int mode, bool protoTemplates)
{
int i;
- HTREEITEM hItem = NULL;
+ HTREEITEM hItem = nullptr;
HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
TreeView_DeleteAllItems(hProtoList);
TreeView_SetImageList(hProtoList, hProtocolImageList, TVSIL_NORMAL);
ProtocolSettings *proto;
- for (i = 0, proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext(), i++) {
+ for (i = 0, proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext(), i++) {
char protoName[128];
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE;
@@ -419,7 +419,7 @@ static bool BrowseFile(HWND hwndDlg, char *filter, char *defExt, char *path, int GetWindowTextA(hwndDlg, path, maxLen);
ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = filter;//"Templates (*.ivt)\0*.ivt\0All Files\0*.*\0\0";
ofn.lpstrFile = path;
ofn.Flags = OFN_FILEMUSTEXIST;
@@ -573,7 +573,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar {
MarkInitialized(2);
TranslateDialogDefault(hwndDlg);
- srmmCurrentProtoItem = NULL;
+ srmmCurrentProtoItem = nullptr;
RefreshProtoList(hwndDlg, 0, true);
return TRUE;
}
@@ -645,7 +645,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case UM_CHECKSTATECHANGE:
{
ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != NULL)
+ if (proto != nullptr)
if (strcmpi(proto->getProtocolName(), "_default_"))
proto->setSRMMEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
@@ -680,7 +680,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)NULL);
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveSRMMProtoSettings(hwndDlg, srmmCurrentProtoItem);
UpdateSRMMProtoInfo(hwndDlg, proto);
break;
@@ -706,7 +706,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w case WM_INITDIALOG:
MarkInitialized(4);
TranslateDialogDefault(hwndDlg);
- historyCurrentProtoItem = NULL;
+ historyCurrentProtoItem = nullptr;
RefreshProtoList(hwndDlg, 2, true);
return TRUE;
@@ -777,7 +777,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w case UM_CHECKSTATECHANGE:
{
ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != NULL)
+ if (proto != nullptr)
if (strcmpi(proto->getProtocolName(), "_default_"))
proto->setHistoryEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
@@ -813,7 +813,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)NULL);
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveHistoryProtoSettings(hwndDlg, historyCurrentProtoItem);
UpdateHistoryProtoInfo(hwndDlg, proto);
break;
@@ -839,7 +839,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA case WM_INITDIALOG:
MarkInitialized(8);
TranslateDialogDefault(hwndDlg);
- chatCurrentProtoItem = NULL;
+ chatCurrentProtoItem = nullptr;
RefreshProtoList(hwndDlg, 1, true);
return TRUE;
@@ -910,7 +910,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA case UM_CHECKSTATECHANGE:
{
ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != NULL)
+ if (proto != nullptr)
if (strcmpi(proto->getProtocolName(), "_default_"))
proto->setChatEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
@@ -947,7 +947,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)NULL);
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveChatProtoSettings(hwndDlg, chatCurrentProtoItem);
UpdateChatProtoInfo(hwndDlg, proto);
break;
@@ -970,12 +970,12 @@ bool Options::bSmileyAdd = false; int Options::avatarServiceFlags = 0;
int Options::generalFlags;
-ProtocolSettings *Options::protocolList = NULL;
+ProtocolSettings *Options::protocolList = nullptr;
ProtocolSettings::ProtocolSettings(const char *protocolName)
{
this->protocolName = mir_strdup(protocolName);
- next = NULL;
+ next = nullptr;
srmmEnable = false;
srmmMode = Options::MODE_COMPATIBLE;
srmmFlags = 0;
@@ -1476,7 +1476,7 @@ void Options::init() /* TODO: move to buildProtocolList method */
int protoCount;
PROTOACCOUNT **pProtos;
- ProtocolSettings *lastProto = NULL;
+ ProtocolSettings *lastProto = nullptr;
Proto_EnumAccounts(&protoCount, &pProtos);
for (int i = 0; i < protoCount + 1; i++) {
ProtocolSettings *proto;
@@ -1593,7 +1593,7 @@ void Options::init() db_free(&dbv);
}
proto->copyToTemp();
- if (lastProto != NULL) {
+ if (lastProto != nullptr) {
lastProto->setNext(proto);
}
else {
@@ -1611,14 +1611,14 @@ void Options::init() void Options::uninit()
{
ProtocolSettings *p, *p1;
- for (p = protocolList; p != NULL; p = p1) {
+ for (p = protocolList; p != nullptr; p = p1) {
p1 = p->getNext();
delete p;
}
TemplateMap::dropTemplates();
- if (hImageList != NULL)
+ if (hImageList != nullptr)
ImageList_Destroy(hImageList);
- if (hProtocolImageList != NULL)
+ if (hProtocolImageList != nullptr)
ImageList_Destroy(hProtocolImageList);
}
@@ -1660,23 +1660,23 @@ ProtocolSettings * Options::getProtocolSettings() ProtocolSettings * Options::getProtocolSettings(const char *protocolName)
{
- for (ProtocolSettings *proto = protocolList; proto != NULL; proto = proto->getNext())
+ for (ProtocolSettings *proto = protocolList; proto != nullptr; proto = proto->getNext())
if (!strcmpi(proto->getProtocolName(), protocolName))
return proto;
- return NULL;
+ return nullptr;
}
void Options::resetProtocolSettings()
{
- for (ProtocolSettings *proto = Options::getProtocolSettings(); proto != NULL; proto = proto->getNext())
+ for (ProtocolSettings *proto = Options::getProtocolSettings(); proto != nullptr; proto = proto->getNext())
proto->copyToTemp();
}
void Options::saveProtocolSettings()
{
ProtocolSettings *proto = Options::getProtocolSettings();
- for (int i = 0; proto != NULL; proto = proto->getNext(), i++) {
+ for (int i = 0; proto != nullptr; proto = proto->getNext(), i++) {
char dbsName[256];
char tmpPath[MAX_PATH];
proto->copyFromTemp();
@@ -1751,7 +1751,7 @@ void Options::saveProtocolSettings() void Options::Reload()
{
ProtocolSettings *p, *p1;
- for (p = Options::protocolList; p != NULL; p = p1) {
+ for (p = Options::protocolList; p != nullptr; p = p1) {
p1 = p->getNext();
delete p;
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index afaab42afb..b7538c2cc4 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -64,8 +64,8 @@ static const char *classNames[] = { ScriverHTMLBuilder::ScriverHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
- startedTime = time(NULL);
+ setLastEventTime(time(nullptr));
+ startedTime = time(nullptr);
}
bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
@@ -128,7 +128,7 @@ char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod if ((mode == 0 || mode == 1) && (dwFlags & SMF_LOG_SHOWDATE)) {
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
@@ -174,7 +174,7 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color;
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE) {
@@ -191,9 +191,9 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
COLORREF bkgColor = db_get_dw(NULL, SRMMMOD, "BkgColour", 0xFFFFFF);
@@ -277,7 +277,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event ptrA szRealProto(getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
const char *className = "";
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
bool isRTL = (eventData->dwFlags & IEEDF_RTL) != 0;
@@ -334,7 +334,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event if (dwFlags & SMF_LOG_SHOWTIME &&
(eventData->iType != IEED_EVENT_MESSAGE ||
(dwFlags & SMF_LOG_MARKFOLLOWUPS || isGroupBreak || !(dwFlags & SMF_LOG_GROUPMESSAGES)))) {
- char* timestampString = NULL;
+ char* timestampString = nullptr;
if (dwFlags & SMF_LOG_GROUPMESSAGES) {
if (isGroupBreak) {
if (!(dwFlags & SMF_LOG_MARKFOLLOWUPS))
@@ -347,7 +347,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event }
else timestampString = timestampToString(dwFlags, eventData->time, 0);
- if (timestampString != NULL)
+ if (timestampString != nullptr)
str.AppendFormat("<span class=\"%s\">%s</span>", isSent ? "timeOut" : "timeIn", timestampString);
if (eventData->iType != IEED_EVENT_MESSAGE)
@@ -409,7 +409,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event void ScriverHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE)
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index e904b93f38..657e22560a 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -77,9 +77,9 @@ static const char *classNames[] = { TabSRMMHTMLBuilder::TabSRMMHTMLBuilder()
{
setLastEventType(-1);
- setLastEventTime(time(NULL));
- lastEventTime = time(NULL);
- startedTime = time(NULL);
+ setLastEventTime(time(nullptr));
+ lastEventTime = time(nullptr);
+ startedTime = time(nullptr);
}
bool TabSRMMHTMLBuilder::isDbEventShown(DWORD dwFlags, DBEVENTINFO *dbei)
@@ -121,10 +121,10 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) *colour = db_get_dw(NULL, TABSRMM_FONTMODULE, str, 0x000000);
}
if (lf) {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
mir_snprintf(str, "Font%dSize", i);
lf->lfHeight = (char)db_get_b(NULL, TABSRMM_FONTMODULE, str, 10);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
lf->lfWidth = 0;
lf->lfEscapement = 0;
@@ -158,7 +158,7 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG const char *szFormat;
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
if (!isGroupBreak || !(dwFlags & MWF_LOG_SHOWDATES)) {
@@ -201,7 +201,7 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color;
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE) {
@@ -218,9 +218,9 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
}
else {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
str.Append("<html><head><style type=\"text/css\">\n");
COLORREF inColor, outColor;
@@ -291,7 +291,7 @@ time_t TabSRMMHTMLBuilder::getStartedTime() void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
- DWORD today = (DWORD)time(NULL);
+ DWORD today = (DWORD)time(nullptr);
today = today - today % 86400;
DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
@@ -303,7 +303,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event char *szRealProto = getRealProto(event->hContact);
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_FILE || eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_STATUSCHANGE) {
bool isGroupBreak = true;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
@@ -420,7 +420,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event void TabSRMMHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event)
{
ProtocolSettings *protoSettings = getSRMMProtocolSettings(event->hContact);
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
if (protoSettings->getSRMMMode() == Options::MODE_TEMPLATE)
diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp index 705ba6ddc3..708abda305 100644 --- a/plugins/IEView/src/Template.cpp +++ b/plugins/IEView/src/Template.cpp @@ -39,7 +39,7 @@ TokenDef::TokenDef(const char *tokenString, int token, int escape) Token::Token(int type, const char *text, int escape)
{
- next = NULL;
+ next = nullptr;
this->type = type;
this->escape = escape;
this->text = mir_strdup(text);
@@ -77,8 +77,8 @@ const char* Token::getText() Template::Template(const char *name, const char *text)
{
- m_next = NULL;
- m_tokens = NULL;
+ m_next = nullptr;
+ m_tokens = nullptr;
m_text = mir_strdup(text);
m_name = mir_strdup(name);
tokenize();
@@ -89,8 +89,8 @@ Template::~Template() mir_free(m_text);
mir_free(m_name);
Token *ptr = m_tokens, *ptr2;
- m_tokens = NULL;
- for (; ptr != NULL; ptr = ptr2) {
+ m_tokens = nullptr;
+ for (; ptr != nullptr; ptr = ptr2) {
ptr2 = ptr->getNext();
delete ptr;
}
@@ -148,11 +148,11 @@ static TokenDef tokenNames[] = { void Template::tokenize()
{
- if (m_text == NULL)
+ if (m_text == nullptr)
return;
char *str = mir_strdup(m_text);
- Token *lastToken = NULL;
+ Token *lastToken = nullptr;
int lastTokenType = Token::PLAIN;
int lastTokenEscape = 0;
int l = (int)mir_strlen(str);
@@ -191,9 +191,9 @@ void Template::tokenize() if (lastTokenType == Token::PLAIN)
newToken = new Token(lastTokenType, str + lastTokenStart, lastTokenEscape);
else
- newToken = new Token(lastTokenType, NULL, lastTokenEscape);
+ newToken = new Token(lastTokenType, nullptr, lastTokenEscape);
- if (lastToken != NULL)
+ if (lastToken != nullptr)
lastToken->setNext(newToken);
else
m_tokens = newToken;
@@ -208,13 +208,13 @@ void Template::tokenize() mir_free(str);
}
-TemplateMap* TemplateMap::m_mapList = NULL;
+TemplateMap* TemplateMap::m_mapList = nullptr;
TemplateMap::TemplateMap(const char *name)
{
- m_entries = NULL;
- m_next = NULL;
- m_filename = NULL;
+ m_entries = nullptr;
+ m_next = nullptr;
+ m_filename = nullptr;
m_name = mir_strdup(name);
m_grouping = false;
m_rtl = false;
@@ -231,7 +231,7 @@ TemplateMap::~TemplateMap() TemplateMap* TemplateMap::add(const char *id, const char *filename)
{
TemplateMap *map;
- for (map = m_mapList; map != NULL; map = map->m_next) {
+ for (map = m_mapList; map != nullptr; map = map->m_next) {
if (!mir_strcmp(map->m_name, id)) {
map->clear();
map->setFilename(filename);
@@ -256,8 +256,8 @@ void TemplateMap::clear() {
Template *ptr, *ptr2;
ptr = m_entries;
- m_entries = NULL;
- for (; ptr != NULL; ptr = ptr2) {
+ m_entries = nullptr;
+ for (; ptr != nullptr; ptr = ptr2) {
ptr2 = ptr->getNext();
delete ptr;
}
@@ -318,12 +318,12 @@ static TokenDef templateNames[] = { TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, bool onlyInfo)
{
char lastTemplate[1024], tmp2[1024];
- if (filename == NULL || mir_strlen(filename) == 0)
- return NULL;
+ if (filename == nullptr || mir_strlen(filename) == 0)
+ return nullptr;
FILE *fh = fopen(filename, "rt");
- if (fh == NULL)
- return NULL;
+ if (fh == nullptr)
+ return nullptr;
TemplateMap *tmap;
if (!onlyInfo)
@@ -334,7 +334,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, char store[4096];
bool wasTemplate = false;
CMStringA templateText;
- while (fgets(store, sizeof(store), fh) != NULL) {
+ while (fgets(store, sizeof(store), fh) != nullptr) {
if (sscanf(store, "%s", tmp2) == EOF) continue;
//template start
bool bFound = false;
@@ -366,7 +366,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, "hMessageOutGroupStart", "hMessageOutGroupInner" };
tmap->m_grouping = true;
for (int i = 0; i < _countof(groupTemplates); i++) {
- if (tmap->getTemplate(groupTemplates[i]) == NULL) {
+ if (tmap->getTemplate(groupTemplates[i]) == nullptr) {
tmap->m_grouping = false;
break;
}
@@ -374,7 +374,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, static const char *rtlTemplates[] = { "MessageInRTL", "MessageOutRTL" }; //"HTMLStartRTL",
tmap->m_rtl = true;
for (int i = 0; i < _countof(rtlTemplates); i++) {
- if (tmap->getTemplate(rtlTemplates[i]) == NULL) {
+ if (tmap->getTemplate(rtlTemplates[i]) == nullptr) {
tmap->m_rtl = false;
break;
}
@@ -384,29 +384,29 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, Template* TemplateMap::getTemplate(const char *text)
{
- for (Template *ptr = m_entries; ptr != NULL; ptr = ptr->getNext())
+ for (Template *ptr = m_entries; ptr != nullptr; ptr = ptr->getNext())
if (ptr->equals(text))
return ptr;
- return 0;
+ return nullptr;
}
Template* TemplateMap::getTemplate(const char *proto, const char *text)
{
- for (TemplateMap *ptr = m_mapList; ptr != NULL; ptr = ptr->m_next)
+ for (TemplateMap *ptr = m_mapList; ptr != nullptr; ptr = ptr->m_next)
if (!mir_strcmp(ptr->m_name, proto))
return ptr->getTemplate(text);
- return NULL;
+ return nullptr;
}
TemplateMap* TemplateMap::getTemplateMap(const char *proto)
{
- for (TemplateMap *ptr = m_mapList; ptr != NULL; ptr = ptr->m_next)
+ for (TemplateMap *ptr = m_mapList; ptr != nullptr; ptr = ptr->m_next)
if (!mir_strcmp(ptr->m_name, proto))
return ptr;
- return NULL;
+ return nullptr;
}
void TemplateMap::setFilename(const char *filename)
@@ -422,7 +422,7 @@ TemplateMap* TemplateMap::loadTemplates(const char *id, const char *filename, bo void TemplateMap::dropTemplates()
{
- for (TemplateMap *p = m_mapList, *p1; p != NULL; p = p1) {
+ for (TemplateMap *p = m_mapList, *p1; p != nullptr; p = p1) {
p1 = p->m_next;
delete p;
}
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 2910730b1c..95b083c771 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TemplateHTMLBuilder::TemplateHTMLBuilder()
{
iLastEventType = -1;
- startedTime = lastEventTime = time(NULL);
- groupTemplate = NULL;
+ startedTime = lastEventTime = time(nullptr);
+ groupTemplate = nullptr;
}
TemplateHTMLBuilder::~TemplateHTMLBuilder()
@@ -36,7 +36,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) {
DBVARIANT dbv;
wchar_t tmpPath[MAX_PATH];
- wchar_t *result = NULL;
+ wchar_t *result = nullptr;
if (Options::getAvatarServiceFlags() == Options::AVATARSERVICE_PRESENT) {
AVATARCACHEENTRY *ace;
@@ -45,7 +45,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) else
ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
- if (ace != NULL) {
+ if (ace != nullptr) {
if (ace->cbSize == sizeof(AVATARCACHEENTRY))
result = ace->szFilename;
else // compatibility: in M0.9 it will always be char*
@@ -55,7 +55,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) {
if (mir_wstrlen(dbv.ptszVal) > 0) {
//wchar_t *ext = wcsrchr(dbv.ptszVal, '.');
- if (result == NULL) {
+ if (result == nullptr) {
/* relative -> absolute */
mir_wstrcpy(tmpPath, dbv.ptszVal);
if (wcsncmp(tmpPath, L"http://", 7))
@@ -89,7 +89,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? L"s" : L"t", str, _countof(str));
else { // date
struct tm tm_now, tm_today;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
@@ -109,26 +109,26 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, ProtocolSettings *protoSettings)
{
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
DBVARIANT dbv;
char tempStr[1024];
- char *szNameIn = NULL;
- char *szNameOut = NULL;
- char *szUINIn = NULL;
- char *szUINOut = NULL;
- char *szNickIn = NULL;
- char *szNickOut = NULL;
- char *szStatusMsg = NULL;
+ char *szNameIn = nullptr;
+ char *szNameOut = nullptr;
+ char *szUINIn = nullptr;
+ char *szUINOut = nullptr;
+ char *szNickIn = nullptr;
+ char *szNickOut = nullptr;
+ char *szStatusMsg = nullptr;
MCONTACT hRealContact = getRealContact(event->hContact);
char *szRealProto = getProto(hRealContact);
char *szProto = getProto(event->pszProto, event->hContact);
TemplateMap *tmpm = getTemplateMap(protoSettings);
- if (tmpm == NULL)
+ if (tmpm == nullptr)
return;
char tempBase[1024] = { 0 };
@@ -155,7 +155,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr wchar_t szNoAvatarPath[MAX_PATH];
wcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
- if (szNoAvatarPathTmp != NULL)
+ if (szNoAvatarPathTmp != nullptr)
*szNoAvatarPathTmp = 0;
mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
if (_waccess(szNoAvatarPath, 0) == -1)
@@ -165,11 +165,11 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr char *szNoAvatar = mir_utf8encode(tempStr);
char *szAvatarIn = getAvatar(event->hContact, szRealProto);
- if (szAvatarIn == NULL)
+ if (szAvatarIn == nullptr)
szAvatarIn = mir_strdup(szNoAvatar);
char *szAvatarOut = getAvatar(NULL, szRealProto);
- if (szAvatarOut == NULL)
+ if (szAvatarOut == nullptr)
szAvatarOut = mir_strdup(szNoAvatar);
if (!db_get(event->hContact, "CList", "StatusMsg", &dbv)) {
@@ -186,19 +186,19 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr if (tszNick != NULL)
szNickOut = encodeUTF8(event->hContact, szRealProto, tszNick, ENF_NAMESMILEYS, true);
- Template *tmplt = NULL;
+ Template *tmplt = nullptr;
if (tmpm) {
tmplt = tmpm->getTemplate(((event->dwFlags & IEEF_RTL) && tmpm->isRTL()) ? "HTMLStartRTL" : "HTMLStart");
- if (tmplt == NULL)
+ if (tmplt == nullptr)
tmplt = tmpm->getTemplate("HTMLStart");
}
CMStringA str;
- if (tmplt != NULL) {
- for (Token *token = tmplt->getTokens(); token != NULL; token = token->getNext()) {
+ if (tmplt != nullptr) {
+ for (Token *token = tmplt->getTokens(); token != nullptr; token = token->getNext()) {
const char *tokenVal;
- tokenVal = NULL;
+ tokenVal = nullptr;
switch (token->getType()) {
case Token::PLAIN:
tokenVal = token->getText();
@@ -237,7 +237,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr tokenVal = szNickOut;
break;
}
- if (tokenVal != NULL) {
+ if (tokenVal != nullptr) {
if (token->getEscape())
str.Append(ptrA(Utils::escapeString(tokenVal)));
else
@@ -263,13 +263,13 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr mir_free(szNickOut);
mir_free(szStatusMsg);
- groupTemplate = NULL;
+ groupTemplate = nullptr;
iLastEventType = -1;
}
void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, ProtocolSettings* protoSettings)
{
- if (protoSettings == NULL)
+ if (protoSettings == nullptr)
return;
DBVARIANT dbv;
@@ -277,15 +277,15 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, char tempStr[1024];
char szCID[32];
- char *szNameIn = NULL;
- char *szNameOut = NULL;
- char *szUIN = NULL;
- char *szUINIn = NULL;
- char *szUINOut = NULL;
- char *szNickIn = NULL;
- char *szNickOut = NULL;
- char *szStatusMsg = NULL;
- char *szAvatar = NULL;
+ char *szNameIn = nullptr;
+ char *szNameOut = nullptr;
+ char *szUIN = nullptr;
+ char *szUINIn = nullptr;
+ char *szUINOut = nullptr;
+ char *szNickIn = nullptr;
+ char *szNickOut = nullptr;
+ char *szStatusMsg = nullptr;
+ char *szAvatar = nullptr;
const char *tmpltName[2];
bool isGrouping = false;
@@ -295,7 +295,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, tempBase[0] = '\0';
TemplateMap *tmpm = getTemplateMap(protoSettings);
- if (tmpm != NULL) {
+ if (tmpm != nullptr) {
mir_strcpy(tempBase, "file://");
mir_strcat(tempBase, tmpm->getFilename());
@@ -324,7 +324,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, wchar_t szNoAvatarPath[MAX_PATH];
wcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
- if (szNoAvatarPathTmp != NULL)
+ if (szNoAvatarPathTmp != nullptr)
*szNoAvatarPathTmp = 0;
mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
if (_waccess(szNoAvatarPath, 0) == -1)
@@ -333,15 +333,15 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, mir_snprintf(tempStr, "%snoavatar.png", tempBase);
char *szNoAvatar = mir_utf8encode(tempStr);
- char *szAvatarIn = NULL;
+ char *szAvatarIn = nullptr;
if (event->hContact != NULL)
szAvatarIn = getAvatar(event->hContact, szRealProto);
- if (szAvatarIn == NULL)
+ if (szAvatarIn == nullptr)
szAvatarIn = mir_strdup(szNoAvatar);
char *szAvatarOut = getAvatar(NULL, szRealProto);
- if (szAvatarOut == NULL)
+ if (szAvatarOut == nullptr)
szAvatarOut = mir_strdup(szNoAvatar);
if (event->hContact != NULL) {
@@ -361,7 +361,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, szNickOut = encodeUTF8(event->hContact, szRealProto, tszNick, ENF_NAMESMILEYS, true);
IEVIEWEVENTDATA* eventData = event->eventData;
- for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
+ for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE || eventData->iType == IEED_EVENT_FILE || eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_SYSTEM) {
CMStringA str;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
@@ -385,10 +385,10 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, mir_snprintf(szCID, "%d", (int)event->hContact);
}
tmpltName[0] = groupTemplate;
- tmpltName[1] = NULL;
- groupTemplate = NULL;
+ tmpltName[1] = nullptr;
+ groupTemplate = nullptr;
- char *szName = NULL, *szText = NULL, *szFileDesc = NULL;
+ char *szName = nullptr, *szText = nullptr, *szFileDesc = nullptr;
if (event->eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
else
@@ -430,14 +430,14 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, }
else if (eventData->iType == IEED_EVENT_FILE) {
tmpltName[1] = isHistory ? isSent ? "hFileOut" : "hFileIn" : isSent ? "FileOut" : "FileIn";
- Template *tmplt = (tmpm == NULL) ? NULL : tmpm->getTemplate(tmpltName[1]);
- if (tmplt == NULL)
+ Template *tmplt = (tmpm == nullptr) ? nullptr : tmpm->getTemplate(tmpltName[1]);
+ if (tmplt == nullptr)
tmpltName[1] = isHistory ? "hFile" : "File";
}
else if (eventData->iType == IEED_EVENT_URL) {
tmpltName[1] = isHistory ? isSent ? "hURLOut" : "hURLIn" : isSent ? "URLOut" : "URLIn";
- Template *tmplt = (tmpm == NULL) ? NULL : tmpm->getTemplate(tmpltName[1]);
- if (tmplt == NULL)
+ Template *tmplt = (tmpm == nullptr) ? nullptr : tmpm->getTemplate(tmpltName[1]);
+ if (tmplt == nullptr)
tmpltName[1] = isHistory ? "hURL" : "URL";
}
else if (eventData->iType == IEED_EVENT_STATUSCHANGE || (eventData->iType == IEED_EVENT_SYSTEM))
@@ -445,14 +445,14 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, /* template-specific formatting */
for (int i = 0; i < 2; i++) {
- if (tmpltName[i] == NULL || tmpm == NULL) continue;
+ if (tmpltName[i] == nullptr || tmpm == nullptr) continue;
Template *tmplt = tmpm->getTemplate(tmpltName[i]);
- if (tmplt == NULL)
+ if (tmplt == nullptr)
continue;
- for (Token *token = tmplt->getTokens(); token != NULL; token = token->getNext()) {
+ for (Token *token = tmplt->getTokens(); token != nullptr; token = token->getNext()) {
const char *tokenVal;
- tokenVal = NULL;
+ tokenVal = nullptr;
switch (token->getType()) {
case Token::PLAIN:
tokenVal = token->getText();
@@ -536,7 +536,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, tokenVal = szFileDesc;
break;
}
- if (tokenVal != NULL) {
+ if (tokenVal != nullptr) {
if (token->getEscape())
str.Append(ptrA(Utils::escapeString(tokenVal)));
else
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index 1b77f1efb4..68d47269aa 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -23,26 +23,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TextToken::TextToken(int _type, const char *_text, int _len)
{
- next = NULL;
+ next = nullptr;
tag = 0;
end = false;
type = _type;
text = mir_strndup(_text, _len);
wtext = mir_a2u(text);
- link = NULL;
- wlink = NULL;
+ link = nullptr;
+ wlink = nullptr;
}
TextToken::TextToken(int _type, const wchar_t *_wtext, int _len)
{
- next = NULL;
+ next = nullptr;
tag = 0;
end = false;
type = _type;
wtext = mir_wstrndup(_wtext, _len);
text = mir_u2a(wtext);
- link = NULL;
- wlink = NULL;
+ link = nullptr;
+ wlink = nullptr;
}
TextToken::~TextToken()
@@ -92,7 +92,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) static int bbTagEnd[BB_TAG_NUM];
static int bbTagCount[BB_TAG_NUM];
int i, j;
- TextToken *firstToken = NULL, *lastToken = NULL, *bbToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr, *bbToken = nullptr;
int textLen = 0;
for (j = 0; j < BB_TAG_NUM; j++) {
bbTagCount[j] = 0;
@@ -213,14 +213,14 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) if (textLen > 0) {
TextToken *newToken = new TextToken(TEXT, text + i - textLen, textLen);
textLen = 0;
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
lastToken = newToken;
}
if (newTokenType == BBCODE) {
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = bbToken;
else
lastToken->setNext(bbToken);
@@ -237,7 +237,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) TextToken* TextToken::tokenizeLinks(const wchar_t *text)
{
- TextToken *firstToken = NULL, *lastToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr;
int textLen = 0;
int l = (int)mir_wstrlen(text);
for (int i = 0; i <= l;) {
@@ -267,7 +267,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) if (textLen > 0) {
TextToken *newToken = new TextToken(TEXT, text + i - textLen, textLen);
textLen = 0;
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -277,7 +277,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) if (newTokenType == WWWLINK || newTokenType == LINK) {
TextToken *newToken = new TextToken(newTokenType, text + i, newTokenSize);
newToken->setLink(newToken->getText());
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -294,7 +294,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, const wchar_t *text, bool isSent)
{
- TextToken *firstToken = NULL, *lastToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr;
int l = (int)mir_wstrlen(text);
if (!Options::isSmileyAdd())
return new TextToken(TEXT, text, l);
@@ -307,12 +307,12 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons sp.hContact = hContact;
SMADD_BATCHPARSERES *spRes = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
int last_pos = 0;
- if (spRes != NULL) {
+ if (spRes != nullptr) {
for (int i = 0; i < (int)sp.numSmileys; i++) {
- if (spRes[i].filepath != NULL && mir_strlen((char *)spRes[i].filepath) > 0) {
+ if (spRes[i].filepath != nullptr && mir_strlen((char *)spRes[i].filepath) > 0) {
if ((int)spRes[i].startChar - last_pos > 0) {
TextToken *newToken = new TextToken(TEXT, text + last_pos, spRes[i].startChar - last_pos);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -325,7 +325,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons else
newToken->setLink((char *)spRes[i].filepath);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -338,7 +338,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons }
if (last_pos < l) {
TextToken *newToken = new TextToken(TEXT, text + last_pos, l - last_pos);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -350,7 +350,7 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const char *proto, cons TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text)
{
- TextToken *firstToken = NULL, *lastToken = NULL;
+ TextToken *firstToken = nullptr, *lastToken = nullptr;
int textLen = 0;
int l = (int)mir_wstrlen(text);
wchar_t* tokenBuffer = new wchar_t[l + 1];
@@ -359,7 +359,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) int newTokenSize = 1;
int newTokenTag = 0;
int newTokenTextLen = 0;
- const wchar_t * newTokenText = NULL;
+ const wchar_t * newTokenText = nullptr;
bool endToken = false;
@@ -420,7 +420,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) if (textLen > 0) {
TextToken *newToken = new TextToken(TEXT, tokenBuffer, textLen);
textLen = 0;
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -431,7 +431,7 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) TextToken *newToken = new TextToken(newTokenType, newTokenText, newTokenTextLen);
newToken->setEnd(endToken);
newToken->setTag(newTokenTag);
- if (lastToken == NULL)
+ if (lastToken == nullptr)
firstToken = newToken;
else
lastToken->setNext(newToken);
@@ -453,8 +453,8 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) {
wchar_t *out;
const wchar_t *ptr;
- if (str == NULL)
- return NULL;
+ if (str == nullptr)
+ return nullptr;
int c = 0;
bool wasSpace = false;
for (ptr = str; *ptr != '\0'; ptr++) {
@@ -502,7 +502,7 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) void TextToken::toString(CMStringW &str)
{
- wchar_t *eText = NULL, *eLink = NULL;
+ wchar_t *eText = nullptr, *eLink = nullptr;
switch (type) {
case TEXT:
eText = htmlEncode(wtext);
@@ -516,12 +516,12 @@ void TextToken::toString(CMStringW &str) const wchar_t *linkPrefix = type == WWWLINK ? L"http://" : L"";
if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_EMBED)) {
wchar_t *match = wcsstr(wlink, L"youtube.com");
- if (match != NULL) {
+ if (match != nullptr) {
match = wcsstr(match + 11, L"v=");
- if (match != NULL) {
+ if (match != nullptr) {
match += 2;
wchar_t *match2 = wcsstr(match, L"&");
- int len = match2 != NULL ? match2 - match : (int)mir_wstrlen(match);
+ int len = match2 != nullptr ? match2 - match : (int)mir_wstrlen(match);
match = mir_wstrdup(match);
match[len] = 0;
int width = 0;
@@ -563,7 +563,7 @@ void TextToken::toString(CMStringW &str) break;
case SMILEY:
eText = htmlEncode(wtext);
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(wlink, L".swf") != NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(wlink, L".swf") != nullptr)) {
str.AppendFormat(L"<span title=\"%s\" class=\"img\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></span>",
@@ -595,14 +595,14 @@ void TextToken::toString(CMStringW &str) break;
case BB_IMG:
eText = htmlEncode(wtext);
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && eText != NULL && (wcsstr(eText, L".swf") != NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && eText != nullptr && (wcsstr(eText, L".swf") != nullptr)) {
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"100%%\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></div>",
eText);
}
else {
- if (eText != NULL && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8))
+ if (eText != nullptr && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8))
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><img class=\"img\" style=\"width: expression((maxw = this.parentNode.offsetWidth ) > this.width ? 'auto' : maxw);\" src=\"file://%s\" /></div>", eText);
else
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><img class=\"img\" style=\"width: expression((maxw = this.parentNode.offsetWidth ) > this.width ? 'auto' : maxw);\" src=\"%s\" /></div>", eText);
@@ -611,7 +611,7 @@ void TextToken::toString(CMStringW &str) case BB_BIMG:
eText = htmlEncode(mir_ptr<wchar_t>(Utils::toAbsolute(wtext)));
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(eText, L".swf") != NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(eText, L".swf") != nullptr)) {
str.AppendFormat(L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"100%%\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></div>",
@@ -668,6 +668,6 @@ void TextToken::toString(CMStringW &str) }
break;
}
- if (eText != NULL) delete[] eText;
- if (eLink != NULL) delete[] eLink;
+ if (eText != nullptr) delete[] eText;
+ if (eLink != nullptr) delete[] eLink;
}
diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index 2a7e48a0e3..f195c9638e 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -51,7 +51,7 @@ static int countNoWhitespace(const wchar_t *str) void Utils::convertPath(char *path)
{
- if (path != NULL) {
+ if (path != nullptr) {
for (; *path != '\0'; path++) {
if (*path == '\\') *path = '/';
}
@@ -60,7 +60,7 @@ void Utils::convertPath(char *path) void Utils::convertPath(wchar_t *path)
{
- if (path != NULL) {
+ if (path != nullptr) {
for (; *path != '\0'; path++) {
if (*path == '\\') *path = '/';
}
@@ -89,8 +89,8 @@ int Utils::detectURL(const wchar_t *text) char *Utils::escapeString(const char *a)
{
- if (a == NULL)
- return NULL;
+ if (a == nullptr)
+ return nullptr;
int i, l, len = (int)mir_strlen(a);
for (i = l = 0; i < len; i++, l++) {
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp index 3ca5d06151..db0fae3210 100644 --- a/plugins/IEView/src/external_funcs.cpp +++ b/plugins/IEView/src/external_funcs.cpp @@ -190,7 +190,7 @@ namespace External if (pDispParams == nullptr || pDispParams->cArgs < 5)
return E_INVALIDARG;
- HINSTANCE res = ShellExecuteW(NULL, pDispParams->rgvarg[4].bstrVal, pDispParams->rgvarg[3].bstrVal, pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].intVal);
+ HINSTANCE res = ShellExecuteW(nullptr, pDispParams->rgvarg[4].bstrVal, pDispParams->rgvarg[3].bstrVal, pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].intVal);
if (pVarResult != nullptr)
{
@@ -207,7 +207,7 @@ namespace External return E_INVALIDARG;
BSTR data = pDispParams->rgvarg[0].bstrVal;
- if (OpenClipboard(NULL))
+ if (OpenClipboard(nullptr))
{
EmptyClipboard();
size_t size = sizeof(wchar_t)* (mir_wstrlen(data) + 1);
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp index 5ac7146d98..4b86be1748 100644 --- a/plugins/IEView/src/ieview_main.cpp +++ b/plugins/IEView/src/ieview_main.cpp @@ -67,7 +67,7 @@ IconItem iconList[] = extern "C" int __declspec(dllexport) Load(void)
{
- int wdsize = GetCurrentDirectory(0, NULL);
+ int wdsize = GetCurrentDirectory(0, nullptr);
wchar_t *workingDir = new wchar_t[wdsize];
GetCurrentDirectory(wdsize, workingDir);
Utils::convertPath(workingDir);
diff --git a/plugins/IEView/src/ieview_services.cpp b/plugins/IEView/src/ieview_services.cpp index b1d6d66f27..0681854e12 100644 --- a/plugins/IEView/src/ieview_services.cpp +++ b/plugins/IEView/src/ieview_services.cpp @@ -26,7 +26,7 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam) IEVIEWWINDOW *window = (IEVIEWWINDOW *)lParam;
Options::init();
if (window->iType == IEW_CREATE) {
- HTMLBuilder *builder = NULL;
+ HTMLBuilder *builder = nullptr;
switch (window->dwMode) {
case IEWM_MUCC:
builder = new MUCCHTMLBuilder();
@@ -44,7 +44,7 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam) builder = new HistoryHTMLBuilder();
break;
case IEWM_BROWSER:
- builder = NULL;
+ builder = nullptr;
break;
default:
builder = new ScriverHTMLBuilder();
@@ -55,17 +55,17 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam) }
else if (window->iType == IEW_SETPOS) {
IEView *view = IEView::get(window->hwnd);
- if (view != NULL)
+ if (view != nullptr)
view->setWindowPos(window->x, window->y, window->cx, window->cy);
}
else if (window->iType == IEW_SCROLLBOTTOM) {
IEView *view = IEView::get(window->hwnd);
- if (view != NULL)
+ if (view != nullptr)
view->scrollToBottom();
}
else if (window->iType == IEW_DESTROY) {
IEView *view = IEView::get(window->hwnd);
- if (view != NULL)
+ if (view != nullptr)
delete view;
}
return 0;
@@ -76,7 +76,7 @@ INT_PTR HandleIEEvent(WPARAM, LPARAM lParam) IEVIEWEVENT *event = (IEVIEWEVENT *)lParam;
Options::init();
IEView *view = IEView::get(event->hwnd);
- if (view != NULL) {
+ if (view != nullptr) {
if (event->iType == IEE_LOG_DB_EVENTS)
view->appendEventOld(event);
else if (event->iType == IEE_CLEAR_LOG)
@@ -98,7 +98,7 @@ INT_PTR HandleIENavigate(WPARAM, LPARAM lParam) IEVIEWNAVIGATE *navigate = (IEVIEWNAVIGATE *)lParam;
Options::init();
IEView *view = IEView::get(navigate->hwnd);
- if (view != NULL) {
+ if (view != nullptr) {
if (navigate->iType == IEN_NAVIGATE) {
view->navigate(navigate);
}
|