From 7433dd0063c023025688d7cf93a4b73585ce05e7 Mon Sep 17 00:00:00 2001 From: Ben Copsey Date: Sat, 20 Nov 2010 13:27:25 +0000 Subject: [PATCH] Fixes for GCC_WARN_UNDECLARED_SELECTOR More type conversion tweaks --- Classes/ASIAuthenticationDialog.m | 6 +++++- Classes/ASIHTTPRequest.m | 22 ++++++++++++++++---- Classes/ASIWebPageRequest.m | 5 +++++ Mac Sample/AppDelegate.m | 4 ++++ iPhone Sample/AuthenticationViewController.m | 6 ++++++ iPhone Sample/QueueViewController.m | 11 +++++++--- iPhone Sample/RootViewController.m | 2 +- iPhone Sample/SampleViewController.m | 7 +++++++ iPhone Sample/UploadViewController.m | 6 ++++++ iPhone Sample/WebPageViewController.m | 10 +++++++-- iPhone.xcodeproj/project.pbxproj | 16 ++++++++++++-- strict.xcconfig | 2 +- 12 files changed, 83 insertions(+), 14 deletions(-) diff --git a/Classes/ASIAuthenticationDialog.m b/Classes/ASIAuthenticationDialog.m index 93c5073e..66315be1 100644 --- a/Classes/ASIAuthenticationDialog.m +++ b/Classes/ASIAuthenticationDialog.m @@ -37,6 +37,10 @@ - (void)showTitle; - (void)show; - (NSArray *)requestsRequiringTheseCredentials; - (void)presentNextDialog; +- (void)keyboardWillShow:(NSNotification *)notification; +- (void)orientationChanged:(NSNotification *)notification; +- (void)cancelAuthenticationFromDialog:(id)sender; +- (void)loginWithCredentialsFromDialog:(id)sender; @property (retain) UITableView *tableView; @end @@ -149,7 +153,7 @@ - (void)orientationChanged:(NSNotification *)notification } CGAffineTransform previousTransform = self.view.layer.affineTransform; - CGAffineTransform newTransform = CGAffineTransformMakeRotation(angle * M_PI / 180.0); + CGAffineTransform newTransform = CGAffineTransformMakeRotation((CGFloat)(angle * M_PI / 180.0)); // Reset the transform so we can set the size self.view.layer.affineTransform = CGAffineTransformIdentity; diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index a4b1c9e8..4f58f73c 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.7-140 2010-11-13"; +NSString *ASIHTTPRequestVersion = @"v1.8-4 2010-11-20"; NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; @@ -152,16 +152,25 @@ - (void)unscheduleReadStream; - (BOOL)willAskDelegateForCredentials; - (BOOL)willAskDelegateForProxyCredentials; +- (void)askDelegateForProxyCredentials; +- (void)askDelegateForCredentials; +- (void)failAuthentication; + + (void)measureBandwidthUsage; + (void)recordBandwidthUsage; + - (void)startRequest; - (void)updateStatus:(NSTimer *)timer; - (void)checkRequestStatus; - - (void)markAsFinished; - (void)performRedirect; - (BOOL)shouldTimeOut; ++ (void)performInvocation:(NSInvocation *)invocation onTarget:(id *)target releasingObject:(id)objectToRelease; ++ (void)hideNetworkActivityIndicatorAfterDelay; ++ (void)hideNetworkActivityIndicatorIfNeeeded; ++ (void)runRequests; + - (void)useDataFromCache; @@ -173,14 +182,19 @@ + (void)registerForNetworkReachabilityNotifications; + (void)unsubscribeFromNetworkReachabilityNotifications; // Called when the status of the network changes + (void)reachabilityChanged:(NSNotification *)note; -- (void)failAuthentication; #endif #if NS_BLOCKS_AVAILABLE - (void)performBlockOnMainThread:(ASIBasicBlock)block; - (void)releaseBlocksOnMainThread; ++ (void)releaseBlocks:(NSArray *)blocks; +- (void)callBlock:(ASIBasicBlock)block; #endif + + + + @property (assign) BOOL complete; @property (retain) NSArray *responseCookies; @property (assign) int responseStatusCode; @@ -1820,7 +1834,7 @@ + (void)updateProgressIndicator:(id *)indicator withProgress:(unsigned long long #if TARGET_OS_IPHONE // Cocoa Touch: UIProgressView SEL selector = @selector(setProgress:); - float progressAmount = (progress*1.0f)/(total*1.0f); + float progressAmount = (float)((progress*1.0)/(total*1.0)); #else // Cocoa: NSProgressIndicator diff --git a/Classes/ASIWebPageRequest.m b/Classes/ASIWebPageRequest.m index f6941f49..94a267a9 100644 --- a/Classes/ASIWebPageRequest.m +++ b/Classes/ASIWebPageRequest.m @@ -26,6 +26,11 @@ - (void)parseAsCSS; - (void)addURLToFetch:(NSString *)newURL; + (NSArray *)CSSURLsFromString:(NSString *)string; - (NSString *)relativePathTo:(NSString *)destinationPath fromPath:(NSString *)sourcePath; + +- (void)finishedFetchingExternalResources:(ASINetworkQueue *)queue; +- (void)externalResourceFetchSucceeded:(ASIHTTPRequest *)externalResourceRequest; +- (void)externalResourceFetchFailed:(ASIHTTPRequest *)externalResourceRequest; + @property (retain, nonatomic) ASINetworkQueue *externalResourceQueue; @property (retain, nonatomic) NSMutableDictionary *resourceList; @end diff --git a/Mac Sample/AppDelegate.m b/Mac Sample/AppDelegate.m index 93e23ffc..8d96372d 100644 --- a/Mac Sample/AppDelegate.m +++ b/Mac Sample/AppDelegate.m @@ -24,6 +24,10 @@ - (void)authSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo - (void)postFinished:(ASIHTTPRequest *)request; - (void)postFailed:(ASIHTTPRequest *)request; - (void)fetchURL:(NSURL *)url; +- (void)tableViewDataFetchFinished:(ASIHTTPRequest *)request; +- (void)rowImageDownloadFinished:(ASIHTTPRequest *)request; +- (void)webPageFetchFailed:(ASIHTTPRequest *)request; +- (void)webPageFetchSucceeded:(ASIHTTPRequest *)request; @end @implementation AppDelegate diff --git a/iPhone Sample/AuthenticationViewController.m b/iPhone Sample/AuthenticationViewController.m index f886f4aa..c6a8e3ef 100644 --- a/iPhone Sample/AuthenticationViewController.m +++ b/iPhone Sample/AuthenticationViewController.m @@ -18,6 +18,12 @@ - (void) addTextFieldAtIndex:(NSUInteger) index; - (UITextField *) textFieldAtIndex:(NSUInteger) index; @end +// Private stuff +@interface AuthenticationViewController () +- (IBAction)topSecretFetchFailed:(ASIHTTPRequest *)theRequest; +- (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)theRequest; +@end + @implementation AuthenticationViewController - (IBAction)fetchTopSecretInformation:(id)sender diff --git a/iPhone Sample/QueueViewController.m b/iPhone Sample/QueueViewController.m index 66fd8f20..27d5f8a5 100644 --- a/iPhone Sample/QueueViewController.m +++ b/iPhone Sample/QueueViewController.m @@ -12,8 +12,13 @@ #import "InfoCell.h" #import "ToggleCell.h" -@implementation QueueViewController +// Private stuff +@interface QueueViewController () +- (void)imageFetchComplete:(ASIHTTPRequest *)request; +- (void)imageFetchFailed:(ASIHTTPRequest *)request; +@end +@implementation QueueViewController - (IBAction)fetchThreeImages:(id)sender { @@ -222,7 +227,7 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath } NSUInteger imageWidth = (tableWidth-tablePadding-20)/3; - NSUInteger imageHeight = imageWidth*0.66; + NSUInteger imageHeight = imageWidth*0.66f; [imageView1 setFrame:CGRectMake(tablePadding/2,10,imageWidth,imageHeight)]; @@ -265,7 +270,7 @@ - (CGFloat)tableView:(UITableView *)theTableView heightForRowAtIndexPath:(NSInde tablePadding = 110; } NSUInteger imageWidth = (tableWidth-tablePadding-20)/3; - NSUInteger imageHeight = imageWidth*0.66; + NSUInteger imageHeight = imageWidth*0.66f; return imageHeight+50; } else { return 42; diff --git a/iPhone Sample/RootViewController.m b/iPhone Sample/RootViewController.m index 763f600e..40b6d6c4 100644 --- a/iPhone Sample/RootViewController.m +++ b/iPhone Sample/RootViewController.m @@ -19,7 +19,7 @@ @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; - self.contentSizeForViewInPopover = CGSizeMake(310.0, self.tableView.rowHeight*5.0); + self.contentSizeForViewInPopover = CGSizeMake(310.0f, self.tableView.rowHeight*5.0f); } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/iPhone Sample/SampleViewController.m b/iPhone Sample/SampleViewController.m index c16409f7..74312994 100644 --- a/iPhone Sample/SampleViewController.m +++ b/iPhone Sample/SampleViewController.m @@ -8,6 +8,13 @@ #import "SampleViewController.h" +// Private stuff +@interface SampleViewController () +- (void)keyboardWillShow:(NSNotification *)notification; +- (void)keyboardWillHide:(NSNotification *)notification; +@end + + @implementation SampleViewController diff --git a/iPhone Sample/UploadViewController.m b/iPhone Sample/UploadViewController.m index c62f1a66..f8e75497 100644 --- a/iPhone Sample/UploadViewController.m +++ b/iPhone Sample/UploadViewController.m @@ -10,6 +10,12 @@ #import "ASIFormDataRequest.h" #import "InfoCell.h" +// Private stuff +@interface UploadViewController () +- (void)uploadFailed:(ASIHTTPRequest *)theRequest; +- (void)uploadFinished:(ASIHTTPRequest *)theRequest; +@end + @implementation UploadViewController - (IBAction)performLargeUpload:(id)sender diff --git a/iPhone Sample/WebPageViewController.m b/iPhone Sample/WebPageViewController.m index 9919cbf9..db982dc7 100644 --- a/iPhone Sample/WebPageViewController.m +++ b/iPhone Sample/WebPageViewController.m @@ -13,6 +13,12 @@ #import "ToggleCell.h" #import "RequestProgressCell.h" +// Private stuff +@interface WebPageViewController () +- (void)webPageFetchFailed:(ASIHTTPRequest *)theRequest; +- (void)webPageFetchSucceeded:(ASIHTTPRequest *)theRequest; +@end + @implementation WebPageViewController - (void)fetchWebPage:(id)sender @@ -116,7 +122,7 @@ - (void)request:(ASIHTTPRequest *)theRequest didReceiveBytes:(long long)newLengt if (requestNumber != NSNotFound) { RequestProgressCell *cell = (RequestProgressCell *)[[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:requestNumber inSection:2]]; if ([theRequest contentLength]+[theRequest partialDownloadSize] > 0) { - float progressAmount = ([theRequest totalBytesRead]*1.0f)/(([theRequest contentLength]+[theRequest partialDownloadSize])*1.0f); + float progressAmount = (float)(([theRequest totalBytesRead]*1.0)/(([theRequest contentLength]+[theRequest partialDownloadSize])*1.0)); [[cell progressView] setProgress:progressAmount]; } } @@ -216,7 +222,7 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath } else { [[cell textLabel] setText:[[theRequest url] absoluteString]]; if ([theRequest contentLength] > 0) { - [[(RequestProgressCell *)cell progressView] setProgress:[theRequest totalBytesRead]/([theRequest contentLength]+[theRequest partialDownloadSize])]; + [[(RequestProgressCell *)cell progressView] setProgress:(float)(([theRequest totalBytesRead]*1.0)/(([theRequest contentLength]+[theRequest partialDownloadSize])*1.0))]; } [[cell accessoryView] setHidden:NO]; } diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index 81cc5f6b..2e396e1c 100644 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -11,6 +11,9 @@ B50C182C121C26FA0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C182B121C26FA0055FCAB /* Security.framework */; }; B50C1848121C27510055FCAB /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = B50C1847121C27510055FCAB /* client.p12 */; }; B50D532C126C87ED0022EA6F /* BlocksTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B50D532B126C87ED0022EA6F /* BlocksTests.m */; }; + B50F66191297FA45003887B1 /* strict.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = B50F66181297FA45003887B1 /* strict.xcconfig */; }; + B50F661A1297FA45003887B1 /* strict.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = B50F66181297FA45003887B1 /* strict.xcconfig */; }; + B50F661B1297FA45003887B1 /* strict.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = B50F66181297FA45003887B1 /* strict.xcconfig */; }; B51791A31024C3E800583567 /* AuthenticationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B51791A21024C3E800583567 /* AuthenticationViewController.m */; }; B51A1A9B11DDF85100ED75CF /* ASIDownloadCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B51A1A7A11DDF7BF00ED75CF /* ASIDownloadCacheTests.m */; }; B522DACE1030B2AB009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522DACD1030B2AB009A2D22 /* ASIInputStream.m */; }; @@ -148,6 +151,7 @@ B50C1847121C27510055FCAB /* client.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; name = client.p12; path = "iPhone Sample/Resources/client.p12"; sourceTree = ""; }; B50D532A126C87ED0022EA6F /* BlocksTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlocksTests.h; sourceTree = ""; }; B50D532B126C87ED0022EA6F /* BlocksTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlocksTests.m; sourceTree = ""; }; + B50F66181297FA45003887B1 /* strict.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = strict.xcconfig; sourceTree = ""; }; B51791A11024C3E800583567 /* AuthenticationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AuthenticationViewController.h; path = "iPhone Sample/AuthenticationViewController.h"; sourceTree = ""; }; B51791A21024C3E800583567 /* AuthenticationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AuthenticationViewController.m; path = "iPhone Sample/AuthenticationViewController.m"; sourceTree = ""; }; B51A1A7911DDF7BF00ED75CF /* ASIDownloadCacheTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDownloadCacheTests.h; sourceTree = ""; }; @@ -435,6 +439,7 @@ B5BD2AF811CA541100D7C426 /* iPadSampleAppDelegate.h */, B5BD2AF911CA541100D7C426 /* iPadSampleAppDelegate.m */, B55B605F0F765A750064029C /* iPhone_Prefix.pch */, + B50F66181297FA45003887B1 /* strict.xcconfig */, B55B60600F765A750064029C /* main.m */, B52329A911CA3380006C6E5A /* UI helpers */, ); @@ -687,6 +692,7 @@ B55B60740F765A990064029C /* iphone-icon.png in Resources */, B576D76611C7F4D90059B815 /* iPhoneMainWindow.xib in Resources */, B523254311CA01F1006C6E5A /* Sample.xib in Resources */, + B50F661A1297FA45003887B1 /* strict.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -696,6 +702,7 @@ files = ( B56529A3101C8EDA000499CF /* iphone-tests-icon.png in Resources */, B50C1848121C27510055FCAB /* client.p12 in Resources */, + B50F661B1297FA45003887B1 /* strict.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -707,6 +714,7 @@ B558B5EB11C7F9C8009B4627 /* iPadMainWindow.xib in Resources */, B523254211CA01F1006C6E5A /* Sample.xib in Resources */, B52325AD11CA05A8006C6E5A /* info.png in Resources */, + B50F66191297FA45003887B1 /* strict.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -878,7 +886,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; PRODUCT_NAME = "ASIHTTPRequest iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos4.1; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -897,13 +905,14 @@ IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; PRODUCT_NAME = "ASIHTTPRequest iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos4.1; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; B55B60CC0F765BB10064029C /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -938,6 +947,7 @@ }; B55B60CD0F765BB10064029C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; @@ -974,6 +984,7 @@ }; B576D72111C7F34D0059B815 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; @@ -996,6 +1007,7 @@ }; B576D72211C7F34D0059B815 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; diff --git a/strict.xcconfig b/strict.xcconfig index 4da6b5eb..018f7776 100644 --- a/strict.xcconfig +++ b/strict.xcconfig @@ -17,7 +17,7 @@ GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES GCC_WARN_SIGN_COMPARE = YES GCC_WARN_STRICT_SELECTOR_MATCH = missing value GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES -//GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNDECLARED_SELECTOR = YES GCC_WARN_UNUSED_FUNCTION = YES GCC_WARN_UNUSED_LABEL = YES GCC_WARN_UNUSED_VALUE = YES