Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Use string_view inputs for conversion functions #26031

Merged
merged 1 commit into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shell/platform/windows/string_conversion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace flutter {

std::string Utf8FromUtf16(const std::wstring& utf16_string) {
std::string Utf8FromUtf16(const std::wstring_view utf16_string) {
if (utf16_string.empty()) {
return std::string();
}
Expand All @@ -30,7 +30,7 @@ std::string Utf8FromUtf16(const std::wstring& utf16_string) {
return utf8_string;
}

std::wstring Utf16FromUtf8(const std::string& utf8_string) {
std::wstring Utf16FromUtf8(const std::string_view utf8_string) {
if (utf8_string.empty()) {
return std::wstring();
}
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/windows/string_conversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ namespace flutter {

// Converts a string from UTF-16 to UTF-8. Returns an empty string if the
// input is not valid UTF-16.
std::string Utf8FromUtf16(const std::wstring& utf16_string);
std::string Utf8FromUtf16(const std::wstring_view utf16_string);

// Converts a string from UTF-8 to UTF-16. Returns an empty string if the
// input is not valid UTF-8.
std::wstring Utf16FromUtf8(const std::string& utf8_string);
std::wstring Utf16FromUtf8(const std::string_view utf8_string);

} // namespace flutter

Expand Down