Enable XCode 9 recommended warnings and fix occurrences of them in the code

This commit is contained in:
Cameron Gutman
2018-02-19 14:26:12 -08:00
parent dfd30c0624
commit c913b3f04f
5 changed files with 77 additions and 27 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;