From e08422234b648304fc54da17b5cba46334c6047c Mon Sep 17 00:00:00 2001 From: Daniel Jalkut Date: Mon, 27 Jul 2015 12:22:40 -0400 Subject: [PATCH 1/3] Quiet warnings generated by -Wassign-enum by casting to the expected enum type. Most of these warnings are inevitable because of the design of the enum type to separately declare enum constants for specific APIs, but to stick to the more generic shared enum type in the function prototype. --- Sparkle/SUCodeSigningVerifier.m | 6 +++--- Sparkle/SUDSAVerifier.m | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sparkle/SUCodeSigningVerifier.m b/Sparkle/SUCodeSigningVerifier.m index 73efc6c1..8690641b 100644 --- a/Sparkle/SUCodeSigningVerifier.m +++ b/Sparkle/SUCodeSigningVerifier.m @@ -52,7 +52,7 @@ // Note that kSecCSCheckNestedCode may not work with pre-Mavericks code signing. // See https://github.com/sparkle-project/Sparkle/issues/376#issuecomment-48824267 and https://developer.apple.com/library/mac/technotes/tn2206 - SecCSFlags flags = kSecCSDefaultFlags | kSecCSCheckAllArchitectures; + SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures); result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError); if (cfError) { @@ -108,7 +108,7 @@ finally: // Note that kSecCSCheckNestedCode may not work with pre-Mavericks code signing. // See https://github.com/sparkle-project/Sparkle/issues/376#issuecomment-48824267 and https://developer.apple.com/library/mac/technotes/tn2206 - SecCSFlags flags = kSecCSDefaultFlags | kSecCSCheckAllArchitectures; + SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures); result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, NULL, &cfError); if (cfError) { @@ -136,7 +136,7 @@ static id valueOrNSNull(id value) { + (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label { CFDictionaryRef signingInfo = nil; - const SecCSFlags flags = kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation; + const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation); if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) { NSDictionary *signingDict = CFBridgingRelease(signingInfo); NSMutableDictionary *relevantInfo = [NSMutableDictionary dictionary]; diff --git a/Sparkle/SUDSAVerifier.m b/Sparkle/SUDSAVerifier.m index 4789327e..b9018471 100644 --- a/Sparkle/SUDSAVerifier.m +++ b/Sparkle/SUDSAVerifier.m @@ -55,7 +55,7 @@ SecExternalItemType itemType = kSecItemTypePublicKey; CFArrayRef items = NULL; - OSStatus status = SecItemImport((__bridge CFDataRef)data, NULL, &format, &itemType, 0, NULL, NULL, &items); + OSStatus status = SecItemImport((__bridge CFDataRef)data, NULL, &format, &itemType, (SecItemImportExportFlags)0, NULL, NULL, &items); if (status != errSecSuccess || !items) { if (items) { CFRelease(items); From 93957e5183273b8be414e548417cc50a40df4098 Mon Sep 17 00:00:00 2001 From: Daniel Jalkut Date: Mon, 27 Jul 2015 13:05:13 -0400 Subject: [PATCH 2/3] Quiet warning about casting away const-ness of CFTypeRef. --- Sparkle/SUDSAVerifier.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sparkle/SUDSAVerifier.m b/Sparkle/SUDSAVerifier.m index b9018471..fa5f9934 100644 --- a/Sparkle/SUDSAVerifier.m +++ b/Sparkle/SUDSAVerifier.m @@ -65,7 +65,13 @@ } if (format == kSecFormatOpenSSL && itemType == kSecItemTypePublicKey && CFArrayGetCount(items) == 1) { + // Seems silly, but we can't quiet the warning about dropping CFTypeRef's const qualifier through + // any manner of casting I've tried, including interim explicit cast to void*. The -Wcast-qual + // warning is on by default with -Weverything and apparently became more noisy as of Xcode 7. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-qual" _secKey = (SecKeyRef)CFRetain(CFArrayGetValueAtIndex(items, 0)); +#pragma clang diagnostic pop } CFRelease(items); From 43442f8b9b6eed81d12494b4715ae3078ac78a7b Mon Sep 17 00:00:00 2001 From: Daniel Jalkut Date: Mon, 27 Jul 2015 13:10:01 -0400 Subject: [PATCH 3/3] Beginning with the 10.11 SDK, WebView expects delegates to conform with explicit protocols. Declare these protocols on SUUpdateAlert, and define dummy protocols when building with an earlier SDK. --- Sparkle/SUUpdateAlert.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUUpdateAlert.h b/Sparkle/SUUpdateAlert.h index 2db57bf4..fa643c81 100644 --- a/Sparkle/SUUpdateAlert.h +++ b/Sparkle/SUUpdateAlert.h @@ -9,9 +9,19 @@ #ifndef SUUPDATEALERT_H #define SUUPDATEALERT_H +#import #import "SUWindowController.h" #import "SUVersionDisplayProtocol.h" +// WebKit protocols are not explicitly declared until 10.11 SDK, so +// declare dummy protocols to keep the build working on earlier SDKs. +#if !defined(MAC_OS_X_VERSION_10_11) +@protocol WebFrameLoadDelegate +@end +@protocol WebPolicyDelegate +@end +#endif + @protocol SUUpdateAlertDelegate; typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) { @@ -22,7 +32,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) { }; @class WebView, SUAppcastItem, SUHost; -@interface SUUpdateAlert : SUWindowController +@interface SUUpdateAlert : SUWindowController @property (weak) id versionDisplayer;