diff --git a/samples/echoServer/src/echoServerMain/kotlin/EchoServer.kt b/samples/echoServer/src/echoServerMain/kotlin/EchoServer.kt index a532ba6327f..748c0e3eaf2 100644 --- a/samples/echoServer/src/echoServerMain/kotlin/EchoServer.kt +++ b/samples/echoServer/src/echoServerMain/kotlin/EchoServer.kt @@ -22,7 +22,7 @@ fun main(args: Array) { memScoped { val buffer = ByteArray(1024) - val prefixBuffer = "echo: ".toUtf8() + val prefixBuffer = "echo: ".encodeToByteArray() val serverAddr = alloc() val listenFd = socket(AF_INET, SOCK_STREAM, 0) diff --git a/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt b/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt index 0ec4ea139e8..f6d7260a1c0 100644 --- a/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt +++ b/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt @@ -45,7 +45,7 @@ class CUrl(url: String) { fun CPointer.toKString(length: Int): String { val bytes = this.readBytes(length) - return bytes.stringFromUtf8() + return bytes.decodeToString() } fun header_callback(buffer: CPointer?, size: size_t, nitems: size_t, userdata: COpaquePointer?): size_t { diff --git a/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt b/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt index 3f5fc9a2773..ffd0acba133 100644 --- a/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt +++ b/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt @@ -34,7 +34,7 @@ private fun Int.checkAVError() { if (this != 0) { val buffer = ByteArray(1024) av_strerror(this, buffer.refTo(0), buffer.size.convert()) - throw Error("AVError: ${buffer.stringFromUtf8()}") + throw Error("AVError: ${buffer.decodeToString()}") } } diff --git a/samples/weather_function/function/src/main/kotlin/org/example/weather_func/curl.kt b/samples/weather_function/function/src/main/kotlin/org/example/weather_func/curl.kt index e5a11a74b14..d66195b0ec0 100644 --- a/samples/weather_function/function/src/main/kotlin/org/example/weather_func/curl.kt +++ b/samples/weather_function/function/src/main/kotlin/org/example/weather_func/curl.kt @@ -91,4 +91,4 @@ fun writeCallback(buffer: CPointer?, size: size_t, totalItems: size_t, return responseSize } -private fun CPointer.toKString(length: Int) = readBytes(length).stringFromUtf8() +private fun CPointer.toKString(length: Int) = readBytes(length).decodeToString()