From 0f47ee4d5d373938b14f76c44feab4be53eecdc5 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Sun, 23 Jan 2022 14:47:11 +0800 Subject: [PATCH 1/3] Upgrade SwiftFormat --- BuildTools/Package.resolved | 4 ++-- BuildTools/Package.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BuildTools/Package.resolved b/BuildTools/Package.resolved index b1a975b..fd1fd93 100644 --- a/BuildTools/Package.resolved +++ b/BuildTools/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/nicklockwood/SwiftFormat", "state": { "branch": null, - "revision": "872e7034f54aeee3f20acf790ecc13e1383f7360", - "version": "0.48.4" + "revision": "415c08ce2d63ff8bca95228939c92375882ea538", + "version": "0.49.2" } } ] diff --git a/BuildTools/Package.swift b/BuildTools/Package.swift index b70f6c1..3ae99ad 100644 --- a/BuildTools/Package.swift +++ b/BuildTools/Package.swift @@ -5,7 +5,7 @@ let package = Package( name: "BuildTools", platforms: [.macOS(.v10_11)], dependencies: [ - .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.48.4"), + .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.49.2"), ], targets: [.target(name: "BuildTools", path: "")] ) From 6ab03a61899a3c2dc4ee0f794365929d8a52ef14 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Sun, 23 Jan 2022 14:47:30 +0800 Subject: [PATCH 2/3] Update project file --- eul.xcodeproj/project.pbxproj | 4 +++- eul.xcodeproj/xcshareddata/xcschemes/eul.xcscheme | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/eul.xcodeproj/project.pbxproj b/eul.xcodeproj/project.pbxproj index 0ca0819..7238340 100644 --- a/eul.xcodeproj/project.pbxproj +++ b/eul.xcodeproj/project.pbxproj @@ -1181,7 +1181,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1240; - LastUpgradeCheck = 1220; + LastUpgradeCheck = 1320; ORGANIZATIONNAME = "Gao Sun"; TargetAttributes = { 6C2688ED2556762B00FB7306 = { @@ -2106,6 +2106,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = SelfUpdate/SelfUpdate.entitlements; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_ASSET_PATHS = "\"SelfUpdate/Preview Content\""; @@ -2130,6 +2131,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = SelfUpdate/SelfUpdate.entitlements; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_ASSET_PATHS = "\"SelfUpdate/Preview Content\""; diff --git a/eul.xcodeproj/xcshareddata/xcschemes/eul.xcscheme b/eul.xcodeproj/xcshareddata/xcschemes/eul.xcscheme index eff3a47..956ea29 100644 --- a/eul.xcodeproj/xcshareddata/xcschemes/eul.xcscheme +++ b/eul.xcodeproj/xcshareddata/xcschemes/eul.xcscheme @@ -1,6 +1,6 @@ Date: Sun, 23 Jan 2022 15:13:27 +0800 Subject: [PATCH 3/3] Use throw to assert `SMCParamStruct` size --- eul/Utilities/SMC.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eul/Utilities/SMC.swift b/eul/Utilities/SMC.swift index c186ea4..9f567c7 100644 --- a/eul/Utilities/SMC.swift +++ b/eul/Utilities/SMC.swift @@ -296,6 +296,9 @@ public enum SMCKit { /// - parameter kIOReturn: I/O Kit error code /// - parameter SMCResult: SMC specific return code case unknown(kIOReturn: kern_return_t, SMCResult: UInt8) + + /// SMCParamStruct size is not desired + case paramStructSizeMismatched } /// Connection to the SMC driver @@ -380,7 +383,9 @@ public enum SMCKit { selector: SMCParamStruct.Selector = .kSMCHandleYPCEvent) throws -> SMCParamStruct { - assert(MemoryLayout.stride == 80, "SMCParamStruct size is != 80") + guard MemoryLayout.stride == 80 else { + throw SMCError.paramStructSizeMismatched + } var outputStruct = SMCParamStruct() let inputStructSize = MemoryLayout.stride