diff options
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 6c0b0e93..6f3a969c 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -503,6 +503,7 @@ function allocate(slab, types, allocator, ptr) { Module['allocate'] = allocate; function Pointer_stringify(ptr, /* optional */ length) { +#if UTF_STRING_SUPPORT var utf8 = new Runtime.UTF8Processor(); var nullTerminated = typeof(length) == "undefined"; var ret = ""; @@ -519,6 +520,13 @@ function Pointer_stringify(ptr, /* optional */ length) { if (!nullTerminated && i == length) break; } return ret; +#else +#if USE_TYPED_ARRAYS == 2 + return String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + (length || _strlen(ptr)))); +#else + throw 'unsupported combination'; +#endif +#endif } Module['Pointer_stringify'] = Pointer_stringify; |