From a3f136022a927975b527514395374382bda64420 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 20 Feb 2026 20:58:32 -0800 Subject: [PATCH] Fix Xcode 26.4 beta compiler warnings (#2850) --- Autoupdate/SPUSparkleDeltaArchive.m | 16 +++--- Autoupdate/SPUXarDeltaArchive.m | 6 +-- Autoupdate/SUBinaryDeltaApply.m | 4 +- Autoupdate/SUBinaryDeltaCommon.m | 20 +++---- Autoupdate/SUBinaryDeltaCreate.m | 2 +- Autoupdate/SUCodeSigningVerifier.m | 11 ++-- Autoupdate/SUDiskImageUnarchiver.m | 5 +- Autoupdate/SUSignatureVerifier.m | 2 +- Downloader/SPUDownloader.m | 2 +- InstallerConnection/SUInstallerConnection.m | 2 +- InstallerLauncher/SUInstallerLauncher.m | 2 +- .../InstallerProgressAppController.m | 2 +- Sparkle/SPUAppcastItemStateResolver.m | 2 +- Sparkle/SPUExtractSignedFeed.m | 4 +- Sparkle/SPUInstallerDriver.m | 16 +++--- Sparkle/SPUStandardUserDriver.m | 4 +- Sparkle/SPUUserUpdateState.m | 2 +- Sparkle/SUAppcast.m | 2 +- Sparkle/SUAppcastDriver.m | 4 +- Sparkle/SUAppcastItem.m | 2 +- Sparkle/SUFileManager.m | 2 +- Sparkle/SUSignatures.m | 2 +- Sparkle/SUStandardVersionComparator.m | 2 +- Sparkle/SUStatusController.m | 4 +- Sparkle/SUSystemProfiler.m | 2 +- Sparkle/SUTextViewReleaseNotesView.m | 4 +- Sparkle/SUUpdateAlert.m | 6 +-- TestApplication/SUPopUpTitlebarUserDriver.m | 2 +- TestApplication/SUTestApplicationDelegate.m | 16 +++--- Tests/SUBinaryDeltaTest.m | 10 ++-- Tests/SUSignatureVerifierTest.m | 30 +++++------ Vendor/bsdiff/bscommon.c | 8 +-- Vendor/bsdiff/bsdiff.c | 52 +++++++++---------- Vendor/bsdiff/bspatch.c | 21 ++++---- Vendor/ed25519-sparkle/src/sha512.c | 22 ++++---- sparkle-cli/SPUCommandLineUserDriver.m | 2 +- 36 files changed, 149 insertions(+), 146 deletions(-) diff --git a/Autoupdate/SPUSparkleDeltaArchive.m b/Autoupdate/SPUSparkleDeltaArchive.m index e34cb103..a02954cb 100644 --- a/Autoupdate/SPUSparkleDeltaArchive.m +++ b/Autoupdate/SPUSparkleDeltaArchive.m @@ -178,7 +178,7 @@ typedef struct FILE *file = _file; void *compressionBuffer = _compressionBuffer; - _compressionStream.dst_ptr = buffer; + _compressionStream.dst_ptr = (uint8_t *)buffer; _compressionStream.dst_size = (size_t)length; while (_compressionStream.dst_size > 0) { @@ -194,7 +194,7 @@ typedef struct } // Reset source buffer - _compressionStream.src_ptr = compressionBuffer; + _compressionStream.src_ptr = (const uint8_t *)compressionBuffer; _compressionStream.src_size = bytesRead; } @@ -264,7 +264,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode return nil; } - SPUDeltaCompressionMode compression = 0; + SPUDeltaCompressionMode compression = SPUDeltaCompressionModeNone; if (fread(&compression, sizeof(compression), 1, file) < 1) { _error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read compression value from patch file: %@", patchFile] }]; return nil; @@ -379,7 +379,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode return @[]; } - char *fileTableData = calloc(1, filePathSectionSize); + char *fileTableData = (char *)calloc(1, filePathSectionSize); if (fileTableData == NULL) { _error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %llu bytes for relative file paths.", filePathSectionSize] }]; return nil; @@ -449,7 +449,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode { uint64_t currentItemIndex = 0; while (YES) { - SPUDeltaItemCommands commands = 0; + SPUDeltaItemCommands commands = (SPUDeltaItemCommands)0; if (![self _readBuffer:&commands length:sizeof(commands)]) { break; } @@ -715,14 +715,14 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode case SPUDeltaCompressionModeLZFSE: case SPUDeltaCompressionModeLZ4: case SPUDeltaCompressionModeZLIB: { - _compressionStream.src_ptr = buffer; + _compressionStream.src_ptr = (const uint8_t *)buffer; _compressionStream.src_size = (size_t)length; FILE *file = _file; void *compressionBuffer = _compressionBuffer; while (_compressionStream.src_size > 0) { // Reset destination buffer - _compressionStream.dst_ptr = compressionBuffer; + _compressionStream.dst_ptr = (uint8_t *)compressionBuffer; _compressionStream.dst_size = COMPRESSION_BUFFER_SIZE; if (compression_stream_process(&_compressionStream, 0) == COMPRESSION_STATUS_ERROR) { @@ -1259,7 +1259,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode _compressionStream.src_size = 0; while (_compressionStream.dst_size > 0) { - _compressionStream.dst_ptr = compressionBuffer; + _compressionStream.dst_ptr = (uint8_t *)compressionBuffer; _compressionStream.dst_size = COMPRESSION_BUFFER_SIZE; compression_status status = compression_stream_process(&_compressionStream, COMPRESSION_STREAM_FINALIZE); diff --git a/Autoupdate/SPUXarDeltaArchive.m b/Autoupdate/SPUXarDeltaArchive.m index 59fac116..f92241d9 100644 --- a/Autoupdate/SPUXarDeltaArchive.m +++ b/Autoupdate/SPUXarDeltaArchive.m @@ -252,7 +252,7 @@ static xar_file_t xarAddFile(NSMutableDictionary *fileTab NSArray *subpathComponents = [relativePathComponents subarrayWithRange:NSMakeRange(0, componentIndex + 1)]; NSString *subpathKey = [subpathComponents componentsJoinedByString:@"/"]; - xar_file_t cachedFile = [fileTable[subpathKey] pointerValue]; + xar_file_t cachedFile = (xar_file_t)[fileTable[subpathKey] pointerValue]; if (cachedFile != NULL) { lastParent = cachedFile; } else { @@ -349,7 +349,7 @@ static xar_file_t xarAddFile(NSMutableDictionary *fileTab continue; } - SPUDeltaItemCommands commands = 0; + SPUDeltaItemCommands commands = (SPUDeltaItemCommands)0; { const char *value = NULL; if (xar_prop_get(file, DELETE_KEY, &value) == 0) { @@ -399,7 +399,7 @@ static xar_file_t xarAddFile(NSMutableDictionary *fileTab assert(item.itemFilePath != nil); assert(item.xarContext != NULL); - xar_file_t file = item.xarContext; + xar_file_t file = (xar_file_t)item.xarContext; if (xar_extract_tofile(_x, file, item.itemFilePath.fileSystemRepresentation) != 0) { _error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_EXTRACT_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to extract xar file entry to %@", item.itemFilePath] }]; return NO; diff --git a/Autoupdate/SUBinaryDeltaApply.m b/Autoupdate/SUBinaryDeltaApply.m index f8ca965f..b4f85741 100644 --- a/Autoupdate/SUBinaryDeltaApply.m +++ b/Autoupdate/SUBinaryDeltaApply.m @@ -41,7 +41,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa progressCallback(0/7.0); - SUBinaryDeltaMajorVersion majorDiffVersion = header.majorVersion; + SUBinaryDeltaMajorVersion majorDiffVersion = (SUBinaryDeltaMajorVersion)header.majorVersion; uint16_t minorDiffVersion = header.minorVersion; unsigned char *expectedBeforeHash = header.beforeTreeHash; @@ -444,7 +444,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa if (failedToApplyFileSystemCompression) { // Try to replace bundle normally - if (![fileManager replaceItemAtURL:[NSURL fileURLWithPath:finalDestination] withItemAtURL:[NSURL fileURLWithPath:destination isDirectory:YES] backupItemName:nil options:0 resultingItemURL:NULL error:error]) { + if (![fileManager replaceItemAtURL:[NSURL fileURLWithPath:finalDestination] withItemAtURL:[NSURL fileURLWithPath:destination isDirectory:YES] backupItemName:nil options:(NSFileManagerItemReplacementOptions)0 resultingItemURL:NULL error:error]) { removeTree(destination); return NO; } diff --git a/Autoupdate/SUBinaryDeltaCommon.m b/Autoupdate/SUBinaryDeltaCommon.m index aea2bcf3..0202b26c 100644 --- a/Autoupdate/SUBinaryDeltaCommon.m +++ b/Autoupdate/SUBinaryDeltaCommon.m @@ -128,7 +128,7 @@ NSString *temporaryFilename(NSString *base) NSMutableData *data = [NSMutableData data]; [data appendBytes:template.fileSystemRepresentation length:strlen(template.fileSystemRepresentation) + 1]; - char *buffer = data.mutableBytes; + char *buffer = (char *)data.mutableBytes; int fd = mkstemp(buffer); if (fd == -1) { perror("mkstemp"); @@ -149,7 +149,7 @@ NSString *temporaryDirectory(NSString *base) NSMutableData *data = [NSMutableData data]; [data appendBytes:template.fileSystemRepresentation length:strlen(template.fileSystemRepresentation) + 1]; - char *buffer = data.mutableBytes; + char *buffer = (char *)data.mutableBytes; char *templateResult = mkdtemp(buffer); if (templateResult == NULL) { perror("mkdtemp"); @@ -180,12 +180,12 @@ static BOOL crc32HashOfFileContents(uLong *outChecksum, FTSENT *ent, void *tempB return NO; } - checksum = crc32(checksum, (const void *)linkDestination, (unsigned int)linkDestinationLength); + checksum = crc32(checksum, (const Bytef *)linkDestination, (unsigned int)linkDestinationLength); } else if (ent->fts_info == FTS_F) { ssize_t fileSize = ent->fts_statp->st_size; uint64_t encodedFileSize = (uint64_t)fileSize; - checksum = crc32(checksum, (const void *)&encodedFileSize, sizeof(encodedFileSize)); + checksum = crc32(checksum, (const Bytef *)&encodedFileSize, sizeof(encodedFileSize)); if (fileSize > 0) { FILE *file = fopen(ent->fts_path, "rb"); @@ -204,7 +204,7 @@ static BOOL crc32HashOfFileContents(uLong *outChecksum, FTSENT *ent, void *tempB return NO; } - checksum = crc32(checksum, tempBuffer, (uInt)bytesToConsume); + checksum = crc32(checksum, (const Bytef *)tempBuffer, (uInt)bytesToConsume); bytesLeft -= bytesToConsume; } @@ -337,7 +337,7 @@ BOOL getRawHashOfTreeAndFileTablesWithVersion(void *hashBuffer, NSString *path, uint64_t encodedFileContentsChecksum = fileContentsChecksum; - crc32ChecksumValue = crc32(crc32ChecksumValue, (const void *)&encodedFileContentsChecksum, sizeof(encodedFileContentsChecksum)); + crc32ChecksumValue = crc32(crc32ChecksumValue, (const Bytef *)&encodedFileContentsChecksum, sizeof(encodedFileContentsChecksum)); if (ent->fts_info == FTS_F) { fileHashKey = [NSData dataWithBytes:&encodedFileContentsChecksum length:sizeof(encodedFileContentsChecksum)]; @@ -378,7 +378,7 @@ BOOL getRawHashOfTreeAndFileTablesWithVersion(void *hashBuffer, NSString *path, const char *relativePathBytes = [relativePath fileSystemRepresentation]; if (majorVersion >= SUBinaryDeltaMajorVersion4) { - crc32ChecksumValue = crc32(crc32ChecksumValue, (const void *)relativePathBytes, (uInt)strlen(relativePathBytes)); + crc32ChecksumValue = crc32(crc32ChecksumValue, (const Bytef *)relativePathBytes, (uInt)strlen(relativePathBytes)); } else { CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes)); } @@ -393,8 +393,8 @@ BOOL getRawHashOfTreeAndFileTablesWithVersion(void *hashBuffer, NSString *path, uint16_t hashedPermissions = (ent->fts_info == FTS_SL) ? VALID_SYMBOLIC_LINK_PERMISSIONS : permissions; if (majorVersion >= SUBinaryDeltaMajorVersion4) { - crc32ChecksumValue = crc32(crc32ChecksumValue, (const void *)&type, sizeof(type)); - crc32ChecksumValue = crc32(crc32ChecksumValue, (const void *)&hashedPermissions, sizeof(hashedPermissions)); + crc32ChecksumValue = crc32(crc32ChecksumValue, (const Bytef *)&type, sizeof(type)); + crc32ChecksumValue = crc32(crc32ChecksumValue, (const Bytef *)&hashedPermissions, sizeof(hashedPermissions)); } else { CC_SHA1_Update(&hashContext, &type, sizeof(type)); CC_SHA1_Update(&hashContext, &hashedPermissions, sizeof(hashedPermissions)); @@ -410,7 +410,7 @@ BOOL getRawHashOfTreeAndFileTablesWithVersion(void *hashBuffer, NSString *path, memset(hashBuffer, 0, BINARY_DELTA_HASH_LENGTH); memcpy(hashBuffer, &encodedCrc32ChecksumValue, sizeof(encodedCrc32ChecksumValue)); } else { - CC_SHA1_Final(hashBuffer, &hashContext); + CC_SHA1_Final((unsigned char *)hashBuffer, &hashContext); } return YES; diff --git a/Autoupdate/SUBinaryDeltaCreate.m b/Autoupdate/SUBinaryDeltaCreate.m index 88f7bde0..79517fc0 100644 --- a/Autoupdate/SUBinaryDeltaCreate.m +++ b/Autoupdate/SUBinaryDeltaCreate.m @@ -133,7 +133,7 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent) return false; } - char *buffer = malloc((size_t)listSize); + char *buffer = (char *)malloc((size_t)listSize); assert(buffer != NULL); ssize_t sizeBack = listxattr(ent->fts_path, buffer, (size_t)listSize, options); diff --git a/Autoupdate/SUCodeSigningVerifier.m b/Autoupdate/SUCodeSigningVerifier.m index 78da809c..4ec5352d 100644 --- a/Autoupdate/SUCodeSigningVerifier.m +++ b/Autoupdate/SUCodeSigningVerifier.m @@ -74,8 +74,7 @@ // See https://github.com/sparkle-project/Sparkle/issues/376#issuecomment-48824267 and https://developer.apple.com/library/mac/technotes/tn2206 // Additionally, there are several reasons to stay away from deep verification and to prefer EdDSA signing the download archive instead. // See https://github.com/sparkle-project/Sparkle/pull/523#commitcomment-17549302 and https://github.com/sparkle-project/Sparkle/issues/543 - SecCSFlags flags = kSecCSCheckAllArchitectures; - result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError); + result = SecStaticCodeCheckValidityWithErrors(staticCode, kSecCSCheckAllArchitectures, requirement, &cfError); if (result != errSecSuccess) { NSError *underlyingError; @@ -147,6 +146,8 @@ finally: OSStatus result; SecStaticCodeRef staticCode = NULL; CFErrorRef cfError = NULL; + // See also code further below where kSecCSCheckNestedCode may be added + SecCSFlags flags = kSecCSCheckAllArchitectures; result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode); if (result != noErr) { @@ -160,7 +161,6 @@ finally: } // See in -codeSignatureIsValidAtBundleURL:andMatchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed - SecCSFlags flags = kSecCSCheckAllArchitectures; if (checkNestedCode) { flags |= kSecCSCheckNestedCode; } @@ -330,6 +330,7 @@ static NSString * _Nullable SUTeamIdentifierFromCode(SecStaticCodeRef staticCode OSStatus result; NSError *resultError = nil; + CFErrorRef cfError = NULL; NSString *commonErrorMessage = @"The download archive cannot be validated with Apple Developer ID code signing as fallback (after (Ed)DSA verification has failed)"; @@ -379,9 +380,7 @@ static NSString * _Nullable SUTeamIdentifierFromCode(SecStaticCodeRef staticCode goto finally; } - SecCSFlags flags = (SecCSFlags)kSecCSDefaultFlags; - CFErrorRef cfError = NULL; - result = SecStaticCodeCheckValidityWithErrors(downloadStaticCode, flags, requirement, &cfError); + result = SecStaticCodeCheckValidityWithErrors(downloadStaticCode, kSecCSDefaultFlags, requirement, &cfError); if (result != errSecSuccess) { NSError *underlyingError; if (cfError != NULL) { diff --git a/Autoupdate/SUDiskImageUnarchiver.m b/Autoupdate/SUDiskImageUnarchiver.m index d61d07ab..fce32604 100644 --- a/Autoupdate/SUDiskImageUnarchiver.m +++ b/Autoupdate/SUDiskImageUnarchiver.m @@ -133,6 +133,8 @@ static NSUInteger fileCountForDirectory(NSFileManager *fileManager, NSString *it NSMutableArray *itemsToExtract = [NSMutableArray array]; NSUInteger totalFileExtractionCount = 0; + BOOL success = YES; + { NSTask *task = [[NSTask alloc] init]; task.launchPath = @"/usr/bin/hdiutil"; @@ -269,7 +271,7 @@ static NSUInteger fileCountForDirectory(NSFileManager *fileManager, NSString *it [itemsToExtract addObject:item]; } - _fileProgressIncrement = (0.99 - _currentExtractionProgress) / totalFileExtractionCount; + _fileProgressIncrement = (0.99 - _currentExtractionProgress) / (double)totalFileExtractionCount; _notifier = notifier; // Copy all items we want to extract and notify of progress @@ -286,7 +288,6 @@ static NSUInteger fileCountForDirectory(NSFileManager *fileManager, NSString *it [notifier notifyProgress:1.0]; - BOOL success = YES; goto finally; reportError: diff --git a/Autoupdate/SUSignatureVerifier.m b/Autoupdate/SUSignatureVerifier.m index 2831b0b5..2e720339 100644 --- a/Autoupdate/SUSignatureVerifier.m +++ b/Autoupdate/SUSignatureVerifier.m @@ -172,7 +172,7 @@ } case SUSigningInputStatusPresent: { assert(data != nil); - if (ed25519_verify(signatures.ed25519Signature, data.bytes, data.length, _pubKeys.ed25519PubKey)) { + if (ed25519_verify(signatures.ed25519Signature, (const unsigned char *)data.bytes, data.length, _pubKeys.ed25519PubKey)) { SULog(SULogLevelDefault, @"OK: EdDSA signature is correct for %@", fileKind); #if SPARKLE_BUILD_LEGACY_DSA_SUPPORT // No need to check DSA when EdDSA verification succeeded, unless a DSA signature is provided and it's diff --git a/Downloader/SPUDownloader.m b/Downloader/SPUDownloader.m index 65810dab..1160b4b2 100644 --- a/Downloader/SPUDownloader.m +++ b/Downloader/SPUDownloader.m @@ -286,7 +286,7 @@ static bool SPUValidateStatusCodeAndFailIfInvalid(NSURLResponse * _Nullable resp NSURL *downloadURL = [NSURL fileURLWithPath:toPath isDirectory:NO]; NSError *bookmarkError = nil; - NSData *bookmarkData = [downloadURL bookmarkDataWithOptions:0 includingResourceValuesForKeys:@[] relativeToURL:nil error:&bookmarkError]; + NSData *bookmarkData = [downloadURL bookmarkDataWithOptions:(NSURLBookmarkCreationOptions)0 includingResourceValuesForKeys:@[] relativeToURL:nil error:&bookmarkError]; if (bookmarkData == nil) { [_delegate downloaderDidFailWithError:bookmarkError]; } else { diff --git a/InstallerConnection/SUInstallerConnection.m b/InstallerConnection/SUInstallerConnection.m index 52722a46..68ce1512 100644 --- a/InstallerConnection/SUInstallerConnection.m +++ b/InstallerConnection/SUInstallerConnection.m @@ -73,7 +73,7 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K - (void)_setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain SPU_OBJC_DIRECT { - NSXPCConnectionOptions options = systemDomain ? NSXPCConnectionPrivileged : 0; + NSXPCConnectionOptions options = systemDomain ? NSXPCConnectionPrivileged : (NSXPCConnectionOptions)0; NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 02cdf972..bac0352e 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -206,7 +206,7 @@ [NSGraphicsContext saveGraphicsState]; NSGraphicsContext.currentContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:iconBitmapRep]; - [icon drawInRect:NSMakeRect(0, 0, imageDimensions, imageDimensions)]; + [icon drawInRect:NSMakeRect(0.0, 0.0, (CGFloat)imageDimensions, (CGFloat)imageDimensions)]; [NSGraphicsContext restoreGraphicsState]; diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index 76bfc59e..3e276aa1 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -102,7 +102,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; // This difference is significant. We shouldn't have a model where the 'server' tries to connect to a 'client', // nor have a model where a process that runs at the highest level (the installer can run as root) tries to connect to a user level agent or process BOOL systemDomain = arguments[2].boolValue; - NSXPCConnectionOptions connectionOptions = systemDomain ? NSXPCConnectionPrivileged : 0; + NSXPCConnectionOptions connectionOptions = systemDomain ? NSXPCConnectionPrivileged : (NSXPCConnectionOptions)0; _systemDomain = systemDomain; _connection = [[NSXPCConnection alloc] initWithMachServiceName:SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) options:connectionOptions]; diff --git a/Sparkle/SPUAppcastItemStateResolver.m b/Sparkle/SPUAppcastItemStateResolver.m index 6b8bde7d..9f1ee60e 100644 --- a/Sparkle/SPUAppcastItemStateResolver.m +++ b/Sparkle/SPUAppcastItemStateResolver.m @@ -168,7 +168,7 @@ BOOL minimumOperatingSystemVersionIsOK = [self isMinimumOperatingSystemVersionOK:minimumOperatingSystemVersion]; - BOOL maximumOperatingSystemVersionIsOK = [self isMaximumOperatingSystemVersionOK:maximumOperatingSystemVersion];; + BOOL maximumOperatingSystemVersionIsOK = [self isMaximumOperatingSystemVersionOK:maximumOperatingSystemVersion]; BOOL majorUpgrade = ![self isMinimumAutoupdateVersionOK:minimumAutoupdateVersion]; diff --git a/Sparkle/SPUExtractSignedFeed.m b/Sparkle/SPUExtractSignedFeed.m index 080fc01e..dedabd38 100644 --- a/Sparkle/SPUExtractSignedFeed.m +++ b/Sparkle/SPUExtractSignedFeed.m @@ -23,7 +23,7 @@ NSData *SPUExtractAppcastContent(NSData *appcastData, NSString * _Nullable __aut NSData *contentFeedData = [appcastData subdataWithRange:NSMakeRange(0, prefixRange.location)]; - NSRange suffixRange = [appcastData rangeOfData:[NSData dataWithBytesNoCopy:feedSigningSuffix length:sizeof(feedSigningSuffix) - 1 freeWhenDone:NO] options:0 range:NSMakeRange(NSMaxRange(prefixRange), appcastDataLength - NSMaxRange(prefixRange))]; + NSRange suffixRange = [appcastData rangeOfData:[NSData dataWithBytesNoCopy:feedSigningSuffix length:sizeof(feedSigningSuffix) - 1 freeWhenDone:NO] options:(NSDataSearchOptions)0 range:NSMakeRange(NSMaxRange(prefixRange), appcastDataLength - NSMaxRange(prefixRange))]; if (suffixRange.location == NSNotFound) { return appcastData; @@ -76,7 +76,7 @@ NSData *SPUExtractReleaseNotesContent(NSData *data) return data; } - NSRange commentSuffixRange = [data rangeOfData:signWarningComment options:0 range:NSMakeRange(signWarningCommentPrefix.length, data.length - signWarningCommentPrefix.length)]; + NSRange commentSuffixRange = [data rangeOfData:signWarningComment options:(NSDataSearchOptions)0 range:NSMakeRange(signWarningCommentPrefix.length, data.length - signWarningCommentPrefix.length)]; if (commentSuffixRange.location == NSNotFound) { return data; diff --git a/Sparkle/SPUInstallerDriver.m b/Sparkle/SPUInstallerDriver.m index cdc0e9a4..809a90c6 100644 --- a/Sparkle/SPUInstallerDriver.m +++ b/Sparkle/SPUInstallerDriver.m @@ -296,7 +296,7 @@ - (void)_handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data SPU_OBJC_DIRECT { - if (!SPUInstallerMessageTypeIsLegal(_currentStage, identifier)) { + if (!SPUInstallerMessageTypeIsLegal(_currentStage, (SPUInstallerMessageType)identifier)) { SULog(SULogLevelError, @"Error: received out of order message with current stage: %d, requested stage: %d", _currentStage, identifier); return; } @@ -305,14 +305,14 @@ if (identifier == SPUExtractionStarted) { _extractionAttempts++; - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; [delegate installerDidStartExtracting]; } else if (identifier == SPUExtractedArchiveWithProgress) { if (data.length == sizeof(double) && sizeof(double) == sizeof(uint64_t)) { uint64_t progressValue = CFSwapInt64LittleToHost(*(const uint64_t *)data.bytes); double progress = *(double *)&progressValue; [delegate installerDidExtractUpdateWithProgress:progress]; - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; } } else if (identifier == SPUArchiveExtractionFailed) { // If this is a delta update, there must be a regular update we can fall back to @@ -326,11 +326,11 @@ [self _reportInstallerError:unarchivedError genericErrorCode:SUUnarchivingError genericUserInfo:genericUserInfo]; } } else if (identifier == SPUValidationStarted) { - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; } else if (identifier == SPUInstallationStartedStage1) { - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; } else if (identifier == SPUInstallationFinishedStage1) { - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; // Let the installer keep a copy of the appcast item data // We may want to ask for it later (note the updater can relaunch without the app necessarily having relaunched) @@ -349,7 +349,7 @@ [delegate installerDidFinishPreparationAndWillInstallImmediately:hasTargetTerminated]; } else if (identifier == SPUInstallationFinishedStage2) { - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; BOOL hasTargetTerminated = NO; if (data.length >= sizeof(uint8_t)) { @@ -366,7 +366,7 @@ [delegate installerDidStartInstallingWithApplicationTerminated:hasTargetTerminated]; } else if (identifier == SPUInstallationFinishedStage3) { - _currentStage = identifier; + _currentStage = (SPUInstallerMessageType)identifier; [_installerConnection invalidate]; _installerConnection = nil; diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index ed30fef5..9562e8a4 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -112,7 +112,7 @@ - (double)currentTime SPU_OBJC_DIRECT { if (_timebaseInfo.denom > 0) { - return (1.0 * mach_absolute_time() * _timebaseInfo.numer / _timebaseInfo.denom); + return (double)(mach_absolute_time() * _timebaseInfo.numer) / (double)_timebaseInfo.denom; } else { return 0.0; } @@ -826,7 +826,7 @@ NSBundle *sparkleBundle = SUSparkleBundle(); #endif - if (_expectedContentLength > 0.0) { + if (_expectedContentLength > 0) { double newProgressValue = (double)_bytesDownloaded / (double)_expectedContentLength; [_statusController setProgressValue:MIN(newProgressValue, 1.0)]; diff --git a/Sparkle/SPUUserUpdateState.m b/Sparkle/SPUUserUpdateState.m index 3f5aa454..8bd006e0 100644 --- a/Sparkle/SPUUserUpdateState.m +++ b/Sparkle/SPUUserUpdateState.m @@ -40,7 +40,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { - SPUUserUpdateStage stage = [decoder decodeIntegerForKey:SPUUserUpdateStateStageKey]; + SPUUserUpdateStage stage = (SPUUserUpdateStage)[decoder decodeIntegerForKey:SPUUserUpdateStateStageKey]; BOOL userInitiated = [decoder decodeBoolForKey:SPUUserUpdateStateUserInitiatedKey]; return [self initWithStage:stage userInitiated:userInitiated]; diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index d20641cb..3b512388 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -80,7 +80,7 @@ return nil; } - NSUInteger options = NSXMLNodeLoadExternalEntitiesNever; // Prevent inclusion from file:// + NSXMLNodeOptions options = NSXMLNodeLoadExternalEntitiesNever; // Prevent inclusion from file:// NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:appcastData options:options error:errorp]; if (nil == document) { return nil; diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index b567cd25..464300ae 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -274,7 +274,7 @@ if (notFoundPrimaryItem != nil) { hostToLatestAppcastItemComparisonResult = [applicationVersionComparator compareVersion:_host.version toVersion:notFoundPrimaryItem.versionString]; } else { - hostToLatestAppcastItemComparisonResult = 0; + hostToLatestAppcastItemComparisonResult = NSOrderedSame; } [delegate didNotFindUpdateWithLatestAppcastItem:notFoundPrimaryItem hostToLatestAppcastItemComparisonResult:hostToLatestAppcastItemComparisonResult background:background]; @@ -619,7 +619,7 @@ SPU_OBJC_DIRECT NSTimeInterval timeSinceRelease = [currentDate timeIntervalSinceDate:itemReleaseDate]; NSTimeInterval phasedRolloutInterval = [phasedRolloutIntervalObject doubleValue]; - NSTimeInterval timeToWaitForGroup = phasedRolloutInterval * phasedUpdateGroup.unsignedIntegerValue; + NSTimeInterval timeToWaitForGroup = phasedRolloutInterval * (NSTimeInterval)(phasedUpdateGroup.unsignedIntegerValue); if (timeSinceRelease >= timeToWaitForGroup) { return YES; diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index da145a01..1089f868 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -176,7 +176,7 @@ static NSString *SUAppcastItemSigningValidationStatusKey = @"SUAppcastItemSignin case SPUAppcastSigningValidationStatusSkipped: case SPUAppcastSigningValidationStatusSucceeded: case SPUAppcastSigningValidationStatusFailed: - _signingValidationStatus = decodedSigningValidationStatus; + _signingValidationStatus = (SPUAppcastSigningValidationStatus)decodedSigningValidationStatus; break; default: // This shouldn't be reached, skipped == 0 matches an old encoder that doesn't encode this enum. diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 6e944ea8..a80614ba 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -415,7 +415,7 @@ SPU_OBJC_DIRECT // Preserve the modification time struct timeval modTime; - TIMESPEC_TO_TIMEVAL(&modTime, &statInfo.st_mtimespec); + TIMESPEC_TO_TIMEVAL(&modTime, &statInfo.st_mtimespec) const struct timeval timeInputs[] = {accessTime, modTime}; diff --git a/Sparkle/SUSignatures.m b/Sparkle/SUSignatures.m index cdc152e3..a71e6ccc 100644 --- a/Sparkle/SUSignatures.m +++ b/Sparkle/SUSignatures.m @@ -37,7 +37,7 @@ static SUSigningInputStatus decode(NSString *str, NSData * __strong *outData) { } NSString *stripped = [str stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet]; - NSData *result = [[NSData alloc] initWithBase64EncodedString:stripped options:0]; + NSData *result = [[NSData alloc] initWithBase64EncodedString:stripped options:(NSDataBase64DecodingOptions)0]; if (!result) { return SUSigningInputStatusInvalid; } diff --git a/Sparkle/SUStandardVersionComparator.m b/Sparkle/SUStandardVersionComparator.m index 29b56eb1..c3bbb98a 100644 --- a/Sparkle/SUStandardVersionComparator.m +++ b/Sparkle/SUStandardVersionComparator.m @@ -171,7 +171,7 @@ typedef NS_ENUM(NSInteger, SUCharacterType) { - (void)balanceVersionPartsA:(NSMutableArray *)partsA partsB:(NSMutableArray *)partsB SPU_OBJC_DIRECT { NSUInteger partANumberAndPeriodPartsCount = [self countOfNumberAndPeriodStartingParts:partsA]; - NSUInteger partBNumberAndPeriodPartsCount = [self countOfNumberAndPeriodStartingParts:partsB];; + NSUInteger partBNumberAndPeriodPartsCount = [self countOfNumberAndPeriodStartingParts:partsB]; if (partANumberAndPeriodPartsCount > partBNumberAndPeriodPartsCount) { [self addNumberAndPeriodPartsToParts:partsB toNumberAndPeriodPartsCount:partBNumberAndPeriodPartsCount fromParts:partsA fromNumberAndPeriodPartsCount:partANumberAndPeriodPartsCount]; diff --git a/Sparkle/SUStatusController.m b/Sparkle/SUStatusController.m index 1564e63c..b6835a5c 100644 --- a/Sparkle/SUStatusController.m +++ b/Sparkle/SUStatusController.m @@ -80,10 +80,10 @@ static NSString *const SUStatusControllerTouchBarIdentifier = @"" SPARKLE_BUNDLE } if (_minimizable) { - window.styleMask |= NSWindowStyleMaskMiniaturizable; + window.styleMask = (NSWindowStyleMask)(window.styleMask | NSWindowStyleMaskMiniaturizable); } if (_closable) { - window.styleMask |= NSWindowStyleMaskClosable; + window.styleMask = (NSWindowStyleMask)(window.styleMask | NSWindowStyleMaskClosable); } [_progressBar setUsesThreadedAnimation:YES]; [_statusTextField setFont:[NSFont monospacedDigitSystemFontOfSize:0 weight:NSFontWeightRegular]]; diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index 3e7a6147..5cfe74ea 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -157,7 +157,7 @@ NSString *const SUSystemProfilerPreferredLanguageKey = @"lang"; unsigned long bytes; size_t bytes_size = sizeof(unsigned long); if (sysctlbyname("hw.memsize", &bytes, &bytes_size, NULL, 0) == 0) { - double megabytes = bytes / (1024. * 1024.); + double megabytes = (double)bytes / (1024. * 1024.); NSString *stringValue = [NSString stringWithFormat:@"%lu", (unsigned long)megabytes]; [profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerMemoryKey, SULocalizedStringFromTableInBundle(@"Memory (MB)", SPARKLE_TABLE, sparkleBundle, nil), stringValue, stringValue] forKeys:profileDictKeys]]; } diff --git a/Sparkle/SUTextViewReleaseNotesView.m b/Sparkle/SUTextViewReleaseNotesView.m index 930a7ecd..f402775c 100644 --- a/Sparkle/SUTextViewReleaseNotesView.m +++ b/Sparkle/SUTextViewReleaseNotesView.m @@ -182,7 +182,7 @@ static void processMarkdownFragmentAttributedString(NSAttributedString *fragment // to avoid outputting multiple list bullets // Also avoid processing list items that were processed from previous passes / fragments if (canProcessListItem) { - CGFloat firstLineIdentation = intent.indentationLevel * (font.pointSize * 1.5); + CGFloat firstLineIdentation = (CGFloat)intent.indentationLevel * (font.pointSize * 1.5); paragraphStyle.firstLineHeadIndent += firstLineIdentation; // Advance subsequent lines and text that wraps to next line by next tab interval past the firstLineIdentation @@ -288,7 +288,7 @@ static NSAttributedString *formatMarkdownAttributedString(NSAttributedString *or // Enumerate through every presentation intent fragment and create a new attributed string that we append to the output // Foundation handles formatting some things for us already in the attributed string such as bold/itatlics and hyperlinks, // but we need to handle formatting paragraphs, headers, lists, block quotes, etc in the attributed string. - [originalAttributedString enumerateAttribute:NSPresentationIntentAttributeName inRange:NSMakeRange(0, originalAttributedString.length) options:0 usingBlock:^(NSPresentationIntent *intent, NSRange presentationIntentRange, BOOL * _Nonnull __unused stopPresentationIntentEnumeration) { + [originalAttributedString enumerateAttribute:NSPresentationIntentAttributeName inRange:NSMakeRange(0, originalAttributedString.length) options:(NSAttributedStringEnumerationOptions)0 usingBlock:^(NSPresentationIntent *intent, NSRange presentationIntentRange, BOOL * _Nonnull __unused stopPresentationIntentEnumeration) { // Split the presentation intent by lines so we treat every line as a separate paragraph so we present them properly (with correct indentation / tabs) // Normally multiple lines aren't in the same paragraph, but this can happen in some cases like code blocks diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index e5c195e6..6c762ec9 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -375,7 +375,7 @@ typedef NS_ENUM(NSInteger, SUReleaseNotesFormat) [_releaseNotesContentView addSubview:_releaseNotesView.view positioned:NSWindowBelow relativeTo:_releaseNotesSpinner]; _releaseNotesView.view.frame = _releaseNotesContentView.bounds; - _releaseNotesView.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + _releaseNotesView.view.autoresizingMask = (NSAutoresizingMaskOptions)(NSViewWidthSizable | NSViewHeightSizable); if (@available(macOS 10.14, *)) { // We need a transparent background @@ -443,7 +443,7 @@ typedef NS_ENUM(NSInteger, SUReleaseNotesFormat) window.frameAutosaveName = @"SUUpdateAlert2"; } else { // Update alert should not be resizable when no release notes are available - window.styleMask &= ~NSWindowStyleMaskResizable; + window.styleMask = (NSWindowStyleMask)(window.styleMask & ~NSWindowStyleMaskResizable); } _windowLoadedAndShowsReleaseNotes = showReleaseNotes; @@ -463,7 +463,7 @@ typedef NS_ENUM(NSInteger, SUReleaseNotesFormat) // NOTE: The code below for deciding what buttons to hide is complex! Due to array of feature configurations :) - [_updaterSettings addObserver:self forKeyPath:SUAllowsAutomaticUpdatesKeyPath options:(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew) context:NULL]; + [_updaterSettings addObserver:self forKeyPath:SUAllowsAutomaticUpdatesKeyPath options:(NSKeyValueObservingOptions)(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew) context:NULL]; if (_state.stage == SPUUserUpdateStageInstalling) { // We're going to be relaunching pretty instantaneously diff --git a/TestApplication/SUPopUpTitlebarUserDriver.m b/TestApplication/SUPopUpTitlebarUserDriver.m index d703adcb..c76569f2 100644 --- a/TestApplication/SUPopUpTitlebarUserDriver.m +++ b/TestApplication/SUPopUpTitlebarUserDriver.m @@ -230,7 +230,7 @@ } if (_expectedContentLength > 0) { - double progress = (double)_contentLengthDownloaded / _expectedContentLength; + double progress = (double)_contentLengthDownloaded / (double)_expectedContentLength; [self addUpdateButtonWithTitle:[NSString stringWithFormat:@"Downloading (%0.0f%%)", progress * 100] action:nil]; } } diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index 69928a02..e2f1500f 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -191,9 +191,9 @@ NSData *archive = [NSData dataWithContentsOfURL:patchURL]; assert(archive != nil); - ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack); + ed25519_sign(signature, (const unsigned char *)archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack); - NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64EncodedStringWithOptions:0]; + NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]; // Obtain the file attributes to get the file size of our update later NSError *fileAttributesError = nil; @@ -214,12 +214,12 @@ NSUInteger numberOfFromVersionReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_DELTA_FROM_VERSION" withString:mainBundleVersion options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)]; assert(numberOfFromVersionReplacements == 1); - NSRange feedSignaturesPrefixRange = [appcastContents rangeOfString:@"