diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-12-15 01:05:33 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-12-15 01:57:06 +0100 |
commit | 0471998e13aada9a76e92b13ab3885c2d1c2fb84 (patch) | |
tree | 776d15ab92ef044956940bc2228b61256ca4feb9 | |
parent | 63b858b5d827797eec959d009ad0b970de167dc5 (diff) |
Add missing braces around single-line statements
87 files changed, 681 insertions, 318 deletions
diff --git a/src/broadcast/broadcastmanager.cpp b/src/broadcast/broadcastmanager.cpp index 2456559ffc..7b62c351d7 100644 --- a/src/broadcast/broadcastmanager.cpp +++ b/src/broadcast/broadcastmanager.cpp @@ -152,8 +152,9 @@ void BroadcastManager::slotProfilesChanged() { } bool BroadcastManager::addConnection(BroadcastProfilePtr profile) { - if (!profile) + if (!profile) { return false; + } if (findConnectionForProfile(profile).isNull() == false) { return false; @@ -173,8 +174,9 @@ bool BroadcastManager::addConnection(BroadcastProfilePtr profile) { } bool BroadcastManager::removeConnection(BroadcastProfilePtr profile) { - if (!profile) + if (!profile) { return false; + } ShoutConnectionPtr connection = findConnectionForProfile(profile); if (connection) { @@ -199,8 +201,9 @@ ShoutConnectionPtr BroadcastManager::findConnectionForProfile(BroadcastProfilePt QVector<NetworkOutputStreamWorkerPtr> workers = m_pNetworkStream->outputWorkers(); for (const NetworkOutputStreamWorkerPtr& pWorker : workers) { ShoutConnectionPtr connection = qSharedPointerCast<ShoutConnection>(pWorker); - if (connection.isNull()) + if (connection.isNull()) { continue; + } if (connection->profile() == profile) { return connection; diff --git a/src/controllers/bulk/bulkcontroller.cpp b/src/controllers/bulk/bulkcontroller.cpp index 76b0afdd34..f8b91e4494 100644 --- a/src/controllers/bulk/bulkcontroller.cpp +++ b/src/controllers/bulk/bulkcontroller.cpp @@ -126,9 +126,13 @@ bool BulkController::matchProductInfo(const ProductInfo& product) { bool ok; // Product and vendor match is always required value = product.vendor_id.toInt(&ok, 16); - if (!ok || vendor_id!=value) return false; + if (!ok || vendor_id != value) { + return false; + } value = product.product_id.toInt(&ok, 16); - if (!ok || product_id!=value) return false; + if (!ok || product_id != value) { + return false; + } // Match found return true; diff --git a/src/controllers/controller.cpp b/src/controllers/controller.cpp index 8149dd88b0..876fcc673d 100644 --- a/src/controllers/controller.cpp +++ b/src/controllers/controller.cpp @@ -120,8 +120,12 @@ void Controller::receive(const QByteArray& data, mixxx::Duration timestamp) { QString::number(length)); for(int i=0; i<length; i++) { QString spacer=" "; - if ((i+1) % 4 == 0) spacer=" "; - if ((i+1) % 16 == 0) spacer="\n"; + if ((i + 1) % 4 == 0) { + spacer = " "; + } + if ((i + 1) % 16 == 0) { + spacer = "\n"; + } message += QString("%1%2") .arg((unsigned char)(data.at(i)), 2, 16, QChar('0')).toUpper() .arg(spacer); diff --git a/src/controllers/controllerpresetfilehandler.cpp b/src/controllers/controllerpresetfilehandler.cpp index cfec632695..55151d1858 100644 --- a/src/controllers/controllerpresetfilehandler.cpp +++ b/src/controllers/controllerpresetfilehandler.cpp @@ -116,8 +116,9 @@ void ControllerPresetFileHandler::addScriptFilesToPreset( const QDomElement& controller, ControllerPreset* preset, const QDir& systemPresetsPath) const { - if (controller.isNull()) + if (controller.isNull()) { return; + } QString deviceId = controller.attribute("id", ""); preset->setDeviceId(deviceId); diff --git a/src/controllers/controllerpresetinfo.cpp b/src/controllers/controllerpresetinfo.cpp index 34f075de5b..b519330acb 100644 --- a/src/controllers/controllerpresetinfo.cpp +++ b/src/controllers/controllerpresetinfo.cpp @@ -47,16 +47,24 @@ PresetInfo::PresetInfo(const QString& preset_path) } QDomElement dom_author = info.firstChildElement("author"); - if (!dom_author.isNull()) m_author = dom_author.text(); + if (!dom_author.isNull()) { + m_author = dom_author.text(); + } QDomElement dom_description = info.firstChildElement("description"); - if (!dom_description.isNull()) m_description = dom_description.text(); + if (!dom_description.isNull()) { + m_description = dom_description.text(); + } QDomElement dom_forums = info.firstChildElement("forums"); - if (!dom_forums.isNull()) m_forumlink = dom_forums.text(); + if (!dom_forums.isNull()) { + m_forumlink = dom_forums.text(); + } QDomElement dom_wiki = info.firstChildElement("wiki"); - if (!dom_wiki.isNull()) m_wikilink = dom_wiki.text(); + if (!dom_wiki.isNull()) { + m_wikilink = dom_wiki.text(); + } QDomElement devices = info.firstChildElement("devices"); if (!devices.isNull()) { diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp index bdbd148287..64ba02bd85 100644 --- a/src/controllers/dlgprefcontroller.cpp +++ b/src/controllers/dlgprefcontroller.cpp @@ -205,8 +205,9 @@ QString DlgPrefController::presetName( const ControllerPresetPointer pPreset) const { if (pPreset) { QString name = pPreset->name(); - if (name.length() > 0) + if (name.length() > 0) { return name; + } } return tr("No Name"); } @@ -215,8 +216,9 @@ QString DlgPrefController::presetDescription( const ControllerPresetPointer pPreset) const { if (pPreset) { QString description = pPreset->description(); - if (description.length() > 0) + if (description.length() > 0) { return description; + } } return tr("No Description"); } @@ -225,8 +227,9 @@ QString DlgPrefController::presetAuthor( const ControllerPresetPointer pPreset) const { if (pPreset) { QString author = pPreset->author(); - if (author.length() > 0) + if (author.length() > 0) { return author; + } } return tr("No Author"); } @@ -236,8 +239,9 @@ QString DlgPrefController::presetForumLink( QString url; if (pPreset) { QString link = pPreset->forumlink(); - if (link.length() > 0) + if (link.length() > 0) { url = "<a href=\"" + link + "\">Mixxx Forums</a>"; + } } return url; } @@ -247,8 +251,9 @@ QString DlgPrefController::presetWikiLink( QString url; if (pPreset) { QString link = pPreset->wikilink(); - if (link.length() > 0) + if (link.length() > 0) { url = "<a href=\"" + link + "\">Mixxx Wiki</a>"; + } } return url; } 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; } diff --git a/src/controllers/keyboard/keyboardeventfilter.cpp b/src/controllers/keyboard/keyboardeventfilter.cpp index 8722ab770e..254e4700f1 100644 --- a/src/controllers/keyboard/keyboardeventfilter.cpp +++ b/src/controllers/keyboard/keyboardeventfilter.cpp @@ -131,17 +131,21 @@ QKeySequence KeyboardEventFilter::getKeySeq(QKeyEvent* e) { // TODO(XXX) check if we may simply return QKeySequence(e->modifiers()+e->key()) - if (e->modifiers() & Qt::ShiftModifier) + if (e->modifiers() & Qt::ShiftModifier) { modseq += "Shift+"; + } - if (e->modifiers() & Qt::ControlModifier) + if (e->modifiers() & Qt::ControlModifier) { modseq += "Ctrl+"; + } - if (e->modifiers() & Qt::AltModifier) + if (e->modifiers() & Qt::AltModifier) { modseq += "Alt+"; + } - if (e->modifiers() & Qt::MetaModifier) + if (e->modifiers() & Qt::MetaModifier) { modseq += "Meta+"; + } if (e->key() >= 0x01000020 && e->key() <= 0x01000023) { // Do not act on Modifier only diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp index d767dd002a..1aa4c75b97 100644 --- a/src/controllers/midi/midicontroller.cpp +++ b/src/controllers/midi/midicontroller.cpp @@ -371,14 +371,16 @@ double MidiController::computeValue( if (options.rot64 || options.rot64_inv) { tempval = prevmidivalue; diff = newmidivalue - 64.; - if (diff == -1 || diff == 1) + if (diff == -1 || diff == 1) { diff /= 16; - else + } else { diff += (diff > 0 ? -1 : +1); - if (options.rot64) + } + if (options.rot64) { tempval += diff; - else + } else { tempval -= diff; + } return (tempval < 0. ? 0. : (tempval > 127. ? 127.0 : tempval)); } |