Skip to content

Commit 81b2428

Browse files
committed
Appropriately cast inside +stringForKeycode:
This avoids callers from warnings or errors when compiled with CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
1 parent 1d77421 commit 81b2428

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

DGGKeyCodeTranslater.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828

2929
@interface DGGKeyCodeTranslater : NSObject
3030

31-
+ (NSString *)stringForKeycode:(unsigned short)keycode;
31+
+ (NSString *)stringForKeycode:(NSUInteger)keycode;
3232

3333
@end

DGGKeyCodeTranslater.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030

3131
@implementation DGGKeyCodeTranslater
3232

33-
+ (NSString *)stringForKeycode:(unsigned short)keycode
33+
+ (NSString *)stringForKeycode:(NSUInteger)keycode
3434
{
3535
TISInputSourceRef keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
3636
CFDataRef uchr = TISGetInputSourceProperty(keyboardLayout , kTISPropertyUnicodeKeyLayoutData);
3737
UniCharCount maxStringLength = 4;
3838
UniCharCount actualStringLength = 0;
3939
UniChar outChar[4];
4040
UInt32 deadKeyState;
41-
OSStatus result = UCKeyTranslate((const UCKeyboardLayout *)CFDataGetBytePtr(uchr), keycode, kUCKeyActionDisplay, 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, maxStringLength, &actualStringLength, outChar);
41+
OSStatus result = UCKeyTranslate((const UCKeyboardLayout *)CFDataGetBytePtr(uchr), (UInt16)keycode, kUCKeyActionDisplay, 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, maxStringLength, &actualStringLength, outChar);
4242
if (result != noErr)
4343
return nil;
4444

0 commit comments

Comments
 (0)