diff options
Diffstat (limited to 'modules/webrtc/webrtc_data_channel_js.cpp')
-rw-r--r-- | modules/webrtc/webrtc_data_channel_js.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp index 2edd212a50..2c648ba9f9 100644 --- a/modules/webrtc/webrtc_data_channel_js.cpp +++ b/modules/webrtc/webrtc_data_channel_js.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -68,7 +68,6 @@ void WebRTCDataChannelJS::_on_error() { } void WebRTCDataChannelJS::_on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string) { - ERR_FAIL_COND_MSG(in_buffer.space_left() < (int)(p_size + 5), "Buffer full! Dropping data."); uint8_t is_string = p_is_string ? 1 : 0; @@ -312,14 +311,14 @@ WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) { return; } var len = buffer.length*buffer.BYTES_PER_ELEMENT; - var out = Module._malloc(len); - Module.HEAPU8.set(buffer, out); + var out = _malloc(len); + HEAPU8.set(buffer, out); ccall("_emrtc_on_ch_message", "void", ["number", "number", "number", "number"], [c_ptr, out, len, is_string] ); - Module._free(out); + _free(out); } }, this, js_id); @@ -334,7 +333,7 @@ WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) { stringToUTF8(str, ptr, len+1); return ptr; }, js_id); - if(str != NULL) { + if(str != nullptr) { _label.parse_utf8(str); EM_ASM({ _free($0) }, str); } @@ -347,7 +346,7 @@ WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) { stringToUTF8(str, ptr, len+1); return ptr; }, js_id); - if(str != NULL) { + if(str != nullptr) { _protocol.parse_utf8(str); EM_ASM({ _free($0) }, str); } |