mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Further reduce macro usage.
This commit is contained in:
1 parent
b774241f25
commit
8db491ade0
6 files changed
+18
-30
No files matched your search
Vendored
+3
@@ -14,6 +14,9 @@
|
||||
// Misc:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
extern const NSTimeInterval SUMinimumUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUDefaultUpdateCheckInterval;
|
||||
|
||||
extern NSString *const SUBundleIdentifier;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Vendored
+8
@@ -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";
|
||||
|
||||
Vendored
-5
@@ -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)
|
||||
|
||||
Vendored
+3
-3
@@ -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];
|
||||
|
||||
Vendored
-18
@@ -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
|
||||
Vendored
+4
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user