summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-02 14:15:38 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 14:21:39 +0200
commitdf897ef5b01a045769ffb71ebc6dead179db857c (patch)
tree3bdb14e7315477d6e322e11bb5e2300f0de99b90
parent62f5c3124b991abe9b9423a4908ca076079d5327 (diff)
downloadingen-df897ef5b01a045769ffb71ebc6dead179db857c.tar.gz
ingen-df897ef5b01a045769ffb71ebc6dead179db857c.tar.bz2
ingen-df897ef5b01a045769ffb71ebc6dead179db857c.zip
Use nullptr for empty smart pointers
-rw-r--r--include/ingen/DataAccess.hpp4
-rw-r--r--include/ingen/InstanceAccess.hpp4
-rw-r--r--include/ingen/Interface.hpp2
-rw-r--r--include/ingen/LV2Features.hpp2
-rw-r--r--include/ingen/client/SocketClient.hpp2
-rw-r--r--src/World.cpp2
-rw-r--r--src/client/ClientStore.cpp4
-rw-r--r--src/client/GraphModel.cpp2
-rw-r--r--src/client/PluginModel.cpp2
-rw-r--r--src/client/PluginUI.cpp4
-rw-r--r--src/gui/App.cpp2
-rw-r--r--src/gui/BreadCrumbs.cpp8
-rw-r--r--src/gui/BreadCrumbs.hpp4
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/gui/GraphBox.cpp2
-rw-r--r--src/gui/WindowFactory.hpp2
-rw-r--r--src/server/CompiledGraph.cpp2
-rw-r--r--src/server/Engine.cpp4
-rw-r--r--src/server/GraphImpl.cpp2
-rw-r--r--src/server/LV2Block.cpp8
-rw-r--r--src/server/LV2ResizeFeature.hpp5
-rw-r--r--src/server/PreProcessContext.hpp2
-rw-r--r--src/server/Worker.cpp2
-rw-r--r--src/server/ingen_lv2.cpp4
24 files changed, 38 insertions, 39 deletions
diff --git a/include/ingen/DataAccess.hpp b/include/ingen/DataAccess.hpp
index b06c8dec..49bb6102 100644
--- a/include/ingen/DataAccess.hpp
+++ b/include/ingen/DataAccess.hpp
@@ -44,12 +44,12 @@ struct DataAccess : public ingen::LV2Features::Feature
SPtr<LV2_Feature> feature(World& world, Node* node) override {
Node* store_node = world.store()->get(node->path());
if (!store_node) {
- return SPtr<LV2_Feature>();
+ return nullptr;
}
LilvInstance* inst = store_node->instance();
if (!inst) {
- return SPtr<LV2_Feature>();
+ return nullptr;
}
const LV2_Descriptor* desc = lilv_instance_get_descriptor(inst);
diff --git a/include/ingen/InstanceAccess.hpp b/include/ingen/InstanceAccess.hpp
index 4d67d8db..500f4902 100644
--- a/include/ingen/InstanceAccess.hpp
+++ b/include/ingen/InstanceAccess.hpp
@@ -37,12 +37,12 @@ struct InstanceAccess : public ingen::LV2Features::Feature
SPtr<LV2_Feature> feature(World& world, Node* node) override {
Node* store_node = world.store()->get(node->path());
if (!store_node) {
- return SPtr<LV2_Feature>();
+ return nullptr;
}
LilvInstance* instance = store_node->instance();
if (!instance) {
- return SPtr<LV2_Feature>();
+ return nullptr;
}
return std::make_shared<LV2_Feature>(
diff --git a/include/ingen/Interface.hpp b/include/ingen/Interface.hpp
index 8a87af8b..98c0d4cd 100644
--- a/include/ingen/Interface.hpp
+++ b/include/ingen/Interface.hpp
@@ -55,7 +55,7 @@ public:
virtual URI uri() const = 0;
- virtual SPtr<Interface> respondee() const { return SPtr<Interface>(); }
+ virtual SPtr<Interface> respondee() const { return nullptr; }
virtual void set_respondee(const SPtr<Interface>& respondee) {}
diff --git a/include/ingen/LV2Features.hpp b/include/ingen/LV2Features.hpp
index ae201bf6..792ee9d9 100644
--- a/include/ingen/LV2Features.hpp
+++ b/include/ingen/LV2Features.hpp
@@ -57,7 +57,7 @@ protected:
const char* uri() const override { return _uri; }
SPtr<LV2_Feature> feature(World& world, Node* block) override {
- return SPtr<LV2_Feature>();
+ return nullptr;
}
const char* _uri;
diff --git a/include/ingen/client/SocketClient.hpp b/include/ingen/client/SocketClient.hpp
index 8e551821..642ae1ef 100644
--- a/include/ingen/client/SocketClient.hpp
+++ b/include/ingen/client/SocketClient.hpp
@@ -59,7 +59,7 @@ public:
if (!sock->connect(uri)) {
world.log().error("Failed to connect <%1%> (%2%)\n",
sock->uri(), strerror(errno));
- return SPtr<Interface>();
+ return nullptr;
}
return SPtr<Interface>(new SocketClient(world, uri, sock, respondee));
}
diff --git a/src/World.cpp b/src/World.cpp
index 4b502e6e..6df3b4b1 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -305,7 +305,7 @@ World::new_interface(const URI& engine_uri, const SPtr<Interface>& respondee)
_impl->interface_factories.find(std::string(engine_uri.scheme()));
if (i == _impl->interface_factories.end()) {
log().warn("Unknown URI scheme `%1%'\n", engine_uri.scheme());
- return SPtr<Interface>();
+ return nullptr;
}
return i->second(*this, engine_uri, respondee);
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index a02a3227..a9d8f44b 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -96,7 +96,7 @@ ClientStore::remove_object(const Raul::Path& path)
// Find the object, the "top" of the tree to remove
const iterator top = find(path);
if (top == end()) {
- return SPtr<ObjectModel>();
+ return nullptr;
}
auto object = std::dynamic_pointer_cast<ObjectModel>(top->second);
@@ -158,7 +158,7 @@ ClientStore::_object(const Raul::Path& path)
{
const iterator i = find(path);
if (i == end()) {
- return SPtr<ObjectModel>();
+ return nullptr;
} else {
auto model = std::dynamic_pointer_cast<ObjectModel>(i->second);
assert(model);
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index 4de2cb53..b965258e 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -105,7 +105,7 @@ GraphModel::get_arc(const Node* tail, const Node* head)
if (i != _arcs.end()) {
return std::dynamic_pointer_cast<ArcModel>(i->second);
} else {
- return SPtr<ArcModel>();
+ return nullptr;
}
}
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index f72d8a3a..b3a9aecd 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -245,7 +245,7 @@ SPtr<PluginUI>
PluginModel::ui(ingen::World& world, const SPtr<const BlockModel>& block) const
{
if (!_lilv_plugin) {
- return SPtr<PluginUI>();
+ return nullptr;
}
return PluginUI::create(world, block, _lilv_plugin);
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 1074be3e..b0f92e41 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -40,7 +40,7 @@ get_port(PluginUI* ui, uint32_t port_index)
ui->world().log().error("%1% UI tried to access invalid port %2%\n",
ui->block()->plugin()->uri().c_str(),
port_index);
- return SPtr<const PortModel>();
+ return nullptr;
}
return ui->block()->ports()[port_index];
}
@@ -211,7 +211,7 @@ PluginUI::create(ingen::World& world,
if (!ui) {
lilv_node_free(gtk_ui);
- return SPtr<PluginUI>();
+ return nullptr;
}
// Create the PluginUI, but don't instantiate yet
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 4be4bbd5..c5727617 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -202,7 +202,7 @@ App::detach()
_loader.reset();
_store.reset();
_client.reset();
- _world.set_interface(SPtr<Interface>());
+ _world.set_interface(nullptr);
}
}
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 5dbdab17..b75c8670 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -49,7 +49,7 @@ BreadCrumbs::view(const Raul::Path& path)
}
}
- return SPtr<GraphView>();
+ return nullptr;
}
/** Sets up the crumbs to display `path`.
@@ -158,10 +158,8 @@ BreadCrumbs::build(const Raul::Path& path, const SPtr<GraphView>& view)
BreadCrumbs::BreadCrumb*
BreadCrumbs::create_crumb(const Raul::Path& path, const SPtr<GraphView>& view)
{
- BreadCrumb* but = manage(
- new BreadCrumb(path,
- ((view && path == view->graph()->path())
- ? view : SPtr<GraphView>())));
+ BreadCrumb* but = manage(new BreadCrumb(
+ path, ((view && path == view->graph()->path()) ? view : nullptr)));
but->signal_toggled().connect(
sigc::bind(sigc::mem_fun(this, &BreadCrumbs::breadcrumb_clicked),
diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp
index d62a7ee0..6f42e573 100644
--- a/src/gui/BreadCrumbs.hpp
+++ b/src/gui/BreadCrumbs.hpp
@@ -65,7 +65,7 @@ private:
{
public:
BreadCrumb(const Raul::Path& path,
- const SPtr<GraphView>& view = SPtr<GraphView>())
+ const SPtr<GraphView>& view = nullptr)
: _path(path)
, _view(view)
{
@@ -103,7 +103,7 @@ private:
};
BreadCrumb* create_crumb(const Raul::Path& path,
- const SPtr<GraphView>& view = SPtr<GraphView>());
+ const SPtr<GraphView>& view = nullptr);
void breadcrumb_clicked(BreadCrumb* crumb);
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 16e88235..3e5e5d7c 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -292,7 +292,7 @@ ConnectWindow::disconnect()
_attached = false;
_app->detach();
- set_connected_to(SPtr<ingen::Interface>());
+ set_connected_to(nullptr);
if (!_widgets_loaded) {
return;
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 56bb45d2..571bc61a 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -197,7 +197,7 @@ GraphBox::create(App& app, const SPtr<const GraphModel>& graph)
Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win");
xml->get_widget_derived("graph_win_vbox", result);
result->init_box(app);
- result->set_graph(graph, SPtr<GraphView>());
+ result->set_graph(graph, nullptr);
if (app.is_plugin()) {
result->_menu_close->set_sensitive(false);
diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp
index 77d84ac6..5b1a6984 100644
--- a/src/gui/WindowFactory.hpp
+++ b/src/gui/WindowFactory.hpp
@@ -63,7 +63,7 @@ public:
void present_graph(
SPtr<const client::GraphModel> graph,
GraphWindow* preferred = nullptr,
- SPtr<GraphView> view = SPtr<GraphView>());
+ SPtr<GraphView> view = nullptr);
void present_load_plugin(SPtr<const client::GraphModel> graph, Properties data=Properties());
void present_load_graph(SPtr<const client::GraphModel> graph, Properties data=Properties());
diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp
index ba4cc11e..3c6b6172 100644
--- a/src/server/CompiledGraph.cpp
+++ b/src/server/CompiledGraph.cpp
@@ -82,7 +82,7 @@ CompiledGraph::compile(Raul::Maid& maid, GraphImpl& graph)
} else {
log.error("Feedback compiling %1%\n", e.node->path());
}
- return MPtr<CompiledGraph>();
+ return nullptr;
}
}
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index ae5b297f..efc152d5 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -169,7 +169,7 @@ Engine::~Engine()
store->clear();
}
- _world.set_store(SPtr<ingen::Store>());
+ _world.set_store(nullptr);
}
void
@@ -406,7 +406,7 @@ Engine::activate()
enqueue_event(
new events::CreateGraph(
- *this, SPtr<Interface>(), -1, 0, Raul::Path("/"), properties));
+ *this, nullptr, -1, 0, Raul::Path("/"), properties));
flush_events(std::chrono::milliseconds(10));
if (!_root_graph) {
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index 08c8ccc6..4d1d7856 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -292,7 +292,7 @@ GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port)
_arcs.erase(i);
return arc;
} else {
- return SPtr<ArcImpl>();
+ return nullptr;
}
}
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index c555ac4a..7855a0f1 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -90,7 +90,7 @@ LV2Block::make_instance(URIs& uris,
if (!inst) {
engine.log().error("Failed to instantiate <%1%>\n",
_lv2_plugin->uri().c_str());
- return SPtr<Instance>();
+ return nullptr;
}
const LV2_Options_Interface* options_iface = nullptr;
@@ -148,7 +148,7 @@ LV2Block::make_instance(URIs& uris,
"%1% auto-morphed to unknown type %2%\n",
port->path().c_str(),
type);
- return SPtr<Instance>();
+ return nullptr;
}
} else {
parent_graph()->engine().log().error(
@@ -178,7 +178,7 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly)
const SampleRate rate = bufs.engine().sample_rate();
assert(!_prepared_instances);
_prepared_instances = bufs.maid().make_managed<Instances>(
- poly, *_instances, SPtr<Instance>());
+ poly, *_instances, nullptr);
for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) {
SPtr<Instance> inst = make_instance(bufs.uris(), rate, i, true);
if (!inst) {
@@ -436,7 +436,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
// Actually create plugin instances and port buffers.
const SampleRate rate = bufs.engine().sample_rate();
_instances = bufs.maid().make_managed<Instances>(
- _polyphony, SPtr<Instance>());
+ _polyphony, nullptr);
for (uint32_t i = 0; i < _polyphony; ++i) {
_instances->at(i) = make_instance(bufs.uris(), rate, i, false);
if (!_instances->at(i)) {
diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp
index 1bd93ee0..322aacb8 100644
--- a/src/server/LV2ResizeFeature.hpp
+++ b/src/server/LV2ResizeFeature.hpp
@@ -46,8 +46,9 @@ struct ResizeFeature : public ingen::LV2Features::Feature {
SPtr<LV2_Feature> feature(World& w, Node* n) {
BlockImpl* block = dynamic_cast<BlockImpl*>(n);
- if (!block)
- return SPtr<LV2_Feature>();
+ if (!block) {
+ return nullptr;
+ }
LV2_Resize_Port_Resize* data
= (LV2_Resize_Port_Resize*)malloc(sizeof(LV2_Resize_Port_Resize));
data->data = block;
diff --git a/src/server/PreProcessContext.hpp b/src/server/PreProcessContext.hpp
index 7579e1e2..a1bdbb5f 100644
--- a/src/server/PreProcessContext.hpp
+++ b/src/server/PreProcessContext.hpp
@@ -67,7 +67,7 @@ public:
if (must_compile(graph)) {
return compile(maid, graph);
}
- return MPtr<CompiledGraph>();
+ return nullptr;
}
/** Return all graphs that require compilation after an atomic bundle. */
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 69f9eec6..1180fa47 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -96,7 +96,7 @@ Worker::Schedule::feature(World&, Node* n)
{
auto* block = dynamic_cast<LV2Block*>(n);
if (!block) {
- return SPtr<LV2_Feature>();
+ return nullptr;
}
auto* data = static_cast<LV2_Worker_Schedule*>(malloc(sizeof(LV2_Worker_Schedule)));
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index a50b5859..e5abcc92 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -672,8 +672,8 @@ static void
ingen_cleanup(LV2_Handle instance)
{
auto* me = static_cast<IngenPlugin*>(instance);
- me->world->set_engine(SPtr<ingen::server::Engine>());
- me->world->set_interface(SPtr<ingen::Interface>());
+ me->world->set_engine(nullptr);
+ me->world->set_interface(nullptr);
if (me->main) {
me->main->join();
me->main.reset();