From d750847a1935f49029ac129618f77d7ea644d08d Mon Sep 17 00:00:00 2001 From: volth Date: Wed, 7 Aug 2019 14:34:38 +0000 Subject: [PATCH] teavm_printString: fix on linux --- core/src/main/resources/org/teavm/backend/c/runtime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/resources/org/teavm/backend/c/runtime.c b/core/src/main/resources/org/teavm/backend/c/runtime.c index 0ff829447..2578abf2a 100644 --- a/core/src/main/resources/org/teavm/backend/c/runtime.c +++ b/core/src/main/resources/org/teavm/backend/c/runtime.c @@ -296,15 +296,15 @@ void teavm_printString(char16_t* s) { wchar_t* buf = malloc(sizeof(wchar_t) * cap); wchar_t* out = buf; int32_t sz = 0; - wchar_t c; - do { + while (*s != '\0') { s = teavm_utf16ToUtf32(s, out++); if (++sz == cap) { cap *= 2; buf = realloc(buf, sizeof(wchar_t) * cap); out = buf + sz; } - } while (c != '\0'); + } + *out = '\0'; fprintf(stderr, "%ls", buf); free(buf); #endif