Skip to content
This repository was archived by the owner on Feb 16, 2019. It is now read-only.

Commit c893cb4

Browse files
committed
ARC
1 parent 66396c7 commit c893cb4

33 files changed

+61
-360
lines changed

SSToolkit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
B24E9E80121DC29A0085F81E /* UIViewController+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E42121DC29A0085F81E /* UIViewController+SSToolkitAdditions.m */; };
110110
B25C8E601394327000DE7BFF /* SSCollectionViewExtremityTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2B456FC139078B80060C279 /* SSCollectionViewExtremityTableViewCell.m */; };
111111
B25C8E611394327000DE7BFF /* SSCollectionViewExtremityTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = B2B456FB139078B80060C279 /* SSCollectionViewExtremityTableViewCell.h */; };
112-
B26679B4151BB5D000BFDF6E /* SSConcurrentOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E11121DC29A0085F81E /* SSConcurrentOperation.m */; };
113112
B267D3451226CE0400B66519 /* SSCollectionViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B267D3431226CE0400B66519 /* SSCollectionViewController.h */; };
114113
B267D3461226CE0400B66519 /* SSCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B267D3441226CE0400B66519 /* SSCollectionViewController.m */; };
115114
B2721BA0132F136C00D762FD /* SSCollectionViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = B2721B9F132F136C00D762FD /* SSCollectionViewInternal.h */; };
@@ -957,7 +956,6 @@
957956
B2136B3D13ABCC0C00FEBCFD /* SSBorderedView.m in Sources */,
958957
B280E25D13BA769C00FCDA5C /* SSAnimatedImageView.m in Sources */,
959958
B229B469144CE2F500F71626 /* SSCollectionViewTableView.m in Sources */,
960-
B24F7ACA146B2CB7003255E2 /* SSManagedOperationQueue.m in Sources */,
961959
9EB278B114BBC4360077194C /* SSConcurrentOperation.m in Sources */,
962960
B2C50815151BAB4000E94614 /* NSBundle+SSToolkitAdditions.m in Sources */,
963961
B2F72A141534D54C00556B66 /* SSRateLimit.m in Sources */,
@@ -1010,6 +1008,7 @@
10101008
armv6,
10111009
armv7,
10121010
);
1011+
CLANG_ENABLE_OBJC_ARC = YES;
10131012
COPY_PHASE_STRIP = NO;
10141013
DSTROOT = /tmp/SSToolkit.dst;
10151014
GCC_C_LANGUAGE_STANDARD = "compiler-default";
@@ -1056,6 +1055,7 @@
10561055
armv6,
10571056
armv7,
10581057
);
1058+
CLANG_ENABLE_OBJC_ARC = YES;
10591059
DSTROOT = /tmp/SSToolkit.dst;
10601060
GCC_C_LANGUAGE_STANDARD = "compiler-default";
10611061
GCC_MODEL_TUNING = G5;

SSToolkit/NSArray+SSToolkitAdditions.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ - (NSArray *)shuffledArray {
4141
[copy removeObjectAtIndex:index];
4242
}
4343

44-
[copy release];
4544
return array;
4645
}
4746

4847

4948
- (NSMutableArray *)deepMutableCopy {
50-
return (NSMutableArray *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (CFArrayRef)self, kCFPropertyListMutableContainers);
49+
return (__bridge_transfer NSMutableArray *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (__bridge CFArrayRef)self, kCFPropertyListMutableContainers);
5150
}
5251

5352

SSToolkit/NSData+SSToolkitAdditions.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ - (NSString *)MD5Sum {
3838
for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
3939
[ms appendFormat: @"%02x", (int)(digest[i])];
4040
}
41-
return [[ms copy] autorelease];
41+
return [ms copy];
4242
}
4343

4444
- (NSString *)SHA1Sum {
@@ -77,7 +77,7 @@ - (NSString *)base64EncodedString {
7777
output[index + 3] = (i + 2) < length ? _base64EncodingTable[(value >> 0) & 0x3F] : '=';
7878
}
7979

80-
return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
80+
return [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
8181
}
8282

8383

SSToolkit/NSDictionary+SSToolkitAdditions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ - (NSString *)stringWithFormEncodedComponents {
6464

6565

6666
- (NSMutableDictionary *)deepMutableCopy {
67-
return (NSMutableDictionary *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (CFDictionaryRef)self, kCFPropertyListMutableContainers);
67+
return (__bridge_transfer NSMutableDictionary *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (__bridge CFDictionaryRef)self, kCFPropertyListMutableContainers);
6868
}
6969

7070

SSToolkit/NSString+SSToolkitAdditions.m

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,10 @@ - (NSComparisonResult)compareToVersionString:(NSString *)version {
5151
for (NSUInteger i = 0; i < [leftFields count]; i++) {
5252
NSComparisonResult result = [[leftFields objectAtIndex:i] compare:[rightFields objectAtIndex:i] options:NSNumericSearch];
5353
if (result != NSOrderedSame) {
54-
[leftFields release];
55-
[rightFields release];
5654
return result;
5755
}
5856
}
5957

60-
[leftFields release];
61-
[rightFields release];
6258
return NSOrderedSame;
6359
}
6460

@@ -110,7 +106,7 @@ - (NSString *)escapeHTML {
110106

111107
- (NSString *)unescapeHTML {
112108
NSMutableString *s = [NSMutableString string];
113-
NSMutableString *target = [[self mutableCopy] autorelease];
109+
NSMutableString *target = [self mutableCopy];
114110
NSCharacterSet *chs = [NSCharacterSet characterSetWithCharactersInString:@"&"];
115111

116112
while ([target length] > 0) {
@@ -161,11 +157,11 @@ - (NSString *)stringByEscapingForURLQuery {
161157
static CFStringRef leaveAlone = CFSTR(" ");
162158
static CFStringRef toEscape = CFSTR("\n\r:/=,!$&'()*+;[]@#?%");
163159

164-
CFStringRef escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, leaveAlone,
160+
CFStringRef escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)self, leaveAlone,
165161
toEscape, kCFStringEncodingUTF8);
166162

167163
if (escapedStr) {
168-
NSMutableString *mutable = [NSMutableString stringWithString:(NSString *)escapedStr];
164+
NSMutableString *mutable = [NSMutableString stringWithString:(__bridge NSString *)escapedStr];
169165
CFRelease(escapedStr);
170166

171167
[mutable replaceOccurrencesOfString:@" " withString:@"+" options:0 range:NSMakeRange(0, [mutable length])];
@@ -185,30 +181,29 @@ - (NSString *)stringByUnescapingFromURLQuery {
185181

186182
- (NSString *)URLEncodedString {
187183
static CFStringRef toEscape = CFSTR(":/=,!$&'()*+;[]@#?%");
188-
return [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
189-
(CFStringRef)self,
190-
NULL,
191-
toEscape,
192-
kCFStringEncodingUTF8) autorelease];
184+
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
185+
(__bridge CFStringRef)self,
186+
NULL,
187+
toEscape,
188+
kCFStringEncodingUTF8);
193189
}
194190

195191

196192
- (NSString *)URLEncodedParameterString {
197193
static CFStringRef toEscape = CFSTR(":/=,!$&'()*+;[]@#?");
198-
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
199-
(CFStringRef)self,
200-
NULL,
201-
toEscape,
202-
kCFStringEncodingUTF8);
203-
return [result autorelease];
194+
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
195+
(__bridge CFStringRef)self,
196+
NULL,
197+
toEscape,
198+
kCFStringEncodingUTF8);
204199
}
205200

206201

207202
- (NSString *)URLDecodedString {
208-
return [(NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
209-
(CFStringRef)self,
210-
CFSTR(""),
211-
kCFStringEncodingUTF8) autorelease];
203+
return (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
204+
(__bridge CFStringRef)self,
205+
CFSTR(""),
206+
kCFStringEncodingUTF8);
212207
}
213208

214209

@@ -224,8 +219,7 @@ - (NSString *)base64EncodedString {
224219

225220

226221
+ (NSString *)stringWithBase64String:(NSString *)base64String {
227-
return [[[NSString alloc] initWithData:[NSData dataWithBase64String:base64String] encoding:NSUTF8StringEncoding]
228-
autorelease];
222+
return [[NSString alloc] initWithData:[NSData dataWithBase64String:base64String] encoding:NSUTF8StringEncoding];
229223
}
230224

231225

@@ -236,7 +230,7 @@ + (NSString *)stringWithUUID {
236230
CFUUIDRef uuid = CFUUIDCreate(NULL);
237231
CFStringRef string = CFUUIDCreateString(NULL, uuid);
238232
CFRelease(uuid);
239-
return [(NSString *)string autorelease];
233+
return (__bridge_transfer NSString *)string;
240234
}
241235

242236

SSToolkit/NSURL+SSToolkitAdditions.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ + (id)URLWithFormat:(NSString *)format, ... {
1717
NSString *string = [[NSString alloc] initWithFormat:format arguments:arguments];
1818
va_end(arguments);
1919

20-
NSURL *url = [NSURL URLWithString:string];
21-
[string release];
22-
23-
return url;
20+
return [NSURL URLWithString:string];
2421
}
2522

2623

SSToolkit/SSAddressBarTextField.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ - (void)setLoading:(BOOL)isLoading {
4242
- (void)dealloc {
4343
self.reloadButton = nil;
4444
self.stopButton = nil;
45-
[_textFieldBackgroundView release];
46-
[super dealloc];
4745
}
4846

4947

SSToolkit/SSAddressBarTextFieldBackgroundView.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ - (void)setLoading:(BOOL)isLoading {
4242
}
4343

4444

45-
#pragma mark - NSObject
46-
47-
- (void)dealloc {
48-
[_innerView release];
49-
[super dealloc];
50-
}
51-
52-
5345
#pragma mark - UIView
5446

5547
- (id)initWithFrame:(CGRect)aFrame {

SSToolkit/SSAnimatedImageView.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ - (CAKeyframeAnimation *)_animationWithName:(NSString *)animationName images:(NS
2525
}];
2626

2727
animation.values = values;
28-
[values release];
2928

3029
if (delegate) {
3130
animation.delegate = self;
@@ -81,9 +80,7 @@ - (void)startTimedImageAnimation:(NSString *)animationName images:(NSArray *)ima
8180

8281
[keyTimesAsPercent addObject:[NSNumber numberWithFloat:1.0f]];
8382

84-
animation.keyTimes = keyTimesAsPercent;
85-
[keyTimesAsPercent release];
86-
83+
animation.keyTimes = keyTimesAsPercent;
8784
animation.duration = totalDuration;
8885
}
8986

SSToolkit/SSBadgeTableViewCell.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ @implementation SSBadgeTableViewCell
1616
@synthesize badgeView = _badgeView;
1717

1818

19-
#pragma mark - NSObject
20-
21-
- (void)dealloc {
22-
[_badgeView release];
23-
[super dealloc];
24-
}
25-
26-
2719
#pragma mark - UITableView
2820

2921
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

0 commit comments

Comments
 (0)