From 67531295b9ea23faac051c3ef55eea6a7c570a0b Mon Sep 17 00:00:00 2001 From: Isaac Wankerl Date: Sat, 31 May 2014 21:16:04 -0500 Subject: [PATCH 1/4] Bumped up almost all of the warnings in the TestApp project and fixed the resulting issues. --- .../FsprgEmbeddedStoreController.h | 2 +- .../FsprgEmbeddedStoreController.m | 4 +- FsprgEmbeddedStore/FsprgStoreParameters.m | 8 +- TestApp/AppController.m | 8 +- TestApp/TestApp.xcodeproj/project.pbxproj | 82 ++++++++++++++++++- 5 files changed, 95 insertions(+), 9 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h index 60702e5..fbc8bea 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h @@ -78,4 +78,4 @@ */ - (NSString *)storeHost; -@end \ No newline at end of file +@end diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index 3cb8f7b..071c03b 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -209,7 +209,7 @@ - (void)resizeContentDivE return; } - float windowHeight = [[self webView] frame].size.height; + CGFloat windowHeight = [[self webView] frame].size.height; id result = [[[self webView] windowScriptObject] evaluateWebScript:@"document.getElementsByClassName('store-page-navigation')[0].clientHeight"]; if (result == [WebUndefined undefined]) { return; @@ -220,7 +220,7 @@ - (void)resizeContentDivE float paddingTop = [[[cssStyle paddingBottom] substringToIndex:[[cssStyle paddingTop] length]-2] floatValue]; float paddingBottom = [[[cssStyle paddingBottom] substringToIndex:[[cssStyle paddingBottom] length]-2] floatValue]; - float newHeight = windowHeight - paddingTop - paddingBottom - pageNavigationHeight; + CGFloat newHeight = windowHeight - paddingTop - paddingBottom - pageNavigationHeight; [[resizableContentE style] setHeight:[NSString stringWithFormat:@"%fpx", newHeight]]; } diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index fc09b5f..127bd90 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -44,7 +44,10 @@ + (void)initialize NSStringFromSelector(@selector(orderProcessType)), NSStringFromSelector(@selector(storeId)), NSStringFromSelector(@selector(productId)), +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wselector" NSStringFromSelector(@selector(mode)), +#pragma clang diagnostic pop NSStringFromSelector(@selector(campaign)), NSStringFromSelector(@selector(option)), NSStringFromSelector(@selector(referrer)), @@ -143,7 +146,10 @@ - (NSURL *)toURL [keys removeObject:kOrderProcessType]; [keys removeObject:kStoreId]; [keys removeObject:kProductId]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wselector" [keys sortUsingSelector:@selector(compare:)]; +#pragma clang diagnostic pop NSString *queryStr = @""; NSUInteger i, count = [keys count]; @@ -333,4 +339,4 @@ - (void)dealloc [super dealloc]; } -@end \ No newline at end of file +@end diff --git a/TestApp/AppController.m b/TestApp/AppController.m index c47e203..6259a23 100644 --- a/TestApp/AppController.m +++ b/TestApp/AppController.m @@ -124,9 +124,9 @@ - (NSView *)viewWithFrame:(NSRect)frame forOrder:(FsprgOrder *)order NSData *data = [NSPropertyListSerialization dataFromPropertyList:[order raw] format:NSPropertyListXMLFormat_v1_0 errorDescription:&errorDesc]; - NSString *orderAsStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + NSString *orderAsStr = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; - OrderViewController *orderViewController = [[OrderViewController alloc] initWithNibName:@"OrderView" bundle:nil]; + OrderViewController *orderViewController = [[[OrderViewController alloc] initWithNibName:@"OrderView" bundle:nil] autorelease]; [orderViewController setRepresentedObject:orderAsStr]; [[[orderViewController view] window] setBackgroundColor:[NSColor blackColor]]; @@ -136,12 +136,12 @@ - (NSView *)viewWithFrame:(NSRect)frame forOrder:(FsprgOrder *)order - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { - NSRunAlertPanel(@"Alert", [error localizedDescription], @"OK", nil, nil); + NSRunAlertPanel(@"Alert", @"%@", @"OK", nil, nil, [error localizedDescription]); } - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { - NSRunAlertPanel(@"Alert", [error localizedDescription], @"OK", nil, nil); + NSRunAlertPanel(@"Alert", @"%@", @"OK", nil, nil, [error localizedDescription]); } // NSApplicationDelegate diff --git a/TestApp/TestApp.xcodeproj/project.pbxproj b/TestApp/TestApp.xcodeproj/project.pbxproj index 60f5604..e5a14d7 100644 --- a/TestApp/TestApp.xcodeproj/project.pbxproj +++ b/TestApp/TestApp.xcodeproj/project.pbxproj @@ -292,7 +292,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0440; + LastUpgradeCheck = 0510; ORGANIZATIONNAME = FastSpring; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TestApp" */; @@ -376,9 +376,49 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_CXX0X_EXTENSIONS = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; + CLANG_WARN_OBJC_RECEIVER_WEAK = YES; + CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = TestApp_Prefix.pch; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = TestApp; WRAPPER_EXTENSION = app; @@ -388,9 +428,49 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_CXX0X_EXTENSIONS = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; + CLANG_WARN_OBJC_RECEIVER_WEAK = YES; + CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = TestApp_Prefix.pch; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = TestApp; WRAPPER_EXTENSION = app; From b542d9a1b2b4dd04a47688794481450fa8ffadb1 Mon Sep 17 00:00:00 2001 From: Isaac Wankerl Date: Mon, 16 Nov 2015 22:14:54 -0600 Subject: [PATCH 2/4] Fix a memory leak --- FsprgEmbeddedStore/FsprgEmbeddedStoreController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index b2c40fe..3f9a05c 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -294,7 +294,7 @@ - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame { NSString *title = [sender mainFrameTitle]; - NSAlert *alertPanel = [[NSAlert alloc] init]; + NSAlert *alertPanel = [[[NSAlert alloc] init] autorelease]; [alertPanel setMessageText:title]; [alertPanel setInformativeText:message]; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 From 9531fcd0884140f9d2efeec3225659e1c716d5fb Mon Sep 17 00:00:00 2001 From: Isaac Wankerl Date: Mon, 16 Nov 2015 22:15:16 -0600 Subject: [PATCH 3/4] Fix an unused variable issue. --- FsprgEmbeddedStore/Model/FsprgOrder.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FsprgEmbeddedStore/Model/FsprgOrder.m b/FsprgEmbeddedStore/Model/FsprgOrder.m index 2164f8e..8a88d49 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrder.m +++ b/FsprgEmbeddedStore/Model/FsprgOrder.m @@ -14,9 +14,9 @@ @implementation FsprgOrder + (FsprgOrder *)orderFromData:(NSData *)aData { NSPropertyListFormat *format = nil; - NSString *errorDesc = nil; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 + NSString *errorDesc = nil; NSDictionary *aDict = [NSPropertyListSerialization propertyListFromData:aData mutabilityOption:NSPropertyListImmutable format:format From 62c4126cc08cde5701b47eda317ca868b7e190d1 Mon Sep 17 00:00:00 2001 From: Isaac Wankerl Date: Fri, 6 Jul 2018 08:27:08 -0500 Subject: [PATCH 4/4] Get RETRIEVE_SSL_CERTIFICATES define working with Xcode 9.4 --- FsprgEmbeddedStore/FsprgEmbeddedStoreController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index 3f9a05c..6517927 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -11,7 +11,7 @@ #import "FsprgOrderDocumentRepresentation.h" // We don't retrieve SSL certificates below OSX 10.6 -#define RETRIEVE_SSL_CERTIFICATES defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 +#define RETRIEVE_SSL_CERTIFICATES /* defined(MAC_OS_X_VERSION_10_6) && */ MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 @interface FsprgEmbeddedStoreController ()