From 2be877fd1f041bdd46d4a41ccdafe709e7111324 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 12 Sep 2026 20:55:57 -0700 Subject: [PATCH] Remove old compile time availability guards (#2920) --- Autoupdate/SPUDeltaArchiveProtocol.h | 2 -- Autoupdate/SPUSparkleDeltaArchive.m | 5 ----- Autoupdate/SPUXarDeltaArchive.m | 16 ---------------- Autoupdate/SUBinaryDeltaApply.m | 2 +- .../InstallerProgressAppController.m | 6 ------ Sparkle/SPUStandardUserDriver.m | 6 ------ 6 files changed, 1 insertion(+), 36 deletions(-) diff --git a/Autoupdate/SPUDeltaArchiveProtocol.h b/Autoupdate/SPUDeltaArchiveProtocol.h index f601266b..5bac87cc 100644 --- a/Autoupdate/SPUDeltaArchiveProtocol.h +++ b/Autoupdate/SPUDeltaArchiveProtocol.h @@ -73,8 +73,6 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveItem : NSObject // For reading, file items cannot be extracted out of order. @protocol SPUDeltaArchiveProtocol -@property (nonatomic, readonly, class) BOOL maySupportSafeExtraction; - // If non-nil, there was an error with reading or writing data from the archive @property (nonatomic, readonly, nullable) NSError *error; diff --git a/Autoupdate/SPUSparkleDeltaArchive.m b/Autoupdate/SPUSparkleDeltaArchive.m index 218058b0..2b45bde8 100644 --- a/Autoupdate/SPUSparkleDeltaArchive.m +++ b/Autoupdate/SPUSparkleDeltaArchive.m @@ -52,11 +52,6 @@ typedef struct @synthesize error = _error; -+ (BOOL)maySupportSafeExtraction -{ - return YES; -} - - (instancetype)initWithPatchFileForWriting:(NSString *)patchFile { self = [super init]; diff --git a/Autoupdate/SPUXarDeltaArchive.m b/Autoupdate/SPUXarDeltaArchive.m index f92241d9..b6b01146 100644 --- a/Autoupdate/SPUXarDeltaArchive.m +++ b/Autoupdate/SPUXarDeltaArchive.m @@ -17,17 +17,9 @@ #include "AppKitPrevention.h" -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000 - #define HAS_XAR_GET_SAFE_PATH 1 -#else - #define HAS_XAR_GET_SAFE_PATH 0 -#endif - -#if HAS_XAR_GET_SAFE_PATH // This is preferred over xar_get_path (which is deprecated) when it's available // Don't use OS availability for this API extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import)); -#endif // Xar attribute keys #define BINARY_DELTA_ATTRIBUTES_KEY "binary-delta-attributes" @@ -92,12 +84,6 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import)); } } -// This indicates if safe extraction is available at compile time (SDK), but not if it's available at runtime. -+ (BOOL)maySupportSafeExtraction -{ - return HAS_XAR_GET_SAFE_PATH; -} - - (nullable SPUDeltaArchiveHeader *)readHeader { NSString *patchFile = _patchFile; @@ -323,7 +309,6 @@ static xar_file_t xarAddFile(NSMutableDictionary *fileTab xar_iter_t iter = xar_iter_new(); for (xar_file_t file = xar_file_first(_x, iter); file; file = xar_file_next(iter)) { char *pathCString; -#if HAS_XAR_GET_SAFE_PATH #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunguarded-availability-new" if (xar_get_safe_path != NULL) { @@ -331,7 +316,6 @@ static xar_file_t xarAddFile(NSMutableDictionary *fileTab } #pragma clang diagnostic pop else -#endif { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" diff --git a/Autoupdate/SUBinaryDeltaApply.m b/Autoupdate/SUBinaryDeltaApply.m index 3cbc5cb7..ac19136b 100644 --- a/Autoupdate/SUBinaryDeltaApply.m +++ b/Autoupdate/SUBinaryDeltaApply.m @@ -72,7 +72,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa // Reject patches that did not generate valid hierarchical xar container paths // These will not succeed to patch using recent versions of BinaryDelta - if ([[archive class] maySupportSafeExtraction] && majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) { + if (majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) { if (error != NULL) { *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"This patch version (%u.%u) is too old and potentially unsafe to apply. Please re-generate the patch using the latest version of BinaryDelta or generate_appcast. New version %u.%u patches will still be compatible with older versions of Sparkle.", majorDiffVersion, minorDiffVersion, majorDiffVersion, latestMinorVersionForMajorVersion(majorDiffVersion)] }]; } diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index fc56a979..fb73bd28 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -28,12 +28,6 @@ */ static const NSTimeInterval SUTerminationTimeDelay = 0.3; -#if __MAC_OS_X_VERSION_MAX_ALLOWED < 140000 -@interface NSApplication (ActivationAPIs) -- (void)activate; -@end -#endif - @interface InstallerProgressAppController () @end diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index 0b658057..355096ec 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -35,12 +35,6 @@ #import -#if __MAC_OS_X_VERSION_MAX_ALLOWED < 140000 -@interface NSApplication (ActivationAPIs) -- (void)activate; -@end -#endif - // Delay before we need to show the checking for updates progress window when user initiates an update check static const NSTimeInterval SUShowCheckingForUpdatesTimeDelay = 0.3;