From 7fadfa5a0c71a09804dafe5aa9b486ce402cc2bc Mon Sep 17 00:00:00 2001 From: igotti-google Date: Sat, 26 Aug 2017 11:50:10 +0300 Subject: [PATCH] Fix type in conversion to ByteArray --- runtime/src/main/cpp/KString.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/main/cpp/KString.cpp b/runtime/src/main/cpp/KString.cpp index f966081ee58..b5aa32fe1a0 100644 --- a/runtime/src/main/cpp/KString.cpp +++ b/runtime/src/main/cpp/KString.cpp @@ -740,7 +740,7 @@ OBJ_GETTER(Kotlin_String_toUtf8Array, KString thiz, KInt start, KInt size) { KStdString utf8; utf8::unchecked::utf16to8(utf16, utf16 + size, back_inserter(utf8)); ArrayHeader* result = AllocArrayInstance( - theByteArrayTypeInfo, utf8.size() + 1, OBJ_RESULT)->array(); + theByteArrayTypeInfo, utf8.size(), OBJ_RESULT)->array(); ::memcpy(ByteArrayAddressOfElementAt(result, 0), utf8.c_str(), utf8.size()); RETURN_OBJ(result->obj()); }