summaryrefslogtreecommitdiff
path: root/plugins/IEView
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-07 16:48:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-07 16:48:08 +0300
commit92adecd638db5510fc8e258a519b2f4a225c4573 (patch)
treefb7a089785ab5161b51942160a2ef2182f41646b /plugins/IEView
parent09c998451798561b15e2b7a58d4d77446a238b5c (diff)
fixes #3385 (IEView: crash on filetransfer open)
Diffstat (limited to 'plugins/IEView')
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.cpp13
-rw-r--r--plugins/IEView/src/IEView.cpp68
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.cpp20
-rw-r--r--plugins/IEView/src/TextToken.cpp22
-rw-r--r--plugins/IEView/src/Utils.cpp10
-rw-r--r--plugins/IEView/src/external_funcs.cpp119
-rw-r--r--plugins/IEView/src/ieview_services.cpp2
7 files changed, 123 insertions, 131 deletions
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp
index f4d4ffba07..25014d36bb 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.cpp
+++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp
@@ -69,7 +69,7 @@ HistoryHTMLBuilder::HistoryHTMLBuilder()
startedTime = time(0);
}
-bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
+bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO *dbei)
{
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
@@ -90,7 +90,7 @@ char *HistoryHTMLBuilder::timestampToString(time_t check)
return szResult;
}
-void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, COLORREF * colour, COLORREF * bkgColour)
+void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA *lf, COLORREF *colour, COLORREF *bkgColour)
{
char str[128];
int style;
@@ -133,12 +133,12 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, CO
}
}
-const char *HistoryHTMLBuilder::getTemplateFilename(ProtocolSettings * protoSettings)
+const char *HistoryHTMLBuilder::getTemplateFilename(ProtocolSettings *protoSettings)
{
return protoSettings->getHistoryTemplateFilename();
}
-int HistoryHTMLBuilder::getFlags(ProtocolSettings * protoSettings)
+int HistoryHTMLBuilder::getFlags(ProtocolSettings *protoSettings)
{
return protoSettings->getHistoryFlags();
}
@@ -222,12 +222,11 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event)
void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
uint32_t dwFlags = db_get_b(0, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
- IEVIEWEVENTDATA* eventData = event->eventData;
+ IEVIEWEVENTDATA *eventData = event->eventData;
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 || eventData->iType == IEED_EVENT_FILE)
- {
+ if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE || eventData->iType == IEED_EVENT_FILE) {
ptrA szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(event->hContact, eventData->szNick.w, ENF_NAMESMILEYS, true);
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp
index 20b012c8ad..48f7bbdce7 100644
--- a/plugins/IEView/src/IEView.cpp
+++ b/plugins/IEView/src/IEView.cpp
@@ -27,7 +27,7 @@ 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 = nullptr;
+IEView *IEView::list = nullptr;
mir_cs IEView::mutex;
static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -115,7 +115,7 @@ STDMETHODIMP IEViewSink::QueryInterface(REFIID riid, PVOID *ppv)
*ppv = (IDispatch *)this;
if (DIID_DWebBrowserEvents2 == riid)
- *ppv = (DWebBrowserEvents2*)this;
+ *ppv = (DWebBrowserEvents2 *)this;
if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
@@ -137,10 +137,10 @@ STDMETHODIMP_(ULONG) IEViewSink::Release(void)
}
STDMETHODIMP IEViewSink::GetTypeInfoCount(UINT *) { return E_NOTIMPL; }
-STDMETHODIMP IEViewSink::GetTypeInfo(UINT, LCID, LPTYPEINFO*) { return S_OK; }
-STDMETHODIMP IEViewSink::GetIDsOfNames(REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return S_OK; }
+STDMETHODIMP IEViewSink::GetTypeInfo(UINT, LCID, LPTYPEINFO *) { return S_OK; }
+STDMETHODIMP IEViewSink::GetIDsOfNames(REFIID, LPOLESTR *, UINT, LCID, DISPID *) { return S_OK; }
-STDMETHODIMP IEViewSink::Invoke(DISPID dispIdMember, REFIID, LCID, uint16_t, DISPPARAMS* pDispParams, VARIANT*, EXCEPINFO*, UINT*)
+STDMETHODIMP IEViewSink::Invoke(DISPID dispIdMember, REFIID, LCID, uint16_t, DISPPARAMS *pDispParams, VARIANT *, EXCEPINFO *, UINT *)
{
if (!pDispParams) return E_INVALIDARG;
switch (dispIdMember) {
@@ -165,7 +165,7 @@ void IEViewSink::DownloadBegin() {}
void IEViewSink::DownloadComplete() {}
void IEViewSink::TitleChange(BSTR) {}
void IEViewSink::PropertyChange(BSTR) {}
-void IEViewSink::BeforeNavigate2(IDispatch*, VARIANT* url, VARIANT*, VARIANT*, VARIANT*, VARIANT*, VARIANT_BOOL* cancel)
+void IEViewSink::BeforeNavigate2(IDispatch *, VARIANT *url, VARIANT *, VARIANT *, VARIANT *, VARIANT *, VARIANT_BOOL *cancel)
{
if (mir_wstrcmp(url->bstrVal, L"about:blank")) {
Utils_OpenUrlW(url->bstrVal);
@@ -173,9 +173,9 @@ void IEViewSink::BeforeNavigate2(IDispatch*, VARIANT* url, VARIANT*, VARIANT*, V
}
}
-void IEViewSink::NewWindow2(IDispatch**, VARIANT_BOOL*) {}
-void IEViewSink::NavigateComplete(IDispatch*, VARIANT*) {}
-void IEViewSink::DocumentComplete(IDispatch*, VARIANT*) {}
+void IEViewSink::NewWindow2(IDispatch **, VARIANT_BOOL *) {}
+void IEViewSink::NavigateComplete(IDispatch *, VARIANT *) {}
+void IEViewSink::DocumentComplete(IDispatch *, VARIANT *) {}
void IEViewSink::OnQuit() {}
void IEViewSink::OnVisible(VARIANT_BOOL) {}
void IEViewSink::OnToolBar(VARIANT_BOOL) {}
@@ -188,10 +188,10 @@ void IEViewSink::WindowSetLeft(long) {}
void IEViewSink::WindowSetTop(long) {}
void IEViewSink::WindowSetWidth(long) {}
void IEViewSink::WindowSetHeight(long) {}
-void IEViewSink::WindowClosing(VARIANT_BOOL, VARIANT_BOOL*) {}
+void IEViewSink::WindowClosing(VARIANT_BOOL, VARIANT_BOOL *) {}
void IEViewSink::ClientToHostWindow(long *, long *) {}
void IEViewSink::SetSecureLockIcon(long) {}
-void IEViewSink::FileDownload(VARIANT_BOOL*) {}
+void IEViewSink::FileDownload(VARIANT_BOOL *) {}
void IEView::waitWhileBusy()
{
@@ -306,7 +306,7 @@ void IEView::release()
list = nullptr;
}
-IEView* IEView::get(HWND hwnd)
+IEView *IEView::get(HWND hwnd)
{
if (list == nullptr) return nullptr;
@@ -355,17 +355,17 @@ STDMETHODIMP IEView::QueryInterface(REFIID riid, PVOID *ppv)
if (IID_IUnknown == riid)
*ppv = this;
if (IID_IOleClientSite == riid)
- *ppv = (IOleClientSite*)this;//Unknown)m_pIOleClientSite;
+ *ppv = (IOleClientSite *)this;//Unknown)m_pIOleClientSite;
if (IID_IOleWindow == riid || IID_IOleInPlaceSite == riid)
- *ppv = (IOleInPlaceSite*)this;//m_pIOleIPSite;
+ *ppv = (IOleInPlaceSite *)this;//m_pIOleIPSite;
if (IID_IDocHostUIHandler == riid)
- *ppv = (IDocHostUIHandler*)this;//m_pIOleIPSite;
+ *ppv = (IDocHostUIHandler *)this;//m_pIOleIPSite;
if (IID_IInternetSecurityManager == riid)
- *ppv = (IInternetSecurityManager*)this;
+ *ppv = (IInternetSecurityManager *)this;
if (IID_IServiceProvider == riid)
- *ppv = (IServiceProvider*)this;
+ *ppv = (IServiceProvider *)this;
if (IID_IDispatch == riid)
- *ppv = (IDispatch*)this;
+ *ppv = (IDispatch *)this;
if (nullptr != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
@@ -393,15 +393,14 @@ STDMETHODIMP IEView::GetTypeInfoCount(UINT *pctinfo)
*pctinfo = 4;
return S_OK;
}
-STDMETHODIMP IEView::GetTypeInfo(UINT, LCID, LPTYPEINFO*)
+STDMETHODIMP IEView::GetTypeInfo(UINT, LCID, LPTYPEINFO *)
{
return S_OK;
}
STDMETHODIMP IEView::GetIDsOfNames(REFIID /*riid*/, LPOLESTR *rgszNames, UINT cNames, LCID /*lcid*/, DISPID *rgDispId)
{
HRESULT retval = S_OK;
- for (size_t i = 0; i < cNames; i++)
- {
+ for (size_t i = 0; i < cNames; i++) {
if (!wcscmp(L"db_get", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_DB_GET;
else if (!wcscmp(L"db_set", rgszNames[i]))
@@ -420,8 +419,7 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID /*riid*/, LPOLESTR *rgszNames, UINT cN
else if (!wcscmp(L"mir_CallContactService", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_CALLCONTACTSERVICE;
- else
- {
+ else {
rgDispId[i] = NULL;
retval = DISP_E_UNKNOWNNAME;
}
@@ -439,8 +437,7 @@ STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
UINT * /*puArgErr*/)
{
- switch (dispIdMember)
- {
+ switch (dispIdMember) {
case DISPID_EXTERNAL_CALLSERVICE:
return External::mir_CallService(pDispParams, pVarResult);
case DISPID_EXTERNAL_CALLCONTACTSERVICE:
@@ -565,7 +562,7 @@ STDMETHODIMP IEView::RequestNewObjectLayout(void)
STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarget, IDispatch *)
{
CComPtr<IOleCommandTarget> pOleCommandTarget;
- if (SUCCEEDED(pcmdTarget->QueryInterface(IID_IOleCommandTarget, (void**)&pOleCommandTarget))) {
+ if (SUCCEEDED(pcmdTarget->QueryInterface(IID_IOleCommandTarget, (void **)&pOleCommandTarget))) {
CComPtr<IOleWindow> pOleWindow;
if (SUCCEEDED(pOleCommandTarget.QueryInterface(&pOleWindow))) {
HWND hSPWnd;
@@ -588,7 +585,7 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge
ppt->y,
0,
hwnd,
- (RECT*)nullptr);
+ (RECT *)nullptr);
DestroyMenu(hMenu);
if (iSelection == ID_MENU_CLEARLOG)
clear(nullptr);
@@ -638,7 +635,7 @@ STDMETHODIMP IEView::FilterDataObject(IDataObject *, IDataObject **) { return E_
/* IServiceProvider */
-STDMETHODIMP IEView::QueryService(REFGUID guidService, REFIID riid, void** ppvObject)
+STDMETHODIMP IEView::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
{
if (guidService == SID_SInternetSecurityManager && riid == IID_IInternetSecurityManager) {
return (HRESULT)this->QueryInterface(riid, ppvObject);
@@ -698,7 +695,7 @@ STDMETHODIMP IEView::ProcessUrlAction(LPCWSTR pwszUrl, DWORD dwAction, uint8_t *
else return INET_E_DEFAULT_ACTION;
if (cbPolicy >= sizeof(uint32_t)) {
- *(uint32_t*)pPolicy = dwPolicy;
+ *(uint32_t *)pPolicy = dwPolicy;
return S_OK;
}
@@ -722,7 +719,7 @@ STDMETHODIMP IEView::GetZoneMappings(DWORD, IEnumString **, DWORD)
return INET_E_DEFAULT_ACTION;
}
-IHTMLDocument2* IEView::getDocument()
+IHTMLDocument2 *IEView::getDocument()
{
CComPtr<IDispatch> dispatch;
if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != nullptr) {
@@ -848,8 +845,7 @@ void IEView::navigate(const wchar_t *url)
}
void IEView::documentClose()
-{
-}
+{}
void IEView::appendEventOld(IEVIEWEVENT *event)
{
@@ -911,7 +907,7 @@ void IEView::clear(IEVIEWEVENT *event)
setBorder();
}
-wchar_t* IEView::selection()
+wchar_t *IEView::selection()
{
wszSelectedText = getSelection();
return (mir_wstrlen(wszSelectedText) == 0) ? nullptr : wszSelectedText.get();
@@ -943,7 +939,7 @@ void IEView::translateAccelerator(UINT uMsg, WPARAM wParam, LPARAM lParam)
/**
* Returns the selected text within the active document
**/
-wchar_t* IEView::getSelection()
+wchar_t *IEView::getSelection()
{
CComPtr<IHTMLDocument2> document = getDocument();
if (document == nullptr)
@@ -974,7 +970,7 @@ wchar_t* IEView::getSelection()
/**
* Returns the destination url (href) of the given anchor element (or parent anchor element)
**/
-wchar_t* IEView::getHrefFromAnchor(CComPtr<IHTMLElement> element)
+wchar_t *IEView::getHrefFromAnchor(CComPtr<IHTMLElement> element)
{
if (element == nullptr)
return nullptr;
@@ -1061,4 +1057,4 @@ void IEView::navigate(IEVIEWNAVIGATE *nav)
navigate(nav->url.w);
else
navigate(nav->url.a);
-} \ No newline at end of file
+}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index f0abd2c097..19c3e85fae 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -68,7 +68,7 @@ ScriverHTMLBuilder::ScriverHTMLBuilder()
startedTime = time(0);
}
-bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
+bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO *dbei)
{
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
@@ -80,7 +80,7 @@ bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
}
}
-void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
+void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA *lf, COLORREF *colour)
{
char str[32];
int style;
@@ -118,7 +118,7 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
}
}
-char* ScriverHTMLBuilder::timestampToString(uint32_t dwFlags, time_t check, int mode)
+char *ScriverHTMLBuilder::timestampToString(uint32_t dwFlags, time_t check, int mode)
{
static char szResult[512]; szResult[0] = '\0';
char str[80];
@@ -134,13 +134,13 @@ char* ScriverHTMLBuilder::timestampToString(uint32_t dwFlags, time_t check, int
today = mktime(&tm_today);
if (dwFlags & SMF_LOG_USERELATIVEDATE && check >= today) {
- strncpy(szResult, Translate("Today"), _countof(szResult)-1);
+ strncpy(szResult, Translate("Today"), _countof(szResult) - 1);
if (mode == 0) {
mir_strcat(szResult, ",");
}
}
else if (dwFlags & SMF_LOG_USERELATIVEDATE && check > (today - 86400)) {
- strncpy(szResult, Translate("Yesterday"), _countof(szResult)-1);
+ strncpy(szResult, Translate("Yesterday"), _countof(szResult) - 1);
if (mode == 0) {
mir_strcat(szResult, ",");
}
@@ -179,7 +179,7 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event)
buildHeadTemplate(view, event, protoSettings);
return;
}
-
+
CMStringA str;
if (protoSettings->getSRMMMode() == Options::MODE_CSS) {
const char *externalCSS = protoSettings->getSRMMCssFilename();
@@ -273,7 +273,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event
dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, 0) ? SMF_LOG_MSGONNEWLINE : 0;
dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_DRAWLINES, 0) ? SMF_LOG_DRAWLINES : 0;
- IEVIEWEVENTDATA* eventData = event->eventData;
+ IEVIEWEVENTDATA *eventData = event->eventData;
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;
@@ -328,8 +328,8 @@ 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 = nullptr;
+ (dwFlags & SMF_LOG_MARKFOLLOWUPS || isGroupBreak || !(dwFlags & SMF_LOG_GROUPMESSAGES)))) {
+ char *timestampString = nullptr;
if (dwFlags & SMF_LOG_GROUPMESSAGES) {
if (isGroupBreak) {
if (!(dwFlags & SMF_LOG_MARKFOLLOWUPS))
@@ -382,7 +382,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event
else className = "notices";
if (eventData->iType == IEED_EVENT_FILE) {
- str.AppendFormat("<span class=\"%s\">%s: %s</span>", className,
+ str.AppendFormat("<span class=\"%s\">%s: %s</span>", className,
(isSent) ? Translate("File sent") : Translate("File received"), szText.get());
}
else str.AppendFormat("<span class=\"%s\">%s</span>", className, szText.get());
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp
index 76927e80a8..a1bb18be63 100644
--- a/plugins/IEView/src/TextToken.cpp
+++ b/plugins/IEView/src/TextToken.cpp
@@ -66,14 +66,14 @@ static int countNoWhitespace(const wchar_t *str)
return c;
}
-TextToken* TextToken::tokenizeBBCodes(const wchar_t *text)
+TextToken *TextToken::tokenizeBBCodes(const wchar_t *text)
{
return tokenizeBBCodes(text, (int)mir_wstrlen(text));
}
// TODO: Add the following BBCodes: code
#define BB_TAG_NUM 10
-TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l)
+TextToken *TextToken::tokenizeBBCodes(const wchar_t *text, int l)
{
static const wchar_t *bbTagName[] = { L"b", L"i", L"u", L"s", L"img", L"color", L"size", L"bimg", L"url", L"code" };
static int bbTagNameLen[] = { 1, 1, 1, 1, 3, 5, 4, 4, 3, 4 };
@@ -170,7 +170,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l)
else {
for (j = 0; j < BB_TAG_NUM; j++) {
k = i + 2;
- if (bbTagCount[j]>0 && !wcsnicmp(text + k, bbTagName[j], bbTagNameLen[j])) {
+ if (bbTagCount[j] > 0 && !wcsnicmp(text + k, bbTagName[j], bbTagNameLen[j])) {
k += bbTagNameLen[j];
if (text[k] == ']') {
k++;
@@ -225,7 +225,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l)
return firstToken;
}
-TextToken* TextToken::tokenizeLinks(const wchar_t *text)
+TextToken *TextToken::tokenizeLinks(const wchar_t *text)
{
TextToken *firstToken = nullptr, *lastToken = nullptr;
int textLen = 0;
@@ -282,7 +282,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text)
return firstToken;
}
-TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const wchar_t *text, bool isSent)
+TextToken *TextToken::tokenizeSmileys(MCONTACT hContact, const wchar_t *text, bool isSent)
{
TextToken *firstToken = nullptr, *lastToken = nullptr;
int l = (int)mir_wstrlen(text);
@@ -339,18 +339,18 @@ TextToken* TextToken::tokenizeSmileys(MCONTACT hContact, const wchar_t *text, bo
return firstToken;
}
-TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text)
+TextToken *TextToken::tokenizeChatFormatting(const wchar_t *text)
{
TextToken *firstToken = nullptr, *lastToken = nullptr;
int textLen = 0;
int l = (int)mir_wstrlen(text);
- wchar_t* tokenBuffer = new wchar_t[l + 1];
+ wchar_t *tokenBuffer = new wchar_t[l + 1];
for (int i = 0; i <= l;) {
int newTokenType = TEXT;
int newTokenSize = 1;
int newTokenTag = 0;
int newTokenTextLen = 0;
- const wchar_t * newTokenText = nullptr;
+ const wchar_t *newTokenText = nullptr;
bool endToken = false;
@@ -558,7 +558,7 @@ void TextToken::toString(CMStringW &str)
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>",
- eText, wlink);
+ eText, wlink);
}
else str.AppendFormat(L"<img class=\"img\" src=\"file://%s\" title=\"%s\" alt=\"%s\" />", wlink, eText, eText);
break;
@@ -590,7 +590,7 @@ void TextToken::toString(CMStringW &str)
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);
+ eText);
}
else {
if (eText != nullptr && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8))
@@ -606,7 +606,7 @@ void TextToken::toString(CMStringW &str)
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);
+ 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=\"file://%s\" /></div>", eText);
break;
diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp
index 50da2b3a8b..c29b4b3b21 100644
--- a/plugins/IEView/src/Utils.cpp
+++ b/plugins/IEView/src/Utils.cpp
@@ -29,12 +29,12 @@ const wchar_t *Utils::getBaseDir()
return base_dir;
}
-wchar_t* Utils::toAbsolute(wchar_t* relative)
+wchar_t *Utils::toAbsolute(wchar_t *relative)
{
- const wchar_t* bdir = getBaseDir();
+ const wchar_t *bdir = getBaseDir();
long len = (int)mir_wstrlen(bdir);
long tlen = len + (int)mir_wstrlen(relative);
- wchar_t* result = (wchar_t*)mir_alloc(sizeof(wchar_t)*(tlen + 1));
+ wchar_t *result = (wchar_t *)mir_alloc(sizeof(wchar_t) * (tlen + 1));
if (result) {
mir_wstrcpy(result, bdir);
mir_wstrcpy(result + len, relative);
@@ -99,7 +99,7 @@ char *Utils::escapeString(const char *a)
l++;
}
}
- char *out = (char*)mir_alloc(l + 1);
+ char *out = (char *)mir_alloc(l + 1);
for (i = l = 0; i < len; i++, l++) {
if (a[i] == '\\' || a[i] == '\n' || a[i] == '\r' || a[i] == '\"'
|| a[i] == '\'' || a[i] == '\b' || a[i] == '\t' || a[i] == '\f') {
@@ -126,4 +126,4 @@ bool Utils::DbEventIsForHistory(DBEVENTINFO *dbei)
{
DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
return et && (et->flags & DETF_HISTORY);
-} \ No newline at end of file
+}
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp
index a690d9f0c8..57e4c8f5cf 100644
--- a/plugins/IEView/src/external_funcs.cpp
+++ b/plugins/IEView/src/external_funcs.cpp
@@ -4,8 +4,7 @@ template<typename T>
T Var_To(VARIANTARG &pVar, char strType = 'W')
{
T retVal = NULL;
- switch (pVar.vt)
- {
+ switch (pVar.vt) {
case VT_BSTR:
if (strType == 'U')
retVal = (T)mir_utf8encodeW(pVar.bstrVal);
@@ -14,6 +13,7 @@ T Var_To(VARIANTARG &pVar, char strType = 'W')
else
retVal = (T)pVar.bstrVal;
break;
+
case VT_INT:
case VT_I1:
case VT_I2:
@@ -25,89 +25,89 @@ T Var_To(VARIANTARG &pVar, char strType = 'W')
return retVal;
}
+static const wchar_t* STR(const VARIANTARG &pVar)
+{
+ return (pVar.vt == VT_BSTR) ? pVar.bstrVal : L"";
+}
+
namespace External
{
- HRESULT mir_CallService(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ HRESULT mir_CallService(DISPPARAMS *p, VARIANT *pVarResult)
{
- if (pDispParams == nullptr || pDispParams->cArgs < 3)
+ if (p == nullptr || p->cArgs < 3)
return E_INVALIDARG;
wchar_t wType = 'W', lType = 'W';
- if (pDispParams->cArgs >= 5) lType = pDispParams->rgvarg[4].bstrVal[0];
- if (pDispParams->cArgs >= 4) wType = pDispParams->rgvarg[3].bstrVal[0];
+ if (p->cArgs >= 5) lType = p->rgvarg[4].bstrVal[0];
+ if (p->cArgs >= 4) wType = p->rgvarg[3].bstrVal[0];
- BSTR szName = pDispParams->rgvarg[2].bstrVal;
- WPARAM wParam = Var_To<WPARAM>(pDispParams->rgvarg[1], wType);
- LPARAM lParam = Var_To<LPARAM>(pDispParams->rgvarg[0], lType);
+ BSTR szName = p->rgvarg[2].bstrVal;
+ WPARAM wParam = Var_To<WPARAM>(p->rgvarg[1], wType);
+ LPARAM lParam = Var_To<LPARAM>(p->rgvarg[0], lType);
- INT_PTR res = CallService(_T2A((wchar_t*)szName), wParam, lParam);
+ INT_PTR res = CallService(_T2A((wchar_t *)szName), wParam, lParam);
- if (wType == 'A' || wType == 'U') mir_free((void*)wParam);
- if (lType == 'A' || lType == 'U') mir_free((void*)lParam);
+ if (wType == 'A' || wType == 'U') mir_free((void *)wParam);
+ if (lType == 'A' || lType == 'U') mir_free((void *)lParam);
- if (pVarResult != nullptr)
- {
+ if (pVarResult != nullptr) {
pVarResult->vt = VT_UINT;
pVarResult->uintVal = (UINT)res;
}
return S_OK;
}
- HRESULT mir_CallContactService(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ HRESULT mir_CallContactService(DISPPARAMS *p, VARIANT *pVarResult)
{
- if (pDispParams == nullptr || pDispParams->cArgs < 4)
+ if (p == nullptr || p->cArgs < 4)
return E_INVALIDARG;
wchar_t wType = 'W', lType = 'W';
- if (pDispParams->cArgs >= 6) lType = pDispParams->rgvarg[5].bstrVal[0];
- if (pDispParams->cArgs >= 5) wType = pDispParams->rgvarg[4].bstrVal[0];
+ if (p->cArgs >= 6) lType = p->rgvarg[5].bstrVal[0];
+ if (p->cArgs >= 5) wType = p->rgvarg[4].bstrVal[0];
- MCONTACT hContact = pDispParams->rgvarg[3].intVal;
- BSTR szName = pDispParams->rgvarg[2].bstrVal;
- WPARAM wParam = Var_To<WPARAM>(pDispParams->rgvarg[1], wType);
- LPARAM lParam = Var_To<LPARAM>(pDispParams->rgvarg[0], lType);
+ MCONTACT hContact = p->rgvarg[3].intVal;
+ BSTR szName = p->rgvarg[2].bstrVal;
+ WPARAM wParam = Var_To<WPARAM>(p->rgvarg[1], wType);
+ LPARAM lParam = Var_To<LPARAM>(p->rgvarg[0], lType);
- INT_PTR res = ProtoChainSend(hContact, _T2A((wchar_t*)szName), wParam, lParam);
+ INT_PTR res = ProtoChainSend(hContact, _T2A((wchar_t *)szName), wParam, lParam);
- if (wType == 'A' || wType == 'U') mir_free((void*)wParam);
- if (lType == 'A' || lType == 'U') mir_free((void*)lParam);
+ if (wType == 'A' || wType == 'U') mir_free((void *)wParam);
+ if (lType == 'A' || lType == 'U') mir_free((void *)lParam);
- if (pVarResult != nullptr)
- {
+ if (pVarResult != nullptr) {
pVarResult->vt = VT_UINT;
pVarResult->uintVal = (UINT)res;
}
return S_OK;
}
- HRESULT IEView_GetCurrentContact(IEView *self, DISPPARAMS*, VARIANT *pVarResult)
+ HRESULT IEView_GetCurrentContact(IEView *self, DISPPARAMS *, VARIANT *pVarResult)
{
- if (pVarResult != nullptr)
- {
+ if (pVarResult != nullptr) {
pVarResult->vt = VT_UINT;
pVarResult->uintVal = self->Get_CurrentContact();
}
return S_OK;
}
- HRESULT db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ HRESULT db_get(DISPPARAMS *p, VARIANT *pVarResult)
{
- if (pDispParams->cArgs < 3)
+ if (p->cArgs < 3)
return E_INVALIDARG;
- MCONTACT hContact = pDispParams->rgvarg[2].intVal;
- BSTR szModule = pDispParams->rgvarg[1].bstrVal;
- BSTR szSetting = pDispParams->rgvarg[0].bstrVal;
+ MCONTACT hContact = p->rgvarg[2].intVal;
+ BSTR szModule = p->rgvarg[1].bstrVal;
+ BSTR szSetting = p->rgvarg[0].bstrVal;
DBVARIANT dbv = { 0 };
- if (db_get(hContact, _T2A((wchar_t*)szModule), _T2A((wchar_t*)szSetting), &dbv))
+ if (db_get(hContact, _T2A((wchar_t *)szModule), _T2A((wchar_t *)szSetting), &dbv))
return S_OK;
- if (pVarResult != nullptr)
- {
- switch (dbv.type)
- {
+ if (pVarResult != nullptr) {
+ switch (dbv.type) {
case DBVT_BYTE:
//pVarResult->bVal = dbv.bVal != 0;
//pVarResult->vt = VT_BOOL;
@@ -140,21 +140,20 @@ namespace External
return S_OK;
}
- HRESULT db_set(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ HRESULT db_set(DISPPARAMS *p, VARIANT *pVarResult)
{
- if (pDispParams == nullptr || pDispParams->cArgs < 4)
+ if (p == nullptr || p->cArgs < 4)
return E_INVALIDARG;
- MCONTACT hContact = pDispParams->rgvarg[3].intVal;
- BSTR szModule = pDispParams->rgvarg[2].bstrVal;
- BSTR szSetting = pDispParams->rgvarg[1].bstrVal;
+ MCONTACT hContact = p->rgvarg[3].intVal;
+ BSTR szModule = p->rgvarg[2].bstrVal;
+ BSTR szSetting = p->rgvarg[1].bstrVal;
DBVARIANT dbv = { 0 };
- VARIANT& pVal = pDispParams->rgvarg[0];
+ VARIANT &pVal = p->rgvarg[0];
- switch (pVal.vt)
- {
+ switch (pVal.vt) {
case VT_BSTR:
dbv.type = DBVT_WCHAR;
dbv.pwszVal = mir_wstrdup(pVal.bstrVal);
@@ -171,29 +170,27 @@ namespace External
dbv.type = DBVT_BYTE;
dbv.bVal = pVal.boolVal;
break;
- default:
+ default:
return E_INVALIDARG;
}
- INT_PTR res = ::db_set(hContact, _T2A((wchar_t*)szModule), _T2A((wchar_t*)szSetting), &dbv);
+ INT_PTR res = ::db_set(hContact, _T2A((wchar_t *)szModule), _T2A((wchar_t *)szSetting), &dbv);
- if (pVarResult != nullptr)
- {
+ if (pVarResult != nullptr) {
pVarResult->vt = VT_INT;
pVarResult->intVal = (int)res;
}
return S_OK;
}
- HRESULT win32_ShellExecute(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ HRESULT win32_ShellExecute(DISPPARAMS *p, VARIANT *pVarResult)
{
- if (pDispParams == nullptr || pDispParams->cArgs < 5)
+ if (p == nullptr || p->cArgs < 5)
return E_INVALIDARG;
- HINSTANCE res = ShellExecuteW(nullptr, pDispParams->rgvarg[4].bstrVal, pDispParams->rgvarg[3].bstrVal, pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].intVal);
+ HINSTANCE res = ShellExecuteW(nullptr, STR(p->rgvarg[4]), STR(p->rgvarg[3]), STR(p->rgvarg[2]), STR(p->rgvarg[1]), p->rgvarg[0].intVal);
- if (pVarResult != nullptr)
- {
+ if (pVarResult != nullptr) {
pVarResult->vt = VT_HANDLE;
pVarResult->ullVal = (ULONGLONG)res;
}
@@ -201,12 +198,12 @@ namespace External
return S_OK;
}
- HRESULT win32_CopyToClipboard(DISPPARAMS *pDispParams, VARIANT*)
+ HRESULT win32_CopyToClipboard(DISPPARAMS *p, VARIANT *)
{
- if (pDispParams == nullptr || pDispParams->cArgs < 1)
+ if (p == nullptr || p->cArgs < 1)
return E_INVALIDARG;
- Utils_ClipboardCopy(pDispParams->rgvarg[0].bstrVal);
+ Utils_ClipboardCopy(p->rgvarg[0].bstrVal);
return S_OK;
}
-} \ No newline at end of file
+}
diff --git a/plugins/IEView/src/ieview_services.cpp b/plugins/IEView/src/ieview_services.cpp
index e53eda024d..e6000fe8c8 100644
--- a/plugins/IEView/src/ieview_services.cpp
+++ b/plugins/IEView/src/ieview_services.cpp
@@ -104,4 +104,4 @@ INT_PTR ReloadOptions(WPARAM, LPARAM)
{
Options::reload();
return 0;
-} \ No newline at end of file
+}