summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-09-27 18:35:31 -0400
committerDavid Robillard <d@drobilla.net>2022-09-27 18:36:33 -0400
commit92cf4f1e48a90d8622f237a732b08487e0cde46c (patch)
tree9b9cdeeb50b14bf8d64e2c6e914573303a7cc61c /src
parent3ae3c86937c7ffc45d24e36a33560cd63ebb900b (diff)
downloadingen-92cf4f1e48a90d8622f237a732b08487e0cde46c.tar.gz
ingen-92cf4f1e48a90d8622f237a732b08487e0cde46c.tar.bz2
ingen-92cf4f1e48a90d8622f237a732b08487e0cde46c.zip
Use braced init lists to avoid repeating return types
Diffstat (limited to 'src')
-rw-r--r--src/AtomReader.cpp6
-rw-r--r--src/FilePath.cpp2
-rw-r--r--src/Forge.cpp2
-rw-r--r--src/Log.cpp2
-rw-r--r--src/Parser.cpp12
-rw-r--r--src/URI.cpp2
-rw-r--r--src/gui/PropertiesWindow.cpp2
-rw-r--r--src/runtime_paths.cpp8
-rw-r--r--src/server/BlockImpl.hpp2
-rw-r--r--src/server/BufferFactory.cpp8
-rw-r--r--src/server/LV2Block.cpp2
-rw-r--r--src/server/LV2Options.hpp2
-rw-r--r--src/server/SocketListener.cpp4
-rw-r--r--src/server/Worker.cpp2
14 files changed, 28 insertions, 28 deletions
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index 761c271b..ac52082f 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -83,7 +83,7 @@ boost::optional<URI>
AtomReader::atom_to_uri(const LV2_Atom* atom)
{
if (!atom) {
- return boost::optional<URI>();
+ return {};
}
if (atom->type == _uris.atom_URI) {
@@ -112,7 +112,7 @@ AtomReader::atom_to_uri(const LV2_Atom* atom)
_log.warn("Unknown URID %1%\n", str);
}
- return boost::optional<URI>();
+ return {};
}
boost::optional<raul::Path>
@@ -122,7 +122,7 @@ AtomReader::atom_to_path(const LV2_Atom* atom)
if (uri && uri_is_path(*uri)) {
return uri_to_path(*uri);
}
- return boost::optional<raul::Path>();
+ return {};
}
Resource::Graph
diff --git a/src/FilePath.cpp b/src/FilePath.cpp
index f8da196e..8cbd3a9e 100644
--- a/src/FilePath.cpp
+++ b/src/FilePath.cpp
@@ -105,7 +105,7 @@ FilePath::root_name()
}
#endif
- return FilePath();
+ return {};
}
FilePath
diff --git a/src/Forge.cpp b/src/Forge.cpp
index 6b8f7b14..abce74f2 100644
--- a/src/Forge.cpp
+++ b/src/Forge.cpp
@@ -35,7 +35,7 @@ Atom
Forge::make_urid(const ingen::URI& u)
{
const LV2_URID urid = _map.map_uri(u.string());
- return Atom(sizeof(int32_t), URID, &urid);
+ return {sizeof(int32_t), URID, &urid};
}
std::string
diff --git a/src/Log.cpp b/src/Log.cpp
index bc11fe3d..e05caa21 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -162,7 +162,7 @@ Log::Feature::feature(World& world, Node* block)
f->URI = LV2_LOG__log;
f->data = &handle->lv2_log;
- return std::shared_ptr<LV2_Feature>(f, &free_log_feature);
+ return {f, &free_log_feature};
}
} // namespace ingen
diff --git a/src/Parser.cpp b/src/Parser.cpp
index 6e0ee7a1..7b25031c 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -168,7 +168,7 @@ get_port(ingen::World& world,
|| i->second.type() != world.forge().Int
|| i->second.get<int32_t>() < 0) {
world.log().error("Port %1% has no valid index\n", subject);
- return boost::optional<PortRecord>();
+ return {};
}
*index = i->second.get<int32_t>();
}
@@ -189,7 +189,7 @@ get_port(ingen::World& world,
if (!raul::Symbol::is_valid(sym)) {
world.log().error("Port %1% has invalid symbol `%2%'\n", subject, sym);
- return boost::optional<PortRecord>();
+ return {};
}
const raul::Symbol port_sym(sym);
@@ -270,7 +270,7 @@ parse_block(ingen::World& world,
if (!prototype.is_valid()) {
world.log().error("Block %1% (%2%) missing mandatory lv2:prototype\n",
subject, path);
- return boost::optional<raul::Path>();
+ return {};
}
const auto* type_uri =
@@ -361,7 +361,7 @@ parse_graph(ingen::World& world,
world, model, port, ctx, graph_path, &index);
if (!port_record) {
world.log().error("Invalid port %1%\n", port);
- return boost::optional<raul::Path>();
+ return {};
}
// Store port information in ports map
@@ -412,7 +412,7 @@ parse_graph(ingen::World& world,
world, model, port, subctx, block_path, nullptr);
if (!port_record) {
world.log().error("Invalid port %1%\n", port);
- return boost::optional<raul::Path>();
+ return {};
}
// Create port and/or set all port properties
@@ -577,7 +577,7 @@ parse(ingen::World& world,
}
}
- return boost::optional<raul::Path>();
+ return {};
}
bool
diff --git a/src/URI.cpp b/src/URI.cpp
index 339ca07c..cc40a9a3 100644
--- a/src/URI.cpp
+++ b/src/URI.cpp
@@ -125,7 +125,7 @@ URI::make_relative(const URI& base) const
{
SerdURI uri;
SerdNode node = serd_node_new_relative_uri(&_uri, &base._uri, nullptr, &uri);
- return URI(node, uri);
+ return {node, uri};
}
} // namespace ingen
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 6082faed..4ea1536d 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -512,7 +512,7 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
}
}
- return Atom();
+ return {};
}
void
diff --git a/src/runtime_paths.cpp b/src/runtime_paths.cpp
index d90ab1c7..86315be8 100644
--- a/src/runtime_paths.cpp
+++ b/src/runtime_paths.cpp
@@ -138,28 +138,28 @@ FilePath
user_config_dir()
{
if (const char* xdg_config_home = getenv("XDG_CONFIG_HOME")) {
- return FilePath(xdg_config_home);
+ return {xdg_config_home};
}
if (const char* home = getenv("HOME")) {
return FilePath(home) / ".config";
}
- return FilePath();
+ return {};
}
FilePath
user_data_dir()
{
if (const char* xdg_data_home = getenv("XDG_DATA_HOME")) {
- return FilePath(xdg_data_home);
+ return {xdg_data_home};
}
if (const char* home = getenv("HOME")) {
return FilePath(home) / ".local/share";
}
- return FilePath();
+ return {};
}
std::vector<FilePath>
diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp
index ed3566aa..9d63f78e 100644
--- a/src/server/BlockImpl.hpp
+++ b/src/server/BlockImpl.hpp
@@ -117,7 +117,7 @@ public:
/** Save current state as preset. */
virtual boost::optional<Resource>
save_preset(const URI& bundle,
- const Properties& props) { return boost::optional<Resource>(); }
+ const Properties& props) { return {}; }
/** Learn the next incoming MIDI event (for internals) */
virtual void learn() {}
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index 348dbca6..8ed4eaae 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -150,7 +150,7 @@ BufferFactory::get_buffer(LV2_URID type,
try_head->_next = nullptr;
try_head->set_type(&BufferFactory::get_buffer, type, value_type);
try_head->clear();
- return BufferRef(try_head);
+ return {try_head};
}
BufferRef
@@ -159,12 +159,12 @@ BufferFactory::claim_buffer(LV2_URID type, LV2_URID value_type, uint32_t)
Buffer* try_head = try_get_buffer(type);
if (!try_head) {
_engine.world().log().rt_error("Failed to obtain buffer");
- return BufferRef();
+ return {};
}
try_head->_next = nullptr;
try_head->set_type(&BufferFactory::claim_buffer, type, value_type);
- return BufferRef(try_head);
+ return {try_head};
}
BufferRef
@@ -185,7 +185,7 @@ BufferFactory::create(LV2_URID type, LV2_URID value_type, uint32_t capacity)
capacity = std::max(capacity, default_size(_uris.atom_Sound));
}
- return BufferRef(new Buffer(*this, type, value_type, capacity));
+ return {new Buffer(*this, type, value_type, capacity)};
}
void
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 35a06368..4cdcecd7 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -758,7 +758,7 @@ LV2Block::save_preset(const URI& uri,
return {preset};
}
- return boost::optional<Resource>();
+ return {};
}
void
diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp
index 50544e01..02824be6 100644
--- a/src/server/LV2Options.hpp
+++ b/src/server/LV2Options.hpp
@@ -66,7 +66,7 @@ public:
f->URI = LV2_OPTIONS__options;
f->data = malloc(sizeof(options));
memcpy(f->data, options, sizeof(options));
- return std::shared_ptr<LV2_Feature>(f, &free_feature);
+ return {f, &free_feature};
}
private:
diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp
index 0d377732..ed874634 100644
--- a/src/server/SocketListener.cpp
+++ b/src/server/SocketListener.cpp
@@ -51,7 +51,7 @@ get_link_target(const char* link_path)
// Stat the link to get the required size for the target path
struct stat link_stat{};
if (lstat(link_path, &link_stat)) {
- return std::string();
+ return {};
}
// Allocate buffer and read link target
@@ -63,7 +63,7 @@ get_link_target(const char* link_path)
}
free(target);
- return std::string();
+ return {};
}
static void ingen_listen(Engine* engine,
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 149d91e7..5b4da498 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -110,7 +110,7 @@ Worker::Schedule::feature(World&, Node* n)
f->URI = LV2_WORKER__schedule;
f->data = data;
- return std::shared_ptr<LV2_Feature>(f, &free_feature);
+ return {f, &free_feature};
}
Worker::Worker(Log& log, uint32_t buffer_size, bool synchronous)