From 93f74299f07585d5c922aa048055141e7a487e07 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Jul 2022 21:55:46 +1000 Subject: Cleanup: clang-tidy changes to GHOST_SystemX11 Also remove redundant check. --- intern/ghost/intern/GHOST_SystemX11.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 70a9687672c..00cc5f3af8f 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1159,7 +1159,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) /* Setting unicode on key-up events gives #XLookupNone status. */ xic = window->getX11_XIC(); - if (xic && xke->type == KeyPress) { + if (xic) { Status status; /* Use utf8 because its not locale repentant, from XORG docs. */ @@ -1213,20 +1213,21 @@ void GHOST_SystemX11::processEvent(XEvent *xe) if (xke->type == KeyPress && xic) { unsigned char c; int i = 0; - while (1) { - /* search character boundary */ - if ((unsigned char)utf8_buf[i++] > 0x7f) { + while (true) { + /* Search character boundary. */ + if ((uchar)utf8_buf[i++] > 0x7f) { for (; i < len; ++i) { c = utf8_buf[i]; - if (c < 0x80 || c > 0xbf) + if (c < 0x80 || c > 0xbf) { break; + } } } - if (i >= len) + if (i >= len) { break; - - /* enqueue previous character */ + } + /* Enqueue previous character. */ pushEvent(g_event); g_event = new GHOST_EventKey( @@ -1234,8 +1235,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe) } } - if (utf8_buf != utf8_array) + if (utf8_buf != utf8_array) { free(utf8_buf); + } #endif break; -- cgit v1.2.3