1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-09 06:18:49 +00:00

Update simplistic_calculator (#1417)

* Update `simplsitic_calculator`

* Drop `DEVELOPMENT_TEAM`
This commit is contained in:
Brett Morgan
2022-09-08 15:42:55 +10:00
committed by GitHub
parent 726bef3b08
commit 0d9b5c25a5
30 changed files with 211 additions and 160 deletions

View File

@@ -48,10 +48,10 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) {
int target_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, nullptr, 0, nullptr, nullptr);
if (target_length == 0) {
return std::string();
}
std::string utf8_string;
if (target_length == 0 || target_length > utf8_string.max_size()) {
return utf8_string;
}
utf8_string.resize(target_length);
int converted_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,