From ae2435cf16d9ee987d87c32f58f5fa3f7b5bbae3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 12 Aug 2017 18:15:26 +0200 Subject: [PATCH] Silence some more C89_BUILD warnings --- frontend/drivers/platform_win32.c | 6 ++++-- gfx/common/win32_common.c | 5 ++++- gfx/drivers_context/wgl_ctx.c | 3 ++- input/drivers/dinput.c | 7 ++++--- input/drivers_joypad/xinput_joypad.c | 12 ++++++------ libretro-common/rthreads/rthreads.c | 6 ++++-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 2aa65eb10b..02ae1dd7d3 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -66,6 +66,7 @@ static void gfx_dwm_shutdown(void) static bool gfx_init_dwm(void) { + HRESULT (WINAPI *mmcss)(BOOL); static bool inited = false; if (inited) @@ -89,7 +90,7 @@ static bool gfx_init_dwm(void) DragAcceptFiles_func = (VOID (WINAPI*)(HWND, BOOL))dylib_proc(shell32lib, "DragAcceptFiles"); - HRESULT (WINAPI *mmcss)(BOOL) = + mmcss = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); if (mmcss) { @@ -104,6 +105,7 @@ static bool gfx_init_dwm(void) static void gfx_set_dwm(void) { HRESULT ret; + HRESULT (WINAPI *composition_enable)(UINT); settings_t *settings = config_get_ptr(); if (!gfx_init_dwm()) @@ -112,7 +114,7 @@ static void gfx_set_dwm(void) if (settings->bools.video_disable_composition == dwm_composition_disabled) return; - HRESULT (WINAPI *composition_enable)(UINT) = + composition_enable = (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition"); if (!composition_enable) { diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index cfeb717de2..cdb1249668 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -205,9 +205,12 @@ static BOOL CALLBACK win32_monitor_enum_proc(HMONITOR hMonitor, void win32_monitor_from_window(void) { #ifndef _XBOX + ui_window_t *window = NULL; + win32_monitor_last = MonitorFromWindow(main_window.hwnd, MONITOR_DEFAULTTONEAREST); - const ui_window_t *window = ui_companion_driver_get_window_ptr(); + + window = (ui_window_t*)ui_companion_driver_get_window_ptr(); if (window) window->destroy(&main_window); diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index 5e19fbfa67..0766516cb5 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -435,9 +435,10 @@ static void gfx_ctx_wgl_update_title(void *data, void *data2) static void gfx_ctx_wgl_get_video_size(void *data, unsigned *width, unsigned *height) { - (void)data; HWND window = win32_get_window(); + (void)data; + if (!window) { RECT mon_rect; diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 4314ce04f5..b1b34051c8 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -222,6 +222,8 @@ static void dinput_poll(void *data) if (di->mouse) { DIMOUSESTATE2 mouse_state; + POINT point = {0}; + memset(&mouse_state, 0, sizeof(mouse_state)); if (FAILED(IDirectInputDevice8_GetDeviceState( @@ -237,8 +239,8 @@ static void dinput_poll(void *data) di->mouse_rel_y = mouse_state.lY; - if (!mouse_state.rgbButtons[0]) - unset_doubleclick_on_titlebar(); + if (!mouse_state.rgbButtons[0]) + unset_doubleclick_on_titlebar(); if (doubleclick_on_titlebar_pressed()) di->mouse_l = 0; else @@ -248,7 +250,6 @@ static void dinput_poll(void *data) /* No simple way to get absolute coordinates * for RETRO_DEVICE_POINTER. Just use Win32 APIs. */ - POINT point = {0}; GetCursorPos(&point); ScreenToClient((HWND)video_driver_window_get(), &point); di->mouse_x = point.x; diff --git a/input/drivers_joypad/xinput_joypad.c b/input/drivers_joypad/xinput_joypad.c index 3c77f48547..eacba9e370 100644 --- a/input/drivers_joypad/xinput_joypad.c +++ b/input/drivers_joypad/xinput_joypad.c @@ -375,11 +375,11 @@ static bool xinput_joypad_button(unsigned port_num, uint16_t joykey) static int16_t xinput_joypad_axis (unsigned port_num, uint32_t joyaxis) { int xuser; - int16_t val = 0; - int axis = -1; - - bool is_neg = false; - bool is_pos = false; + int16_t val = 0; + int axis = -1; + bool is_neg = false; + bool is_pos = false; + XINPUT_GAMEPAD* pad = NULL; if (joyaxis == AXIS_NONE) return 0; @@ -404,7 +404,7 @@ static int16_t xinput_joypad_axis (unsigned port_num, uint32_t joyaxis) is_pos = true; } - XINPUT_GAMEPAD* pad = &(g_xinput_states[xuser].xstate.Gamepad); + pad = &(g_xinput_states[xuser].xstate.Gamepad); switch (axis) { diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index a059bc2f04..5f1f98c724 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -530,12 +530,14 @@ static bool _scond_wait_win32(scond_t *cond, slock_t *lock, DWORD dwMilliseconds { #if _WIN32_WINNT >= 0x0500 LARGE_INTEGER now; + LONGLONG elapsed; + QueryPerformanceCounter(&now); - LONGLONG elapsed = now.QuadPart - tsBegin.QuadPart; + elapsed = now.QuadPart - tsBegin.QuadPart; elapsed *= 1000; elapsed /= performanceCounterFrequency.QuadPart; #else - DWORD now = timeGetTime(); + DWORD now = timeGetTime(); DWORD elapsed = now - tsBegin; #endif