Skip to content

Commit 362dbb9

Browse files
committed
remove deprecated allocateUTF8
Signed-off-by: Yuchen Liang <[email protected]>
1 parent dfb795e commit 362dbb9

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tools/wasm-bpt-printer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ if(EMSCRIPTEN)
44
add_executable(wasm-bpt-printer ${WASM_SHELL_SOURCES})
55
target_link_libraries(wasm-bpt-printer bustub)
66
set_target_properties(wasm-bpt-printer PROPERTIES OUTPUT_NAME bustub-wasm-bpt-printer)
7-
target_link_options(wasm-bpt-printer PRIVATE -sEXPORTED_FUNCTIONS=['_BusTubInit','_BusTubApplyCommand','_free'] -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','allocateUTF8','UTF8ToString'])
7+
target_link_options(wasm-bpt-printer PRIVATE -sEXPORTED_FUNCTIONS=['_BusTubInit','_BusTubApplyCommand','_free','_malloc'] -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','stringToUTF8','UTF8ToString'])
88
endif()

tools/wasm-bpt-printer/extra_files/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
const executeQuery = Module.cwrap('BusTubApplyCommand', 'number', ['string', 'number', 'number'])
100100
window.executeQuery = (x) => {
101101
const bufferSize = 64 * 1024
102-
let output = "\0".repeat(bufferSize)
103-
let ptrOutput = Module.allocateUTF8(output)
102+
const ptrOutput = Module._malloc(bufferSize)
103+
Module.stringToUTF8("", ptrOutput, bufferSize)
104104
const retCode = executeQuery(x, ptrOutput, bufferSize)
105105
output = Module.UTF8ToString(ptrOutput)
106106
Module._free(ptrOutput)
@@ -190,4 +190,4 @@
190190
gtag('config', 'UA-52525161-8');
191191
</script>
192192

193-
</html>
193+
</html>

tools/wasm-shell/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ if(EMSCRIPTEN)
44
add_executable(wasm-shell ${WASM_SHELL_SOURCES})
55
target_link_libraries(wasm-shell bustub)
66
set_target_properties(wasm-shell PROPERTIES OUTPUT_NAME bustub-wasm-shell)
7-
target_link_options(wasm-shell PRIVATE -sEXPORTED_FUNCTIONS=['_BusTubInit','_BusTubExecuteQuery','_free'] -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','allocateUTF8','UTF8ToString'])
7+
target_link_options(wasm-shell PRIVATE -sEXPORTED_FUNCTIONS=['_BusTubInit','_BusTubExecuteQuery','_free','_malloc'] -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','stringToUTF8','UTF8ToString'])
88
endif()

tools/wasm-shell/extra_files/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
const initialize = Module.cwrap('BusTubInit', 'number', [])
8686
window.executeQuery = (x) => {
8787
const bufferSize = 64 * 1024
88-
let output = "\0".repeat(bufferSize)
89-
let ptrOutput = Module.allocateUTF8(output)
90-
let output2 = "\0".repeat(bufferSize)
91-
let ptrOutput2 = Module.allocateUTF8(output2)
88+
const ptrOutput = Module._malloc(bufferSize)
89+
Module.stringToUTF8("", ptrOutput, bufferSize)
90+
const ptrOutput2 = Module._malloc(bufferSize)
91+
Module.stringToUTF8("", ptrOutput2, bufferSize)
9292
const retCode = executeQuery(x, ptrOutput2, ptrOutput, bufferSize)
9393
output = Module.UTF8ToString(ptrOutput)
9494
output2 = Module.UTF8ToString(ptrOutput2)
@@ -159,4 +159,4 @@
159159
gtag('config', 'UA-52525161-8');
160160
</script>
161161

162-
</html>
162+
</html>

0 commit comments

Comments
 (0)