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

Side by Side Diff: base/i18n/character_encoding.cc

Issue 2691573003: base: Remove auto raw pointer deduction. (Closed)
Patch Set: update Created 3 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
« no previous file with comments | « no previous file | base/memory/memory_pressure_listener.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/i18n/character_encoding.h" 5 #include "base/i18n/character_encoding.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "third_party/icu/source/common/unicode/ucnv.h" 8 #include "third_party/icu/source/common/unicode/ucnv.h"
9 9
10 namespace base { 10 namespace base {
11 namespace { 11 namespace {
12 12
13 // An array of all supported canonical encoding names. 13 // An array of all supported canonical encoding names.
14 const char* const kCanonicalEncodingNames[] = { 14 const char* const kCanonicalEncodingNames[] = {
15 "Big5", "EUC-JP", "EUC-KR", "gb18030", 15 "Big5", "EUC-JP", "EUC-KR", "gb18030",
16 "GBK", "IBM866", "ISO-2022-JP", "ISO-8859-10", 16 "GBK", "IBM866", "ISO-2022-JP", "ISO-8859-10",
17 "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "ISO-8859-16", 17 "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "ISO-8859-16",
18 "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", 18 "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5",
19 "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-8-I", 19 "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-8-I",
20 "KOI8-R", "KOI8-U", "macintosh", "Shift_JIS", 20 "KOI8-R", "KOI8-U", "macintosh", "Shift_JIS",
21 "UTF-16LE", "UTF-8", "windows-1250", "windows-1251", 21 "UTF-16LE", "UTF-8", "windows-1250", "windows-1251",
22 "windows-1252", "windows-1253", "windows-1254", "windows-1255", 22 "windows-1252", "windows-1253", "windows-1254", "windows-1255",
23 "windows-1256", "windows-1257", "windows-1258", "windows-874"}; 23 "windows-1256", "windows-1257", "windows-1258", "windows-874"};
24 24
25 } // namespace 25 } // namespace
26 26
27 std::string GetCanonicalEncodingNameByAliasName(const std::string& alias_name) { 27 std::string GetCanonicalEncodingNameByAliasName(const std::string& alias_name) {
28 for (auto& encoding_name : kCanonicalEncodingNames) { 28 for (auto* encoding_name : kCanonicalEncodingNames) {
29 if (alias_name == encoding_name) 29 if (alias_name == encoding_name)
30 return alias_name; 30 return alias_name;
31 } 31 }
32 static const char* kStandards[3] = {"HTML", "MIME", "IANA"}; 32 static const char* kStandards[3] = {"HTML", "MIME", "IANA"};
33 for (auto& standard : kStandards) { 33 for (auto* standard : kStandards) {
34 UErrorCode error_code = U_ZERO_ERROR; 34 UErrorCode error_code = U_ZERO_ERROR;
35 const char* canonical_name = 35 const char* canonical_name =
36 ucnv_getStandardName(alias_name.c_str(), standard, &error_code); 36 ucnv_getStandardName(alias_name.c_str(), standard, &error_code);
37 if (U_SUCCESS(error_code) && canonical_name) 37 if (U_SUCCESS(error_code) && canonical_name)
38 return canonical_name; 38 return canonical_name;
39 } 39 }
40 return std::string(); 40 return std::string();
41 } 41 }
42 } // namespace base 42 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/memory/memory_pressure_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698