소스 검색

use console.warn instead of Module.printErr: emscripten no longer exports printErr by default, and instead err() should be used in code seen by the optimizer; however, as Godot only runs on the Web (and not in node.js or elsewhere), using console.warn directly is good enough, and will work in all versions if emscripten

Alon Zakai (kripken) 7 년 전
부모
커밋
71c03883b5
3개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 3
      platform/javascript/http_request.js
  2. 2 2
      platform/javascript/javascript_eval.cpp
  3. 1 1
      platform/javascript/os_javascript.cpp

+ 3 - 3
platform/javascript/http_request.js

@@ -82,7 +82,7 @@ var GodotHTTPRequest = {
 
 
 	godot_xhr_send_string: function(xhrId, strPtr) {
 	godot_xhr_send_string: function(xhrId, strPtr) {
 		if (!strPtr) {
 		if (!strPtr) {
-			Module.printErr("Failed to send string per XHR: null pointer");
+			console.warn("Failed to send string per XHR: null pointer");
 			return;
 			return;
 		}
 		}
 		GodotHTTPRequest.requests[xhrId].send(UTF8ToString(strPtr));
 		GodotHTTPRequest.requests[xhrId].send(UTF8ToString(strPtr));
@@ -90,11 +90,11 @@ var GodotHTTPRequest = {
 
 
 	godot_xhr_send_data: function(xhrId, ptr, len) {
 	godot_xhr_send_data: function(xhrId, ptr, len) {
 		if (!ptr) {
 		if (!ptr) {
-			Module.printErr("Failed to send data per XHR: null pointer");
+			console.warn("Failed to send data per XHR: null pointer");
 			return;
 			return;
 		}
 		}
 		if (len < 0) {
 		if (len < 0) {
-			Module.printErr("Failed to send data per XHR: buffer length less than 0");
+			console.warn("Failed to send data per XHR: buffer length less than 0");
 			return;
 			return;
 		}
 		}
 		GodotHTTPRequest.requests[xhrId].send(HEAPU8.subarray(ptr, ptr + len));
 		GodotHTTPRequest.requests[xhrId].send(HEAPU8.subarray(ptr, ptr + len));

+ 2 - 2
platform/javascript/javascript_eval.cpp

@@ -69,7 +69,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
 				eval_ret = eval(UTF8ToString(CODE));
 				eval_ret = eval(UTF8ToString(CODE));
 			}
 			}
 		} catch (e) {
 		} catch (e) {
-			Module.printErr(e);
+			console.warn(e);
 			eval_ret = null;
 			eval_ret = null;
 		}
 		}
 
 
@@ -97,7 +97,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
 					if (array_ptr!==0) {
 					if (array_ptr!==0) {
 						_free(array_ptr)
 						_free(array_ptr)
 					}
 					}
-					Module.printErr(e);
+					console.warn(e);
 					// fall through
 					// fall through
 				}
 				}
 				break;
 				break;

+ 1 - 1
platform/javascript/os_javascript.cpp

@@ -788,7 +788,7 @@ bool OS_JavaScript::main_loop_iterate() {
 			/* clang-format off */
 			/* clang-format off */
 			EM_ASM(
 			EM_ASM(
 				FS.syncfs(function(err) {
 				FS.syncfs(function(err) {
-					if (err) { Module.printErr('Failed to save IDB file system: ' + err.message); }
+					if (err) { console.warn('Failed to save IDB file system: ' + err.message); }
 				});
 				});
 			);
 			);
 			/* clang-format on */
 			/* clang-format on */