summaryrefslogtreecommitdiffstats
path: root/include/ingen
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 /include/ingen
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 'include/ingen')
-rw-r--r--include/ingen/Forge.hpp24
-rw-r--r--include/ingen/URI.hpp4
-rw-r--r--include/ingen/URIMap.hpp3
-rw-r--r--include/ingen/filesystem.hpp2
4 files changed, 16 insertions, 17 deletions
diff --git a/include/ingen/Forge.hpp b/include/ingen/Forge.hpp
index 8dc7805c..fdd53276 100644
--- a/include/ingen/Forge.hpp
+++ b/include/ingen/Forge.hpp
@@ -44,38 +44,38 @@ public:
return atom.type() == URI || atom.type() == URID;
}
- static Atom make() { return Atom(); }
- Atom make(int32_t v) { return Atom(sizeof(v), Int, &v); }
- Atom make(float v) { return Atom(sizeof(v), Float, &v); }
+ static Atom make() { return {}; }
+ Atom make(int32_t v) { return {sizeof(v), Int, &v}; }
+ Atom make(float v) { return {sizeof(v), Float, &v}; }
Atom make(bool v) {
const int32_t iv = v ? 1 : 0;
- return Atom(sizeof(int32_t), Bool, &iv);
+ return {sizeof(int32_t), Bool, &iv};
}
- Atom make_urid(int32_t v) { return Atom(sizeof(int32_t), URID, &v); }
+ Atom make_urid(int32_t v) { return {sizeof(int32_t), URID, &v}; }
Atom make_urid(const ingen::URI& u);
static Atom alloc(uint32_t s, uint32_t t, const void* v) {
- return Atom(s, t, v);
+ return {s, t, v};
}
Atom alloc(const char* v) {
- const size_t len = strlen(v);
- return Atom(len + 1, String, v);
+ const auto len = static_cast<uint32_t>(strlen(v));
+ return {len + 1U, String, v};
}
Atom alloc(const std::string& v) {
- return Atom(v.length() + 1, String, v.c_str());
+ return {static_cast<uint32_t>(v.length()) + 1U, String, v.c_str()};
}
Atom alloc_uri(const char* v) {
- const size_t len = strlen(v);
- return Atom(len + 1, URI, v);
+ const auto len = static_cast<uint32_t>(strlen(v));
+ return {len + 1U, URI, v};
}
Atom alloc_uri(const std::string& v) {
- return Atom(v.length() + 1, URI, v.c_str());
+ return {static_cast<uint32_t>(v.length()) + 1U, URI, v.c_str()};
}
private:
diff --git a/include/ingen/URI.hpp b/include/ingen/URI.hpp
index ea57edca..0c8d23ef 100644
--- a/include/ingen/URI.hpp
+++ b/include/ingen/URI.hpp
@@ -57,7 +57,7 @@ public:
bool empty() const { return !_node.buf; }
- std::string string() const { return std::string(c_str(), _node.n_bytes); }
+ std::string string() const { return {c_str(), _node.n_bytes}; }
size_t length() const { return _node.n_bytes; }
const char* c_str() const
@@ -102,7 +102,7 @@ private:
URI(SerdNode node, SerdURI uri);
static Chunk make_chunk(const SerdChunk& chunk) {
- return Chunk(reinterpret_cast<const char*>(chunk.buf), chunk.len);
+ return {reinterpret_cast<const char*>(chunk.buf), chunk.len};
}
SerdURI _uri;
diff --git a/include/ingen/URIMap.hpp b/include/ingen/URIMap.hpp
index f5ae8a37..de137af2 100644
--- a/include/ingen/URIMap.hpp
+++ b/include/ingen/URIMap.hpp
@@ -58,8 +58,7 @@ public:
std::shared_ptr<LV2_Feature> feature(World&, Node*) override
{
- return std::shared_ptr<LV2_Feature>(&_feature,
- NullDeleter<LV2_Feature>);
+ return {&_feature, NullDeleter<LV2_Feature>};
}
private:
diff --git a/include/ingen/filesystem.hpp b/include/ingen/filesystem.hpp
index 5e64cc8c..5a90e7b7 100644
--- a/include/ingen/filesystem.hpp
+++ b/include/ingen/filesystem.hpp
@@ -75,7 +75,7 @@ inline FilePath current_path()
std::unique_ptr<char, Freer> cpath(realpath(".", nullptr));
- return FilePath(cpath.get());
+ return {cpath.get()};
}
} // namespace filesystem