diff --git a/.travis.yml b/.travis.yml index 25bafc13..90a7a5da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,2 @@ language: objective-c -script: make travis +script: make ci diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index fb608346..21b6ad27 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -21,6 +21,7 @@ SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VE CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION) ALWAYS_SEARCH_USER_PATHS = NO +ENABLE_STRICT_OBJC_MSGSEND = YES GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_PREFIX_HEADER = Sparkle/Sparkle.pch GCC_SYMBOLS_PRIVATE_EXTERN = YES @@ -39,6 +40,7 @@ CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES CLANG_ENABLE_MODULES = YES CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_ASSIGN_ENUM = YES CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES CLANG_WARN_DOCUMENTATION_COMMENTS = YES CLANG_WARN_EMPTY_BODY = YES @@ -50,6 +52,9 @@ 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_UNREACHABLE_CODE = YES +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 @@ -76,4 +81,4 @@ GCC_WARN_UNUSED_VARIABLE = YES WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties // Turn on all warnings, then disable a few which are almost impossible to avoid -WARNING_CFLAGS = -Wall -Weverything -Wno-empty-translation-unit -Wno-unused-macros -Wno-gnu-statement-expression -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-cstring-format-directive $(WARNING_CFLAGS_EXTRA) +WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-auto-import $(WARNING_CFLAGS_EXTRA) diff --git a/Makefile b/Makefile index d3867c17..6912bdda 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all localizable-strings release build test travis +.PHONY: all localizable-strings release build test ci ifndef BUILDDIR BUILDDIR := $(shell mktemp -d "$(TMPDIR)/Sparkle.XXXXXX") @@ -20,4 +20,9 @@ build: test: xcodebuild -scheme Distribution -configuration Debug test -travis: test +ci: + for i in {7..11} ; do \ + if xcrun --sdk "macosx10.$$i" --show-sdk-path 2> /dev/null ; then \ + xcodebuild -sdk "macosx10.$$i" -scheme Distribution -configuration Debug test ; \ + fi ; \ + done diff --git a/README.markdown b/README.markdown index 8eaf4a34..62e7dc20 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -# Sparkle [![Build Status](https://travis-ci.org/sparkle-project/Sparkle.svg?branch=master)](https://travis-ci.org/sparkle-project/Sparkle) +# Sparkle [![Build Status](https://travis-ci.org/sparkle-project/Sparkle.svg?branch=master)](https://travis-ci.org/sparkle-project/Sparkle) An easy-to-use software update framework for Cocoa developers. diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 410df8f4..dced1da7 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -170,9 +170,12 @@ else if ([name isEqualToString:SURSSElementPubDate]) { // pubDate is expected to be an NSDate by SUAppcastItem, but the RSS class was returning an NSString - NSDate *date = [NSDate dateWithNaturalLanguageString:[node stringValue]]; - if (date) - dict[name] = date; + NSString *string = node.stringValue; + if (string) { + NSDate *date = [NSDate dateWithNaturalLanguageString:string]; + if (date) + dict[name] = date; + } } else if ([name isEqualToString:SUAppcastElementDeltas]) { @@ -188,7 +191,9 @@ NSMutableArray *tags = [NSMutableArray array]; NSEnumerator *childEnum = [[node children] objectEnumerator]; for (NSXMLNode *child in childEnum) { - [tags addObject:[child name]]; + NSString *childName = child.name; + if (childName) + [tags addObject:childName]; } dict[name] = tags; } diff --git a/Sparkle/SUBinaryDeltaCommon.h b/Sparkle/SUBinaryDeltaCommon.h index 5c226563..3e7db6c6 100644 --- a/Sparkle/SUBinaryDeltaCommon.h +++ b/Sparkle/SUBinaryDeltaCommon.h @@ -65,7 +65,7 @@ typedef NS_ENUM(uint16_t, SUBinaryDeltaMinorVersion) }; #define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion -#define FIRST_DELTA_DIFF_MINOR_VERSION 0 +#define FIRST_DELTA_DIFF_MINOR_VERSION ((SUBinaryDeltaMinorVersion)0) #define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion diff --git a/Sparkle/SUBinaryDeltaCommon.m b/Sparkle/SUBinaryDeltaCommon.m index ec7fc4e1..a6ecd0be 100644 --- a/Sparkle/SUBinaryDeltaCommon.m +++ b/Sparkle/SUBinaryDeltaCommon.m @@ -43,7 +43,7 @@ SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVe case SUBeigeMajorVersion: return SUBeigeMinorVersion; } - return 0; + return (SUBinaryDeltaMinorVersion)0; } NSString *temporaryFilename(NSString *base) @@ -144,7 +144,10 @@ NSData *hashOfFileContents(FTSENT *ent) NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion) { - const char *sourcePaths[] = {[path fileSystemRepresentation], 0}; + char pathBuffer[PATH_MAX] = {0}; + [path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]; + + char * const sourcePaths[] = {pathBuffer, 0}; FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); if (!fts) { perror("fts_open"); diff --git a/Sparkle/SUBinaryDeltaCreate.m b/Sparkle/SUBinaryDeltaCreate.m index 6af55016..de192506 100644 --- a/Sparkle/SUBinaryDeltaCreate.m +++ b/Sparkle/SUBinaryDeltaCreate.m @@ -237,8 +237,11 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary]; - const char *sourcePaths[] = {[source fileSystemRepresentation], 0}; - FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); + char pathBuffer[PATH_MAX] = {0}; + [source getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]; + + char *sourcePaths[] = {pathBuffer, 0}; + FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); if (!fts) { perror("fts_open"); return 1; @@ -295,9 +298,12 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi if (verbose) { fprintf(stderr, "\nProcessing %s...", [destination fileSystemRepresentation]); } + + pathBuffer[0] = 0; + [destination getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]; - sourcePaths[0] = [destination fileSystemRepresentation]; - fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); + sourcePaths[0] = pathBuffer; + fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); if (!fts) { perror("fts_open"); return 1; diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index fc5724bd..c2d25de2 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -38,7 +38,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza + (AuthorizationRef)authorizationForExecutable:(NSString*)executablePath { - NSParameterAssert(executablePath); + SUParameterAssert(executablePath); // Get authorization using advice in Apple's Technical Q&A1172 @@ -52,12 +52,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if ((validAuth == errAuthorizationSuccess) && (auth != NULL)) { - const char* executableFileSystemRepresentation = [executablePath fileSystemRepresentation]; + char executableFileSystemRepresentation[PATH_MAX]; + [executablePath getFileSystemRepresentation:executableFileSystemRepresentation maxLength:sizeof(executableFileSystemRepresentation)]; // Prepare a right allowing script to execute with privileges AuthorizationItem right = { .name = kAuthorizationRightExecute, - .value = (char*)executableFileSystemRepresentation, + .value = executableFileSystemRepresentation, .valueLength = strlen(executableFileSystemRepresentation), }; @@ -93,7 +94,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza + (void)performInstallationToPath:(NSString *)destinationPath fromPath:(NSString *)packagePath host:(SUHost *)__unused host versionComparator:(id)__unused comparator completionHandler:(void (^)(NSError *))completionHandler { - NSParameterAssert(packagePath); + SUParameterAssert(packagePath); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ @@ -106,10 +107,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza AuthorizationRef auth = [self authorizationForExecutable:installerPath]; if (auth != NULL) { + char pathBuffer[PATH_MAX] = {0}; + [packagePath getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]; + // Permission was granted to execute the installer with privileges - const char* const arguments[] = { + char * const arguments[] = { "-pkg", - [packagePath fileSystemRepresentation], + pathBuffer, "-target", "/", NULL diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 69b698e2..b9d622e8 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -41,7 +41,7 @@ typedef struct { { if ((self = [super init])) { - NSParameterAssert(aBundle); + SUParameterAssert(aBundle); self.bundle = aBundle; if (![self.bundle bundleIdentifier]) { SULog(@"Error: the bundle being updated at %@ has no %@! This will cause preference read/write to not work properly.", self.bundle, kCFBundleIdentifierKey); @@ -53,7 +53,8 @@ typedef struct { } // If we're using the main bundle's defaults we'll use the standard user defaults mechanism, otherwise we have to get CF-y. - usesStandardUserDefaults = !self.defaultsDomain || [self.defaultsDomain isEqualToString:[[NSBundle mainBundle] bundleIdentifier]]; + NSString *mainBundleIdentifier = NSBundle.mainBundle.bundleIdentifier; + usesStandardUserDefaults = !self.defaultsDomain || [self.defaultsDomain isEqualToString:mainBundleIdentifier]; } return self; } diff --git a/Sparkle/SUInstaller.m b/Sparkle/SUInstaller.m index 83b8d610..658e4e0d 100644 --- a/Sparkle/SUInstaller.m +++ b/Sparkle/SUInstaller.m @@ -44,8 +44,8 @@ static NSString *sUpdateFolder = nil; + (NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr { - NSParameterAssert(inUpdateFolder); - NSParameterAssert(host); + SUParameterAssert(inUpdateFolder); + SUParameterAssert(host); // Search subdirectories for the application NSString *currentFile, @@ -84,7 +84,8 @@ static NSString *sUpdateFolder = nil; } else { // Try matching on bundle identifiers in case the user has changed the name of the host app NSBundle *incomingBundle = [NSBundle bundleWithPath:currentPath]; - if (incomingBundle && [[incomingBundle bundleIdentifier] isEqualToString:[[host bundle] bundleIdentifier]]) { + NSString *hostBundleIdentifier = host.bundle.bundleIdentifier; + if (incomingBundle && [incomingBundle.bundleIdentifier isEqualToString:hostBundleIdentifier]) { isPackage = NO; newAppDownloadPath = currentPath; break; diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index 0846f8fd..cea72914 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -16,7 +16,7 @@ + (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host versionComparator:(id)comparator completionHandler:(void (^)(NSError *))completionHandler { - NSParameterAssert(host); + SUParameterAssert(host); // Prevent malicious downgrades if (![[[NSBundle bundleWithIdentifier:SUBundleIdentifier] infoDictionary][SUEnableAutomatedDowngradesKey] boolValue]) { diff --git a/Sparkle/SUPlainInstallerInternals.m b/Sparkle/SUPlainInstallerInternals.m index 1edd33a6..75ae5a5c 100644 --- a/Sparkle/SUPlainInstallerInternals.m +++ b/Sparkle/SUPlainInstallerInternals.m @@ -61,14 +61,14 @@ static inline void PerformOnMainThreadSync(dispatch_block_t theBlock) // Authorization code based on generous contribution from Allan Odgaard. Thanks, Allan! #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" // this is terrible; will fix later probably -static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char *executablePath, AuthorizationFlags options, const char *const *arguments) +static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char *executablePath, AuthorizationFlags options, char *const *arguments) { // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! sig_t oldSigChildHandler = signal(SIGCHLD, SIG_DFL); BOOL returnValue = YES; - if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, (char* const*)arguments, NULL) == errAuthorizationSuccess) + if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, arguments, NULL) == errAuthorizationSuccess) { int status; pid_t pid = wait(&status); @@ -172,9 +172,14 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza { // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! - const char *srcPath = [src fileSystemRepresentation]; - const char *tmpPath = [tmp fileSystemRepresentation]; - const char *dstPath = [dst fileSystemRepresentation]; + char srcPath[PATH_MAX] = {0}; + [src getFileSystemRepresentation:srcPath maxLength:sizeof(srcPath)]; + + char tmpPath[PATH_MAX] = {0}; + [tmp getFileSystemRepresentation:tmpPath maxLength:sizeof(tmpPath)]; + + char dstPath[PATH_MAX] = {0}; + [dst getFileSystemRepresentation:dstPath maxLength:sizeof(dstPath)]; struct stat dstSB; if (stat(dstPath, &dstSB) != 0) // Doesn't exist yet, try containing folder. @@ -228,16 +233,16 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (res) // Set permissions while it's still in source, so we have it with working and correct perms when it arrives at destination. { - const char *coParams[] = { "-R", uidgid, srcPath, NULL }; + char *coParams[] = { "-R", uidgid, srcPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams); if (!res) - SULog(@"chown -R %s %s failed.", uidgid, srcPath); + SULog(@"chown -R %@ %@ failed.", @(uidgid), @(srcPath)); } BOOL haveDst = [[NSFileManager defaultManager] fileExistsAtPath:dst]; if (res && haveDst) // If there's something at our tmp path (previous failed update or whatever) delete that first. { - const char *rmParams[] = { "-rf", tmpPath, NULL }; + char *rmParams[] = { "-rf", tmpPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams); if (!res) SULog(@"rm failed"); @@ -245,7 +250,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (res && haveDst) // Move old exe to tmp path. { - const char *mvParams[] = { "-f", dstPath, tmpPath, NULL }; + char *mvParams[] = { "-f", dstPath, tmpPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams); if (!res) SULog(@"mv 1 failed"); @@ -253,7 +258,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (res) // Move new exe to old exe's path. { - const char *mvParams2[] = { "-f", srcPath, dstPath, NULL }; + char *mvParams2[] = { "-f", srcPath, dstPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams2); if (!res) SULog(@"mv 2 failed"); @@ -304,9 +309,14 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza { // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! - const char *srcPath = [src fileSystemRepresentation]; - const char *dstPath = [dst fileSystemRepresentation]; - const char *dstContainerPath = [[dst stringByDeletingLastPathComponent] fileSystemRepresentation]; + char srcPath[PATH_MAX] = {0}; + [src getFileSystemRepresentation:srcPath maxLength:sizeof(srcPath)]; + + char dstPath[PATH_MAX] = {0}; + [dst getFileSystemRepresentation:dstPath maxLength:sizeof(dstPath)]; + + char dstContainerPath[PATH_MAX] = {0}; + [dst.stringByDeletingLastPathComponent getFileSystemRepresentation:dstContainerPath maxLength:sizeof(dstContainerPath)]; struct stat dstSB; stat(dstContainerPath, &dstSB); @@ -332,7 +342,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (res) // Set permissions while it's still in source, so we have it with working and correct perms when it arrives at destination. { - const char *coParams[] = { "-R", uidgid, srcPath, NULL }; + char *coParams[] = { "-R", uidgid, srcPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams); if (!res) SULog(@"Can't set permissions"); @@ -341,7 +351,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza BOOL haveDst = [[NSFileManager defaultManager] fileExistsAtPath:dst]; if (res && haveDst) // If there's something at our tmp path (previous failed update or whatever) delete that first. { - const char *rmParams[] = { "-rf", dstPath, NULL }; + char *rmParams[] = { "-rf", dstPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams); if (!res) SULog(@"Can't remove destination file"); @@ -349,7 +359,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (res) // Move!. { - const char *mvParams[] = { "-f", srcPath, dstPath, NULL }; + char *mvParams[] = { "-f", srcPath, dstPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams); if (!res) SULog(@"Can't move source file"); @@ -378,7 +388,8 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza { // *** MUST BE SAFE TO CALL ON NON-MAIN THREAD! - const char *srcPath = [src fileSystemRepresentation]; + char srcPath[PATH_MAX] = {0}; + [src getFileSystemRepresentation:srcPath maxLength:sizeof(srcPath)]; AuthorizationRef auth = NULL; OSStatus authStat = errAuthorizationDenied; @@ -397,7 +408,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (res) // If there's something at our tmp path (previous failed update or whatever) delete that first. { - const char *rmParams[] = { "-rf", srcPath, NULL }; + char *rmParams[] = { "-rf", srcPath, NULL }; res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams); if (!res) SULog(@"Can't remove destination file"); diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 74b354f5..dc76d38f 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -246,7 +246,10 @@ - (void)webView:(WebView *)__unused sender decidePolicyForNavigationAction:(NSDictionary *)__unused actionInformation request:(NSURLRequest *)request frame:(WebFrame *)__unused frame decisionListener:(id)listener { if (self.webViewFinishedLoading) { - [[NSWorkspace sharedWorkspace] openURL:[request URL]]; + NSURL *requestURL = request.URL; + if (requestURL) { + [[NSWorkspace sharedWorkspace] openURL:requestURL]; + } [listener ignore]; } diff --git a/Sparkle/Sparkle.pch b/Sparkle/Sparkle.pch index afac8dca..7a53b80a 100644 --- a/Sparkle/Sparkle.pch +++ b/Sparkle/Sparkle.pch @@ -19,4 +19,9 @@ #define SULocalizedString(key, comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", (NSBundle *__nonnull)([NSBundle bundleWithIdentifier:SUBundleIdentifier] ? [NSBundle bundleWithIdentifier:SUBundleIdentifier] : [NSBundle mainBundle]), comment) +// Work around a warning generated by some versions of Xcode that we still support, +// when using NSParameterAssert +#define SUParameterAssert(condition) \ + NSAssert((condition), @"Invalid parameter not satisfying: %@", @(#condition)) + #endif diff --git a/Tests/SUCodeSigningVerifierTest.m b/Tests/SUCodeSigningVerifierTest.m index 6abd0319..95e394f0 100644 --- a/Tests/SUCodeSigningVerifierTest.m +++ b/Tests/SUCodeSigningVerifierTest.m @@ -30,8 +30,9 @@ [super setUp]; NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]]; + NSString *unitTestBundleIdentifier = unitTestBundle.bundleIdentifier; NSString *zippedAppPath = [unitTestBundle pathForResource:@"SparkleTestCodeSignApp" ofType:@"zip"]; - NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[unitTestBundle bundleIdentifier]]; + NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:unitTestBundleIdentifier]; NSError *error = nil; if ([[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:&error]) { if ([self unzip:zippedAppPath toPath:tempDir]) { diff --git a/Tests/SUInstallerTest.m b/Tests/SUInstallerTest.m index ceee0b6c..8b73abe3 100644 --- a/Tests/SUInstallerTest.m +++ b/Tests/SUInstallerTest.m @@ -30,6 +30,7 @@ [super tearDown]; } +#if __clang_major__ >= 6 - (void)testInstallIfRoot { uid_t uid = getuid(); @@ -61,5 +62,6 @@ [self waitForExpectationsWithTimeout:40 handler:nil]; [fm removeItemAtPath:expectedDestination error:nil]; } +#endif @end diff --git a/Tests/SUPipedUnarchiverTest.m b/Tests/SUPipedUnarchiverTest.m index 5bb163b4..eb5c7c0b 100644 --- a/Tests/SUPipedUnarchiverTest.m +++ b/Tests/SUPipedUnarchiverTest.m @@ -11,6 +11,7 @@ #import "SUUnarchiver.h" #import "SUPipedUnarchiver.h" +#if __clang_major__ >= 6 @interface SUPipedUnarchiverTest : XCTestCase @property (nonatomic, strong) XCTestExpectation *unarchived; @@ -78,3 +79,4 @@ } @end +#endif diff --git a/Vendor/bsdiff/bspatch.c b/Vendor/bsdiff/bspatch.c index 7c8c238e..ca7a72ab 100644 --- a/Vendor/bsdiff/bspatch.c +++ b/Vendor/bsdiff/bspatch.c @@ -123,7 +123,7 @@ static off_t offtin(u_char *buf) return y; } -int bspatch(int argc,char * argv[]) +int bspatch(int argc,const char * const argv[]) { FILE * f, * cpf, * dpf, * epf; stream_t cstream, dstream, estream; diff --git a/Vendor/bsdiff/bspatch.h b/Vendor/bsdiff/bspatch.h index f9bb672f..fe21db74 100644 --- a/Vendor/bsdiff/bspatch.h +++ b/Vendor/bsdiff/bspatch.h @@ -9,4 +9,4 @@ // So that we can use this method in SUBinaryDeltaApply.m. // Silences the GCC warning that the prototype doesn't exist. -int bspatch(int argc, char * argv[]); +int bspatch(int argc, const char * const argv[]); diff --git a/Vendor/bsdiff/sais.c b/Vendor/bsdiff/sais.c index 39b57e62..1c26760b 100644 --- a/Vendor/bsdiff/sais.c +++ b/Vendor/bsdiff/sais.c @@ -40,7 +40,7 @@ #define SAIS_MYMALLOC(_num, _type) ((_type *)malloc((_num) * sizeof(_type))) #define SAIS_MYFREE(_ptr, _num, _type) free((_ptr)) -#define chr(_a) (cs == sizeof(sais_index_type) ? ((sais_index_type *)T)[(_a)] : ((unsigned char *)T)[(_a)]) +#define chr(_a) (cs == sizeof(sais_index_type) ? ((const sais_index_type *)T)[(_a)] : ((const unsigned char *)T)[(_a)]) /* find the start or end of each bucket */ static diff --git a/Vendor/bsdiff/sais.h b/Vendor/bsdiff/sais.h index 1abd0af6..eec93a99 100644 --- a/Vendor/bsdiff/sais.h +++ b/Vendor/bsdiff/sais.h @@ -24,8 +24,8 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef _SAIS_H -#define _SAIS_H 1 +#ifndef SAIS_H +#define SAIS_H 1 #ifdef __cplusplus extern "C" { @@ -56,4 +56,4 @@ sais_int_bwt(const sais_index_type *T, sais_index_type *U, sais_index_type *A, i } /* extern "C" */ #endif /* __cplusplus */ -#endif /* _SAIS_H */ +#endif /* SAIS_H */