Skip to content

Commit e9447a0

Browse files
committed
minor fixes for Abhishek's patch
- fixed include order (local before system) - fixed unused variable - made member pointer const so reader knows it always gets initialized - nullptr instead of NULL as nagged by clang-tidy
1 parent 3fcc426 commit e9447a0

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/KDFoundation/platform/macos/macos_platform_event_loop.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <KDFoundation/platform/abstract_platform_event_loop.h>
1515
#include <KDFoundation/kdfoundation_global.h>
16+
1617
#include <unordered_map>
1718

1819
namespace KDFoundation {

src/KDFoundation/platform/macos/macos_platform_event_loop.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
#include "macos_platform_event_loop.h"
1313
#include "macos_platform_timer.h"
14+
1415
#import <Foundation/Foundation.h>
1516
#import <AppKit/AppKit.h>
17+
1618
#include <limits>
1719
#include <memory>
1820

@@ -79,6 +81,7 @@
7981
// TODO
8082
return false;
8183
}
84+
8285
std::unique_ptr<AbstractPlatformTimer> MacOSPlatformEventLoop::createPlatformTimerImpl(Timer *timer)
8386
{
8487
return std::make_unique<MacOSPlatformTimer>(timer);

src/KDFoundation/platform/macos/macos_platform_timer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
#pragma once
1313

14+
#include <KDFoundation/platform/abstract_platform_timer.h>
15+
#include <KDFoundation/file_descriptor_notifier.h>
16+
1417
#include <CoreFoundation/CoreFoundation.h>
1518

1619
#include <chrono>
1720

18-
#include <KDFoundation/platform/abstract_platform_timer.h>
19-
#include <KDFoundation/file_descriptor_notifier.h>
20-
2121
namespace KDFoundation {
2222

2323
class Timer;
@@ -32,7 +32,7 @@ class KDFOUNDATION_API MacOSPlatformTimer : public AbstractPlatformTimer
3232
void arm(std::chrono::microseconds us);
3333
void disarm();
3434
static void timerFired(CFRunLoopTimerRef timer, void *info);
35-
Timer *m_handler;
35+
Timer *const m_handler;
3636
CFRunLoopTimerRef cfTimer;
3737
};
3838

src/KDFoundation/platform/macos/macos_platform_timer.mm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
#include "macos_platform_timer.h"
1313
#include "macos_platform_event_loop.h"
14+
#include "KDFoundation/core_application.h"
15+
#include "KDFoundation/timer.h"
16+
#include "KDFoundation/platform/macos/macos_platform_event_loop.h"
17+
1418
#include <Foundation/Foundation.h>
19+
1520
#include <algorithm>
1621
#include <cassert>
1722
#include <chrono>
1823
#include <cstddef>
1924
#include <type_traits>
2025
#include <unistd.h>
21-
#include "KDFoundation/core_application.h"
22-
#include "KDFoundation/timer.h"
23-
#include "KDFoundation/platform/macos/macos_platform_event_loop.h"
2426

2527
using namespace KDFoundation;
2628

@@ -51,7 +53,7 @@
5153
disarm();
5254
}
5355

54-
void MacOSPlatformTimer::timerFired(CFRunLoopTimerRef timer, void *info)
56+
void MacOSPlatformTimer::timerFired(CFRunLoopTimerRef timer, void *)
5557
{
5658
MacOSPlatformEventLoop *ev = eventLoop();
5759
void *key = timer;
@@ -67,7 +69,7 @@
6769
}
6870

6971
CFTimeInterval interval = std::chrono::duration_cast<std::chrono::duration<double>>(us).count();
70-
CFRunLoopTimerContext timerContext = { 0, NULL, NULL, NULL, NULL };
72+
CFRunLoopTimerContext timerContext = { 0, nullptr, nullptr, nullptr, nullptr };
7173
CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
7274
// Create the timer
7375
cfTimer = CFRunLoopTimerCreate(

0 commit comments

Comments
 (0)