From ed94b56d165e3cd522b748a8a48a2e6bace27a69 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Thu, 6 Oct 2022 13:12:12 -0400 Subject: [PATCH] fix compatibility with newer versions of emscripten --- Makefile | 4 ++-- javascript/olm_inbound_group_session.js | 1 + javascript/olm_outbound_group_session.js | 1 + javascript/olm_pk.js | 3 +++ javascript/olm_post.js | 3 +++ javascript/olm_sas.js | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b245ace..a1ea744 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ JS_ASMJS_TARGET := javascript/olm_legacy.js WASM_TARGET := $(BUILD_DIR)/wasm/libolm.a JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json -JS_EXPORTED_RUNTIME_METHODS := [ALLOC_STACK] +JS_EXPORTED_RUNTIME_METHODS := [ALLOC_STACK,writeAsciiToMemory,intArrayFromString] JS_EXTERNS := javascript/externs.js PUBLIC_HEADERS := include/olm/olm.h include/olm/outbound_group_session.h include/olm/inbound_group_session.h include/olm/pk.h include/olm/sas.h include/olm/error.h include/olm/olm_export.h @@ -106,7 +106,7 @@ EMCCFLAGS = --closure 1 --memory-init-file 0 -s NO_FILESYSTEM=1 -s INVOKE_RUN=0 # we don't use this for the legacy build.) EMCCFLAGS_WASM += -s TOTAL_STACK=65536 -s TOTAL_MEMORY=262144 -s ALLOW_MEMORY_GROWTH -EMCCFLAGS_ASMJS += -s WASM=0 +EMCCFLAGS_ASMJS += -s WASM=0 -Wno-error=closure EMCC.c = $(EMCC) $(CFLAGS) $(CPPFLAGS) -c -DNDEBUG -DOLM_STATIC_DEFINE=1 EMCC.cc = $(EMCC) $(CXXFLAGS) $(CPPFLAGS) -c -DNDEBUG -DOLM_STATIC_DEFINE=1 diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js index 423d2b1..1a4dfdf 100644 --- a/javascript/olm_inbound_group_session.js +++ b/javascript/olm_inbound_group_session.js @@ -1,3 +1,4 @@ +/** @constructor */ function InboundGroupSession() { var size = Module['_olm_inbound_group_session_size'](); this.buf = malloc(size); diff --git a/javascript/olm_outbound_group_session.js b/javascript/olm_outbound_group_session.js index 7c5da65..6c1f551 100644 --- a/javascript/olm_outbound_group_session.js +++ b/javascript/olm_outbound_group_session.js @@ -1,3 +1,4 @@ +/** @constructor */ function OutboundGroupSession() { var size = Module['_olm_outbound_group_session_size'](); this.buf = malloc(size); diff --git a/javascript/olm_pk.js b/javascript/olm_pk.js index 4690b90..9228c98 100644 --- a/javascript/olm_pk.js +++ b/javascript/olm_pk.js @@ -1,3 +1,4 @@ +/** @constructor */ function PkEncryption() { var size = Module['_olm_pk_encryption_size'](); this.buf = malloc(size); @@ -98,6 +99,7 @@ PkEncryption.prototype['encrypt'] = restore_stack(function( }); +/** @constructor */ function PkDecryption() { var size = Module['_olm_pk_decryption_size'](); this.buf = malloc(size); @@ -273,6 +275,7 @@ PkDecryption.prototype['decrypt'] = restore_stack(function ( }) +/** @constructor */ function PkSigning() { var size = Module['_olm_pk_signing_size'](); this.buf = malloc(size); diff --git a/javascript/olm_post.js b/javascript/olm_post.js index bd7a06d..eada486 100644 --- a/javascript/olm_post.js +++ b/javascript/olm_post.js @@ -44,6 +44,7 @@ function bzero(ptr, n) { } } +/** @constructor */ function Account() { var size = Module['_olm_account_size'](); this.buf = malloc(size); @@ -244,6 +245,7 @@ Account.prototype['unpickle'] = restore_stack(function(key, pickle) { } }); +/** @constructor */ function Session() { var size = Module['_olm_session_size'](); this.buf = malloc(size); @@ -530,6 +532,7 @@ Session.prototype['describe'] = restore_stack(function() { } }); +/** @constructor */ function Utility() { var size = Module['_olm_utility_size'](); this.buf = malloc(size); diff --git a/javascript/olm_sas.js b/javascript/olm_sas.js index be691ad..186ce15 100644 --- a/javascript/olm_sas.js +++ b/javascript/olm_sas.js @@ -1,3 +1,4 @@ +/** @constructor */ function SAS() { var size = Module['_olm_sas_size'](); var random_length = Module['_olm_create_sas_random_length']();