Further reduce macro usage.

This commit is contained in:
Jake Petroules committed 2014-08-21 19:25:53 -04:00
1 parent b774241f25
commit 8db491ade0
6 files changed
+18 -30

No files matched your search

+3
View File
@@ -14,6 +14,9 @@
// Misc:
// -----------------------------------------------------------------------------
extern const NSTimeInterval SUMinimumUpdateCheckInterval;
extern const NSTimeInterval SUDefaultUpdateCheckInterval;
extern NSString *const SUBundleIdentifier;
// -----------------------------------------------------------------------------
+8
View File
@@ -13,6 +13,14 @@
#import "SUVersionComparisonProtocol.h"
#import "SUConstants.h"
#ifndef DEBUG
#define DEBUG 0
#endif
// Define some minimum intervals to avoid DOS-like checking attacks
const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60);
const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24);
NSString *const SUBundleIdentifier = @SPARKLE_BUNDLE_IDENTIFIER;
NSString *const SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
-5
View File
@@ -152,11 +152,6 @@ static NSString *sUpdateFolder = nil;
}
}
#define SUNotifyDictHostKey @"SUNotifyDictHost"
#define SUNotifyDictErrorKey @"SUNotifyDictError"
#define SUNotifyDictDelegateKey @"SUNotifyDictDelegate"
+ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id<SUInstallerDelegate>)delegate
{
if (result)
+3 -3
View File
@@ -18,7 +18,7 @@
// Constants:
// -----------------------------------------------------------------------------
#define LOG_FILE_PATH @"~/Library/Logs/SparkleUpdateLog.log"
static NSString *const SULogFilePath = @"~/Library/Logs/SparkleUpdateLog.log";
// -----------------------------------------------------------------------------
@@ -38,7 +38,7 @@
void SUClearLog(void)
{
FILE *logfile = fopen([[LOG_FILE_PATH stringByExpandingTildeInPath] fileSystemRepresentation], "w");
FILE *logfile = fopen([[SULogFilePath stringByExpandingTildeInPath] fileSystemRepresentation], "w");
if (logfile) {
fclose(logfile);
}
@@ -62,7 +62,7 @@ void SULog(NSString *format, ...)
NSString *theStr = [[NSString alloc] initWithFormat:format arguments:ap];
NSLog(@"Sparkle: %@", theStr);
FILE *logfile = fopen([[LOG_FILE_PATH stringByExpandingTildeInPath] fileSystemRepresentation], "a");
FILE *logfile = fopen([[SULogFilePath stringByExpandingTildeInPath] fileSystemRepresentation], "a");
if (logfile) {
theStr = [NSString stringWithFormat:@"%@: %@\n", [NSDate date], theStr];
NSData *theData = [theStr dataUsingEncoding:NSUTF8StringEncoding];
-18
View File
@@ -313,22 +313,4 @@ extern NSString *const SUUpdaterAppcastNotificationKey;
@end
// -----------------------------------------------------------------------------
// Constants:
// -----------------------------------------------------------------------------
// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
#if defined(DEBUG) && DEBUG && 0
#define SU_MIN_CHECK_INTERVAL 60
#else
#define SU_MIN_CHECK_INTERVAL 60 * 60
#endif
#if defined(DEBUG) && DEBUG && 0
#define SU_DEFAULT_CHECK_INTERVAL 60
#else
#define SU_DEFAULT_CHECK_INTERVAL 60 * 60 * 24
#endif
#endif
+4 -4
View File
@@ -231,8 +231,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// Now we want to figure out how long until we check again.
NSTimeInterval delayUntilCheck, updateCheckInterval = [self updateCheckInterval];
if (updateCheckInterval < SU_MIN_CHECK_INTERVAL)
updateCheckInterval = SU_MIN_CHECK_INTERVAL;
if (updateCheckInterval < SUMinimumUpdateCheckInterval)
updateCheckInterval = SUMinimumUpdateCheckInterval;
if (intervalSinceCheck < updateCheckInterval)
delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
else
@@ -411,7 +411,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// Hack to support backwards compatibility with older Sparkle versions, which supported
// disabling updates by setting the check interval to 0.
if (automaticallyCheckForUpdates && (NSInteger)[self updateCheckInterval] == 0) {
[self setUpdateCheckInterval:SU_DEFAULT_CHECK_INTERVAL];
[self setUpdateCheckInterval:SUDefaultUpdateCheckInterval];
}
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
// Provide a small delay in case multiple preferences are being updated simultaneously.
@@ -553,7 +553,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
if (intervalValue)
return [intervalValue doubleValue];
else
return SU_DEFAULT_CHECK_INTERVAL;
return SUDefaultUpdateCheckInterval;
}
- (void)dealloc