Skip to content

Commit bd29596

Browse files
committed
Fixing compiler issues when min deployment target is iOS 6+ or Max OS X 10.8+
1 parent e56aa25 commit bd29596

File tree

6 files changed

+174
-3
lines changed

6 files changed

+174
-3
lines changed

Extensions/Roster/MemoryStorage/XMPPRosterMemoryStorage.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
99
#endif
1010

11+
/**
12+
* Does ARC support support GCD objects?
13+
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
14+
**/
15+
#if TARGET_OS_IPHONE
16+
17+
// Compiling for iOS
18+
19+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
20+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
21+
#else // iOS 5.X or earlier
22+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
23+
#endif
24+
25+
#else
26+
27+
// Compiling for Mac OS X
28+
29+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
30+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
31+
#else
32+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
33+
#endif
34+
35+
#endif
36+
1137
// Log levels: off, error, warn, info, verbose
1238
#if DEBUG
1339
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN; // | XMPP_LOG_FLAG_TRACE;
@@ -57,7 +83,9 @@ - (BOOL)configureWithParent:(XMPPRoster *)aParent queue:(dispatch_queue_t)queue
5783
parent = aParent;
5884
parentQueue = queue;
5985

86+
#if NEEDS_DISPATCH_RETAIN_RELEASE
6087
dispatch_retain(parentQueue);
88+
#endif
6189

6290
return YES;
6391
}
@@ -68,8 +96,10 @@ - (BOOL)configureWithParent:(XMPPRoster *)aParent queue:(dispatch_queue_t)queue
6896

6997
- (void)dealloc
7098
{
99+
#if NEEDS_DISPATCH_RETAIN_RELEASE
71100
if (parentQueue)
72101
dispatch_release(parentQueue);
102+
#endif
73103
}
74104

75105
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Extensions/XEP-0009/XMPPJabberRPCModule.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@
1616
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
1717
#endif
1818

19+
/**
20+
* Does ARC support support GCD objects?
21+
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
22+
**/
23+
#if TARGET_OS_IPHONE
24+
25+
// Compiling for iOS
26+
27+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
28+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
29+
#else // iOS 5.X or earlier
30+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
31+
#endif
32+
33+
#else
34+
35+
// Compiling for Mac OS X
36+
37+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
38+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
39+
#else
40+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
41+
#endif
42+
43+
#endif
44+
1945
// Log levels: off, error, warn, info, verbose
2046
// Log flags: trace
2147
#if DEBUG
@@ -57,7 +83,9 @@ - (id)initWithRpcID:(NSString *)aRpcID timer:(dispatch_source_t)aTimer
5783
rpcID = [aRpcID copy];
5884

5985
timer = aTimer;
86+
#if NEEDS_DISPATCH_RETAIN_RELEASE
6087
dispatch_retain(timer);
88+
#endif
6189
}
6290
return self;
6391
}
@@ -77,7 +105,9 @@ - (void)cancelTimer
77105
if (timer)
78106
{
79107
dispatch_source_cancel(timer);
108+
#if NEEDS_DISPATCH_RETAIN_RELEASE
80109
dispatch_release(timer);
110+
#endif
81111
timer = NULL;
82112
}
83113
}

Extensions/XEP-0045/HybridStorage/XMPPRoomHybridStorage.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
99
#endif
1010

11+
/**
12+
* Does ARC support support GCD objects?
13+
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
14+
**/
15+
#if TARGET_OS_IPHONE
16+
17+
// Compiling for iOS
18+
19+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
20+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
21+
#else // iOS 5.X or earlier
22+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
23+
#endif
24+
25+
#else
26+
27+
// Compiling for Mac OS X
28+
29+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
30+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
31+
#else
32+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
33+
#endif
34+
35+
#endif
36+
1137
// Log levels: off, error, warn, info, verbose
1238
#if DEBUG
1339
static const int xmppLogLevel = XMPP_LOG_LEVEL_VERBOSE | XMPP_LOG_FLAG_TRACE;
@@ -337,7 +363,9 @@ - (void)destroyDeleteTimer
337363
if (deleteTimer)
338364
{
339365
dispatch_source_cancel(deleteTimer);
366+
#if NEEDS_DISPATCH_RETAIN_RELEASE
340367
dispatch_release(deleteTimer);
368+
#endif
341369
deleteTimer = NULL;
342370
}
343371
}

Extensions/XEP-0045/MemoryStorage/XMPPRoomMemoryStorage.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
99
#endif
1010

11+
/**
12+
* Does ARC support support GCD objects?
13+
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
14+
**/
15+
#if TARGET_OS_IPHONE
16+
17+
// Compiling for iOS
18+
19+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
20+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
21+
#else // iOS 5.X or earlier
22+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
23+
#endif
24+
25+
#else
26+
27+
// Compiling for Mac OS X
28+
29+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
30+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
31+
#else
32+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
33+
#endif
34+
35+
#endif
36+
1137
// Log levels: off, error, warn, info, verbose
1238
#if DEBUG
1339
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN; // | XMPP_LOG_FLAG_TRACE;
@@ -76,7 +102,9 @@ - (BOOL)configureWithParent:(XMPPRoom *)aParent queue:(dispatch_queue_t)queue
76102
parent = aParent;
77103
parentQueue = queue;
78104

105+
#if NEEDS_DISPATCH_RETAIN_RELEASE
79106
dispatch_retain(parentQueue);
107+
#endif
80108

81109
result = YES;
82110
}
@@ -92,8 +120,10 @@ - (BOOL)configureWithParent:(XMPPRoom *)aParent queue:(dispatch_queue_t)queue
92120

93121
- (void)dealloc
94122
{
123+
#if NEEDS_DISPATCH_RETAIN_RELEASE
95124
if (parentQueue)
96125
dispatch_release(parentQueue);
126+
#endif
97127
}
98128

99129
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Extensions/XEP-0199/XMPPAutoPing.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@
77
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
88
#endif
99

10+
/**
11+
* Does ARC support support GCD objects?
12+
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
13+
**/
14+
#if TARGET_OS_IPHONE
15+
16+
// Compiling for iOS
17+
18+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
19+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
20+
#else // iOS 5.X or earlier
21+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
22+
#endif
23+
24+
#else
25+
26+
// Compiling for Mac OS X
27+
28+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
29+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
30+
#else
31+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
32+
#endif
33+
34+
#endif
35+
1036
// Log levels: off, error, warn, info, verbose
1137
// Log flags: trace
1238
#if DEBUG
@@ -340,7 +366,9 @@ - (void)stopPingIntervalTimer
340366

341367
if (pingIntervalTimer)
342368
{
369+
#if NEEDS_DISPATCH_RETAIN_RELEASE
343370
dispatch_release(pingIntervalTimer);
371+
#endif
344372
pingIntervalTimer = NULL;
345373
}
346374
}

Extensions/XEP-0202/XMPPAutoTime.m

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@
66
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
77
#endif
88

9+
/**
10+
* Does ARC support support GCD objects?
11+
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
12+
**/
13+
#if TARGET_OS_IPHONE
14+
15+
// Compiling for iOS
16+
17+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
18+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
19+
#else // iOS 5.X or earlier
20+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
21+
#endif
22+
23+
#else
24+
25+
// Compiling for Mac OS X
26+
27+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
28+
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
29+
#else
30+
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
31+
#endif
32+
33+
#endif
34+
935
// Log levels: off, error, warn, info, verbose
1036
// Log flags: trace
1137
#if DEBUG
@@ -88,11 +114,8 @@ - (void)dealloc
88114
{
89115
// recalibrationTimer released in [self deactivate]
90116

91-
92117
[xmppTime removeDelegate:self];
93118
xmppTime = nil; // Might be referenced via [super dealloc] -> [self deactivate]
94-
95-
96119
}
97120

98121
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -360,7 +383,9 @@ - (void)stopRecalibrationTimer
360383

361384
if (recalibrationTimer)
362385
{
386+
#if NEEDS_DISPATCH_RETAIN_RELEASE
363387
dispatch_release(recalibrationTimer);
388+
#endif
364389
recalibrationTimer = NULL;
365390
}
366391
}

0 commit comments

Comments
 (0)