Fix interop_zlib test by properly converting ByteArray to String. (#1899)

* Fix interop_zlib test by properly converting ByteArray to String.

* Fix samples build.
This commit is contained in:
Nikolay Igotti
2018-08-17 17:46:14 +03:00
committed by GitHub
parent ac3cdd5c8d
commit 562057cf69
2 changed files with 14 additions and 7 deletions
+12 -4
View File
@@ -758,19 +758,27 @@ const char* byteArrayAsCString(KConstRef thiz, KInt start, KInt size) {
}
OBJ_GETTER(Kotlin_ByteArray_stringFromUtf8OrThrow, KConstRef thiz, KInt start, KInt size) {
const char* rawString = byteArrayAsCString(thiz, start, size);
if (size == 0) {
RETURN_RESULT_OF0(TheEmptyString);
}
RETURN_RESULT_OF(utf8ToUtf16OrThrow, rawString, size);
const char* rawString = byteArrayAsCString(thiz, start, size);
KInt realSize = 0;
while (rawString[realSize] != 0 && realSize < size) {
realSize++;
}
RETURN_RESULT_OF(utf8ToUtf16OrThrow, rawString, realSize);
}
OBJ_GETTER(Kotlin_ByteArray_stringFromUtf8, KConstRef thiz, KInt start, KInt size) {
const char* rawString = byteArrayAsCString(thiz, start, size);
if (size == 0) {
RETURN_RESULT_OF0(TheEmptyString);
}
RETURN_RESULT_OF(utf8ToUtf16, rawString, size);
const char* rawString = byteArrayAsCString(thiz, start, size);
KInt realSize = 0;
while (rawString[realSize] != 0 && realSize < size) {
realSize++;
}
RETURN_RESULT_OF(utf8ToUtf16, rawString, realSize);
}
OBJ_GETTER(Kotlin_String_toUtf8, KString thiz, KInt start, KInt size) {
+2 -3
View File
@@ -10,9 +10,8 @@ include ':nonBlockingEchoServer'
include ':opengl'
include ':socket'
include ':tetris'
// ML samples have non-trivial deps, disable from here.
// include ':tensorflow'
// include ':torch'
include ':tensorflow'
include ':torch'
// Android native activity build requires Android SDK.
// So temporary switching off for now, as it breaks the build
// of other samples if SDK is not present.