Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved headers from Charles D. H. Williams.

  • Loading branch information...
commit 5aa1e18bc54f40e8f16b8a22e897301e10c3ab73 1 parent c3b27a8
andym authored
Showing with 165 additions and 54 deletions.
  1. +4 −1 NSBundle+SUAdditions.h
  2. +1 −1  NSBundle+SUAdditions.m
  3. +4 −1 NSFileManager+Authentication.h
  4. +1 −0  NSFileManager+Authentication.m
  5. +4 −1 NSFileManager+Verification.h
  6. +1 −0  NSFileManager+Verification.m
  7. +5 −0 NSString+extras.h
  8. +1 −0  NSString+extras.m
  9. +5 −1 NSWorkspace_RBAdditions.h
  10. +2 −0  NSWorkspace_RBAdditions.m
  11. +4 −1 NTSynchronousTask.h
  12. +1 −0  NTSynchronousTask.m
  13. +6 −0 RSS.h
  14. +1 −0  RSS.m
  15. +4 −1 SUAppcast.h
  16. +1 −1  SUAppcast.m
  17. +5 −1 SUAppcastItem.h
  18. +1 −0  SUAppcastItem.m
  19. +4 −1 SUAutomaticUpdateAlert.h
  20. +1 −0  SUAutomaticUpdateAlert.m
  21. +19 −11 SUConstants.h
  22. +2 −1  SUConstants.m
  23. +7 −1 SUStandardVersionComparator.h
  24. +1 −0  SUStandardVersionComparator.m
  25. +5 −0 SUStatusChecker.h
  26. +1 −0  SUStatusChecker.m
  27. +5 −1 SUStatusController.h
  28. +1 −0  SUStatusController.m
  29. +4 −1 SUSystemProfiler.h
  30. +2 −1  SUSystemProfiler.m
  31. +4 −1 SUUnarchiver.h
  32. +2 −2 SUUnarchiver.m
  33. +4 −1 SUUpdateAlert.h
  34. +2 −0  SUUpdateAlert.m
  35. +5 −1 SUUpdater+Authentication.m
  36. +2 −0  SUUpdater+DSA.m
  37. +8 −8 SUUpdater.h
  38. +2 −0  SUUpdater.m
  39. +4 −1 SUUserDefaults.h
  40. +1 −1  SUUserDefaults.m
  41. +4 −1 SUVersionComparisonProtocol.h
  42. +23 −12 Sparkle.h
  43. +1 −0  relaunch.m
View
5 NSBundle+SUAdditions.h
@@ -6,7 +6,8 @@
// Copyright 2007 Andy Matuschak. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef NSBUNDLE_PLUS_ADDITIONS_H
+#define NSBUNDLE_PLUS_ADDITIONS_H
@interface NSBundle (SUAdditions)
/*!
@@ -43,3 +44,5 @@
*/
- (BOOL)isRunningFromDiskImage;
@end
+
+#endif
View
2  NSBundle+SUAdditions.m
@@ -6,8 +6,8 @@
// Copyright 2007 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "NSBundle+SUAdditions.h"
-#import "NSWorkspace_RBAdditions.h"
@implementation NSBundle (SUAdditions)
View
5 NSFileManager+Authentication.h
@@ -6,8 +6,11 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef NSFILEMANAGER_PLUS_AUTHENTICATION_H
+#define NSFILEMANAGER_PLUS_AUTHENTICATION_H
@interface NSFileManager (SUAuthenticationAdditions)
- (BOOL)copyPath:(NSString *)src overPath:(NSString *)dst withAuthentication:(BOOL)useAuthentication;
@end
+
+#endif
View
1  NSFileManager+Authentication.m
@@ -8,6 +8,7 @@
// This code based on generous contribution from Allan Odgaard. Thanks, Allan!
+#import "Sparkle.h"
#import "NSFileManager+Authentication.h"
#import <Security/Security.h>
View
5 NSFileManager+Verification.h
@@ -6,9 +6,12 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef NSFILEMANAGER_PLUS_VERIFICATION_H
+#define NSFILEMANAGER_PLUS_VERIFICATION_H
// For the paranoid folks!
@interface NSFileManager (SUVerification)
- (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
@end
+
+#endif
View
1  NSFileManager+Verification.m
@@ -8,6 +8,7 @@
// DSA stuff adapted from code provided by Allan Odgaard. Thanks, Allan!
+#import "Sparkle.h"
#import "NSFileManager+Verification.h"
#import <stdio.h>
View
5 NSString+extras.h
@@ -31,6 +31,9 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
*/
+#ifndef NSSTRING_PLUS_EXTRAS_H
+#define NSSTRING_PLUS_EXTRAS_H
+
/*
NSString+extras.h
@@ -59,3 +62,5 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
@end
+
+#endif
View
1  NSString+extras.m
@@ -40,6 +40,7 @@ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
Copyright (c) 2002 Brent Simmons. All rights reserved.
*/
+#import "Sparkle.h"
#import "NSString+extras.h"
View
6 NSWorkspace_RBAdditions.h
@@ -6,7 +6,9 @@
// Copyright 2007 Rainer Brockerhoff. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef NSWORKSPACE_RBADDITIONS_H
+#define NSWORKSPACE_RBADDITIONS_H
+
extern NSString* NSWorkspace_RBfstypename;
extern NSString* NSWorkspace_RBmntonname;
@@ -35,3 +37,5 @@ extern NSString* NSWorkspace_RBserverURL;
- (NSDictionary*)propertiesForPath:(NSString*)path;
@end
+
+#endif
View
2  NSWorkspace_RBAdditions.m
@@ -6,7 +6,9 @@
// Copyright 2007 Rainer Brockerhoff. All rights reserved.
//
+#import "Sparkle.h"
#import "NSWorkspace_RBAdditions.h"
+
#include <IOKit/IOKitLib.h>
#include <sys/mount.h>
#include <mach/mach.h>
View
5 NTSynchronousTask.h
@@ -6,7 +6,8 @@
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef NTSYNCHRONOUSTASK_H
+#define NTSYNCHRONOUSTASK_H
@interface NTSynchronousTask : NSObject
{
@@ -24,3 +25,5 @@
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
@end
+
+#endif
View
1  NTSynchronousTask.m
@@ -6,6 +6,7 @@
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
+#import "Sparkle.h"
#import "NTSynchronousTask.h"
@interface NTSynchronousTask (Private)
View
6 RSS.h
@@ -31,6 +31,10 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
*/
+#ifndef RSS_H
+#define RSS_H
+
+
/*
RSS.h
A class for reading RSS feeds.
@@ -96,3 +100,5 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
- (NSString *) getelementvalue: (CFXMLTreeRef) tree;
@end
+
+#endif
View
1  RSS.m
@@ -40,6 +40,7 @@ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
*/
+#import "Sparkle.h"
#import "RSS.h"
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
View
5 SUAppcast.h
@@ -6,7 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUAPPCAST_H
+#define SUAPPCAST_H
@class RSS, SUAppcastItem;
@interface SUAppcast : NSObject {
@@ -27,3 +28,5 @@
- (void)appcastDidFailToLoad:(SUAppcast *)appcast;
- (NSString *)userAgentForAppcast:(SUAppcast *)appcast;
@end
+
+#endif
View
2  SUAppcast.m
@@ -6,8 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "SUAppcast.h"
-#import "RSS.h"
@implementation SUAppcast
View
6 SUAppcastItem.h
@@ -6,7 +6,9 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUAPPCASTITEM_H
+#define SUAPPCASTITEM_H
+
@interface SUAppcastItem : NSObject {
NSString *title;
@@ -59,3 +61,5 @@
- (void)setMinimumSystemVersion:(NSString *)systemVersionString;
@end
+
+#endif
View
1  SUAppcastItem.m
@@ -6,6 +6,7 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "SUAppcastItem.h"
@implementation SUAppcastItem
View
5 SUAutomaticUpdateAlert.h
@@ -6,7 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUAUTOMATICUPDATEALERT_H
+#define SUAUTOMATICUPDATEALERT_H
@class SUAppcastItem;
@interface SUAutomaticUpdateAlert : NSWindowController {
@@ -20,3 +21,5 @@
- (IBAction)relaunchLater:sender;
@end
+
+#endif
View
1  SUAutomaticUpdateAlert.m
@@ -6,6 +6,7 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "SUAutomaticUpdateAlert.h"
@implementation SUAutomaticUpdateAlert
View
30 SUConstants.h
@@ -6,6 +6,11 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+
+#ifndef SUCONSTANTS_H
+#define SUCONSTANTS_H
+
+
extern NSString *SUUpdaterWillRestartNotification;
extern NSString *SUFeedURLKey;
@@ -23,15 +28,18 @@ extern NSString *SUEnableAutomaticChecksKey;
// NSInteger is a type that was added to Leopard.
// Here is some glue to ensure that NSInteger will work with pre-10.5 SDKs:
#ifndef NSINTEGER_DEFINED
-#ifdef NS_BUILD_32_LIKE_64
-typedef long NSInteger;
-typedef unsigned long NSUInteger;
-#else
-typedef int NSInteger;
-typedef unsigned int NSUInteger;
-#endif
-#define NSIntegerMax LONG_MAX
-#define NSIntegerMin LONG_MIN
-#define NSUIntegerMax ULONG_MAX
-#define NSINTEGER_DEFINED 1
+ #ifdef NS_BUILD_32_LIKE_64
+ typedef long NSInteger;
+ typedef unsigned long NSUInteger;
+ #else
+ typedef int NSInteger;
+ typedef unsigned int NSUInteger;
+ #endif
+ #define NSIntegerMax LONG_MAX
+ #define NSIntegerMin LONG_MIN
+ #define NSUIntegerMax ULONG_MAX
+ #define NSINTEGER_DEFINED 1
#endif
+
+
+#endif
View
3  SUConstants.m
@@ -6,7 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#import "Sparkle.h"
+#import "SUConstants.h"
NSString *SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
View
8 SUStandardVersionComparator.h
@@ -6,7 +6,11 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUSTANDARDVERSIONCOMPARATOR_H
+#define SUSTANDARDVERSIONCOMPARATOR_H
+
+
+#import "SUVersionComparisonProtocol.h"
/*!
@class
@@ -28,3 +32,5 @@
*/
- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB;
@end
+
+#endif
View
1  SUStandardVersionComparator.m
@@ -6,6 +6,7 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
+#import "Sparkle.h"
#import "SUStandardVersionComparator.h"
@implementation SUStandardVersionComparator
View
5 SUStatusChecker.h
@@ -5,6 +5,9 @@
// Created by Evan Schoenberg on 7/6/06.
//
+#ifndef SUSTATUSCHECKER_H
+#define SUSTATUSCHECKER_H
+
#import "SUUpdater.h"
@class SUStatusChecker;
@@ -23,3 +26,5 @@
+ (SUStatusChecker *)statusCheckerForDelegate:(id<SUStatusCheckerDelegate>)delegate;
@end
+
+#endif
View
1  SUStatusChecker.m
@@ -5,6 +5,7 @@
// Created by Evan Schoenberg on 7/6/06.
//
+#import "Sparkle.h"
#import "SUStatusChecker.h"
@interface SUStatusChecker (Private)
View
6 SUStatusController.h
@@ -6,7 +6,9 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUSTATUSCONTROLLER_H
+#define SUSTATUSCONTROLLER_H
+
@interface SUStatusController : NSWindowController {
double progressValue, maxProgressValue;
@@ -34,3 +36,5 @@
- (void)setStatusText:(NSString *)statusText;
@end
+
+#endif
View
1  SUStatusController.m
@@ -6,6 +6,7 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "SUStatusController.h"
@implementation SUStatusController
View
5 SUSystemProfiler.h
@@ -6,8 +6,11 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUSYSTEMPROFILER_H
+#define SUSYSTEMPROFILER_H
@interface SUSystemProfiler : NSObject {}
+ (NSURL *)profiledURLForAppcastURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hostBundle;
@end
+
+#endif
View
3  SUSystemProfiler.m
@@ -6,8 +6,9 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
+#import "Sparkle.h"
#import "SUSystemProfiler.h"
-#import "NSBundle+SUAdditions.h"
+
#import <sys/sysctl.h>
@implementation SUSystemProfiler
View
5 SUUnarchiver.h
@@ -6,7 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUUNARCHIVER_H
+#define SUUNARCHIVER_H
@interface SUUnarchiver : NSObject {
id delegate;
@@ -22,3 +23,5 @@
- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver;
- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver;
@end
+
+#endif
View
4 SUUnarchiver.m
@@ -6,9 +6,9 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+
+#import "Sparkle.h"
#import "SUUnarchiver.h"
-#import <Carbon/Carbon.h>
-#import "NTSynchronousTask.h"
@implementation SUUnarchiver
View
5 SUUpdateAlert.h
@@ -6,7 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import "Sparkle.h"
+#ifndef SUUPDATEALERT_H
+#define SUUPDATEALERT_H
typedef enum
{
@@ -39,3 +40,5 @@ typedef enum
@interface NSObject (SUUpdateAlertDelegate)
- (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice;
@end
+
+#endif
View
2  SUUpdateAlert.m
@@ -6,7 +6,9 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "SUUpdateAlert.h"
+
#import <WebKit/WebKit.h>
@implementation SUUpdateAlert
View
6 SUUpdater+Authentication.m
@@ -6,8 +6,12 @@
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
+#import "Sparkle.h"
#import "SUUpdater.h"
-#import "sys/stat.h"
+
+#import <sys/types.h>
+#import <sys/wait.h>
+#import <sys/stat.h">
#import <Security/Security.h>
@implementation SUUpdater (SUAuthenticationAdditions)
View
2  SUUpdater+DSA.m
@@ -8,7 +8,9 @@
// Thanks to Allan Odgaard for this code!
+#import "Sparkle.h"
#import "SUUpdater.h"
+
#import <stdio.h>
#import <openssl/evp.h>
#import <openssl/bio.h>
View
16 SUUpdater.h
@@ -6,7 +6,8 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef SUUPDATER_H
+#define SUUPDATER_H
// Before you use Sparkle in your app, you must set SUFeedURL in Info.plist to the
// address of the appcast on your webserver. If you don't already have an
@@ -53,18 +54,17 @@
@end
-#import "Sparkle.h"
-
-
// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
#ifdef DEBUG
-#define SU_MIN_CHECK_INTERVAL 60
+ #define SU_MIN_CHECK_INTERVAL 60
#else
-#define SU_MIN_CHECK_INTERVAL 60*60
+ #define SU_MIN_CHECK_INTERVAL 60*60
#endif
#ifdef DEBUG
-#define SU_DEFAULT_CHECK_INTERVAL 60
+ #define SU_DEFAULT_CHECK_INTERVAL 60
#else
-#define SU_DEFAULT_CHECK_INTERVAL 60*60*24
+ #define SU_DEFAULT_CHECK_INTERVAL 60*60*24
+#endif
+
#endif
View
2  SUUpdater.m
@@ -6,7 +6,9 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
+#import "Sparkle.h"
#import "SUUpdater.h"
+
#import <stdio.h>
#import <sys/stat.h>
#import <unistd.h>
View
5 SUUserDefaults.h
@@ -6,7 +6,8 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef SUUSERDEFAULTS_H
+#define SUUSERDEFAULTS_H
/*!
@class
@@ -36,3 +37,5 @@
- (BOOL)boolForKey:(NSString *)defaultName;
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
@end
+
+#endif
View
2  SUUserDefaults.m
@@ -6,9 +6,9 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
+#import "Sparkle.h"
#import "SUUserDefaults.h"
-
@implementation SUUserDefaults
+ (SUUserDefaults *)standardUserDefaults
View
5 SUVersionComparisonProtocol.h
@@ -6,7 +6,8 @@
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
+#ifndef SUVERSIONCOMPARISONPROTOCOL_H
+#define SUVERSIONCOMPARISONPROTOCOL_H
/*!
@protocol
@@ -22,3 +23,5 @@
- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB;
@end
+
+#endif
View
35 Sparkle.h
@@ -2,15 +2,17 @@
// Sparkle.h
// Sparkle
//
-// Created by Andy Matuschak on 3/16/06.
+// Created by Andy Matuschak on 3/16/06. (Modified by CDHW on 23/12/07)
// Copyright 2006 Andy Matuschak. All rights reserved.
//
//
// Prefix header for all source files of the 'Sparkle' target in the 'Sparkle' project.
//
+
#ifndef SPARKLE_H
#define SPARKLE_H
+
#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", [NSBundle bundleForClass:[self class]], comment)
#ifdef __OBJC__
@@ -24,24 +26,33 @@
// This returns a version string of the form X.Y.Z
#define SUSystemVersionString() [[NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"] objectForKey:@"ProductVersion"]
-#import "SUUpdater.h"
-#import "SUConstants.h"
+
+// This list should include the shared headers. It doesn't matter if some of them aren't shared (unless
+// there are name-space collisions) so we can list all of them to start with:
+
+#import "NSBundle+SUAdditions.h"
+#import "NSFileManager+Authentication.h"
+#import "NSFileManager+Verification.h"
+#import "NSString+extras.h"
+#import "NSWorkspace_RBAdditions.h"
+
+#import "NTSynchronousTask.h"
+
+#import "RSS.h"
+
#import "SUAppcast.h"
#import "SUAppcastItem.h"
-#import "SUUpdateAlert.h"
#import "SUAutomaticUpdateAlert.h"
+#import "SUConstants.h"
+#import "SUStandardVersionComparator.h"
+#import "SUStatusChecker.h"
#import "SUStatusController.h"
+#import "SUSystemProfiler.h"
#import "SUUnarchiver.h"
-#import "SUStatusChecker.h"
+#import "SUUpdateAlert.h"
+#import "SUUpdater.h"
#import "SUUserDefaults.h"
#import "SUVersionComparisonProtocol.h"
-#import "SUStandardVersionComparator.h"
-
-#import "NSFileManager+Authentication.h"
-#import "NSFileManager+Verification.h"
-#import "NSBundle+SUAdditions.h"
-#else
-/* Sparkle.h included more than once */
#endif
View
1  relaunch.m
@@ -1,5 +1,6 @@
// gcc -Wall -arch i386 -arch ppc -Os -s -framework AppKit -o relaunch relaunch.m
+#import "Sparkle.h"
#import <AppKit/AppKit.h>
#import <unistd.h>
Please sign in to comment.
Something went wrong with that request. Please try again.