Skip to content

Commit ac8b1bc

Browse files
authored
Merge pull request #167 from ethereum/new-emscripten-api
Use stringToUTF8 instead of deprecated writeStringToMemory
2 parents 115181c + 271d2b6 commit ac8b1bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

wrapper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ function setupMethods (soljson) {
1414
var compileStandard = null;
1515
if (('_compileJSONCallback' in soljson) || ('_compileStandard' in soljson)) {
1616
var copyString = function (str, ptr) {
17-
var buffer = soljson._malloc(str.length + 1);
18-
soljson.writeStringToMemory(str, buffer);
17+
var length = soljson.lengthBytesUTF8(str);
18+
var buffer = soljson._malloc(length + 1);
19+
soljson.stringToUTF8(str, buffer, length + 1);
1920
soljson.setValue(ptr, buffer, '*');
2021
};
2122
var wrapCallback = function (callback) {

0 commit comments

Comments
 (0)