Skip to content

Commit

Permalink
Auto-update from libvoxelstorm: latest update from project raindrop (…
Browse files Browse the repository at this point in the history
…245b256)
  • Loading branch information
slowriot committed Apr 28, 2024
1 parent 2ff8f8f commit d0d597f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions emscripten_browser_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ EM_JS_INLINE(void, upload, (char const *accept_types, upload_handler callback, v
const file_reader = new FileReader();
file_reader.onload = (event) => {
const uint8Arr = new Uint8Array(event.target.result);
const num_bytes = uint8Arr.length * uint8Arr.BYTES_PER_ELEMENT;
const data_ptr = Module["_malloc"](num_bytes);
const data_on_heap = new Uint8Array(Module["HEAPU8"].buffer, data_ptr, num_bytes);
const data_ptr = Module["_malloc"](uint8Arr.length);
const data_on_heap = new Uint8Array(Module["HEAPU8"].buffer, data_ptr, uint8Arr.length);
data_on_heap.set(uint8Arr);
Module["ccall"]('upload_file_return', 'number', ['string', 'string', 'number', 'number', 'number', 'number'], [event.target.filename, event.target.mime_type, data_on_heap.byteOffset, uint8Arr.length, callback, callback_data]);
Module["_free"](data_ptr);
Expand Down

0 comments on commit d0d597f

Please sign in to comment.