We don’t need to declare ivars in the interface block if they are only accessed via accessors.

This is only true because we’re targeting x86_64 on OS X. The same is true for all iOS architectures, but not i386 on OS X.
Use CFBridgingRelease in a few places: it acts just like [(id)CFMakeCollectable(obj) autorelease] on non-ARC code, but is a bit cleaner.
This commit is contained in:
C.W. Betts committed 2014-06-19 15:32:20 -06:00
1 parent 8577ed8953
commit 7bd4e56cd5
14 files changed
+38 -78

No files matched your search

-10
View File
@@ -10,16 +10,6 @@
#define NTSYNCHRONOUSTASK_H
@interface NTSynchronousTask : NSObject
{
@private
NSTask *mv_task;
NSPipe *mv_outputPipe;
NSPipe *mv_inputPipe;
NSData* mv_output;
BOOL mv_done;
int mv_result;
}
@property (readonly, retain) NSData *output;
@property (readonly) int result;
+1 -23
View File
@@ -10,28 +10,6 @@
#define SUAPPCASTITEM_H
@interface SUAppcastItem : NSObject
{
@private
NSString *title;
NSDate *date;
NSString *itemDescription;
NSURL *releaseNotesURL;
NSString *DSASignature;
NSString *minimumSystemVersion;
NSString *maximumSystemVersion;
NSURL *fileURL;
NSString *versionString;
NSString *displayVersionString;
NSDictionary *deltaUpdates;
NSDictionary *propertiesDictionary;
NSURL *infoURL; // UK 2007-08-31
}
@property (copy, readonly) NSString *title;
@property (copy, readonly) NSDate *date;
@property (copy, readonly) NSString *itemDescription;
@@ -43,7 +21,7 @@
@property (copy, readonly) NSString *versionString;
@property (copy, readonly) NSString *displayVersionString;
@property (copy, readonly) NSDictionary *deltaUpdates;
@property (retain, readonly) NSURL *infoURL;
@property (retain, readonly) NSURL *infoURL; // UK 2007-08-31
// Initializes with data from a dictionary provided by the RSS class.
- (instancetype)initWithDictionary:(NSDictionary *)dict;
+4 -7
View File
@@ -27,6 +27,7 @@
@property (copy, readwrite) NSString *displayVersionString;
@property (copy, readwrite) NSDictionary *deltaUpdates;
@property (retain, readwrite) NSURL *infoURL;
@property (readwrite, copy) NSDictionary *propertiesDictionary;
@end
@implementation SUAppcastItem
@@ -42,6 +43,7 @@
@synthesize releaseNotesURL;
@synthesize title;
@synthesize versionString;
@synthesize propertiesDictionary;
- (BOOL)isDeltaUpdate
{
@@ -161,7 +163,7 @@
{
NSMutableDictionary *deltas = [NSMutableDictionary dictionary];
NSArray *deltaDictionaries = dict[@"deltas"];
for (NSDictionary *deltaDictionary in [deltaDictionaries objectEnumerator]) {
for (NSDictionary *deltaDictionary in deltaDictionaries) {
NSMutableDictionary *fakeAppCastDict = [dict mutableCopy];
[fakeAppCastDict removeObjectForKey:@"deltas"];
fakeAppCastDict[@"enclosure"] = deltaDictionary;
@@ -189,13 +191,8 @@
self.versionString = nil;
self.displayVersionString = nil;
self.infoURL = nil;
[propertiesDictionary release];
self.propertiesDictionary = nil;
[super dealloc];
}
- (NSDictionary *)propertiesDictionary
{
return propertiesDictionary;
}
@end
+1 -5
View File
@@ -21,11 +21,7 @@ typedef enum
} SUAutomaticInstallationChoice;
@class SUAppcastItem, SUHost;
@interface SUAutomaticUpdateAlert : SUWindowController {
SUAppcastItem *updateItem;
id<SUAutomaticUpdateAlertDelegateProtocol> delegate;
SUHost *host;
}
@interface SUAutomaticUpdateAlert : SUWindowController
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id<SUAutomaticUpdateAlertDelegateProtocol>)delegate;
- (IBAction)installNow:sender;
+14 -5
View File
@@ -10,16 +10,25 @@
#import "SUHost.h"
@interface SUAutomaticUpdateAlert ()
@property (retain) SUAppcastItem *updateItem;
@property (assign) id<SUAutomaticUpdateAlertDelegateProtocol> delegate;
@property (retain) SUHost *host;
@end
@implementation SUAutomaticUpdateAlert
@synthesize delegate;
@synthesize host;
@synthesize updateItem;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id<SUAutomaticUpdateAlertDelegateProtocol>)del
{
self = [super initWithHost:aHost windowNibName:@"SUAutomaticUpdateAlert"];
if (self)
{
updateItem = [item retain];
delegate = del;
host = [aHost retain];
self.updateItem = item;
self.delegate = del;
self.host = aHost;
[self setShouldCascadeWindows:NO];
[[self window] center];
}
@@ -28,8 +37,8 @@
- (void)dealloc
{
[host release];
[updateItem release];
self.host = nil;
self.updateItem = nil;
[super dealloc];
}
+2 -3
View File
@@ -49,11 +49,10 @@
CFUUIDRef uuid = CFUUIDCreate(NULL);
if (uuid)
{
CFStringRef uuidString = CFUUIDCreateString(NULL, uuid);
NSString *uuidString = CFBridgingRelease(CFUUIDCreateString(NULL, uuid));
if (uuidString)
{
mountPoint = [@"/Volumes" stringByAppendingPathComponent:(NSString*)uuidString];
CFRelease(uuidString);
mountPoint = [@"/Volumes" stringByAppendingPathComponent:uuidString];
}
CFRelease(uuid);
}
-1
View File
@@ -13,7 +13,6 @@
@interface SUHost : NSObject
{
@private
NSBundle *bundle;
NSString *defaultsDomain;
BOOL usesStandardUserDefaults;
}
+1 -1
View File
@@ -184,7 +184,7 @@
}
CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)defaultsDomain);
return [(id)CFMakeCollectable(obj) autorelease];
return CFBridgingRelease(obj);
}
- (void)setObject:(id)value forUserDefaultsKey:(NSString *)defaultName;
+2 -8
View File
@@ -13,14 +13,8 @@
@class SUHost;
@interface SUStatusController : SUWindowController
{
@private
double progressValue, maxProgressValue;
NSString *title, *statusText, *buttonTitle;
IBOutlet NSButton *actionButton;
IBOutlet NSProgressIndicator* progressBar;
SUHost *host;
}
@property (assign) IBOutlet NSButton *actionButton;
@property (assign) IBOutlet NSProgressIndicator* progressBar;
@property (copy) NSString *statusText;
@property double progressValue;
+2
View File
@@ -26,6 +26,8 @@
@synthesize title;
@synthesize buttonTitle;
@synthesize host;
@synthesize actionButton;
@synthesize progressBar;
- (instancetype)initWithHost:(SUHost *)aHost
{
-2
View File
@@ -26,8 +26,6 @@ typedef enum
@interface SUUpdateAlert : SUWindowController {
SUAppcastItem *updateItem;
SUHost *host;
id<SUUpdateAlertDelegate> delegate;
id<SUVersionDisplay> versionDisplayer;
IBOutlet WebView *releaseNotesView;
IBOutlet NSTextField *description;
-1
View File
@@ -27,7 +27,6 @@ typedef enum {
IBOutlet NSView *moreInfoView;
IBOutlet NSButton *moreInfoButton;
IBOutlet NSTableView *profileTableView;
BOOL isShowingMoreInfo, shouldSendProfile;
}
+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id<SUUpdatePermissionPromptDelegateProtocol>)d;
- (IBAction)toggleMoreInfo:(id)sender;
+10 -8
View File
@@ -11,6 +11,10 @@
#import "SUHost.h"
#import "SUConstants.h"
@interface SUUpdatePermissionPrompt ()
@property BOOL isShowingMoreInfo, shouldSendProfile;
@end
@implementation SUUpdatePermissionPrompt
- (BOOL)shouldAskAboutProfile
@@ -25,8 +29,8 @@
{
host = [aHost retain];
delegate = d;
isShowingMoreInfo = NO;
shouldSendProfile = [self shouldAskAboutProfile];
self.isShowingMoreInfo = NO;
self.shouldSendProfile = [self shouldAskAboutProfile];
systemProfileInformationArray = [profile retain];
[self setShouldCascadeWindows:NO];
}
@@ -80,9 +84,7 @@
- (IBAction)toggleMoreInfo:(id)sender
{
[self willChangeValueForKey:@"isShowingMoreInfo"];
isShowingMoreInfo = !isShowingMoreInfo;
[self didChangeValueForKey:@"isShowingMoreInfo"];
self.isShowingMoreInfo = !_isShowingMoreInfo;
NSView *contentView = [[self window] contentView];
NSRect contentViewFrame = [contentView frame];
@@ -92,7 +94,7 @@
NSRect profileMoreInfoButtonFrame = [moreInfoButton frame];
NSRect descriptionFrame = [descriptionTextField frame];
if (isShowingMoreInfo)
if (_isShowingMoreInfo)
{
// Add the subview
contentViewFrame.size.height += profileMoreInfoViewFrame.size.height;
@@ -120,7 +122,7 @@
[[self window] setFrame:windowFrame display:YES animate:YES];
[contentView setFrame:contentViewFrame];
[contentView setNeedsDisplay:YES];
[moreInfoView setHidden:(!isShowingMoreInfo)];
[moreInfoView setHidden:(!_isShowingMoreInfo)];
}
- (IBAction)finishPrompt:(id)sender
@@ -128,7 +130,7 @@
if (![delegate respondsToSelector:@selector(updatePermissionPromptFinishedWithResult:)]) {
[NSException raise:@"SUInvalidDelegate" format:@"SUUpdatePermissionPrompt's delegate (%@) doesn't respond to updatePermissionPromptFinishedWithResult:!", delegate];
}
[host setBool:shouldSendProfile forUserDefaultsKey:SUSendProfileInfoKey];
[host setBool:_shouldSendProfile forUserDefaultsKey:SUSendProfileInfoKey];
[delegate updatePermissionPromptFinishedWithResult:([sender tag] == 1 ? SUAutomaticallyCheck : SUDoNotAutomaticallyCheck)];
[[self window] close];
[NSApp stopModal];
+1 -4
View File
@@ -17,14 +17,11 @@
@interface SUUpdater : NSObject
{
@private
NSTimer *checkTimer;
SUUpdateDriver *driver;
NSString *customUserAgentString;
SUHost *host;
IBOutlet id delegate;
}
@property (assign) id delegate;
@property (assign) IBOutlet id delegate;
+ (SUUpdater *)sharedUpdater;
+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle;