summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-18 01:22:18 -0400
committerDavid Robillard <d@drobilla.net>2022-08-18 01:22:18 -0400
commit3af246bb3291d8568f6d110884fa55ee5fd20221 (patch)
tree434ac316050356e4db379ba8305b75285b17bbba /src/server/events
parent44381dbda9dbf8d20894789fe8e3ea941b70a1d0 (diff)
downloadingen-3af246bb3291d8568f6d110884fa55ee5fd20221.tar.gz
ingen-3af246bb3291d8568f6d110884fa55ee5fd20221.tar.bz2
ingen-3af246bb3291d8568f6d110884fa55ee5fd20221.zip
Avoid "else" after "return", "break", and "continue"
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Copy.cpp18
-rw-r--r--src/server/events/CreateBlock.cpp15
-rw-r--r--src/server/events/CreateGraph.cpp6
-rw-r--r--src/server/events/CreatePort.cpp18
-rw-r--r--src/server/events/Delta.cpp9
-rw-r--r--src/server/events/Disconnect.cpp4
-rw-r--r--src/server/events/Get.cpp16
7 files changed, 59 insertions, 27 deletions
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index 7f92842e..beb5224c 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -79,19 +79,23 @@ Copy::pre_process(PreProcessContext& ctx)
if (uri_is_path(_msg.new_uri)) {
// Copy to path within the engine
return engine_to_engine(ctx);
- } else if (_msg.new_uri.scheme() == "file") {
+ }
+
+ if (_msg.new_uri.scheme() == "file") {
// Copy to filesystem path (i.e. save)
return engine_to_filesystem(ctx);
- } else {
- return Event::pre_process_done(Status::BAD_REQUEST);
}
- } else if (_msg.old_uri.scheme() == "file") {
+
+ return Event::pre_process_done(Status::BAD_REQUEST);
+ }
+
+ if (_msg.old_uri.scheme() == "file") {
if (uri_is_path(_msg.new_uri)) {
return filesystem_to_engine(ctx);
- } else {
- // Ingen is not your file manager
- return Event::pre_process_done(Status::BAD_REQUEST);
}
+
+ // Ingen is not your file manager
+ return Event::pre_process_done(Status::BAD_REQUEST);
}
return Event::pre_process_done(Status::BAD_URI);
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index 6d0dbe3e..23a0d35e 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -77,9 +77,13 @@ CreateBlock::pre_process(PreProcessContext& ctx)
// Check sanity of target path
if (_path.is_root()) {
return Event::pre_process_done(Status::BAD_URI, _path);
- } else if (store->get(_path)) {
+ }
+
+ if (store->get(_path)) {
return Event::pre_process_done(Status::EXISTS, _path);
- } else if (!(_graph = dynamic_cast<GraphImpl*>(store->get(_path.parent())))) {
+ }
+
+ if (!(_graph = dynamic_cast<GraphImpl*>(store->get(_path.parent())))) {
return Event::pre_process_done(Status::PARENT_NOT_FOUND, _path.parent());
}
@@ -115,8 +119,11 @@ CreateBlock::pre_process(PreProcessContext& ctx)
store->get(uri_to_path(prototype)));
if (!ancestor) {
return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype);
- } else if (!(_block = ancestor->duplicate(
- _engine, raul::Symbol(_path.symbol()), _graph))) {
+ }
+
+ if (!(_block = ancestor->duplicate(_engine,
+ raul::Symbol(_path.symbol()),
+ _graph))) {
return Event::pre_process_done(Status::CREATION_FAILED, _path);
}
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index 367bedfe..dc7c0d7d 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -167,8 +167,10 @@ CreateGraph::pre_process(PreProcessContext& ctx)
if (!ancestor) {
return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND,
prototype);
- } else if (!(_graph = dynamic_cast<GraphImpl*>(
- ancestor->duplicate(_engine, symbol, _parent)))) {
+ }
+
+ if (!(_graph = dynamic_cast<GraphImpl*>(
+ ancestor->duplicate(_engine, symbol, _parent)))) {
return Event::pre_process_done(Status::CREATION_FAILED, _path);
}
} else {
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 5ea9db33..6eee6ed7 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -94,9 +94,13 @@ CreatePort::pre_process(PreProcessContext&)
{
if (_port_type == PortType::UNKNOWN || !_flow) {
return Event::pre_process_done(Status::UNKNOWN_TYPE, _path);
- } else if (_path.is_root()) {
+ }
+
+ if (_path.is_root()) {
return Event::pre_process_done(Status::BAD_URI, _path);
- } else if (_engine.store()->get(_path)) {
+ }
+
+ if (_engine.store()->get(_path)) {
return Event::pre_process_done(Status::EXISTS, _path);
}
@@ -104,10 +108,14 @@ CreatePort::pre_process(PreProcessContext&)
Node* const parent = _engine.store()->get(parent_path);
if (!parent) {
return Event::pre_process_done(Status::PARENT_NOT_FOUND, parent_path);
- } else if (!(_graph = dynamic_cast<GraphImpl*>(parent))) {
+ }
+
+ if (!(_graph = dynamic_cast<GraphImpl*>(parent))) {
return Event::pre_process_done(Status::INVALID_PARENT, parent_path);
- } else if (!_graph->parent() && _engine.activated() &&
- !_engine.driver()->dynamic_ports()) {
+ }
+
+ if (!_graph->parent() && _engine.activated() &&
+ !_engine.driver()->dynamic_ports()) {
return Event::pre_process_done(Status::CREATION_FAILED, _path);
}
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 2c6a50c8..88826a23 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -155,12 +155,15 @@ get_file_node(LilvWorld* lworld, const URIs& uris, const Atom& value)
{
if (value.type() == uris.atom_Path) {
return lilv_new_file_uri(lworld, nullptr, value.ptr<char>());
- } else if (uris.forge.is_uri(value)) {
+ }
+
+ if (uris.forge.is_uri(value)) {
const std::string str = uris.forge.str(value, false);
if (str.substr(0, 5) == "file:") {
return lilv_new_uri(lworld, value.ptr<char>());
}
}
+
return nullptr;
}
@@ -205,9 +208,9 @@ Delta::pre_process(PreProcessContext& ctx)
if ((_preset = block->save_preset(_subject, _properties))) {
return Event::pre_process_done(Status::SUCCESS);
- } else {
- return Event::pre_process_done(Status::FAILURE);
}
+
+ return Event::pre_process_done(Status::FAILURE);
}
std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index b600df4f..c20ed9a8 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -158,7 +158,9 @@ Disconnect::pre_process(PreProcessContext& ctx)
if (!_graph) {
return Event::pre_process_done(Status::INTERNAL_ERROR, _msg.head);
- } else if (!_graph->has_arc(tail, head)) {
+ }
+
+ if (!_graph->has_arc(tail, head)) {
return Event::pre_process_done(Status::NOT_FOUND, _msg.head);
}
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index ff801c06..bd59e19d 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -58,9 +58,13 @@ Get::pre_process(PreProcessContext&)
if (uri == "ingen:/plugins") {
_plugins = _engine.block_factory()->plugins();
return Event::pre_process_done(Status::SUCCESS);
- } else if (uri == "ingen:/engine") {
+ }
+
+ if (uri == "ingen:/engine") {
return Event::pre_process_done(Status::SUCCESS);
- } else if (uri_is_path(uri)) {
+ }
+
+ if (uri_is_path(uri)) {
if ((_object = _engine.store()->get(uri_to_path(uri)))) {
const BlockImpl* block = nullptr;
const GraphImpl* graph = nullptr;
@@ -77,12 +81,14 @@ Get::pre_process(PreProcessContext&)
return Event::pre_process_done(Status::SUCCESS);
}
return Event::pre_process_done(Status::NOT_FOUND, uri);
- } else if ((_plugin = _engine.block_factory()->plugin(uri))) {
+ }
+
+ if ((_plugin = _engine.block_factory()->plugin(uri))) {
_response.put_plugin(_plugin);
return Event::pre_process_done(Status::SUCCESS);
- } else {
- return Event::pre_process_done(Status::NOT_FOUND, uri);
}
+
+ return Event::pre_process_done(Status::NOT_FOUND, uri);
}
void