aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjuj <jujjyl@gmail.com>2013-11-01 16:58:44 -0700
committerjuj <jujjyl@gmail.com>2013-11-01 16:58:44 -0700
commit16b69ebcc08f7dec06ed9fb750b8ff2bfd80c106 (patch)
tree4d867fecf070eceb3b07ee2310869e61cb9f36a9 /src
parent2faaa225c97252baadeb4c8750d8decd2fd04e57 (diff)
parentcb3fe2bb6f6d348d3da7ea8c71af909748ff8d71 (diff)
Merge pull request #1750 from juj/no_copy_vfs_to_heap
no_copy_vfs_to_heap
Diffstat (limited to 'src')
-rw-r--r--src/library_memfs.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library_memfs.js b/src/library_memfs.js
index 9f528108..d3148d8b 100644
--- a/src/library_memfs.js
+++ b/src/library_memfs.js
@@ -225,9 +225,9 @@ mergeInto(LibraryManager.library, {
#if ASSERTIONS
assert(buffer.length);
#endif
- if (canOwn && buffer.buffer === HEAP8.buffer && offset === 0) {
- node.contents = buffer; // this is a subarray of the heap, and we can own it
- node.contentMode = MEMFS.CONTENT_OWNING;
+ if (canOwn && offset === 0) {
+ node.contents = buffer; // this could be a subarray of Emscripten HEAP, or allocated from some other source.
+ node.contentMode = (buffer.buffer === HEAP8.buffer) ? MEMFS.CONTENT_OWNING : MEMFS.CONTENT_FIXED;
} else {
node.contents = new Uint8Array(buffer.subarray(offset, offset+length));
node.contentMode = MEMFS.CONTENT_FIXED;