From c913b3f04fc83106d5a9a4ef56c989c0070034c1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 19 Feb 2018 14:26:12 -0800 Subject: [PATCH] Enable XCode 9 recommended warnings and fix occurrences of them in the code --- Limelight/Crypto/mkcert.c | 2 +- Limelight/Crypto/mkcert.h | 2 +- .../ViewControllers/SWRevealViewController.m | 64 +++++++++++++------ Moonlight.xcodeproj/project.pbxproj | 18 +++++- .../project.pbxproj | 18 +++++- 5 files changed, 77 insertions(+), 27 deletions(-) diff --git a/Limelight/Crypto/mkcert.c b/Limelight/Crypto/mkcert.c index 98a5d49..d6beb64 100644 --- a/Limelight/Crypto/mkcert.c +++ b/Limelight/Crypto/mkcert.c @@ -19,7 +19,7 @@ static const int NUM_YEARS = 10; int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int years); int add_ext(X509 *cert, int nid, char *value); -struct CertKeyPair generateCertKeyPair() { +struct CertKeyPair generateCertKeyPair(void) { BIO *bio_err; X509 *x509 = NULL; EVP_PKEY *pkey = NULL; diff --git a/Limelight/Crypto/mkcert.h b/Limelight/Crypto/mkcert.h index 22e62f5..1e3aba3 100644 --- a/Limelight/Crypto/mkcert.h +++ b/Limelight/Crypto/mkcert.h @@ -18,7 +18,7 @@ typedef struct CertKeyPair { PKCS12 *p12; } CertKeyPair; -struct CertKeyPair generateCertKeyPair(); +struct CertKeyPair generateCertKeyPair(void); void freeCertKeyPair(CertKeyPair); void saveCertKeyPair(const char* certFile, const char* p12File, const char* keyPairFile, CertKeyPair certKeyPair); #endif diff --git a/Limelight/ViewControllers/SWRevealViewController.m b/Limelight/ViewControllers/SWRevealViewController.m index 93ce6ca..31225f2 100755 --- a/Limelight/ViewControllers/SWRevealViewController.m +++ b/Limelight/ViewControllers/SWRevealViewController.m @@ -996,16 +996,32 @@ const int FrontViewPositionNone = 0xff; - (void)_getRevealWidth:(CGFloat*)pRevealWidth revealOverDraw:(CGFloat*)pRevealOverdraw forSymetry:(int)symetry { - if ( symetry < 0 ) *pRevealWidth = _rightViewRevealWidth, *pRevealOverdraw = _rightViewRevealOverdraw; - else *pRevealWidth = _rearViewRevealWidth, *pRevealOverdraw = _rearViewRevealOverdraw; + if ( symetry < 0 ) + { + *pRevealWidth = _rightViewRevealWidth; + *pRevealOverdraw = _rightViewRevealOverdraw; + } + else + { + *pRevealWidth = _rearViewRevealWidth; + *pRevealOverdraw = _rearViewRevealOverdraw; + } if (*pRevealWidth < 0) *pRevealWidth = _contentView.bounds.size.width + *pRevealWidth; } - (void)_getBounceBack:(BOOL*)pBounceBack pStableDrag:(BOOL*)pStableDrag forSymetry:(int)symetry { - if ( symetry < 0 ) *pBounceBack = _bounceBackOnLeftOverdraw, *pStableDrag = _stableDragOnLeftOverdraw; - else *pBounceBack = _bounceBackOnOverdraw, *pStableDrag = _stableDragOnOverdraw; + if ( symetry < 0 ) + { + *pBounceBack = _bounceBackOnLeftOverdraw; + *pStableDrag = _stableDragOnLeftOverdraw; + } + else + { + *pBounceBack = _bounceBackOnOverdraw; + *pStableDrag = _stableDragOnOverdraw; + } } - (void)_getAdjustedFrontViewPosition:(FrontViewPosition*)frontViewPosition forSymetry:(int)symetry @@ -1398,11 +1414,11 @@ const int FrontViewPositionNone = 0xff; // Primitive method for view controller deployment and animated layout to the given position. - (void)_setFrontViewPosition:(FrontViewPosition)newPosition withDuration:(NSTimeInterval)duration { - void (^rearDeploymentCompletion)() = [self _rearViewDeploymentForNewFrontViewPosition:newPosition]; - void (^rightDeploymentCompletion)() = [self _rightViewDeploymentForNewFrontViewPosition:newPosition]; - void (^frontDeploymentCompletion)() = [self _frontViewDeploymentForNewFrontViewPosition:newPosition]; + void (^rearDeploymentCompletion)(void) = [self _rearViewDeploymentForNewFrontViewPosition:newPosition]; + void (^rightDeploymentCompletion)(void) = [self _rightViewDeploymentForNewFrontViewPosition:newPosition]; + void (^frontDeploymentCompletion)(void) = [self _frontViewDeploymentForNewFrontViewPosition:newPosition]; - void (^animations)() = ^() + void (^animations)(void) = ^(void) { // Calling this in the animation block causes the status bar to appear/dissapear in sync with our own animation [self setNeedsStatusBarAppearanceUpdate]; @@ -1455,17 +1471,27 @@ const int FrontViewPositionNone = 0xff; UIView *view = nil; if ( operation == SWRevealControllerOperationReplaceRearController ) - old = _rearViewController, _rearViewController = new, view = _contentView.rearView; - + { + old = _rearViewController; + _rearViewController = new; + view = _contentView.rearView; + } else if ( operation == SWRevealControllerOperationReplaceFrontController ) - old = _frontViewController, _frontViewController = new, view = _contentView.frontView; - + { + old = _frontViewController; + _frontViewController = new; + view = _contentView.frontView; + } else if ( operation == SWRevealControllerOperationReplaceRightController ) - old = _rightViewController, _rightViewController = new, view = _contentView.rightView; + { + old = _rightViewController; + _rightViewController = new; + view = _contentView.rightView; + } - void (^completion)() = [self _transitionFromViewController:old toViewController:new inView:view]; + void (^completion)(void) = [self _transitionFromViewController:old toViewController:new inView:view]; - void (^animationCompletion)() = ^ + void (^animationCompletion)(void) = ^ { completion(); if ( [_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] ) @@ -1527,10 +1553,10 @@ const int FrontViewPositionNone = 0xff; _frontViewPosition = newPosition; - void (^deploymentCompletion)() = + void (^deploymentCompletion)(void) = [self _deploymentForViewController:_frontViewController inView:_contentView.frontView appear:appear disappear:disappear]; - void (^completion)() = ^() + void (^completion)(void) = ^(void) { deploymentCompletion(); if ( positionIsChanging ) @@ -1652,11 +1678,11 @@ const int FrontViewPositionNone = 0xff; if ( toController ) [self addChildViewController:toController]; - void (^deployCompletion)() = [self _deployForViewController:toController inView:view]; + void (^deployCompletion)(void) = [self _deployForViewController:toController inView:view]; [fromController willMoveToParentViewController:nil]; - void (^undeployCompletion)() = [self _undeployForViewController:fromController]; + void (^undeployCompletion)(void) = [self _undeployForViewController:fromController]; void (^completionBlock)(void) = ^(void) { diff --git a/Moonlight.xcodeproj/project.pbxproj b/Moonlight.xcodeproj/project.pbxproj index aa6ed05..efa196e 100644 --- a/Moonlight.xcodeproj/project.pbxproj +++ b/Moonlight.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 47; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -809,7 +809,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Moonlight Stream"; TargetAttributes = { D46A739F1CBC7CB60039F1EE = { @@ -824,7 +824,7 @@ }; }; buildConfigurationList = FB290CE919B2C406004C83CF /* Build configuration list for PBXProject "Moonlight" */; - compatibilityVersion = "Xcode 6.3"; + compatibilityVersion = "Xcode 8.0"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( @@ -1030,14 +1030,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -1076,14 +1082,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/moonlight-common/moonlight-common.xcodeproj/project.pbxproj b/moonlight-common/moonlight-common.xcodeproj/project.pbxproj index 39b9d82..878afba 100644 --- a/moonlight-common/moonlight-common.xcodeproj/project.pbxproj +++ b/moonlight-common/moonlight-common.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 47; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -285,11 +285,11 @@ FB290E2619B37A4E004C83CF /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0810; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Moonlight Stream"; }; buildConfigurationList = FB290E2919B37A4E004C83CF /* Build configuration list for PBXProject "moonlight-common" */; - compatibilityVersion = "Xcode 6.3"; + compatibilityVersion = "Xcode 8.0"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( @@ -351,14 +351,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -399,14 +405,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;