MCPcopy Index your code
hub / github.com/sql-js/sql.js / writeStringToMemory

Function writeStringToMemory

js/sql-debug.js:1304–1317  ·  view source on GitHub ↗

@deprecated

(string, buffer, dontAddNull)

Source from the content-addressed store, hash-verified

1302// to be secure from out of bounds writes.
1303/** @deprecated */
1304function writeStringToMemory(string, buffer, dontAddNull) {
1305 warnOnce('writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!');
1306
1307 var /** @type {number} */ lastChar, /** @type {number} */ end;
1308 if (dontAddNull) {
1309 // stringToUTF8Array always appends null. If we don't want to do that, remember the
1310 // character that existed at the location where the null will be placed, and restore
1311 // that after the write (below).
1312 end = buffer + lengthBytesUTF8(string);
1313 lastChar = HEAP8[end];
1314 }
1315 stringToUTF8(string, buffer, Infinity);
1316 if (dontAddNull) HEAP8[end] = lastChar; // Restore the value under the null character.
1317}
1318
1319
1320function writeArrayToMemory(array, buffer) {

Callers 1

sql-debug.jsFile · 0.70

Calls 3

warnOnceFunction · 0.70
lengthBytesUTF8Function · 0.70
stringToUTF8Function · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…