Fix compiler warnings in HTML5 platform

This commit is contained in:
Leon Krause 2018-10-02 02:30:27 +02:00
parent 55d013195f
commit d93050d8a2
3 changed files with 18 additions and 15 deletions

View File

@ -237,7 +237,7 @@ Error HTTPClient::poll() {
case STATUS_CONNECTION_ERROR: case STATUS_CONNECTION_ERROR:
return ERR_CONNECTION_ERROR; return ERR_CONNECTION_ERROR;
case STATUS_REQUESTING: case STATUS_REQUESTING: {
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (!has_polled) { if (!has_polled) {
@ -282,6 +282,10 @@ Error HTTPClient::poll() {
write = PoolByteArray::Write(); write = PoolByteArray::Write();
break; break;
} }
default:
ERR_FAIL_V(ERR_BUG);
}
return OK; return OK;
} }

View File

@ -140,8 +140,9 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
case Variant::POOL_BYTE_ARRAY: case Variant::POOL_BYTE_ARRAY:
arr_write = PoolByteArray::Write(); arr_write = PoolByteArray::Write();
return arr; return arr;
} default:
return Variant(); return Variant();
} }
}
#endif // JAVASCRIPT_EVAL_ENABLED #endif // JAVASCRIPT_EVAL_ENABLED

View File

@ -121,14 +121,14 @@ void OS_JavaScript::set_window_size(const Size2 p_size) {
emscripten_exit_soft_fullscreen(); emscripten_exit_soft_fullscreen();
window_maximized = false; window_maximized = false;
} }
emscripten_set_canvas_size(p_size.x, p_size.y); emscripten_set_canvas_element_size(NULL, p_size.x, p_size.y);
} }
} }
Size2 OS_JavaScript::get_window_size() const { Size2 OS_JavaScript::get_window_size() const {
int canvas[3]; int canvas[2];
emscripten_get_canvas_size(canvas, canvas + 1, canvas + 2); emscripten_get_canvas_element_size(NULL, canvas, canvas + 1);
return Size2(canvas[0], canvas[1]); return Size2(canvas[0], canvas[1]);
} }
@ -378,15 +378,13 @@ static void set_css_cursor(const char *p_cursor) {
/* clang-format on */ /* clang-format on */
} }
static const char *get_css_cursor() { static bool is_css_cursor_hidden() {
char cursor[16];
/* clang-format off */ /* clang-format off */
EM_ASM_INT({ return EM_ASM_INT({
stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16); return Module.canvas.style.cursor === 'none';
}, cursor); });
/* clang-format on */ /* clang-format on */
return cursor;
} }
void OS_JavaScript::set_cursor_shape(CursorShape p_shape) { void OS_JavaScript::set_cursor_shape(CursorShape p_shape) {
@ -430,7 +428,7 @@ void OS_JavaScript::set_mouse_mode(OS::MouseMode p_mode) {
OS::MouseMode OS_JavaScript::get_mouse_mode() const { OS::MouseMode OS_JavaScript::get_mouse_mode() const {
if (String::utf8(get_css_cursor()) == "none") if (is_css_cursor_hidden())
return MOUSE_MODE_HIDDEN; return MOUSE_MODE_HIDDEN;
EmscriptenPointerlockChangeEvent ev; EmscriptenPointerlockChangeEvent ev;
@ -835,13 +833,13 @@ bool OS_JavaScript::main_loop_iterate() {
strategy.canvasResizedCallback = NULL; strategy.canvasResizedCallback = NULL;
emscripten_enter_soft_fullscreen(NULL, &strategy); emscripten_enter_soft_fullscreen(NULL, &strategy);
} else { } else {
emscripten_set_canvas_size(windowed_size.width, windowed_size.height); emscripten_set_canvas_element_size(NULL, windowed_size.width, windowed_size.height);
} }
just_exited_fullscreen = false; just_exited_fullscreen = false;
} }
int canvas[3]; int canvas[2];
emscripten_get_canvas_size(canvas, canvas + 1, canvas + 2); emscripten_get_canvas_element_size(NULL, canvas, canvas + 1);
video_mode.width = canvas[0]; video_mode.width = canvas[0];
video_mode.height = canvas[1]; video_mode.height = canvas[1];
if (!window_maximized && !video_mode.fullscreen && !just_exited_fullscreen && !entering_fullscreen) { if (!window_maximized && !video_mode.fullscreen && !just_exited_fullscreen && !entering_fullscreen) {