From 4ded4f3b2ed4a28eba420c80d1be21f5b76f485c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 3 May 2023 10:28:41 -0400 Subject: Fix mismatched types in ternary expressions --- src/win.c | 23 ++++++++++++----------- src/x11.c | 11 ++++++----- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/win.c b/src/win.c index 4abed87..bb5796c 100644 --- a/src/win.c +++ b/src/win.c @@ -450,11 +450,11 @@ static uint32_t getModifiers(void) { // clang-format off - return (((GetKeyState(VK_SHIFT) < 0) ? PUGL_MOD_SHIFT : 0U) | - ((GetKeyState(VK_CONTROL) < 0) ? PUGL_MOD_CTRL : 0U) | - ((GetKeyState(VK_MENU) < 0) ? PUGL_MOD_ALT : 0U) | - ((GetKeyState(VK_LWIN) < 0) ? PUGL_MOD_SUPER : 0U) | - ((GetKeyState(VK_RWIN) < 0) ? PUGL_MOD_SUPER : 0U)); + return (((GetKeyState(VK_SHIFT) < 0) ? (uint32_t)PUGL_MOD_SHIFT : 0U) | + ((GetKeyState(VK_CONTROL) < 0) ? (uint32_t)PUGL_MOD_CTRL : 0U) | + ((GetKeyState(VK_MENU) < 0) ? (uint32_t)PUGL_MOD_ALT : 0U) | + ((GetKeyState(VK_LWIN) < 0) ? (uint32_t)PUGL_MOD_SUPER : 0U) | + ((GetKeyState(VK_RWIN) < 0) ? (uint32_t)PUGL_MOD_SUPER : 0U)); // clang-format on } @@ -614,12 +614,13 @@ handleConfigure(PuglView* view, PuglEvent* event) event->configure.height = (PuglSpan)height; event->configure.style = - ((view->impl->mapped ? PUGL_VIEW_STYLE_MAPPED : 0U) | - (view->resizing ? PUGL_VIEW_STYLE_RESIZING : 0U) | - (view->impl->fullscreen ? PUGL_VIEW_STYLE_FULLSCREEN : 0U) | - (view->impl->minimized ? PUGL_VIEW_STYLE_HIDDEN : 0U) | - (view->impl->maximized ? (PUGL_VIEW_STYLE_TALL | PUGL_VIEW_STYLE_WIDE) - : 0U)); + ((view->impl->mapped ? (unsigned)PUGL_VIEW_STYLE_MAPPED : 0U) | + (view->resizing ? (unsigned)PUGL_VIEW_STYLE_RESIZING : 0U) | + (view->impl->fullscreen ? (unsigned)PUGL_VIEW_STYLE_FULLSCREEN : 0U) | + (view->impl->minimized ? (unsigned)PUGL_VIEW_STYLE_HIDDEN : 0U) | + (view->impl->maximized + ? (unsigned)(PUGL_VIEW_STYLE_TALL | PUGL_VIEW_STYLE_WIDE) + : 0U)); return rect; } diff --git a/src/x11.c b/src/x11.c index 22c71d5..85c1296 100644 --- a/src/x11.c +++ b/src/x11.c @@ -848,7 +848,8 @@ translateKey(PuglView* const view, XEvent* const xevent, PuglEvent* const event) const PuglKey special = keySymToSpecial(sym); event->key.key = - ((special || ufound <= 0) ? special : puglDecodeUTF8((const uint8_t*)ustr)); + ((special || ufound <= 0) ? special + : (PuglKey)puglDecodeUTF8((const uint8_t*)ustr)); if (xevent->type == KeyPress && !filter && !special && view->impl->xic) { // Lookup shifted key for possible text event @@ -871,10 +872,10 @@ translateKey(PuglView* const view, XEvent* const xevent, PuglEvent* const event) static uint32_t translateModifiers(const unsigned xstate) { - return (((xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0U) | - ((xstate & ControlMask) ? PUGL_MOD_CTRL : 0U) | - ((xstate & Mod1Mask) ? PUGL_MOD_ALT : 0U) | - ((xstate & Mod4Mask) ? PUGL_MOD_SUPER : 0U)); + return (((xstate & ShiftMask) ? (uint32_t)PUGL_MOD_SHIFT : 0U) | + ((xstate & ControlMask) ? (uint32_t)PUGL_MOD_CTRL : 0U) | + ((xstate & Mod1Mask) ? (uint32_t)PUGL_MOD_ALT : 0U) | + ((xstate & Mod4Mask) ? (uint32_t)PUGL_MOD_SUPER : 0U)); } static PuglStatus -- cgit v1.2.1