diff --git a/dev/a11y_assessments/windows/runner/utils.cpp b/dev/a11y_assessments/windows/runner/utils.cpp index f677d8d5f7..02f4362740 100644 --- a/dev/a11y_assessments/windows/runner/utils.cpp +++ b/dev/a11y_assessments/windows/runner/utils.cpp @@ -49,13 +49,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/dev/benchmarks/complex_layout/windows/runner/utils.cpp b/dev/benchmarks/complex_layout/windows/runner/utils.cpp index b849ce2c32..6abcd65042 100644 --- a/dev/benchmarks/complex_layout/windows/runner/utils.cpp +++ b/dev/benchmarks/complex_layout/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/dev/integration_tests/flutter_gallery/windows/runner/utils.cpp b/dev/integration_tests/flutter_gallery/windows/runner/utils.cpp index f677d8d5f7..02f4362740 100644 --- a/dev/integration_tests/flutter_gallery/windows/runner/utils.cpp +++ b/dev/integration_tests/flutter_gallery/windows/runner/utils.cpp @@ -49,13 +49,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/dev/integration_tests/ui/windows/runner/utils.cpp b/dev/integration_tests/ui/windows/runner/utils.cpp index f677d8d5f7..02f4362740 100644 --- a/dev/integration_tests/ui/windows/runner/utils.cpp +++ b/dev/integration_tests/ui/windows/runner/utils.cpp @@ -49,13 +49,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/dev/integration_tests/windows_startup_test/windows/runner/utils.cpp b/dev/integration_tests/windows_startup_test/windows/runner/utils.cpp index f677d8d5f7..02f4362740 100644 --- a/dev/integration_tests/windows_startup_test/windows/runner/utils.cpp +++ b/dev/integration_tests/windows_startup_test/windows/runner/utils.cpp @@ -49,13 +49,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/dev/manual_tests/windows/runner/utils.cpp b/dev/manual_tests/windows/runner/utils.cpp index b849ce2c32..6abcd65042 100644 --- a/dev/manual_tests/windows/runner/utils.cpp +++ b/dev/manual_tests/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/examples/api/windows/runner/utils.cpp b/examples/api/windows/runner/utils.cpp index b849ce2c32..6abcd65042 100644 --- a/examples/api/windows/runner/utils.cpp +++ b/examples/api/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/examples/flutter_view/windows/runner/utils.cpp b/examples/flutter_view/windows/runner/utils.cpp index b849ce2c32..6abcd65042 100644 --- a/examples/flutter_view/windows/runner/utils.cpp +++ b/examples/flutter_view/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/examples/hello_world/windows/runner/utils.cpp b/examples/hello_world/windows/runner/utils.cpp index b849ce2c32..6abcd65042 100644 --- a/examples/hello_world/windows/runner/utils.cpp +++ b/examples/hello_world/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/examples/layers/windows/runner/utils.cpp b/examples/layers/windows/runner/utils.cpp index f677d8d5f7..02f4362740 100644 --- a/examples/layers/windows/runner/utils.cpp +++ b/examples/layers/windows/runner/utils.cpp @@ -49,13 +49,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/examples/platform_channel/windows/runner/utils.cpp b/examples/platform_channel/windows/runner/utils.cpp index a05ed58ca9..d9ca4c32c9 100644 --- a/examples/platform_channel/windows/runner/utils.cpp +++ b/examples/platform_channel/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/examples/platform_view/windows/runner/utils.cpp b/examples/platform_view/windows/runner/utils.cpp index b849ce2c32..6abcd65042 100644 --- a/examples/platform_view/windows/runner/utils.cpp +++ b/examples/platform_view/windows/runner/utils.cpp @@ -49,12 +49,12 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/packages/flutter_tools/templates/app_shared/windows.tmpl/runner/utils.cpp b/packages/flutter_tools/templates/app_shared/windows.tmpl/runner/utils.cpp index b2b08734db..3a0b46511a 100644 --- a/packages/flutter_tools/templates/app_shared/windows.tmpl/runner/utils.cpp +++ b/packages/flutter_tools/templates/app_shared/windows.tmpl/runner/utils.cpp @@ -45,13 +45,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length);