summaryrefslogtreecommitdiff
path: root/plugins/IEView
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-01-21 13:58:44 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-01-21 13:58:44 +0000
commitf766a15d16ee4a719fdf7ce273f87a333d90a40b (patch)
tree47803e5530bc8a4388b86b6d2eebd9fc97bb27f5 /plugins/IEView
parentdb58ffd66b837aa184ee8d934811b78f9ff8040b (diff)
IEView: memleaks fix, warnings fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@16136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView')
-rw-r--r--plugins/IEView/src/IEView.cpp12
-rw-r--r--plugins/IEView/src/TemplateHTMLBuilder.cpp2
-rw-r--r--plugins/IEView/src/external_funcs.cpp67
3 files changed, 46 insertions, 35 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp
index fe6f254996..63276c293a 100644
--- a/plugins/IEView/src/IEView.cpp
+++ b/plugins/IEView/src/IEView.cpp
@@ -421,7 +421,7 @@ STDMETHODIMP IEView::GetTypeInfo(UINT, LCID, LPTYPEINFO*)
{
return S_OK;
}
-STDMETHODIMP IEView::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+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++)
@@ -443,13 +443,13 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames
}
STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
+ REFIID /*riid*/,
+ LCID /*lcid*/,
+ WORD /*wFlags*/,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
- EXCEPINFO *pExcepInfo,
- UINT *puArgErr)
+ EXCEPINFO * /*pExcepInfo*/,
+ UINT * /*puArgErr*/)
{
switch (dispIdMember)
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp
index 896e55fbb2..f61646820c 100644
--- a/plugins/IEView/src/TemplateHTMLBuilder.cpp
+++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp
@@ -55,7 +55,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto)
}
if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
if (mir_tstrlen(dbv.ptszVal) > 0) {
- TCHAR *ext = _tcsrchr(dbv.ptszVal, '.');
+ //TCHAR *ext = _tcsrchr(dbv.ptszVal, '.');
if (result == NULL) {
/* relative -> absolute */
mir_tstrcpy(tmpPath, dbv.ptszVal);
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp
index 3f38f4d3f1..599734805b 100644
--- a/plugins/IEView/src/external_funcs.cpp
+++ b/plugins/IEView/src/external_funcs.cpp
@@ -5,40 +5,48 @@ namespace External
HRESULT db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult)
{
if (pDispParams->cArgs < 3)
- return TYPE_E_OUTOFBOUNDS;
-
- if (!pDispParams || !pVarResult)
- return S_OK;
+ return E_INVALIDARG;
- MCONTACT hContact = pDispParams->rgvarg[2].vt == VT_INT ? pDispParams->rgvarg[2].intVal : NULL;
- BSTR szModule = pDispParams->rgvarg[1].vt == VT_BSTR ? pDispParams->rgvarg[1].bstrVal : NULL;
- BSTR szSetting = pDispParams->rgvarg[0].vt == VT_BSTR ? pDispParams->rgvarg[0].bstrVal : NULL;
+ MCONTACT hContact = pDispParams->rgvarg[2].intVal;
+ BSTR szModule = pDispParams->rgvarg[1].bstrVal;
+ BSTR szSetting = pDispParams->rgvarg[0].bstrVal;
DBVARIANT dbv = { 0 };
- db_get(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv);
- switch (dbv.type)
+ if (db_get(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv))
+ return E_FAIL;
+
+ if (pVarResult != nullptr)
{
- case DBVT_BYTE:
- pVarResult->bVal = dbv.bVal;
- pVarResult->vt = VT_BOOL;
- break;
- case DBVT_WCHAR:
- pVarResult->vt = VT_BSTR;
- pVarResult->bstrVal = ::SysAllocString(dbv.pwszVal);
- break;
- case DBVT_UTF8:
- pVarResult->vt = VT_BSTR;
- pVarResult->bstrVal = ::SysAllocString(ptrW(mir_utf8decodeW(dbv.pszVal)));
- break;
- case DBVT_ASCIIZ:
- pVarResult->vt = VT_BSTR;
- pVarResult->bstrVal = ::SysAllocString(_A2T(dbv.pszVal));
- break;
- case DBVT_DWORD:
- pVarResult->vt = VT_INT;
- pVarResult->intVal = dbv.dVal;
+ switch (dbv.type)
+ {
+ case DBVT_BYTE:
+ pVarResult->bVal = dbv.bVal;
+ pVarResult->vt = VT_BOOL;
+ break;
+ case DBVT_WCHAR:
+ pVarResult->vt = VT_BSTR;
+ pVarResult->bstrVal = ::SysAllocString(dbv.pwszVal);
+ break;
+ case DBVT_UTF8:
+ pVarResult->vt = VT_BSTR;
+ pVarResult->bstrVal = ::SysAllocString(ptrW(mir_utf8decodeW(dbv.pszVal)));
+ break;
+ case DBVT_ASCIIZ:
+ pVarResult->vt = VT_BSTR;
+ pVarResult->bstrVal = ::SysAllocString(_A2T(dbv.pszVal));
+ break;
+ case DBVT_DWORD:
+ pVarResult->vt = VT_INT;
+ pVarResult->intVal = dbv.dVal;
+ break;
+ case DBVT_WORD:
+ pVarResult->vt = VT_I2;
+ pVarResult->iVal = dbv.dVal;
+ break;
+ }
}
+ db_free(&dbv);
return S_OK;
}
@@ -72,6 +80,9 @@ namespace External
case VT_BOOL:
dbv.type = DBVT_BYTE;
dbv.bVal = pVal.boolVal;
+ break;
+ default:
+ return E_INVALIDARG;
}
INT_PTR res = ::db_set(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv);