Permalink
Browse files

Merging latest changes from CocoaLumberjack project

  • Loading branch information...
1 parent d94f4ef commit e15589efa30b9dd816d54f590d27f2eec0d4fcb9 @robbiehanson committed Mar 28, 2013
@@ -15,32 +15,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
-/**
- * Does ARC support support GCD objects?
- * It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
-**/
-#if TARGET_OS_IPHONE
-
- // Compiling for iOS
-
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else // iOS 5.X or earlier
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
- #endif
-
-#else
-
- // Compiling for Mac OS X
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
- #endif
-
-#endif
-
@interface DDAbstractDatabaseLogger ()
- (void)destroySaveTimer;
- (void)destroyDeleteTimer;
@@ -147,7 +121,7 @@ - (void)destroySaveTimer
dispatch_resume(saveTimer);
saveTimerSuspended = NO;
}
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_release(saveTimer);
#endif
saveTimer = NULL;
@@ -158,7 +132,7 @@ - (void)updateAndResumeSaveTimer
{
if ((saveTimer != NULL) && (saveInterval > 0.0) && (unsavedTime > 0.0))
{
- uint64_t interval = saveInterval * NSEC_PER_SEC;
+ uint64_t interval = (uint64_t)(saveInterval * NSEC_PER_SEC);
dispatch_time_t startTime = dispatch_time(unsavedTime, interval);
dispatch_source_set_timer(saveTimer, startTime, interval, 1.0);
@@ -192,7 +166,7 @@ - (void)destroyDeleteTimer
if (deleteTimer)
{
dispatch_source_cancel(deleteTimer);
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_release(deleteTimer);
#endif
deleteTimer = NULL;
@@ -203,7 +177,7 @@ - (void)updateDeleteTimer
{
if ((deleteTimer != NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
{
- uint64_t interval = deleteInterval * NSEC_PER_SEC;
+ uint64_t interval = (uint64_t)(deleteInterval * NSEC_PER_SEC);
dispatch_time_t startTime;
if (lastDeleteTime > 0)
@@ -19,31 +19,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
-// Does ARC support support GCD objects?
-// It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
-
-#if TARGET_OS_IPHONE
-
- // Compiling for iOS
-
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else // iOS 5.X or earlier
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
- #endif
-
-#else
-
- // Compiling for Mac OS X
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
- #endif
-
-#endif
-
// We probably shouldn't be using DDLog() statements within the DDLog implementation.
// But we still want to leave our log statements for any future debugging,
// and to allow other developers to trace the implementation (which is a great learning tool).
@@ -674,14 +649,14 @@ - (void)scheduleTimerToRollLogFileDueToAge
}});
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_source_t theRollingTimer = rollingTimer;
dispatch_source_set_cancel_handler(rollingTimer, ^{
dispatch_release(theRollingTimer);
});
#endif
- uint64_t delay = [logFileRollingDate timeIntervalSinceNow] * NSEC_PER_SEC;
+ uint64_t delay = (uint64_t)([logFileRollingDate timeIntervalSinceNow] * NSEC_PER_SEC);
dispatch_time_t fireTime = dispatch_time(DISPATCH_TIME_NOW, delay);
dispatch_source_set_timer(rollingTimer, fireTime, DISPATCH_TIME_FOREVER, 1.0);
@@ -489,7 +489,7 @@ NSString *DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
enum {
DDLogMessageCopyFile = 1 << 0,
- DDLogMessageCopyFunction = 1 << 1,
+ DDLogMessageCopyFunction = 1 << 1
};
typedef int DDLogMessageOptions;
@@ -22,31 +22,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
-// Does ARC support support GCD objects?
-// It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
-
-#if TARGET_OS_IPHONE
-
- // Compiling for iOS
-
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else // iOS 5.X or earlier
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
- #endif
-
-#else
-
- // Compiling for Mac OS X
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
- #endif
-
-#endif
-
// We probably shouldn't be using DDLog() statements within the DDLog implementation.
// But we still want to leave our log statements for any future debugging,
// and to allow other developers to trace the implementation (which is a great learning tool).
@@ -805,7 +780,7 @@ - (id)initWithLogger:(id <DDLogger>)aLogger loggerQueue:(dispatch_queue_t)aLogge
if (aLoggerQueue) {
loggerQueue = aLoggerQueue;
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_retain(loggerQueue);
#endif
}
@@ -820,7 +795,7 @@ + (DDLoggerNode *)nodeWithLogger:(id <DDLogger>)logger loggerQueue:(dispatch_que
- (void)dealloc
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (loggerQueue) dispatch_release(loggerQueue);
#endif
}
@@ -871,7 +846,7 @@ - (id)initWithLogMsg:(NSString *)msg
file = (char *)aFile;
if (options & DDLogMessageCopyFunction)
- file = dd_str_copy(aFunction);
+ function = dd_str_copy(aFunction);
else
function = (char *)aFunction;
@@ -977,7 +952,7 @@ - (id)init
- (void)dealloc
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (loggerQueue) dispatch_release(loggerQueue);
#endif
}

0 comments on commit e15589e

Please sign in to comment.