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

Side by Side Diff: src/plugin/PluginUserSettings.cpp

Issue 29330798: Issue #3350 - Replace DISP_E_EXCEPTION returns with DISP_E_BADINDEX (Closed)
Patch Set: Created Nov. 25, 2015, 6:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 { 218 {
219 return DISP_E_TYPEMISMATCH; 219 return DISP_E_TYPEMISMATCH;
220 } 220 }
221 if (pVarResult) 221 if (pVarResult)
222 { 222 {
223 int index = pDispparams->rgvarg[0].lVal; 223 int index = pDispparams->rgvarg[0].lVal;
224 224
225 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList(); 225 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList();
226 226
227 if (index < 0 || index >= static_cast<int>(languageTitleList.size()) ) 227 if (index < 0 || index >= static_cast<int>(languageTitleList.size()) )
228 return DISP_E_EXCEPTION; 228 return DISP_E_BADINDEX;
229 229
230 CString language; 230 CString language;
231 231
232 int loopIndex = 0; 232 int loopIndex = 0;
233 for (std::map<CString, CString>::const_iterator it = languageTitleList .begin(); it != languageTitleList.end(); ++it) 233 for (std::map<CString, CString>::const_iterator it = languageTitleList .begin(); it != languageTitleList.end(); ++it)
234 { 234 {
235 if (loopIndex == index) 235 if (loopIndex == index)
236 { 236 {
237 language = it->first; 237 language = it->first;
238 break; 238 break;
(...skipping 16 matching lines...) Expand all
255 { 255 {
256 return DISP_E_TYPEMISMATCH; 256 return DISP_E_TYPEMISMATCH;
257 } 257 }
258 if (pVarResult) 258 if (pVarResult)
259 { 259 {
260 int index = pDispparams->rgvarg[0].lVal; 260 int index = pDispparams->rgvarg[0].lVal;
261 261
262 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList(); 262 std::map<CString, CString> languageTitleList = settings->GetFilterLang uageTitleList();
263 263
264 if (index < 0 || index >= static_cast<int>(languageTitleList.size()) ) 264 if (index < 0 || index >= static_cast<int>(languageTitleList.size()) )
265 return DISP_E_EXCEPTION; 265 return DISP_E_BADINDEX;
266 266
267 CString languageTitle; 267 CString languageTitle;
268 268
269 int loopIndex = 0; 269 int loopIndex = 0;
270 for (std::map<CString, CString>::const_iterator it = languageTitleList .begin(); it != languageTitleList.end(); ++it) 270 for (std::map<CString, CString>::const_iterator it = languageTitleList .begin(); it != languageTitleList.end(); ++it)
271 { 271 {
272 if (loopIndex == index) 272 if (loopIndex == index)
273 { 273 {
274 languageTitle = it->second; 274 languageTitle = it->second;
275 break; 275 break;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 return DISP_E_MEMBERNOTFOUND; 445 return DISP_E_MEMBERNOTFOUND;
446 break; 446 break;
447 } 447 }
448 } 448 }
449 catch (...) 449 catch (...)
450 { 450 {
451 return E_FAIL; 451 return E_FAIL;
452 } 452 }
453 return S_OK; 453 return S_OK;
454 } 454 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld