aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_pre.js
diff options
context:
space:
mode:
authorDamir Jelić <poljar@termina.org.uk>2019-04-01 17:40:43 +0200
committerHubert Chathi <hubert@uhoreg.ca>2019-04-08 15:18:28 -0400
commit071029c20174307de28ca20232196f83fcc37763 (patch)
tree272e901d2bfcf0efe6be018caed3a3a06d54a815 /javascript/olm_pre.js
parent709687a7b56d6768831766459940b6f0bb078d85 (diff)
javascript: Switch from deprecated Pointer_stringify() to UTF8toString().
The Pointer_stringify() function is deprecated and has a couple of issues because it tries to guess the encoding of the buffer. In some cases it can ignore the length parameter which could end up in inconsistencies. Switch to UTF8toString() that takes a length parameter and respects, that way we don't need to allocate an additional byte for a NULL byte.
Diffstat (limited to 'javascript/olm_pre.js')
-rw-r--r--javascript/olm_pre.js8
1 files changed, 0 insertions, 8 deletions
diff --git a/javascript/olm_pre.js b/javascript/olm_pre.js
index 314d7da..7153f7a 100644
--- a/javascript/olm_pre.js
+++ b/javascript/olm_pre.js
@@ -30,14 +30,6 @@ if (typeof(OLM_OPTIONS) !== 'undefined') {
}
}
-/* The 'length' argument to Pointer_stringify doesn't work if the input
- * includes characters >= 128, which makes Pointer_stringify unreliable. We
- * could use it on strings which are known to be ascii, but that seems
- * dangerous. Instead we add a NULL character to all of our strings and just
- * use UTF8ToString.
- */
-var NULL_BYTE_PADDING_LENGTH = 1;
-
Module['onRuntimeInitialized'] = function() {
OLM_ERROR = Module['_olm_error']();
olm_exports["PRIVATE_KEY_LENGTH"] = Module['_olm_pk_private_key_length']();