Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/character_encoding.cc

Issue 9474020: [Coverity] CID 6203: pass std::string by const-ref (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/character_encoding.h" 5 #include "chrome/browser/character_encoding.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 tokenizer.token()); 247 tokenizer.token());
248 // Ignore invalid encoding. 248 // Ignore invalid encoding.
249 if (!id) 249 if (!id)
250 continue; 250 continue;
251 available_list->push_back(id); 251 available_list->push_back(id);
252 if (available_list->size() == maximum_size) 252 if (available_list->size() == maximum_size)
253 return; 253 return;
254 } 254 }
255 } 255 }
256 256
257 string16 GetEncodingDisplayName(std::string encoding_name, 257 string16 GetEncodingDisplayName(const std::string& encoding_name,
258 int category_string_id) { 258 int category_string_id) {
259 string16 category_name = l10n_util::GetStringUTF16(category_string_id); 259 string16 category_name = l10n_util::GetStringUTF16(category_string_id);
260 if (category_string_id != IDS_ENCODING_KOREAN && 260 if (category_string_id != IDS_ENCODING_KOREAN &&
261 category_string_id != IDS_ENCODING_THAI && 261 category_string_id != IDS_ENCODING_THAI &&
262 category_string_id != IDS_ENCODING_TURKISH) { 262 category_string_id != IDS_ENCODING_TURKISH) {
263 const CanonicalNameDisplayNameMapType* map = 263 const CanonicalNameDisplayNameMapType* map =
264 CanonicalEncodingMapSingleton()->GetCanonicalNameDisplayNameMapData(); 264 CanonicalEncodingMapSingleton()->GetCanonicalNameDisplayNameMapData();
265 DCHECK(map); 265 DCHECK(map);
266 266
267 CanonicalNameDisplayNameMapType::const_iterator found_name = 267 CanonicalNameDisplayNameMapType::const_iterator found_name =
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // Insert new encoding to head of selected encoding list. 537 // Insert new encoding to head of selected encoding list.
538 *selected_encodings = encoding_name; 538 *selected_encodings = encoding_name;
539 // Generate the string for rest selected encoding list. 539 // Generate the string for rest selected encoding list.
540 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); 540 for (std::vector<int>::const_iterator it = selected_encoding_list.begin();
541 it != selected_encoding_list.end(); ++it) { 541 it != selected_encoding_list.end(); ++it) {
542 selected_encodings->append(1, L','); 542 selected_encodings->append(1, L',');
543 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); 543 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it));
544 } 544 }
545 return true; 545 return true;
546 } 546 }
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 408576698