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

Unified Diff: net/base/net_string_util_icu.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « net/base/net_string_util.h ('k') | net/base/net_string_util_icu_alternatives_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_string_util_icu.cc
diff --git a/net/base/net_string_util_icu.cc b/net/base/net_string_util_icu.cc
deleted file mode 100644
index 435f9de24888faec5b93e9a3ca1df4858c73d1c2..0000000000000000000000000000000000000000
--- a/net/base/net_string_util_icu.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/base/net_string_util.h"
-
-#include "base/i18n/i18n_constants.h"
-#include "base/i18n/icu_string_conversions.h"
-#include "base/strings/string_util.h"
-#include "third_party/icu/source/common/unicode/ucnv.h"
-
-namespace net {
-
-const char* const kCharsetLatin1 = base::kCodepageLatin1;
-
-bool ConvertToUtf8(const std::string& text, const char* charset,
- std::string* output) {
- output->clear();
-
- UErrorCode err = U_ZERO_ERROR;
- UConverter* converter(ucnv_open(charset, &err));
- if (U_FAILURE(err))
- return false;
-
- // A single byte in a legacy encoding can be expanded to 3 bytes in UTF-8.
- // A 'two-byte character' in a legacy encoding can be expanded to 4 bytes
- // in UTF-8. Therefore, the expansion ratio is 3 at most. Add one for a
- // trailing '\0'.
- size_t output_length = text.length() * 3 + 1;
- char* buf = WriteInto(output, output_length);
- output_length = ucnv_toAlgorithmic(UCNV_UTF8, converter, buf, output_length,
- text.data(), text.length(), &err);
- ucnv_close(converter);
- if (U_FAILURE(err)) {
- output->clear();
- return false;
- }
-
- output->resize(output_length);
- return true;
-}
-
-bool ConvertToUtf8AndNormalize(const std::string& text, const char* charset,
- std::string* output) {
- return base::ConvertToUtf8AndNormalize(text, charset, output);
-}
-
-bool ConvertToUTF16(const std::string& text, const char* charset,
- base::string16* output) {
- return base::CodepageToUTF16(text, charset,
- base::OnStringConversionError::FAIL, output);
-}
-
-bool ConvertToUTF16WithSubstitutions(const std::string& text,
- const char* charset,
- base::string16* output) {
- return base::CodepageToUTF16(text, charset,
- base::OnStringConversionError::SUBSTITUTE,
- output);
-}
-
-} // namespace net
« no previous file with comments | « net/base/net_string_util.h ('k') | net/base/net_string_util_icu_alternatives_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698