[Bf-blender-cvs] [93f74299f07] master: Cleanup: clang-tidy changes to GHOST_SystemX11

Campbell Barton noreply at git.blender.org
Thu Jul 14 13:56:09 CEST 2022


Commit: 93f74299f07585d5c922aa048055141e7a487e07
Author: Campbell Barton
Date:   Thu Jul 14 21:55:46 2022 +1000
Branches: master
https://developer.blender.org/rB93f74299f07585d5c922aa048055141e7a487e07

Cleanup: clang-tidy changes to GHOST_SystemX11

Also remove redundant check.

===================================================================

M	intern/ghost/intern/GHOST_SystemX11.cpp

===================================================================

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;



More information about the Bf-blender-cvs mailing list