Skip to content

Commit

Permalink
Semantic fixes for macOS Big Sur 11.1
Browse files Browse the repository at this point in the history
Signed-off-by: black.dragon74 <[email protected]>
  • Loading branch information
black-dragon74 committed Dec 16, 2020
1 parent 2eaacc0 commit 3a3cc38
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
18 changes: 13 additions & 5 deletions ROG-HID-Driver/ROG_HID_Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void IMPL(ROG_HID_Driver, initLuxQueue)

// PrimaryUsagePage is a 16bit number in native byte order
kbdUsagePage = OSDynamicCast(OSNumber, usagePageProp);
if (!kbdUsagePage)
if (kbdUsagePage == nullptr)
{
DBGLOG("Dynamic cast to OSNumber failed.");
goto exit;
Expand Down Expand Up @@ -406,21 +406,29 @@ void IMPL(ROG_HID_Driver, initLuxQueue)
void IMPL(ROG_HID_Driver, parseInfoPlist)
{
DBGLOG("Parse custom Info.plist properties");
OSContainer* propContainer;
OSContainer* propContainer{nullptr};
OSNumber* containerVal{nullptr};

SearchProperty("FixCapsLockLED", "IOService", kIOServiceSearchPropertyParents, &propContainer);
if (!propContainer)
goto exit;

ivars->fixCapsLockLED = OSDynamicCast(OSNumber, propContainer)->unsigned8BitValue() == kBooleanTrue;
containerVal = OSDynamicCast(OSNumber, propContainer);
if (containerVal == nullptr)
goto exit;

ivars->fixCapsLockLED = containerVal->unsigned8BitValue() == kBooleanTrue;
DBGLOG("Fix caps lock led: %s", ivars->fixCapsLockLED ? "True" : "False");

propContainer = nullptr;
SearchProperty("BacklightAutoTurnOff", "IOService", kIOServiceSearchPropertyParents, &propContainer);
if (!propContainer)
goto exit;

ivars->bkltAutoTurnOff = OSDynamicCast(OSNumber, propContainer)->unsigned8BitValue() == kBooleanTrue;
containerVal = OSDynamicCast(OSNumber, propContainer);
if (containerVal == nullptr)
goto exit;

ivars->bkltAutoTurnOff = containerVal->unsigned8BitValue() == kBooleanTrue;
DBGLOG("Backlight auto turn off: %s", ivars->bkltAutoTurnOff ? "True" : "False");

exit:
Expand Down
8 changes: 7 additions & 1 deletion ROG-HID.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1160;
LastUpgradeCheck = 1160;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = Nick;
TargetAttributes = {
0118C98524C60E4500C1C663 = {
Expand Down Expand Up @@ -330,6 +330,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -390,6 +391,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -470,6 +472,9 @@
0118C9B324C6121600C1C663 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_DEADCODE_DEADSTORES = NO;
CLANG_ANALYZER_DIVIDE_BY_ZERO = NO;
CLANG_ANALYZER_NULL_DEREFERENCE = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "";
Expand All @@ -486,6 +491,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.black-dragon74.ROG-HID-Driver";
PRODUCT_NAME = "$(inherited)";
PROVISIONING_PROFILE_SPECIFIER = "";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = driverkit;
SKIP_INSTALL = YES;
};
Expand Down

0 comments on commit 3a3cc38

Please sign in to comment.