mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
teavm_printString: fix on linux
This commit is contained in:
parent
ec9fe5471d
commit
d750847a19
|
@ -296,15 +296,15 @@ void teavm_printString(char16_t* s) {
|
||||||
wchar_t* buf = malloc(sizeof(wchar_t) * cap);
|
wchar_t* buf = malloc(sizeof(wchar_t) * cap);
|
||||||
wchar_t* out = buf;
|
wchar_t* out = buf;
|
||||||
int32_t sz = 0;
|
int32_t sz = 0;
|
||||||
wchar_t c;
|
while (*s != '\0') {
|
||||||
do {
|
|
||||||
s = teavm_utf16ToUtf32(s, out++);
|
s = teavm_utf16ToUtf32(s, out++);
|
||||||
if (++sz == cap) {
|
if (++sz == cap) {
|
||||||
cap *= 2;
|
cap *= 2;
|
||||||
buf = realloc(buf, sizeof(wchar_t) * cap);
|
buf = realloc(buf, sizeof(wchar_t) * cap);
|
||||||
out = buf + sz;
|
out = buf + sz;
|
||||||
}
|
}
|
||||||
} while (c != '\0');
|
}
|
||||||
|
*out = '\0';
|
||||||
fprintf(stderr, "%ls", buf);
|
fprintf(stderr, "%ls", buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user