Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginUserSettings.cpp

Issue 10845030: Marshal all libadblockplus calls to the engine process (Closed)
Patch Set: Created May 31, 2013, 2:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/plugin/PluginUserSettings.cpp
===================================================================
--- a/src/plugin/PluginUserSettings.cpp
+++ b/src/plugin/PluginUserSettings.cpp
@@ -20,28 +20,28 @@ static const CString s_Methods[] = {s_Ge
CPluginUserSettings::CPluginUserSettings()
{
}
STDMETHODIMP CPluginUserSettings::QueryInterface(REFIID riid, void **ppvObj)
{
- if (IID_IUnknown == riid || IID_IDispatch == riid)
+ if (IID_IUnknown == riid || IID_IDispatch == riid)
{
*ppvObj = (LPVOID)this;
return NOERROR;
}
return E_NOINTERFACE;
}
/*
-Since CPluginUserSettings is not allocated on the heap, 'AddRef' and 'Release' don't need reference counting,
+Since CPluginUserSettings is not allocated on the heap, 'AddRef' and 'Release' don't need reference counting,
because CPluginUserSettings won't be deleted when reference counter == 0
*/
ULONG __stdcall CPluginUserSettings::AddRef()
{
return 1;
}
@@ -127,17 +127,17 @@ CStringW sGetMessage(const CString& key)
STDMETHODIMP CPluginUserSettings::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispparams, VARIANT* pVarResult,
EXCEPINFO* pExcepinfo, UINT* pArgErr)
{
if (!pDispparams)
return E_POINTER;
if (!pExcepinfo)
- return E_POINTER;
+ return E_POINTER;
if (pDispparams->cNamedArgs)
return DISP_E_NONAMEDARGS;
CPluginSettings* settings = CPluginSettings::GetInstance();
if (dispidMember < 0 || dispidMember >= countof(s_Methods))
return DISP_E_BADINDEX;
@@ -152,30 +152,30 @@ STDMETHODIMP CPluginUserSettings::Invoke
if (VT_BSTR != pDispparams->rgvarg[0].vt)
return DISP_E_TYPEMISMATCH;
if (pVarResult)
{
CComBSTR key = pDispparams->rgvarg[0].bstrVal;
CStringW message = sGetMessage((BSTR)key);
- pVarResult->vt = VT_BSTR;
+ pVarResult->vt = VT_BSTR;
pVarResult->bstrVal = SysAllocString(message);
}
}
else if (s_GetLanguageCount == method)
{
if (pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
if (pVarResult)
{
std::map<CString, CString> languageList = settings->GetFilterLanguageTitleList();
- pVarResult->vt = VT_I4;
+ pVarResult->vt = VT_I4;
pVarResult->lVal = languageList.size();
}
}
else if (s_GetLanguageByIndex == method)
{
if (1 != pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
@@ -200,17 +200,17 @@ STDMETHODIMP CPluginUserSettings::Invoke
{
language = it->first;
break;
}
curIndx++;
}
- pVarResult->vt = VT_BSTR;
+ pVarResult->vt = VT_BSTR;
pVarResult->bstrVal = SysAllocString(language);
}
}
else if (s_GetLanguageTitleByIndex == method)
{
if (1 != pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
@@ -235,17 +235,17 @@ STDMETHODIMP CPluginUserSettings::Invoke
{
languageTitle = it->second;
break;
}
curIndx++;
}
- pVarResult->vt = VT_BSTR;
+ pVarResult->vt = VT_BSTR;
pVarResult->bstrVal = SysAllocString(languageTitle);
}
}
else if (s_SetLanguage == method)
{
if (1 != pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
@@ -260,39 +260,39 @@ STDMETHODIMP CPluginUserSettings::Invoke
{
if (pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
if (pVarResult)
{
CString url = settings->GetSubscription();
- pVarResult->vt = VT_BSTR;
+ pVarResult->vt = VT_BSTR;
pVarResult->bstrVal = SysAllocString(url);
}
}
else if (s_GetWhitelistDomains == method)
{
if (pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
if (pVarResult)
{
std::vector<std::string> whiteList = settings->GetWhiteListedDomainList();
CString sWhiteList;
- for (int i = 0; i < whiteList.size(); i++)
- {
+ for (size_t i = 0; i < whiteList.size(); i++)
+ {
if (!sWhiteList.IsEmpty())
{
sWhiteList += ',';
}
sWhiteList += CString(CA2W(whiteList[i].c_str(), CP_UTF8));
}
- pVarResult->vt = VT_BSTR;
+ pVarResult->vt = VT_BSTR;
pVarResult->bstrVal = SysAllocString(sWhiteList);
}
}
else if (s_AddWhitelistDomain == method)
{
if (1 != pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
@@ -309,20 +309,20 @@ STDMETHODIMP CPluginUserSettings::Invoke
{
if (1 != pDispparams->cArgs)
return DISP_E_BADPARAMCOUNT;
if (VT_BSTR != pDispparams->rgvarg[0].vt)
return DISP_E_TYPEMISMATCH;
CComBSTR domain = pDispparams->rgvarg[0].bstrVal;
- if (settings->IsWhiteListedDomain((BSTR)domain))
+ if (settings->IsWhiteListedDomain((BSTR)domain))
{
settings->AddWhiteListedDomain((BSTR)domain);
CPluginClient::GetInstance()->ClearWhiteListCache();
}
}
- else
+ else
return DISP_E_MEMBERNOTFOUND;
return S_OK;
}

Powered by Google App Engine
This is Rietveld