From 49f0ed06eead2fe473f5d04f6129324df0268bf8 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 28 Jul 2009 21:04:01 +0000 Subject: [PATCH] * A more scalable way of initializing the LED items to NULL. * Tiny coding style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31861 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/input/usb_hid/KeyboardDevice.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp index ca56378ff5..fd3c4a5fd7 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp @@ -98,7 +98,9 @@ KeyboardDevice::KeyboardDevice(HIDReport *inputReport, HIDReport *outputReport) } // find leds if we have an output report - fLEDs[0] = fLEDs[1] = fLEDs[2] = NULL; + for (uint32 i = 0; i < MAX_LEDS; i++) + fLEDs[i] = NULL; + if (outputReport != NULL) { for (uint32 i = 0; i < outputReport->CountItems(); i++) { HIDReportItem *item = outputReport->ItemAt(i); @@ -554,8 +556,8 @@ KeyboardDevice::_ReadReport(bigtime_t timeout) uint16 *compare = fCurrentKeys; for (int32 twice = 0; twice < 2; twice++) { for (size_t i = 0; i < fKeyCount; i++) { - if (current[i] == 0 || (current[i] == 1 && - fKeys[i]->UsagePage() == HID_USAGE_PAGE_KEYBOARD)) + if (current[i] == 0 || (current[i] == 1 + && fKeys[i]->UsagePage() == HID_USAGE_PAGE_KEYBOARD)) continue; bool found = false;