Skip to content

Commit

Permalink
Merge pull request pokeb#224 from zadr/master
Browse files Browse the repository at this point in the history
NSMakeCollectable and the Static Analzyer should play nice
  • Loading branch information
pokeb committed Aug 6, 2011
2 parents abff8c4 + ff7a5cc commit b1e50cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Classes/ASIFormDataRequest.m
Expand Up @@ -30,7 +30,7 @@ @implementation ASIFormDataRequest
#pragma mark utilities
- (NSString*)encodeURL:(NSString *)string
{
NSString *newString = NSMakeCollectable([(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding])) autorelease]);
NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding]))) autorelease];
if (newString) {
return newString;
}
Expand Down
18 changes: 9 additions & 9 deletions Classes/ASIHTTPRequest.m
Expand Up @@ -1519,7 +1519,7 @@ - (void)checkRequestStatus
[self setLastBytesSent:totalBytesSent];

// Find out how much data we've uploaded so far
[self setTotalBytesSent:[NSMakeCollectable([(NSNumber *)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount) autorelease]) unsignedLongLongValue]];
[self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
if (totalBytesSent > lastBytesSent) {

// We've uploaded more data, reset the timeout
Expand Down Expand Up @@ -2238,7 +2238,7 @@ - (void)readResponseHeaders

NSString *connectionHeader = [[[self responseHeaders] objectForKey:@"Connection"] lowercaseString];

NSString *httpVersion = NSMakeCollectable([(NSString *)CFHTTPMessageCopyVersion(message) autorelease]);
NSString *httpVersion = [NSMakeCollectable(CFHTTPMessageCopyVersion(message)) autorelease];

// Don't re-use the connection if the server is HTTP 1.0 and didn't send Connection: Keep-Alive
if (![httpVersion isEqualToString:(NSString *)kCFHTTPVersion1_0] || [connectionHeader isEqualToString:@"keep-alive"]) {
Expand Down Expand Up @@ -3385,7 +3385,7 @@ - (void)handleStreamComplete
[progressLock lock];
// Find out how much data we've uploaded so far
[self setLastBytesSent:totalBytesSent];
[self setTotalBytesSent:[NSMakeCollectable([(NSNumber *)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount) autorelease]) unsignedLongLongValue]];
[self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
[self setComplete:YES];
if (![self contentLength]) {
[self setContentLength:[self totalBytesRead]];
Expand Down Expand Up @@ -3629,7 +3629,7 @@ - (BOOL)retryUsingNewConnection
- (void)handleStreamError

{
NSError *underlyingError = NSMakeCollectable([(NSError *)CFReadStreamCopyError((CFReadStreamRef)[self readStream]) autorelease]);
NSError *underlyingError = [NSMakeCollectable(CFReadStreamCopyError((CFReadStreamRef)[self readStream])) autorelease];

if (![self error]) { // We may already have handled this error

Expand Down Expand Up @@ -3807,12 +3807,12 @@ - (BOOL)configureProxies
} else {

#if TARGET_OS_IPHONE
NSDictionary *proxySettings = NSMakeCollectable([(NSDictionary *)CFNetworkCopySystemProxySettings() autorelease]);
NSDictionary *proxySettings = [NSMakeCollectable(CFNetworkCopySystemProxySettings()) autorelease];
#else
NSDictionary *proxySettings = NSMakeCollectable([(NSDictionary *)SCDynamicStoreCopyProxies(NULL) autorelease]);
NSDictionary *proxySettings = [NSMakeCollectable(SCDynamicStoreCopyProxies(NULL)) autorelease];
#endif

proxies = NSMakeCollectable([(NSArray *)CFNetworkCopyProxiesForURL((CFURLRef)[self url], (CFDictionaryRef)proxySettings) autorelease]);
proxies = [NSMakeCollectable(CFNetworkCopyProxiesForURL((CFURLRef)[self url], (CFDictionaryRef)proxySettings)) autorelease];

// Now check to see if the proxy settings contained a PAC url, we need to run the script to get the real list of proxies if so
NSDictionary *settings = [proxies objectAtIndex:0];
Expand Down Expand Up @@ -3964,7 +3964,7 @@ - (void)runPACScript:(NSString *)script

// Obtain the list of proxies by running the autoconfiguration script
CFErrorRef err = NULL;
NSArray *proxies = NSMakeCollectable([(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)[self url], &err) autorelease]);
NSArray *proxies = [NSMakeCollectable(CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)[self url], &err)) autorelease];
if (!err && [proxies count] > 0) {
NSDictionary *settings = [proxies objectAtIndex:0];
[self setProxyHost:[settings objectForKey:(NSString *)kCFProxyHostNameKey]];
Expand Down Expand Up @@ -4445,7 +4445,7 @@ + (NSString *)mimeTypeForFileAtPath:(NSString *)path
if (!MIMEType) {
return @"application/octet-stream";
}
return NSMakeCollectable([(NSString *)MIMEType autorelease]);
return [NSMakeCollectable(MIMEType) autorelease];
}

#pragma mark bandwidth measurement / throttling
Expand Down

0 comments on commit b1e50cc

Please sign in to comment.