(ptr, /* optional */ length)
| 643 | Module["getMemory"] = getMemory; |
| 644 | |
| 645 | function Pointer_stringify(ptr, /* optional */ length) { |
| 646 | if (length === 0 || !ptr) return ''; |
| 647 | // TODO: use TextDecoder |
| 648 | // Find the length, and check for UTF while doing so |
| 649 | var hasUtf = 0; |
| 650 | var t; |
| 651 | var i = 0; |
| 652 | while (1) { |
| 653 | t = HEAPU8[(((ptr)+(i))>>0)]; |
| 654 | hasUtf |= t; |
| 655 | if (t == 0 && !length) break; |
| 656 | i++; |
| 657 | if (length && i == length) break; |
| 658 | } |
| 659 | if (!length) length = i; |
| 660 | |
| 661 | var ret = ''; |
| 662 | |
| 663 | if (hasUtf < 128) { |
| 664 | var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack |
| 665 | var curr; |
| 666 | while (length > 0) { |
| 667 | curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK))); |
| 668 | ret = ret ? ret + curr : curr; |
| 669 | ptr += MAX_CHUNK; |
| 670 | length -= MAX_CHUNK; |
| 671 | } |
| 672 | return ret; |
| 673 | } |
| 674 | return Module['UTF8ToString'](ptr); |
| 675 | } |
| 676 | Module["Pointer_stringify"] = Pointer_stringify; |
| 677 | |
| 678 | // Given a pointer 'ptr' to a null-terminated ASCII-encoded string in the emscripten HEAP, returns |
no outgoing calls
no test coverage detected