diff options
author | David Robillard <d@drobilla.net> | 2017-12-25 15:26:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-12-25 16:26:13 -0500 |
commit | 15b3b0e9f8823752f80c7e597a70749813e61c79 (patch) | |
tree | 3f324c6e2a455be8b929456dadbf06520889d435 /src/client | |
parent | d6a9571641bcb34acb3521feb08eea33195fd9ca (diff) | |
download | ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.tar.gz ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.tar.bz2 ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.zip |
Always use braces
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/BlockModel.cpp | 21 | ||||
-rw-r--r-- | src/client/ClientStore.cpp | 21 | ||||
-rw-r--r-- | src/client/GraphModel.cpp | 5 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 3 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 19 |
5 files changed, 45 insertions, 24 deletions
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index a5f2eef0..95819c1e 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -143,9 +143,11 @@ BlockModel::add_port(SPtr<PortModel> pm) SPtr<const PortModel> BlockModel::get_port(const Raul::Symbol& symbol) const { - for (auto p : _ports) - if (p->symbol() == symbol) + for (auto p : _ports) { + if (p->symbol() == symbol) { return p; + } + } return SPtr<PortModel>(); } @@ -183,10 +185,12 @@ BlockModel::default_port_value_range(SPtr<const PortModel> port, _min_values, _max_values, nullptr); } - if (!std::isnan(_min_values[port->index()])) + if (!std::isnan(_min_values[port->index()])) { min = _min_values[port->index()]; - if (!std::isnan(_max_values[port->index()])) + } + if (!std::isnan(_max_values[port->index()])) { max = _max_values[port->index()]; + } } if (port->port_property(_uris.lv2_sampleRate)) { @@ -208,13 +212,16 @@ BlockModel::port_value_range(SPtr<const PortModel> port, // Possibly overriden const Atom& min_atom = port->get_property(_uris.lv2_minimum); const Atom& max_atom = port->get_property(_uris.lv2_maximum); - if (min_atom.type() == _uris.forge.Float) + if (min_atom.type() == _uris.forge.Float) { min = min_atom.get<float>(); - if (max_atom.type() == _uris.forge.Float) + } + if (max_atom.type() == _uris.forge.Float) { max = max_atom.get<float>(); + } - if (max <= min) + if (max <= min) { max = min + 1.0; + } if (port->port_property(_uris.lv2_sampleRate)) { min *= srate; diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index c5749388..e91277d9 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -80,8 +80,9 @@ ClientStore::add_object(SPtr<ObjectModel> object) } } - for (auto p : object->properties()) + for (auto p : object->properties()) { object->signal_property().emit(p.first, p.second); + } } SPtr<ObjectModel> @@ -400,21 +401,26 @@ ClientStore::connection_graph(const Raul::Path& tail_path, { SPtr<GraphModel> graph; - if (tail_path.parent() == head_path.parent()) + if (tail_path.parent() == head_path.parent()) { graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent())); + } - if (!graph && tail_path.parent() == head_path.parent().parent()) + if (!graph && tail_path.parent() == head_path.parent().parent()) { graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent())); + } - if (!graph && tail_path.parent().parent() == head_path.parent()) + if (!graph && tail_path.parent().parent() == head_path.parent()) { graph = dynamic_ptr_cast<GraphModel>(_object(head_path.parent())); + } - if (!graph) + if (!graph) { graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent().parent())); + } - if (!graph) + if (!graph) { _log.error(fmt("Unable to find graph for arc %1% => %2%\n") % tail_path % head_path); + } return graph; } @@ -450,8 +456,9 @@ ClientStore::operator()(const Disconnect& msg) SPtr<PortModel> tail = dynamic_ptr_cast<PortModel>(_object(msg.tail)); SPtr<PortModel> head = dynamic_ptr_cast<PortModel>(_object(msg.head)); SPtr<GraphModel> graph = connection_graph(msg.tail, msg.head); - if (graph) + if (graph) { graph->remove_arc(tail.get(), head.get()); + } } void diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index d02a3736..e9fce5c4 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -100,10 +100,11 @@ SPtr<ArcModel> GraphModel::get_arc(const Node* tail, const Node* head) { Arcs::iterator i = _arcs.find(make_pair(tail, head)); - if (i != _arcs.end()) + if (i != _arcs.end()) { return dynamic_ptr_cast<ArcModel>(i->second); - else + } else { return SPtr<ArcModel>(); + } } /** Add a connection to this graph. diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 9c46f55f..5aee03ce 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -78,8 +78,9 @@ void ObjectModel::set(SPtr<ObjectModel> o) { assert(_path == o->path()); - if (o->_parent) + if (o->_parent) { _parent = o->_parent; + } for (auto v : o->properties()) { Resource::set_property(v.first, v.second); diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 91bda703..42422b12 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -97,8 +97,9 @@ PluginModel::get_property(const Raul::URI& key) const { static const Atom nil; const Atom& val = Resource::get_property(key); - if (val.is_valid()) + if (val.is_valid()) { return val; + } // No lv2:symbol from data or engine, invent one if (key == _uris.lv2_symbol) { @@ -143,8 +144,9 @@ PluginModel::get_property(const Raul::URI& key) const } lilv_nodes_free(values); - if (ret) + if (ret) { return *ret; + } } return nil; @@ -155,8 +157,9 @@ PluginModel::set(SPtr<PluginModel> p) { _type = p->_type; - if (p->_lilv_plugin) + if (p->_lilv_plugin) { _lilv_plugin = p->_lilv_plugin; + } for (auto v : p->properties()) { Resource::set_property(v.first, v.second); @@ -177,20 +180,22 @@ Raul::Symbol PluginModel::default_block_symbol() const { const Atom& name_atom = get_property(_uris.lv2_symbol); - if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) + if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) { return Raul::Symbol::symbolify(name_atom.ptr<char>()); - else + } else { return Raul::Symbol("_"); + } } string PluginModel::human_name() const { const Atom& name_atom = get_property(_uris.doap_name); - if (name_atom.type() == _uris.forge.String) + if (name_atom.type() == _uris.forge.String) { return name_atom.ptr<char>(); - else + } else { return default_block_symbol().c_str(); + } } string |