Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 | 81 |
82 // ENTRY POINT | 82 // ENTRY POINT |
83 STDMETHODIMP CPluginUserSettings::QueryInterface(REFIID riid, void **ppvObj) | 83 STDMETHODIMP CPluginUserSettings::QueryInterface(REFIID riid, void **ppvObj) |
84 { | 84 { |
85 if (!ppvObj) | 85 if (!ppvObj) |
86 { | 86 { |
87 return E_POINTER; | 87 return E_POINTER; |
88 } | 88 } |
89 if (riid == IID_IUnknown || riid == IID_IDispatch) // GUID comparison does not throw | 89 if (riid == IID_IUnknown || riid == IID_IDispatch) // GUID comparison does not throw |
90 { | 90 { |
91 *ppvObj = static_cast<void *>(this); | 91 *ppvObj = static_cast<void*>(this); |
Oleksandr
2015/02/12 04:46:22
NIT: No space after void
Eric
2015/02/13 14:57:57
Done.
| |
92 return S_OK; | 92 return S_OK; |
93 } | 93 } |
94 return E_NOINTERFACE; | 94 return E_NOINTERFACE; |
95 } | 95 } |
96 | 96 |
97 /** | 97 /** |
98 * \par Limitation | 98 * \par Limitation |
99 * CPluginUserSettings is not allocated on the heap. | 99 * CPluginUserSettings is not allocated on the heap. |
100 * It appears only as a member variable in CPluginTabBase. | 100 * It appears only as a member variable in CPluginTabBase. |
101 * 'AddRef' and 'Release' don't need reference counting because they don't pre sent COM factories. | 101 * 'AddRef' and 'Release' don't need reference counting because they don't pre sent COM factories. |
(...skipping 29 matching lines...) Expand all Loading... | |
131 { | 131 { |
132 if (!name || !id) | 132 if (!name || !id) |
133 { | 133 { |
134 return E_POINTER; | 134 return E_POINTER; |
135 } | 135 } |
136 if (count != 1) | 136 if (count != 1) |
137 { | 137 { |
138 return E_FAIL; | 138 return E_FAIL; |
139 } | 139 } |
140 auto item = methodIndex.find(*name); // unordered_map::find is not declared noexcept | 140 auto item = methodIndex.find(*name); // unordered_map::find is not declared noexcept |
141 if (item==methodIndex.end()) | 141 if (item == methodIndex.end()) |
Oleksandr
2015/02/12 04:46:22
NIT: Space before and after ==
Eric
2015/02/13 14:57:57
Done.
| |
142 { | 142 { |
143 return DISP_E_UNKNOWNNAME; | 143 return DISP_E_UNKNOWNNAME; |
144 } | 144 } |
145 *id = item->second; | 145 *id = item->second; |
146 } | 146 } |
147 catch (...) | 147 catch (...) |
148 { | 148 { |
149 return E_FAIL; | 149 return E_FAIL; |
150 } | 150 } |
151 return S_OK; | 151 return S_OK; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 if (pDispparams->cArgs != 1) | 214 if (pDispparams->cArgs != 1) |
215 { | 215 { |
216 return DISP_E_BADPARAMCOUNT; | 216 return DISP_E_BADPARAMCOUNT; |
217 } | 217 } |
218 if (pDispparams->rgvarg[0].vt != VT_I4) | 218 if (pDispparams->rgvarg[0].vt != VT_I4) |
219 { | 219 { |
220 return DISP_E_TYPEMISMATCH; | 220 return DISP_E_TYPEMISMATCH; |
221 } | 221 } |
222 if (pVarResult) | 222 if (pVarResult) |
223 { | 223 { |
224 int indx = pDispparams->rgvarg[0].lVal; | 224 int index = pDispparams->rgvarg[0].lVal; |
Oleksandr
2015/02/12 04:46:22
NIT: Might be a good time to fix the typo: "index"
Eric
2015/02/13 14:57:57
OK.
Done.
| |
225 | 225 |
226 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList(); | 226 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList(); |
227 | 227 |
228 if (indx < 0 || indx >= (int)languageTitleList.size()) | 228 if (index < 0 || index >= static_cast<int>(languageTitleList.size()) ) |
229 return DISP_E_EXCEPTION; | 229 return DISP_E_EXCEPTION; |
230 | 230 |
231 CString language; | 231 CString language; |
232 | 232 |
233 int curIndx = 0; | 233 int loopIndex = 0; |
Oleksandr
2015/02/12 04:46:22
NIT: Typo here as well
Eric
2015/02/13 14:57:57
Done.
I should point out that the algorithm here
| |
234 for(std::map<CString, CString>::const_iterator it = languageTitleList. begin(); it != languageTitleList.end(); ++it) | 234 for (std::map<CString, CString>::const_iterator it = languageTitleList .begin(); it != languageTitleList.end(); ++it) |
Oleksandr
2015/02/12 04:46:22
Nit: Space after 'for'
Eric
2015/02/13 14:57:57
Done.
| |
235 { | 235 { |
236 if (curIndx == indx) | 236 if (loopIndex == index) |
237 { | 237 { |
238 language = it->first; | 238 language = it->first; |
239 break; | 239 break; |
240 } | 240 } |
241 curIndx++; | 241 ++loopIndex; |
242 } | 242 } |
243 | 243 |
244 pVarResult->vt = VT_BSTR; | 244 pVarResult->vt = VT_BSTR; |
245 pVarResult->bstrVal = SysAllocString(language); | 245 pVarResult->bstrVal = SysAllocString(language); |
246 } | 246 } |
247 } | 247 } |
248 break; | 248 break; |
249 case dispatchID_GetLanguageTitleByIndex: | 249 case dispatchID_GetLanguageTitleByIndex: |
250 { | 250 { |
251 if (pDispparams->cArgs != 1) | 251 if (pDispparams->cArgs != 1) |
252 { | 252 { |
253 return DISP_E_BADPARAMCOUNT; | 253 return DISP_E_BADPARAMCOUNT; |
254 } | 254 } |
255 if (pDispparams->rgvarg[0].vt != VT_I4) | 255 if (pDispparams->rgvarg[0].vt != VT_I4) |
256 { | 256 { |
257 return DISP_E_TYPEMISMATCH; | 257 return DISP_E_TYPEMISMATCH; |
258 } | 258 } |
259 if (pVarResult) | 259 if (pVarResult) |
260 { | 260 { |
261 int indx = pDispparams->rgvarg[0].lVal; | 261 int index = pDispparams->rgvarg[0].lVal; |
Oleksandr
2015/02/12 04:46:22
Nit: Another indx typo leftover and more below
Eric
2015/02/13 14:57:57
Done.
| |
262 | 262 |
263 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList(); | 263 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList(); |
264 | 264 |
265 if (indx < 0 || indx >= (int)languageTitleList.size()) | 265 if (index < 0 || index >= static_cast<int>(languageTitleList.size()) ) |
266 return DISP_E_EXCEPTION; | 266 return DISP_E_EXCEPTION; |
267 | 267 |
268 CString languageTitle; | 268 CString languageTitle; |
269 | 269 |
270 int curIndx = 0; | 270 int loopIndex = 0; |
271 for(std::map<CString, CString>::const_iterator it = languageTitleList. begin(); it != languageTitleList.end(); ++it) | 271 for (std::map<CString, CString>::const_iterator it = languageTitleList .begin(); it != languageTitleList.end(); ++it) |
Oleksandr
2015/02/12 04:46:22
Nit: Space after 'for'
Eric
2015/02/13 14:57:57
Done.
| |
272 { | 272 { |
273 if (curIndx == indx) | 273 if (loopIndex == index) |
274 { | 274 { |
275 languageTitle = it->second; | 275 languageTitle = it->second; |
276 break; | 276 break; |
277 } | 277 } |
278 curIndx++; | 278 loopIndex++; |
279 } | 279 } |
280 | 280 |
281 pVarResult->vt = VT_BSTR; | 281 pVarResult->vt = VT_BSTR; |
282 pVarResult->bstrVal = SysAllocString(languageTitle); | 282 pVarResult->bstrVal = SysAllocString(languageTitle); |
283 } | 283 } |
284 } | 284 } |
285 break; | 285 break; |
286 case dispatchID_SetLanguage: | 286 case dispatchID_SetLanguage: |
287 { | 287 { |
288 if (pDispparams->cArgs != 1) | 288 if (pDispparams->cArgs != 1) |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 pVarResult->vt = VT_BOOL; | 440 pVarResult->vt = VT_BOOL; |
441 pVarResult->boolVal = CPluginClient::GetInstance()->GetPref(L"displayU pdatePage", false) ? VARIANT_TRUE : VARIANT_FALSE; | 441 pVarResult->boolVal = CPluginClient::GetInstance()->GetPref(L"displayU pdatePage", false) ? VARIANT_TRUE : VARIANT_FALSE; |
442 } | 442 } |
443 } | 443 } |
444 break; | 444 break; |
445 default: | 445 default: |
446 return DISP_E_MEMBERNOTFOUND; | 446 return DISP_E_MEMBERNOTFOUND; |
447 break; | 447 break; |
448 } | 448 } |
449 } | 449 } |
450 catch(...) | 450 catch (...) |
451 { | 451 { |
452 return E_FAIL; | 452 return E_FAIL; |
453 } | 453 } |
454 return S_OK; | 454 return S_OK; |
455 } | 455 } |
LEFT | RIGHT |