[Bf-blender-cvs] [d99ec7ff9e6] master: Cleanup: clang-tidy GHOST Context/Event/TimerManager

Campbell Barton noreply at git.blender.org
Fri Aug 12 03:05:06 CEST 2022


Commit: d99ec7ff9e6f3e3954ad05aa4bf190aae10656d4
Author: Campbell Barton
Date:   Fri Aug 12 11:04:21 2022 +1000
Branches: master
https://developer.blender.org/rBd99ec7ff9e6f3e3954ad05aa4bf190aae10656d4

Cleanup: clang-tidy GHOST Context/Event/TimerManager

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

M	intern/ghost/intern/GHOST_Context.cpp
M	intern/ghost/intern/GHOST_Event.h
M	intern/ghost/intern/GHOST_TimerManager.cpp
M	intern/ghost/intern/GHOST_TimerManager.h

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

diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index f9aa80dc13d..9dd417521eb 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -35,7 +35,7 @@ bool win32_silent_chk(bool result)
 bool win32_chk(bool result, const char *file, int line, const char *text)
 {
   if (!result) {
-    LPTSTR formattedMsg = NULL;
+    LPTSTR formattedMsg = nullptr;
 
     DWORD error = GetLastError();
 
@@ -87,12 +87,12 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
       default: {
         count = FormatMessage((FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
                                FORMAT_MESSAGE_IGNORE_INSERTS),
-                              NULL,
+                              nullptr,
                               error,
                               MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                               (LPTSTR)(&formattedMsg),
                               0,
-                              NULL);
+                              nullptr);
 
         msg = count > 0 ? formattedMsg : "<no system message>\n";
         break;
diff --git a/intern/ghost/intern/GHOST_Event.h b/intern/ghost/intern/GHOST_Event.h
index 0813378a819..1e1c428e2ae 100644
--- a/intern/ghost/intern/GHOST_Event.h
+++ b/intern/ghost/intern/GHOST_Event.h
@@ -22,7 +22,7 @@ class GHOST_Event : public GHOST_IEvent {
    * \param window: The generating window (or NULL if system event).
    */
   GHOST_Event(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window)
-      : m_type(type), m_time(msec), m_window(window), m_data(NULL)
+      : m_type(type), m_time(msec), m_window(window), m_data(nullptr)
   {
   }
 
diff --git a/intern/ghost/intern/GHOST_TimerManager.cpp b/intern/ghost/intern/GHOST_TimerManager.cpp
index 504cdbfb6c8..e54c2515029 100644
--- a/intern/ghost/intern/GHOST_TimerManager.cpp
+++ b/intern/ghost/intern/GHOST_TimerManager.cpp
@@ -71,10 +71,11 @@ uint64_t GHOST_TimerManager::nextFireTime()
   TTimerVector::iterator iter;
 
   for (iter = m_timers.begin(); iter != m_timers.end(); ++iter) {
-    uint64_t next = (*iter)->getNext();
+    const uint64_t next = (*iter)->getNext();
 
-    if (next < smallest)
+    if (next < smallest) {
       smallest = next;
+    }
   }
 
   return smallest;
@@ -86,8 +87,9 @@ bool GHOST_TimerManager::fireTimers(uint64_t time)
   bool anyProcessed = false;
 
   for (iter = m_timers.begin(); iter != m_timers.end(); ++iter) {
-    if (fireTimer(time, *iter))
+    if (fireTimer(time, *iter)) {
       anyProcessed = true;
+    }
   }
 
   return anyProcessed;
@@ -113,9 +115,7 @@ bool GHOST_TimerManager::fireTimer(uint64_t time, GHOST_TimerTask *task)
 
     return true;
   }
-  else {
-    return false;
-  }
+  return false;
 }
 
 void GHOST_TimerManager::disposeTimers()
diff --git a/intern/ghost/intern/GHOST_TimerManager.h b/intern/ghost/intern/GHOST_TimerManager.h
index 090a84d1f14..4458a107190 100644
--- a/intern/ghost/intern/GHOST_TimerManager.h
+++ b/intern/ghost/intern/GHOST_TimerManager.h
@@ -87,7 +87,7 @@ class GHOST_TimerManager {
    */
   void disposeTimers();
 
-  typedef std::vector<GHOST_TimerTask *> TTimerVector;
+  using TTimerVector = std::vector<GHOST_TimerTask *>;
   /** The list with event consumers. */
   TTimerVector m_timers;



More information about the Bf-blender-cvs mailing list