Skip to content

Commit

Permalink
Replace OSDynamicCast with C-style cast to avoid panic
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen-zen committed Sep 13, 2020
1 parent 6870082 commit 8b680d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions VoodooPS2Keyboard/VoodooPS2Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ IORegistryEntry* ApplePS2Keyboard::getDevicebyAddress(IORegistryEntry *parent, i
IORegistryEntry* dev;
int addr;
while ((dev = (IORegistryEntry*)iter->getNextObject())) {
auto location = dev->getLocation();
// The device need to be present in ACPI scope and follow the naming convention ('A'-'Z', '_')
auto name = dev->getName();
auto location = dev->getLocation();
// The device need to be present in ACPI scope and follow the naming convention ('A'-'Z', '_')
auto name = dev->getName();
if (location && name && name [0] <= '_' &&
sscanf(dev->getLocation(), "%x", &addr) == 1 && addr == address) {
child = dev;
Expand All @@ -383,7 +383,7 @@ IOACPIPlatformDevice* ApplePS2Keyboard::getBrightnessPanel() {
auto path = OSDynamicCast(OSString, dev->getProperty("acpi-path"));
if (path != nullptr) {
auto p = IORegistryEntry::fromPath(path->getCStringNoCopy());
auto r = OSDynamicCast(IOACPIPlatformDevice, p);
auto r = (IOACPIPlatformDevice*)p;
if (r) return r;
OSSafeRelease(p);
}
Expand Down Expand Up @@ -924,7 +924,7 @@ void ApplePS2Keyboard::setParamPropertiesGated(OSDictionary * dict)
xml = OSDynamicCast(OSBoolean, dict->getObject(kUseISOLayoutKeyboard));
if (xml) {
if (xml->isTrue()) {
_PS2ToADBMap[0x29] = _PS2ToADBMapMapped[0x56]; //Europe2 '¤º'
_PS2ToADBMap[0x29] = _PS2ToADBMapMapped[0x56]; //Europe2 ''
_PS2ToADBMap[0x56] = _PS2ToADBMapMapped[0x29]; //Grave '~'
}
else {
Expand Down

0 comments on commit 8b680d1

Please sign in to comment.