From 1e61274532dc5b4670684bdce5c14092c11bde45 Mon Sep 17 00:00:00 2001 From: Sergio Giro Date: Mon, 11 Jul 2016 15:43:54 +0100 Subject: [PATCH] system/core: using equivalent code to fix build break for win host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Error from x86_64-w64-mingw32-g++ was: system/core/libutils/Unicode.cpp: In function ‘ssize_t utf16_to_utf8_length(const char16_t*, size_t)’: system/core/libutils/Unicode.cpp:487:78: error: ‘std::basic_ostream::__ostream_type’ has no member named ‘str’ std::string logged_string = (std::ostringstream() << ret_difference).str(); Bug: 29250543 Test: make winsdk-tools, ran libutils_test, checked that safetynet logs appear using adb Change-Id: I09fc1e3e0dcc4683bde987f9e23e3bb4bea8b367 --- libutils/Unicode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp index b2ded0749..6e31ce48d 100644 --- a/libutils/Unicode.cpp +++ b/libutils/Unicode.cpp @@ -484,7 +484,9 @@ ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len) if (ret_difference >= 5) { // Log the difference between new and old calculation. A high number, or equal numbers // appearing frequently, would be indicative of an attack. - std::string logged_string = (std::ostringstream() << ret_difference).str(); + std::ostringstream logged_string_stream; + logged_string_stream << ret_difference; + std::string logged_string = logged_string_stream.str(); android_errorWriteWithInfoLog(0x534e4554, "29250543", -1 /* int_uid */, logged_string.c_str(), logged_string.length() + 1); }