Cleanup: clang-tidy GHOST Context/Event/TimerManager

This commit is contained in:
Campbell Barton 2022-08-12 11:04:21 +10:00
parent 75c5b21a1c
commit d99ec7ff9e
4 changed files with 11 additions and 11 deletions

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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()

View File

@ -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;