| Index: base/strings/utf_string_conversions.cc
|
| diff --git a/base/strings/utf_string_conversions.cc b/base/strings/utf_string_conversions.cc
|
| index c3ea4f253e5b5c68bc6c1795bc354178fcda3382..0256f8ac984d139f90085716a2e8607eaf526e69 100644
|
| --- a/base/strings/utf_string_conversions.cc
|
| +++ b/base/strings/utf_string_conversions.cc
|
| @@ -125,45 +125,45 @@ std::wstring UTF16ToWide(const string16& utf16) {
|
|
|
| #if defined(WCHAR_T_IS_UTF32)
|
|
|
| -bool UTF8ToUTF16(const char* src, size_t src_len, string16* output) {
|
| - PrepareForUTF16Or32Output(src, src_len, output);
|
| - return ConvertUnicode(src, src_len, output);
|
| +bool UTF8ToUTF16(const StringPiece& utf8, string16* output) {
|
| + PrepareForUTF16Or32Output(utf8.data(), utf8.size(), output);
|
| + return ConvertUnicode(utf8.data(), utf8.size(), output);
|
| }
|
|
|
| string16 UTF8ToUTF16(const StringPiece& utf8) {
|
| string16 ret;
|
| // Ignore the success flag of this call, it will do the best it can for
|
| // invalid input, which is what we want here.
|
| - UTF8ToUTF16(utf8.data(), utf8.length(), &ret);
|
| + UTF8ToUTF16(utf8, &ret);
|
| return ret;
|
| }
|
|
|
| -bool UTF16ToUTF8(const char16* src, size_t src_len, std::string* output) {
|
| - PrepareForUTF8Output(src, src_len, output);
|
| - return ConvertUnicode(src, src_len, output);
|
| +bool UTF16ToUTF8(const StringPiece16& utf16, std::string* output) {
|
| + PrepareForUTF8Output(utf16.data(), utf16.length(), output);
|
| + return ConvertUnicode(utf16.data(), utf16.length(), output);
|
| }
|
|
|
| std::string UTF16ToUTF8(const string16& utf16) {
|
| std::string ret;
|
| // Ignore the success flag of this call, it will do the best it can for
|
| // invalid input, which is what we want here.
|
| - UTF16ToUTF8(utf16.data(), utf16.length(), &ret);
|
| + UTF16ToUTF8(utf16, &ret);
|
| return ret;
|
| }
|
|
|
| #elif defined(WCHAR_T_IS_UTF16)
|
| // Easy case since we can use the "wide" versions we already wrote above.
|
|
|
| -bool UTF8ToUTF16(const char* src, size_t src_len, string16* output) {
|
| - return UTF8ToWide(src, src_len, output);
|
| +bool UTF8ToUTF16(const StringPiece& utf8, string16* output) {
|
| + return UTF8ToWide(utf8.data(), utf8.size(), output);
|
| }
|
|
|
| string16 UTF8ToUTF16(const StringPiece& utf8) {
|
| return UTF8ToWide(utf8);
|
| }
|
|
|
| -bool UTF16ToUTF8(const char16* src, size_t src_len, std::string* output) {
|
| - return WideToUTF8(src, src_len, output);
|
| +bool UTF16ToUTF8(const StringPiece16& utf16, std::string* output) {
|
| + return WideToUTF8(utf16.data(), utf16.size(), output);
|
| }
|
|
|
| std::string UTF16ToUTF8(const string16& utf16) {
|
|
|