From e533b597597b9e80e413aeccc3926466fb6d4aa8 Mon Sep 17 00:00:00 2001 From: Rose Date: Sat, 21 Sep 2024 20:30:11 -0400 Subject: [PATCH 1/3] Modifier masks are NSUInteger --- Cocoa/KeyboardShortcutPrivateAPIs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cocoa/KeyboardShortcutPrivateAPIs.h b/Cocoa/KeyboardShortcutPrivateAPIs.h index 8ce0b9192..1a37caf45 100644 --- a/Cocoa/KeyboardShortcutPrivateAPIs.h +++ b/Cocoa/KeyboardShortcutPrivateAPIs.h @@ -4,10 +4,10 @@ @interface NSKeyboardShortcut : NSObject + (id)shortcutWithPreferencesEncoding:(NSString *)encoding; -+ (id)shortcutWithKeyEquivalent:(NSString *)key_equivalent modifierMask:(unsigned long long)mask; -- (id)initWithKeyEquivalent:(NSString *)key_equivalent modifierMask:(unsigned long long)mask; ++ (id)shortcutWithKeyEquivalent:(NSString *)key_equivalent modifierMask:(NSUInteger)mask; +- (id)initWithKeyEquivalent:(NSString *)key_equivalent modifierMask:(NSUInteger)mask; -@property(readonly) unsigned long long modifierMask; +@property(readonly) NSUInteger modifierMask; @property(readonly) NSString *keyEquivalent; @property(readonly) NSString *preferencesEncoding; @property(readonly) NSString *localizedModifierMaskDisplayName; From 7e5996df825f656133348abdb91e4edb2041ee29 Mon Sep 17 00:00:00 2001 From: Rose Date: Sun, 22 Sep 2024 15:54:26 -0400 Subject: [PATCH 2/3] Fix some clang-tidy warnings - Use nil, not NULL for objects - Call Objective-C release instead of CFRelease (unless like we are hacking around ARC, which we are not) - xpc_release to release xpc objects. --- Cocoa/GBTerminalTextFieldCell.m | 2 +- HexFiend/HFPasteboardOwner.m | 2 +- iOS/GBViewController.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cocoa/GBTerminalTextFieldCell.m b/Cocoa/GBTerminalTextFieldCell.m index a6f76a4bb..f704a191f 100644 --- a/Cocoa/GBTerminalTextFieldCell.m +++ b/Cocoa/GBTerminalTextFieldCell.m @@ -45,7 +45,7 @@ - (instancetype)init { self = [super init]; if (!self) { - return NULL; + return nil; } lines = [[NSMutableOrderedSet alloc] init]; return self; diff --git a/HexFiend/HFPasteboardOwner.m b/HexFiend/HFPasteboardOwner.m index 0ca341d63..5140fc678 100755 --- a/HexFiend/HFPasteboardOwner.m +++ b/HexFiend/HFPasteboardOwner.m @@ -44,7 +44,7 @@ - (void)tearDownPasteboardReferenceIfExists { [[NSNotificationCenter defaultCenter] removeObserver:self name:HFPrepareForChangeInFileNotification object:nil]; } if (retainedSelfOnBehalfOfPboard) { - CFRelease(self); + [self release]; retainedSelfOnBehalfOfPboard = NO; } } diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m index 1b7a82a7a..1bf2f2bac 100644 --- a/iOS/GBViewController.m +++ b/iOS/GBViewController.m @@ -612,7 +612,7 @@ - (void)verifyEntitlements const char *_teamIdentifier = xpc_dictionary_get_string(entitlements, "com.apple.developer.team-identifier"); NSString *teamIdentifier = _teamIdentifier? @(_teamIdentifier) : nil; - CFRelease(entitlements); + xpc_release(entitlements); if (!entIdentifier) { // No identifier. Installed using a jailbreak, we're fine. return; From 741637e625529af8886f769e4810b5faddecae87 Mon Sep 17 00:00:00 2001 From: Rose Date: Sun, 22 Sep 2024 16:05:30 -0400 Subject: [PATCH 3/3] Remove xpc_release for ARC xpc objects are handled by ARC. --- iOS/GBViewController.m | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m index 1bf2f2bac..439040b02 100644 --- a/iOS/GBViewController.m +++ b/iOS/GBViewController.m @@ -612,13 +612,10 @@ - (void)verifyEntitlements const char *_teamIdentifier = xpc_dictionary_get_string(entitlements, "com.apple.developer.team-identifier"); NSString *teamIdentifier = _teamIdentifier? @(_teamIdentifier) : nil; - xpc_release(entitlements); - if (!entIdentifier) { // No identifier. Installed using a jailbreak, we're fine. return; } - - + if (teamIdentifier && [entIdentifier hasPrefix:[teamIdentifier stringByAppendingString:@"."]]) { entIdentifier = [entIdentifier substringFromIndex:teamIdentifier.length + 1]; }