Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
UTF8ToString
stringToUTF8
lengthBytesUTF8
allocate
ALLOC_NORMAL
allocateUTF8OnStack
removeFunction
addFunction
Expand Down Expand Up @@ -545,14 +543,14 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
pos = this.pos;
this.pos += 1;
}
var bytes = intArrayFromString(string);
var strptr = allocate(bytes, ALLOC_NORMAL);
var length = lengthBytesUTF8(string);
var strptr = stringToNewUTF8(string);
this.allocatedmem.push(strptr);
this.db.handleError(sqlite3_bind_text(
this.stmt,
pos,
strptr,
bytes.length - 1,
length - 1,
0
));
return true;
Expand All @@ -563,7 +561,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
pos = this.pos;
this.pos += 1;
}
var blobptr = allocate(array, ALLOC_NORMAL);
var blobptr = _malloc(array.length);
writeArrayToMemory(array, blobptr)
this.allocatedmem.push(blobptr);
this.db.handleError(sqlite3_bind_blob(
this.stmt,
Expand Down Expand Up @@ -1204,7 +1203,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
if (result === null) {
sqlite3_result_null(cx);
} else if (result.length != null) {
var blobptr = allocate(result, ALLOC_NORMAL);
var blobptr = _malloc(result.length);
writeArrayToMemory(result, blobptr)
sqlite3_result_blob(cx, blobptr, result.length, -1);
_free(blobptr);
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/exported_runtime_methods.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"stackSave",
"stackRestore",
"UTF8ToString",

"allocate",
"ALLOC_NORMAL",
"stringToNewUTF8",
"writeArrayToMemory",
"allocateUTF8OnStack",
"removeFunction",
"addFunction"
Expand Down
Loading