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

Unified Diff: base/i18n/character_encoding.cc

Issue 2619493002: Let the canonical name of invalid encoding be an empty string (Closed)
Patch Set: std::string Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/i18n/character_encoding.h ('k') | base/i18n/character_encoding_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/character_encoding.cc
diff --git a/base/i18n/character_encoding.cc b/base/i18n/character_encoding.cc
index fd0553a148eb707b25235015241640bfaa5b9440..05d2f50fff216b66cdf805a1c92ade49c9642e74 100644
--- a/base/i18n/character_encoding.cc
+++ b/base/i18n/character_encoding.cc
@@ -24,10 +24,10 @@ const char* const kCanonicalEncodingNames[] = {
} // namespace
-const char* GetCanonicalEncodingNameByAliasName(const std::string& alias_name) {
+std::string GetCanonicalEncodingNameByAliasName(const std::string& alias_name) {
for (auto& encoding_name : kCanonicalEncodingNames) {
if (alias_name == encoding_name)
- return encoding_name;
+ return alias_name;
}
static const char* kStandards[3] = {"HTML", "MIME", "IANA"};
for (auto& standard : kStandards) {
@@ -37,6 +37,6 @@ const char* GetCanonicalEncodingNameByAliasName(const std::string& alias_name) {
if (U_SUCCESS(error_code) && canonical_name)
return canonical_name;
}
- return nullptr;
+ return std::string();
}
} // namespace base
« no previous file with comments | « base/i18n/character_encoding.h ('k') | base/i18n/character_encoding_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698