summaryrefslogtreecommitdiffstats
path: root/src/controllers/hid
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-15 01:05:33 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-15 01:57:06 +0100
commit0471998e13aada9a76e92b13ab3885c2d1c2fb84 (patch)
tree776d15ab92ef044956940bc2228b61256ca4feb9 /src/controllers/hid
parent63b858b5d827797eec959d009ad0b970de167dc5 (diff)
Add missing braces around single-line statements
Diffstat (limited to 'src/controllers/hid')
-rw-r--r--src/controllers/hid/hidcontroller.cpp23
-rw-r--r--src/controllers/hid/hidenumerator.cpp18
2 files changed, 29 insertions, 12 deletions
diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp
index 4ca0d444a8..b94eecc8cc 100644
--- a/src/controllers/hid/hidcontroller.cpp
+++ b/src/controllers/hid/hidcontroller.cpp
@@ -103,8 +103,9 @@ void HidController::visit(const HidControllerPreset* preset) {
bool HidController::matchPreset(const PresetInfo& preset) {
const QList<ProductInfo>& products = preset.getProducts();
for (const auto& product : products) {
- if (matchProductInfo(product))
+ if (matchProductInfo(product)) {
return true;
+ }
}
return false;
}
@@ -114,20 +115,30 @@ bool HidController::matchProductInfo(const ProductInfo& product) {
bool ok;
// Product and vendor match is always required
value = product.vendor_id.toInt(&ok,16);
- if (!ok || hid_vendor_id!=value) return false;
+ if (!ok || hid_vendor_id != value) {
+ return false;
+ }
value = product.product_id.toInt(&ok,16);
- if (!ok || hid_product_id!=value) return false;
+ if (!ok || hid_product_id != value) {
+ return false;
+ }
// Optionally check against interface_number / usage_page && usage
if (hid_interface_number!=-1) {
value = product.interface_number.toInt(&ok,16);
- if (!ok || hid_interface_number!=value) return false;
+ if (!ok || hid_interface_number != value) {
+ return false;
+ }
} else {
value = product.usage_page.toInt(&ok,16);
- if (!ok || hid_usage_page!=value) return false;
+ if (!ok || hid_usage_page != value) {
+ return false;
+ }
value = product.usage.toInt(&ok,16);
- if (!ok || hid_usage!=value) return false;
+ if (!ok || hid_usage != value) {
+ return false;
+ }
}
// Match found
return true;
diff --git a/src/controllers/hid/hidenumerator.cpp b/src/controllers/hid/hidenumerator.cpp
index 330425f4d9..d88b4baebb 100644
--- a/src/controllers/hid/hidenumerator.cpp
+++ b/src/controllers/hid/hidenumerator.cpp
@@ -13,16 +13,19 @@ bool recognizeDevice(const hid_device_info& device_info) {
for (int bl_index = 0; bl_index < denylist_len; bl_index++) {
hid_denylist_t denylisted = hid_denylisted[bl_index];
// If vendor ids do not match, skip.
- if (device_info.vendor_id != denylisted.vendor_id)
+ if (device_info.vendor_id != denylisted.vendor_id) {
continue;
+ }
// If product IDs do not match, skip.
- if (device_info.product_id != denylisted.product_id)
+ if (device_info.product_id != denylisted.product_id) {
continue;
+ }
// Denylist entry based on interface number
if (denylisted.interface_number != -1) {
// Skip matching for devices without usage info.
- if (!interface_number_valid)
+ if (!interface_number_valid) {
continue;
+ }
// If interface number is present and the interface numbers do not
// match, skip.
if (device_info.interface_number != denylisted.interface_number) {
@@ -32,14 +35,17 @@ bool recognizeDevice(const hid_device_info& device_info) {
// Denylist entry based on usage_page and usage (both required)
if (denylisted.usage_page != 0 && denylisted.usage != 0) {
// Skip matching for devices with no usage_page/usage info.
- if (device_info.usage_page == 0 && device_info.usage == 0)
+ if (device_info.usage_page == 0 && device_info.usage == 0) {
continue;
+ }
// If usage_page is different, skip.
- if (device_info.usage_page != denylisted.usage_page)
+ if (device_info.usage_page != denylisted.usage_page) {
continue;
+ }
// If usage is different, skip.
- if (device_info.usage != denylisted.usage)
+ if (device_info.usage != denylisted.usage) {
continue;
+ }
}
return false;
}