diff options
author | David Robillard <d@drobilla.net> | 2017-12-25 13:59:47 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-12-25 16:26:13 -0500 |
commit | d6a9571641bcb34acb3521feb08eea33195fd9ca (patch) | |
tree | 5c28e2800d829b7b1896e2fcbe3f8870b88e039d /src | |
parent | 25177612b20f7d3ebd4138fed9cd9acffec7e756 (diff) | |
download | ingen-d6a9571641bcb34acb3521feb08eea33195fd9ca.tar.gz ingen-d6a9571641bcb34acb3521feb08eea33195fd9ca.tar.bz2 ingen-d6a9571641bcb34acb3521feb08eea33195fd9ca.zip |
Use nullptr
Diffstat (limited to 'src')
78 files changed, 358 insertions, 358 deletions
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 95f96ee4..f3263f65 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -150,8 +150,8 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) } const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg; - const LV2_Atom* subject = NULL; - const LV2_Atom* number = NULL; + const LV2_Atom* subject = nullptr; + const LV2_Atom* number = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_subject, &subject, @@ -173,16 +173,16 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) } else if (obj->body.otype == _uris.ingen_BundleEnd) { _iface(BundleEnd{seq}); } else if (obj->body.otype == _uris.patch_Delete) { - const LV2_Atom_Object* body = NULL; + const LV2_Atom_Object* body = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); if (subject_uri && !body) { _iface(Del{seq, *subject_uri}); return true; } else if (body && body->body.otype == _uris.ingen_Arc) { - const LV2_Atom* tail = NULL; - const LV2_Atom* head = NULL; - const LV2_Atom* incidentTo = NULL; + const LV2_Atom* tail = nullptr; + const LV2_Atom* head = nullptr; + const LV2_Atom* incidentTo = nullptr; lv2_atom_object_get(body, (LV2_URID)_uris.ingen_tail, &tail, (LV2_URID)_uris.ingen_head, &head, @@ -203,8 +203,8 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) } } } else if (obj->body.otype == _uris.patch_Put) { - const LV2_Atom_Object* body = NULL; - const LV2_Atom* context = NULL; + const LV2_Atom_Object* body = nullptr; + const LV2_Atom* context = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, (LV2_URID)_uris.patch_context, &context, @@ -218,8 +218,8 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) } if (body->body.otype == _uris.ingen_Arc) { - LV2_Atom* tail = NULL; - LV2_Atom* head = NULL; + LV2_Atom* tail = nullptr; + LV2_Atom* head = nullptr; lv2_atom_object_get(body, (LV2_URID)_uris.ingen_tail, &tail, (LV2_URID)_uris.ingen_head, &head, @@ -247,9 +247,9 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) return false; } - const LV2_Atom_URID* prop = NULL; - const LV2_Atom* value = NULL; - const LV2_Atom* context = NULL; + const LV2_Atom_URID* prop = nullptr; + const LV2_Atom* value = nullptr; + const LV2_Atom* context = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_property, &prop, (LV2_URID)_uris.patch_value, &value, @@ -276,9 +276,9 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) return false; } - const LV2_Atom_Object* remove = NULL; - const LV2_Atom_Object* add = NULL; - const LV2_Atom* context = NULL; + const LV2_Atom_Object* remove = nullptr; + const LV2_Atom_Object* add = nullptr; + const LV2_Atom* context = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_remove, &remove, (LV2_URID)_uris.patch_add, &add, @@ -306,7 +306,7 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) return false; } - const LV2_Atom* dest = NULL; + const LV2_Atom* dest = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_destination, &dest, 0); if (!dest) { _log.warn("Copy message has no destination\n"); @@ -332,7 +332,7 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) return false; } - const LV2_Atom* dest = NULL; + const LV2_Atom* dest = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_destination, &dest, 0); if (!dest) { _log.warn("Move message has no destination\n"); @@ -353,8 +353,8 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) _iface(Move{seq, *subject_path, *dest_path}); } else if (obj->body.otype == _uris.patch_Response) { - const LV2_Atom* seq = NULL; - const LV2_Atom* body = NULL; + const LV2_Atom* seq = nullptr; + const LV2_Atom* body = nullptr; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_sequenceNumber, &seq, (LV2_URID)_uris.patch_body, &body, diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 1001fa34..30b536bf 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -137,7 +137,7 @@ Configuration::set_value_from_string(Configuration::Option& option, throw (Configuration::OptionError) { if (option.type == _forge.Int) { - char* endptr = NULL; + char* endptr = nullptr; int intval = static_cast<int>(strtol(value.c_str(), &endptr, 10)); if (endptr && *endptr == '\0') { option.value = _forge.make(intval); @@ -233,7 +233,7 @@ Configuration::load(const std::string& path) } SerdNode node = serd_node_new_file_uri( - (const uint8_t*)path.c_str(), NULL, NULL, true); + (const uint8_t*)path.c_str(), nullptr, nullptr, true); const std::string uri((const char*)node.buf); Sord::World world; @@ -292,7 +292,7 @@ Configuration::save(URIMap& uri_map, // Use the file's URI as the base URI SerdURI base_uri; SerdNode base = serd_node_new_file_uri( - (const uint8_t*)path.c_str(), NULL, &base_uri, true); + (const uint8_t*)path.c_str(), nullptr, &base_uri, true); // Create environment with ingen prefix SerdEnv* env = serd_env_new(&base); @@ -315,7 +315,7 @@ Configuration::save(URIMap& uri_map, Sratom* sratom = sratom_new(&uri_map.urid_map_feature()->urid_map); sratom_set_pretty_numbers(sratom, true); sratom_set_sink(sratom, (const char*)base.buf, - (SerdStatementSink)serd_writer_write_statement, NULL, + (SerdStatementSink)serd_writer_write_statement, nullptr, writer); // Write a statement for each valid option diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index 3465981e..eac86662 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -43,7 +43,7 @@ LV2Features::FeatureArray::FeatureArray(FeatureVector& features) : _features(features) { _array = (LV2_Feature**)malloc(sizeof(LV2_Feature*) * (features.size() + 1)); - _array[features.size()] = NULL; + _array[features.size()] = nullptr; for (size_t i = 0; i < features.size(); ++i) { _array[i] = features[i].get(); } diff --git a/src/Parser.cpp b/src/Parser.cpp index bf7dc82a..68cd774f 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -67,7 +67,7 @@ Parser::find_resources(Sord::World& world, std::string file_path = ""; Sord::Iter f = model.find(resource, rdfs_seeAlso, nil); if (!f.end()) { - uint8_t* p = serd_file_uri_parse(f.get_object().to_u_string(), NULL); + uint8_t* p = serd_file_uri_parse(f.get_object().to_u_string(), nullptr); file_path = (const char*)p; free(p); } @@ -441,7 +441,7 @@ parse_graph(Ingen::World* world, // Get all properties boost::optional<PortRecord> port_record = get_port( - world, model, port, subctx, block_path, NULL); + world, model, port, subctx, block_path, nullptr); if (!port_record) { world->log().error(fmt("Invalid port %1%\n") % port); return boost::optional<Raul::Path>(); @@ -733,7 +733,7 @@ Parser::parse_string(Ingen::World* world, // Load string into model Sord::Model model(*world->rdf_world(), base_uri, SORD_SPO|SORD_PSO, false); - SerdEnv* env = serd_env_new(NULL); + SerdEnv* env = serd_env_new(nullptr); if (!base_uri.empty()) { const SerdNode base = serd_node_from_string( SERD_URI, (const uint8_t*)base_uri.c_str()); @@ -741,7 +741,7 @@ Parser::parse_string(Ingen::World* world, } model.load_string(env, SERD_TURTLE, str.c_str(), str.length(), base_uri); - Raul::URI actual_base((const char*)serd_env_get_base_uri(env, NULL)->buf); + Raul::URI actual_base((const char*)serd_env_get_base_uri(env, nullptr)->buf); serd_env_free(env); world->log().info(fmt("Parsing string (base %1%)\n") % base_uri); diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index e0c504a2..069fc867 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -57,7 +57,7 @@ struct Serialiser::Impl { explicit Impl(World& world) : _root_path("/") , _world(world) - , _model(NULL) + , _model(nullptr) , _sratom(sratom_new(&_world.uri_map().urid_map_feature()->urid_map)) {} @@ -282,7 +282,7 @@ Serialiser::Impl::finish() } delete _model; - _model = NULL; + _model = nullptr; _base_uri = ""; return ret; @@ -570,7 +570,7 @@ Serialiser::Impl::serialise_properties(Sord::Node id, SordInserter* inserter = sord_inserter_new(_model->c_obj(), env); sratom_set_sink(_sratom, _base_uri.c_str(), - (SerdStatementSink)sord_inserter_write_statement, NULL, + (SerdStatementSink)sord_inserter_write_statement, nullptr, inserter); sratom_set_pretty_numbers(_sratom, true); diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp index 70b6cb7f..8e0209f9 100644 --- a/src/SocketReader.cpp +++ b/src/SocketReader.cpp @@ -35,8 +35,8 @@ SocketReader::SocketReader(Ingen::World& world, SPtr<Raul::Socket> sock) : _world(world) , _iface(iface) - , _inserter(NULL) - , _msg_node(NULL) + , _inserter(nullptr) + , _msg_node(nullptr) , _socket(sock) , _exit_flag(false) , _thread(&SocketReader::run, this) @@ -76,7 +76,7 @@ SocketReader::write_statement(SocketReader* iface, { if (!iface->_msg_node) { iface->_msg_node = sord_node_from_serd_node( - iface->_world.rdf_world()->c_obj(), iface->_env, subject, 0, 0); + iface->_world.rdf_world()->c_obj(), iface->_env, subject, nullptr, nullptr); } return sord_inserter_write_statement( @@ -108,8 +108,8 @@ SocketReader::run() AtomForgeSink buffer(&forge); - SordNode* base_uri = NULL; - SordModel* model = NULL; + SordNode* base_uri = nullptr; + SordModel* model = nullptr; { // Lock RDF world std::lock_guard<std::mutex> lock(_world.rdf_mutex()); @@ -126,11 +126,11 @@ SocketReader::run() } SerdReader* reader = serd_reader_new( - SERD_TURTLE, this, NULL, + SERD_TURTLE, this, nullptr, (SerdBaseSink)set_base_uri, (SerdPrefixSink)set_prefix, (SerdStatementSink)write_statement, - NULL); + nullptr); serd_env_set_base_uri(_env, sord_node_to_serd_node(base_uri)); serd_reader_start_stream(reader, f, (const uint8_t*)"(socket)", false); @@ -179,7 +179,7 @@ SocketReader::run() // Reset everything for the next iteration buffer.clear(); sord_node_free(world->c_obj(), _msg_node); - _msg_node = NULL; + _msg_node = nullptr; } // Lock RDF world diff --git a/src/TurtleWriter.cpp b/src/TurtleWriter.cpp index 7be046a4..630906e7 100644 --- a/src/TurtleWriter.cpp +++ b/src/TurtleWriter.cpp @@ -95,7 +95,7 @@ TurtleWriter::write(const LV2_Atom* msg, int32_t default_id) } sratom_write(_sratom, &_map.urid_unmap_feature()->urid_unmap, 0, - NULL, NULL, msg->type, msg->size, LV2_ATOM_BODY_CONST(msg)); + nullptr, nullptr, msg->type, msg->size, LV2_ATOM_BODY_CONST(msg)); serd_writer_finish(_writer); return true; } diff --git a/src/URIMap.cpp b/src/URIMap.cpp index b50fd4b7..45debcee 100644 --- a/src/URIMap.cpp +++ b/src/URIMap.cpp @@ -42,7 +42,7 @@ URIMap::URIDMapFeature::URIDMapFeature(URIMap* map, urid_map = *impl; } else { urid_map.map = default_map; - urid_map.handle = NULL; + urid_map.handle = nullptr; } } @@ -71,7 +71,7 @@ URIMap::URIDUnmapFeature::URIDUnmapFeature(URIMap* map, urid_unmap = *impl; } else { urid_unmap.unmap = default_unmap; - urid_unmap.handle = NULL; + urid_unmap.handle = nullptr; } } diff --git a/src/World.cpp b/src/World.cpp index fc82079f..8b9c899d 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -60,7 +60,7 @@ class Store; static Glib::Module* ingen_load_module(Log& log, const string& name) { - Glib::Module* module = NULL; + Glib::Module* module = nullptr; // Search INGEN_MODULE_PATH first bool module_path_found; @@ -89,11 +89,11 @@ ingen_load_module(Log& log, const string& name) } else if (!module_path_found) { log.error(fmt("Unable to find %1% (%2%)\n") % name % Glib::Module::get_last_error()); - return NULL; + return nullptr; } else { log.error(fmt("Unable to load %1% from %2% (%3%)\n") % name % module_path % Glib::Module::get_last_error()); - return NULL; + return nullptr; } } @@ -139,7 +139,7 @@ public: LilvNode* ingen_Plugin = lilv_new_uri( lilv_world, INGEN__Plugin); LilvNodes* internals = lilv_world_find_nodes( - lilv_world, NULL, rdf_type, ingen_Plugin); + lilv_world, nullptr, rdf_type, ingen_Plugin); LILV_FOREACH(nodes, i, internals) { const LilvNode* internal = lilv_nodes_get(internals, i); lilv_world_load_resource(lilv_world, internal); @@ -280,7 +280,7 @@ World::load_module(const char* name) } log().info(fmt("Loading %1% module\n") % name); Glib::Module* lib = ingen_load_module(log(), name); - Ingen::Module* (*module_load)() = NULL; + Ingen::Module* (*module_load)() = nullptr; if (lib && lib->get_symbol("ingen_module_load", (void*&)module_load)) { Module* module = module_load(); if (module) { diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index e3f7d22f..a5f2eef0 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -32,8 +32,8 @@ BlockModel::BlockModel(URIs& uris, , _plugin_uri(plugin->uri()) , _plugin(plugin) , _num_values(0) - , _min_values(0) - , _max_values(0) + , _min_values(nullptr) + , _max_values(nullptr) { } @@ -43,8 +43,8 @@ BlockModel::BlockModel(URIs& uris, : ObjectModel(uris, path) , _plugin_uri(plugin_uri) , _num_values(0) - , _min_values(0) - , _max_values(0) + , _min_values(nullptr) + , _max_values(nullptr) { } @@ -94,8 +94,8 @@ BlockModel::clear() assert(_ports.empty()); delete[] _min_values; delete[] _max_values; - _min_values = 0; - _max_values = 0; + _min_values = nullptr; + _max_values = nullptr; } void @@ -180,7 +180,7 @@ BlockModel::default_port_value_range(SPtr<const PortModel> port, _min_values = new float[_num_values]; _max_values = new float[_num_values]; lilv_plugin_get_port_ranges_float(_plugin->lilv_plugin(), - _min_values, _max_values, 0); + _min_values, _max_values, nullptr); } if (!std::isnan(_min_values[port->index()])) diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 353b0f5c..91bda703 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -35,10 +35,10 @@ using namespace std; namespace Ingen { namespace Client { -LilvWorld* PluginModel::_lilv_world = NULL; -const LilvPlugins* PluginModel::_lilv_plugins = NULL; +LilvWorld* PluginModel::_lilv_world = nullptr; +const LilvPlugins* PluginModel::_lilv_plugins = nullptr; -Sord::World* PluginModel::_rdf_world = NULL; +Sord::World* PluginModel::_rdf_world = nullptr; PluginModel::PluginModel(URIs& uris, const Raul::URI& uri, @@ -279,11 +279,11 @@ PluginModel::get_documentation(const LilvNode* subject, bool html) const LILV_NS_RDFS "comment"); LilvNodes* vals = lilv_world_find_nodes( - _lilv_world, subject, lv2_documentation, NULL); + _lilv_world, subject, lv2_documentation, nullptr); const bool doc_is_html = vals; if (!vals) { vals = lilv_world_find_nodes( - _lilv_world, subject, rdfs_comment, NULL); + _lilv_world, subject, rdfs_comment, nullptr); } if (vals) { diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index d4558ed4..e74b316e 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -28,7 +28,7 @@ using namespace std; namespace Ingen { namespace Client { -SuilHost* PluginUI::ui_host = NULL; +SuilHost* PluginUI::ui_host = nullptr; static SPtr<const PortModel> get_port(PluginUI* ui, uint32_t port_index) @@ -154,7 +154,7 @@ PluginUI::PluginUI(Ingen::World* world, const LilvNode* ui_type) : _world(world) , _block(block) - , _instance(NULL) + , _instance(nullptr) , _uis(uis) , _ui(ui) , _ui_node(lilv_node_duplicate(lilv_ui_get_uri(ui))) @@ -165,7 +165,7 @@ PluginUI::PluginUI(Ingen::World* world, PluginUI::~PluginUI() { for (uint32_t i : _subscribed_ports) { - lv2_ui_unsubscribe(this, i, 0, NULL); + lv2_ui_unsubscribe(this, i, 0, nullptr); } suil_instance_free(_instance); lilv_node_free(_ui_node); @@ -191,8 +191,8 @@ PluginUI::create(Ingen::World* world, LilvNode* gtk_ui = lilv_new_uri(world->lilv_world(), gtk_ui_uri); LilvUIs* uis = lilv_plugin_get_uis(plugin); - const LilvUI* ui = NULL; - const LilvNode* ui_type = NULL; + const LilvUI* ui = nullptr; + const LilvNode* ui_type = nullptr; LILV_FOREACH(uis, u, uis) { const LilvUI* this_ui = lilv_uis_get(uis, u); if (lilv_ui_is_supported(this_ui, @@ -234,11 +234,11 @@ PluginUI::instantiate() LilvNode* ui_portNotification = lilv_new_uri(lworld, LV2_UI__portNotification); LilvNode* ui_plugin = lilv_new_uri(lworld, LV2_UI__plugin); LilvNodes* notes = lilv_world_find_nodes( - lworld, lilv_ui_get_uri(_ui), ui_portNotification, NULL); + lworld, lilv_ui_get_uri(_ui), ui_portNotification, nullptr); LILV_FOREACH(nodes, n, notes) { const LilvNode* note = lilv_nodes_get(notes, n); - const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, NULL); - const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, NULL); + const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, nullptr); + const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, nullptr); if (!plug) { _world->log().error(fmt("%1% UI %2% notification missing plugin\n") % plugin_uri % lilv_node_as_string(_ui_node)); @@ -252,7 +252,7 @@ PluginUI::instantiate() // Notification is valid and for this plugin uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym)); if (index != LV2UI_INVALID_PORT_INDEX) { - lv2_ui_subscribe(this, index, 0, NULL); + lv2_ui_subscribe(this, index, 0, nullptr); _subscribed_ports.insert(index); } } @@ -263,8 +263,8 @@ PluginUI::instantiate() const char* bundle_uri = lilv_node_as_uri(lilv_ui_get_bundle_uri(_ui)); const char* binary_uri = lilv_node_as_uri(lilv_ui_get_binary_uri(_ui)); - char* bundle_path = lilv_file_uri_parse(bundle_uri, NULL); - char* binary_path = lilv_file_uri_parse(binary_uri, NULL); + char* bundle_path = lilv_file_uri_parse(bundle_uri, nullptr); + char* binary_path = lilv_file_uri_parse(binary_uri, nullptr); // Instantiate the actual plugin UI via Suil _instance = suil_instance_new( @@ -285,7 +285,7 @@ PluginUI::instantiate() _world->log().error("Failed to instantiate LV2 UI\n"); // Cancel any subscriptions for (uint32_t i : _subscribed_ports) { - lv2_ui_unsubscribe(this, i, 0, NULL); + lv2_ui_unsubscribe(this, i, 0, nullptr); } return false; } diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 086f7949..f67e4104 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -69,11 +69,11 @@ namespace GUI { class Port; -Gtk::Main* App::_main = 0; +Gtk::Main* App::_main = nullptr; App::App(Ingen::World* world) : _style(new Style(*this)) - , _about_dialog(NULL) + , _about_dialog(nullptr) , _window_factory(new WindowFactory(*this)) , _world(world) , _sample_rate(48000) diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 012235d1..c4081c97 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -50,19 +50,19 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Dialog(cobject) , _xml(xml) - , _icon(NULL) - , _progress_bar(NULL) - , _progress_label(NULL) - , _url_entry(NULL) - , _server_radio(NULL) - , _port_spinbutton(NULL) - , _launch_radio(NULL) - , _internal_radio(NULL) - , _activate_button(NULL) - , _deactivate_button(NULL) - , _disconnect_button(NULL) - , _connect_button(NULL) - , _quit_button(NULL) + , _icon(nullptr) + , _progress_bar(nullptr) + , _progress_label(nullptr) + , _url_entry(nullptr) + , _server_radio(nullptr) + , _port_spinbutton(nullptr) + , _launch_radio(nullptr) + , _internal_radio(nullptr) + , _activate_button(nullptr) + , _deactivate_button(nullptr) + , _disconnect_button(nullptr) + , _connect_button(nullptr) + , _quit_button(nullptr) , _mode(Mode::CONNECT_REMOTE) , _connect_uri("unix:///tmp/ingen.sock") , _ping_id(-1) @@ -248,7 +248,7 @@ ConnectWindow::connect(bool existing) } else if (_mode == Mode::LAUNCH_REMOTE) { const std::string port = std::to_string(_port_spinbutton->get_value_as_int()); - const char* cmd[] = { "ingen", "-e", "-E", port.c_str(), NULL }; + const char* cmd[] = { "ingen", "-e", "-E", port.c_str(), nullptr }; if (!Raul::Process::launch(cmd)) { error("Failed to launch engine process"); @@ -456,7 +456,7 @@ ConnectWindow::gtk_callback() // Timing stuff for repeated attach attempts timeval now; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); static const timeval start = now; static timeval last = now; static unsigned attempts = 0; diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 82861a88..1b6e7967 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -63,9 +63,9 @@ static const int STATUS_CONTEXT_HOVER = 2; GraphBox::GraphBox(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Gtk::VBox(cobject) - , _app(NULL) - , _window(NULL) - , _breadcrumbs(NULL) + , _app(nullptr) + , _window(nullptr) + , _breadcrumbs(nullptr) , _has_shown_documentation(false) , _enable_signal(true) { @@ -197,7 +197,7 @@ GraphBox::~GraphBox() SPtr<GraphBox> GraphBox::create(App& app, SPtr<const GraphModel> graph) { - GraphBox* result = NULL; + GraphBox* result = nullptr; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win"); xml->get_widget_derived("graph_win_vbox", result); result->init_box(app); @@ -413,8 +413,8 @@ GraphBox::show_status(const ObjectModel* model) std::stringstream msg; msg << model->path(); - const PortModel* port = 0; - const BlockModel* block = 0; + const PortModel* port = nullptr; + const BlockModel* block = nullptr; if ((port = dynamic_cast<const PortModel*>(model))) { show_port_status(port, port->value()); diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 37af8a5b..8becdb48 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -83,9 +83,9 @@ GraphCanvas::GraphCanvas(App& app, , _menu_x(0) , _menu_y(0) , _paste_count(0) - , _menu(NULL) - , _internal_menu(NULL) - , _plugin_menu(NULL) + , _menu(nullptr) + , _internal_menu(nullptr) + , _plugin_menu(nullptr) , _human_names(true) , _show_port_names(true) , _menu_dirty(false) @@ -173,7 +173,7 @@ GraphCanvas::GraphCanvas(App& app, show_human_names(app.world()->conf().option("human-names").get<int32_t>()); show_port_names(app.world()->conf().option("port-labels").get<int32_t>()); - set_port_order(port_order, NULL); + set_port_order(port_order, nullptr); } void @@ -402,7 +402,7 @@ GraphCanvas::get_port_view(SPtr<PortModel> port) } } - return NULL; + return nullptr; } /** Called when a connection is added to the model. */ diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 7a0ce102..ab375da8 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -46,7 +46,7 @@ GraphPortModule::GraphPortModule(GraphCanvas& canvas, SPtr<const Client::PortModel> model) : Ganv::Module(canvas, "", 0, 0, false) // FIXME: coords? , _model(model) - , _port(NULL) + , _port(nullptr) { assert(model); diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 287a6e6c..bba2a735 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -35,7 +35,7 @@ namespace GUI { GraphTreeWindow::GraphTreeWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Window(cobject) - , _app(NULL) + , _app(nullptr) , _enable_signal(true) { xml->get_widget_derived("graphs_treeview", _graphs_treeview); diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 591536ac..29a89b16 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -39,8 +39,8 @@ namespace GUI { GraphView::GraphView(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Gtk::Box(cobject) - , _app(NULL) - , _breadcrumb_container(NULL) + , _app(nullptr) + , _breadcrumb_container(nullptr) , _enable_signal(true) { property_visible() = false; @@ -104,7 +104,7 @@ GraphView::set_graph(SPtr<const GraphModel> graph) SPtr<GraphView> GraphView::create(App& app, SPtr<const GraphModel> graph) { - GraphView* result = NULL; + GraphView* result = nullptr; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win"); xml->get_widget_derived("graph_view_box", result); result->init(app); diff --git a/src/gui/GraphWindow.cpp b/src/gui/GraphWindow.cpp index f4457250..257db8cf 100644 --- a/src/gui/GraphWindow.cpp +++ b/src/gui/GraphWindow.cpp @@ -29,7 +29,7 @@ namespace GUI { GraphWindow::GraphWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Window(cobject) - , _box(NULL) + , _box(nullptr) , _position_stored(false) , _x(0) , _y(0) diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index 5f8f8e11..6fbda227 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -45,7 +45,7 @@ namespace GUI { LoadGraphWindow::LoadGraphWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Gtk::FileChooserDialog(cobject) - , _app(NULL) + , _app(nullptr) , _merge_ports(false) { xml->get_widget("load_graph_symbol_label", _symbol_label); diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 2c0d1b63..dc743573 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -240,7 +240,7 @@ get_project_name(SPtr<const PluginModel> plugin) LilvNode* doap_name = lilv_new_uri( plugin->lilv_world(), "http://usefulinc.com/ns/doap#name"); LilvNodes* names = lilv_world_find_nodes( - plugin->lilv_world(), project, doap_name, NULL); + plugin->lilv_world(), project, doap_name, nullptr); if (names) { name = lilv_node_as_string(lilv_nodes_get_first(names)); diff --git a/src/gui/MessagesWindow.cpp b/src/gui/MessagesWindow.cpp index a646f2de..581e732c 100644 --- a/src/gui/MessagesWindow.cpp +++ b/src/gui/MessagesWindow.cpp @@ -86,7 +86,7 @@ MessagesWindow::log(LV2_URID type, const char* fmt, va_list args) std::lock_guard<std::mutex> lock(_mutex); #ifdef HAVE_VASPRINTF - char* buf = NULL; + char* buf = nullptr; const int len = vasprintf(&buf, fmt, args); #else char* buf = g_strdup_vprintf(fmt, args); diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 13f41502..2a9217ab 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -44,7 +44,7 @@ namespace GUI { NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : ObjectMenu(cobject, xml) - , _presets_menu(NULL) + , _presets_menu(nullptr) { xml->get_widget("node_popup_gui_menuitem", _popup_gui_menuitem); xml->get_widget("node_embed_gui_menuitem", _embed_gui_menuitem); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 56fc0e42..d3256178 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -55,8 +55,8 @@ NodeModule::NodeModule(GraphCanvas& canvas, SPtr<const BlockModel> block) : Ganv::Module(canvas, block->path().symbol(), 0, 0, true) , _block(block) - , _gui_widget(NULL) - , _gui_window(NULL) + , _gui_widget(nullptr) + , _gui_window(nullptr) , _initialised(false) { block->signal_new_port().connect( @@ -284,7 +284,7 @@ NodeModule::embed_gui(bool embed) } } else { // un-embed - Ganv::Module::embed(NULL); + Ganv::Module::embed(nullptr); _plugin_ui.reset(); } } @@ -320,7 +320,7 @@ NodeModule::port(SPtr<const PortModel> model) if (port->model() == model) return port; } - return NULL; + return nullptr; } void @@ -388,9 +388,9 @@ void NodeModule::on_gui_window_close() { delete _gui_window; - _gui_window = NULL; + _gui_window = nullptr; _plugin_ui.reset(); - _gui_widget = NULL; + _gui_widget = nullptr; } void diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index df4267df..9c24ebd7 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -34,12 +34,12 @@ namespace GUI { ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) : Gtk::Menu(cobject) - , _app(NULL) - , _polyphonic_menuitem(NULL) - , _disconnect_menuitem(NULL) - , _rename_menuitem(NULL) - , _destroy_menuitem(NULL) - , _properties_menuitem(NULL) + , _app(nullptr) + , _polyphonic_menuitem(nullptr) + , _disconnect_menuitem(nullptr) + , _rename_menuitem(nullptr) + , _destroy_menuitem(nullptr) + , _properties_menuitem(nullptr) , _enable_signal(false) { xml->get_widget("object_learn_menuitem", _learn_menuitem); diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp index c997bf19..0b353b44 100644 --- a/src/gui/PluginMenu.cpp +++ b/src/gui/PluginMenu.cpp @@ -23,7 +23,7 @@ namespace GUI { PluginMenu::PluginMenu(Ingen::World& world) : _world(world) - , _classless_menu(NULL, NULL) + , _classless_menu(nullptr, nullptr) { clear(); } @@ -36,7 +36,7 @@ PluginMenu::clear() const LilvPluginClasses* classes = lilv_world_get_plugin_classes(lworld); // Empty completely - _classless_menu = MenuRecord(NULL, NULL); + _classless_menu = MenuRecord(nullptr, nullptr); _class_menus.clear(); items().clear(); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 88eb8050..28c3c6af 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -163,7 +163,7 @@ Port::update_metadata() bool Port::show_menu(GdkEventButton* ev) { - PortMenu* menu = NULL; + PortMenu* menu = nullptr; WidgetFactory::get_widget_derived("object_menu", menu); if (!menu) { _app.log().error("Failed to load port menu widget\n"); @@ -266,7 +266,7 @@ Port::build_uri_menu() const Atom& designation_atom = model()->get_property( _app.uris().lv2_designation); if (!designation_atom.is_valid()) { - return NULL; + return nullptr; } LilvNode* designation = lilv_new_uri( @@ -277,7 +277,7 @@ Port::build_uri_menu() // Get every class in the range of the port's property RDFS::URISet ranges; LilvNodes* range = lilv_world_find_nodes( - world->lilv_world(), designation, rdfs_range, NULL); + world->lilv_world(), designation, rdfs_range, nullptr); LILV_FOREACH(nodes, r, range) { ranges.insert(Raul::URI(lilv_node_as_string(lilv_nodes_get(range, r)))); } @@ -305,7 +305,7 @@ Port::build_uri_menu() bool Port::on_event(GdkEvent* ev) { - GraphBox* box = NULL; + GraphBox* box = nullptr; switch (ev->type) { case GDK_ENTER_NOTIFY: _entered = true; diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index dfae695a..970b708b 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -178,7 +178,7 @@ PropertiesWindow::class_supported(const RDFS::URISet& types) for (const auto& t : types) { LilvNode* range = lilv_new_uri(world->lilv_world(), t.c_str()); LilvNodes* instances = lilv_world_find_nodes( - world->lilv_world(), NULL, rdf_type, range); + world->lilv_world(), nullptr, rdf_type, range); const bool has_instance = (lilv_nodes_size(instances) > 0); @@ -270,7 +270,7 @@ PropertiesWindow::create_value_widget(const Raul::URI& key, const Atom& value) { if (!type_uri || !Raul::URI::is_valid(type_uri)) { - return NULL; + return nullptr; } Raul::URI type(type_uri); @@ -362,7 +362,7 @@ PropertiesWindow::create_value_widget(const Raul::URI& key, _app->log().error(fmt("No widget for value type %1%\n") % type); - return NULL; + return nullptr; } void diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index a997af5d..4dd21e28 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -33,7 +33,7 @@ label(World* world, const LilvNode* node) LilvNode* rdfs_label = lilv_new_uri( world->lilv_world(), LILV_NS_RDFS "label"); LilvNodes* labels = lilv_world_find_nodes( - world->lilv_world(), node, rdfs_label, NULL); + world->lilv_world(), node, rdfs_label, nullptr); const LilvNode* first = lilv_nodes_get_first(labels); std::string label = first ? lilv_node_as_string(first) : ""; @@ -49,7 +49,7 @@ comment(World* world, const LilvNode* node) LilvNode* rdfs_comment = lilv_new_uri( world->lilv_world(), LILV_NS_RDFS "comment"); LilvNodes* comments = lilv_world_find_nodes( - world->lilv_world(), node, rdfs_comment, NULL); + world->lilv_world(), node, rdfs_comment, nullptr); const LilvNode* first = lilv_nodes_get_first(comments); std::string comment = first ? lilv_node_as_string(first) : ""; @@ -70,9 +70,9 @@ closure(World* world, const LilvNode* pred, URISet& types, bool super) LilvNode* type = lilv_new_uri(world->lilv_world(), t.c_str()); LilvNodes* matches = (super) ? lilv_world_find_nodes( - world->lilv_world(), type, pred, NULL) + world->lilv_world(), type, pred, nullptr) : lilv_world_find_nodes( - world->lilv_world(), NULL, pred, type); + world->lilv_world(), nullptr, pred, type); LILV_FOREACH(nodes, m, matches) { const LilvNode* klass_node = lilv_nodes_get(matches, m); if (lilv_node_is_uri(klass_node)) { @@ -156,12 +156,12 @@ properties(World* world, SPtr<const Client::ObjectModel> model) LILV_NS_RDFS "domain"); LilvNodes* props = lilv_world_find_nodes( - world->lilv_world(), NULL, rdf_type, rdf_Property); + world->lilv_world(), nullptr, rdf_type, rdf_Property); LILV_FOREACH(nodes, p, props) { const LilvNode* prop = lilv_nodes_get(props, p); if (lilv_node_is_uri(prop)) { LilvNodes* domains = lilv_world_find_nodes( - world->lilv_world(), prop, rdfs_domain, NULL); + world->lilv_world(), prop, rdfs_domain, nullptr); unsigned n_matching_domains = 0; LILV_FOREACH(nodes, d, domains) { const LilvNode* domain_node = lilv_nodes_get(domains, d); @@ -203,7 +203,7 @@ instances(World* world, const URISet& types) for (const auto& t : types) { LilvNode* type = lilv_new_uri(world->lilv_world(), t.c_str()); LilvNodes* objects = lilv_world_find_nodes( - world->lilv_world(), NULL, rdf_type, type); + world->lilv_world(), nullptr, rdf_type, type); LILV_FOREACH(nodes, o, objects) { const LilvNode* object = lilv_nodes_get(objects, o); if (!lilv_node_is_uri(object)) { @@ -228,7 +228,7 @@ range(World* world, const LilvNode* prop, bool recursive) world->lilv_world(), LILV_NS_RDFS "range"); LilvNodes* nodes = lilv_world_find_nodes( - world->lilv_world(), prop, rdfs_range, NULL); + world->lilv_world(), prop, rdfs_range, nullptr); URISet ranges; LILV_FOREACH(nodes, n, nodes) { diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index c261ec36..a932300b 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -52,7 +52,7 @@ SubgraphModule::on_double_click(GdkEventButton* event) SPtr<GraphModel> parent = dynamic_ptr_cast<GraphModel>(_graph->parent()); GraphWindow* const preferred = ( (parent && (event->state & GDK_SHIFT_MASK)) - ? NULL + ? nullptr : app().window_factory()->graph_window(parent) ); app().window_factory()->present_graph(_graph, preferred); @@ -89,7 +89,7 @@ SubgraphModule::browse_to_graph() GraphWindow* const preferred = (parent) ? app().window_factory()->graph_window(parent) - : NULL; + : nullptr; app().window_factory()->present_graph(_graph, preferred); } diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp index 8e97d906..466948e4 100644 --- a/src/gui/URIEntry.cpp +++ b/src/gui/URIEntry.cpp @@ -67,8 +67,8 @@ URIEntry::build_value_menu() if (lilv_world_ask(world->lilv_world(), inst, rdf_type, rdfs_Class) || lilv_world_ask(world->lilv_world(), inst, rdf_type, rdfs_Datatype)) { // This value is a class or datatype... - if (!lilv_world_ask(lworld, inst, rdfs_subClassOf, NULL) && - !lilv_world_ask(lworld, inst, owl_onDatatype, NULL)) { + if (!lilv_world_ask(lworld, inst, rdfs_subClassOf, nullptr) && + !lilv_world_ask(lworld, inst, owl_onDatatype, nullptr)) { // ... which is not a subtype of another, add menu add_class_menu_item(menu, inst, label); } @@ -102,12 +102,12 @@ URIEntry::build_subclass_menu(const LilvNode* klass) LilvNode* rdfs_subClassOf = lilv_new_uri(lworld, LILV_NS_RDFS "subClassOf"); LilvNodes* subclasses = lilv_world_find_nodes( - lworld, NULL, rdfs_subClassOf, klass); + lworld, nullptr, rdfs_subClassOf, klass); LilvNodes* subtypes = lilv_world_find_nodes( - lworld, NULL, owl_onDatatype, klass); + lworld, nullptr, owl_onDatatype, klass); if (lilv_nodes_size(subclasses) == 0 && lilv_nodes_size(subtypes) == 0) { - return NULL; + return nullptr; } Gtk::Menu* menu = new Gtk::Menu(); diff --git a/src/gui/Window.hpp b/src/gui/Window.hpp index b7a60c76..2a5c9843 100644 --- a/src/gui/Window.hpp +++ b/src/gui/Window.hpp @@ -32,8 +32,8 @@ class App; class Window : public Gtk::Window { public: - Window() : Gtk::Window(), _app(NULL) {} - explicit Window(BaseObjectType* cobject) : Gtk::Window(cobject), _app(NULL) {} + Window() : Gtk::Window(), _app(nullptr) {} + explicit Window(BaseObjectType* cobject) : Gtk::Window(cobject), _app(nullptr) {} virtual void init_window(App& app) { _app = &app; } @@ -56,8 +56,8 @@ public: class Dialog : public Gtk::Dialog { public: - Dialog() : Gtk::Dialog(), _app(NULL) {} - explicit Dialog(BaseObjectType* cobject) : Gtk::Dialog(cobject), _app(NULL) {} + Dialog() : Gtk::Dialog(), _app(nullptr) {} + explicit Dialog(BaseObjectType* cobject) : Gtk::Dialog(cobject), _app(nullptr) {} virtual void init_dialog(App& app) { _app = &app; } diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 814123fb..3e3ba199 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -41,11 +41,11 @@ namespace GUI { WindowFactory::WindowFactory(App& app) : _app(app) - , _main_box(NULL) - , _load_plugin_win(NULL) - , _load_graph_win(NULL) - , _new_subgraph_win(NULL) - , _properties_win(NULL) + , _main_box(nullptr) + , _load_plugin_win(nullptr) + , _load_graph_win(nullptr) + , _new_subgraph_win(nullptr) + , _properties_win(nullptr) { WidgetFactory::get_widget_derived("load_plugin_win", _load_plugin_win); WidgetFactory::get_widget_derived("load_graph_win", _load_graph_win); @@ -108,18 +108,18 @@ GraphWindow* WindowFactory::graph_window(SPtr<const GraphModel> graph) { if (!graph) - return NULL; + return nullptr; GraphWindowMap::iterator w = _graph_windows.find(graph->path()); - return (w == _graph_windows.end()) ? NULL : w->second; + return (w == _graph_windows.end()) ? nullptr : w->second; } GraphWindow* WindowFactory::parent_graph_window(SPtr<const BlockModel> block) { if (!block) - return NULL; + return nullptr; return graph_window(dynamic_ptr_cast<GraphModel>(block->parent())); } @@ -162,11 +162,11 @@ WindowFactory::new_graph_window(SPtr<const GraphModel> graph, { assert(!view || view->graph() == graph); - GraphWindow* win = NULL; + GraphWindow* win = nullptr; WidgetFactory::get_widget_derived("graph_win", win); if (!win) { _app.log().error("Failed to load graph window widget\n"); - return NULL; + return nullptr; } win->init_window(_app); diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 005ed270..01ddc23e 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -60,10 +60,10 @@ struct IngenLV2AtomSink : public AtomSink { struct IngenLV2UI { IngenLV2UI() : argc(0) - , argv(NULL) - , forge(NULL) - , world(NULL) - , sink(NULL) + , argv(nullptr) + , forge(nullptr) + , world(nullptr) + , sink(nullptr) {} int argc; @@ -97,9 +97,9 @@ instantiate(const LV2UI_Descriptor* descriptor, Ingen::IngenLV2UI* ui = new Ingen::IngenLV2UI(); - LV2_URID_Map* map = NULL; - LV2_URID_Unmap* unmap = NULL; - LV2_Log_Log* log = NULL; + LV2_URID_Map* map = nullptr; + LV2_URID_Unmap* unmap = nullptr; + LV2_Log_Log* log = nullptr; for (int i = 0; features[i]; ++i) { if (!strcmp(features[i]->URI, LV2_URID__map)) { map = (LV2_URID_Map*)features[i]->data; @@ -117,7 +117,7 @@ instantiate(const LV2UI_Descriptor* descriptor, if (!ui->world->load_module("client")) { delete ui; - return NULL; + return nullptr; } ui->sink = new Ingen::IngenLV2AtomSink( @@ -185,7 +185,7 @@ port_event(LV2UI_Handle handle, static const void* extension_data(const char* uri) { - return NULL; + return nullptr; } static const LV2UI_Descriptor descriptor = { @@ -204,6 +204,6 @@ lv2ui_descriptor(uint32_t index) case 0: return &descriptor; default: - return NULL; + return nullptr; } } diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index 93dce69e..0e147642 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -90,7 +90,7 @@ main(int argc, char** argv) // Create world try { - world = unique_ptr<Ingen::World>(new Ingen::World(NULL, NULL, NULL)); + world = unique_ptr<Ingen::World>(new Ingen::World(nullptr, NULL, NULL)); world->load_configuration(argc, argv); if (argc <= 1) { world->conf().print_usage("ingen", cout); @@ -201,7 +201,7 @@ main(int argc, char** argv) engine_interface->copy(Raul::URI(path), main_uri()); } else { SerdNode uri = serd_node_new_file_uri( - (const uint8_t*)path, NULL, NULL, true); + (const uint8_t*)path, nullptr, nullptr, true); std::cout << "Loading " << (const char*)uri.buf << " (server side)" << std::endl; engine_interface->copy(Raul::URI((const char*)uri.buf), @@ -218,7 +218,7 @@ main(int argc, char** argv) engine_interface->copy(main_uri(), Raul::URI(path)); } else { SerdNode uri = serd_node_new_file_uri( - (const uint8_t*)path, NULL, NULL, true); + (const uint8_t*)path, nullptr, nullptr, true); std::cout << "Saving to " << (const char*)uri.buf << std::endl; engine_interface->copy(main_uri(), Raul::URI((const char*)uri.buf)); diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index de7c2de2..3314eb46 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -104,7 +104,7 @@ BlockFactory::plugin(const Raul::URI& uri) { load_plugin(uri); const Plugins::const_iterator i = _plugins.find(uri); - return ((i != _plugins.end()) ? i->second : NULL); + return ((i != _plugins.end()) ? i->second : nullptr); } void diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index d0f0d646..36bf3e30 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -159,7 +159,7 @@ BlockImpl::nth_port_by_type(uint32_t n, bool input, PortType type) } } } - return NULL; + return nullptr; } PortImpl* @@ -170,7 +170,7 @@ BlockImpl::port_by_symbol(const char* symbol) return _ports->at(p); } } - return NULL; + return nullptr; } void diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 7a8d2b8c..62d6b8e0 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -90,7 +90,7 @@ public: /** Duplicate this Node. */ virtual BlockImpl* duplicate(Engine& engine, const Raul::Symbol& symbol, - GraphImpl* parent) { return NULL; } + GraphImpl* parent) { return nullptr; } /** Return true iff this block is activated */ bool activated() const { return _activated; } @@ -102,7 +102,7 @@ public: void set_enabled(bool e) { _enabled = e; } /** Load a preset from the world for this block. */ - virtual LilvState* load_preset(const Raul::URI& uri) { return NULL; } + virtual LilvState* load_preset(const Raul::URI& uri) { return nullptr; } /** Restore `state`. */ virtual void apply_state(Worker* worker, const LilvState* state) {} diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 2353ab5d..c18da06a 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -46,12 +46,12 @@ Buffer::Buffer(BufferFactory& bufs, bool external, void* buf) : _factory(bufs) - , _buf(NULL) + , _buf(nullptr) , _type(type) , _value_type(value_type) , _capacity(capacity) , _latest_event(0) - , _next(NULL) + , _next(nullptr) , _refs(0) , _external(external) { @@ -210,7 +210,7 @@ Buffer::port_data(PortType port_type, SampleCount offset) } default: break; } - return NULL; + return nullptr; } const void* @@ -391,7 +391,7 @@ Buffer::next_value_offset(SampleCount offset, SampleCount end) const const LV2_Atom* Buffer::value() const { - return _value_buffer ? _value_buffer->get<const LV2_Atom>() : NULL; + return _value_buffer ? _value_buffer->get<const LV2_Atom>() : nullptr; } void @@ -417,7 +417,7 @@ Buffer::update_value_buffer(SampleCount offset) } LV2_Atom_Sequence* seq = get<LV2_Atom_Sequence>(); - LV2_Atom_Event* latest = NULL; + LV2_Atom_Event* latest = nullptr; LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { if (ev->time.frames > offset) { break; diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index f4e147ea..6d42b979 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -45,7 +45,7 @@ public: LV2_URID value_type, uint32_t capacity, bool external = false, - void* buf = NULL); + void* buf = nullptr); void clear(); void resize(uint32_t capacity); @@ -91,7 +91,7 @@ public: } else if (is_audio()) { return (const Sample*)_buf; } - return NULL; + return nullptr; } /// Audio buffers only @@ -101,7 +101,7 @@ public: } else if (is_audio()) { return (Sample*)_buf; } - return NULL; + return nullptr; } /// Numeric buffers only diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index f2451405..7c4dd003 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -25,14 +25,14 @@ namespace Ingen { namespace Server { BufferFactory::BufferFactory(Engine& engine, URIs& uris) - : _free_audio(NULL) - , _free_control(NULL) - , _free_sequence(NULL) - , _free_object(NULL) + : _free_audio(nullptr) + , _free_control(nullptr) + , _free_sequence(nullptr) + , _free_object(nullptr) , _engine(engine) , _uris(uris) , _seq_size(0) - , _silent_buffer(NULL) + , _silent_buffer(nullptr) { } @@ -109,7 +109,7 @@ Buffer* BufferFactory::try_get_buffer(LV2_URID type) { std::atomic<Buffer*>& head_ptr = free_list(type); - Buffer* head = NULL; + Buffer* head = nullptr; Buffer* next; do { head = head_ptr.load(); @@ -132,7 +132,7 @@ BufferFactory::get_buffer(LV2_URID type, return create(type, value_type, capacity); } - try_head->_next = NULL; + try_head->_next = nullptr; try_head->set_type(&BufferFactory::get_buffer, type, value_type); try_head->clear(); return BufferRef(try_head); @@ -149,7 +149,7 @@ BufferFactory::claim_buffer(LV2_URID type, return BufferRef(); } - try_head->_next = NULL; + try_head->_next = nullptr; try_head->set_type(&BufferFactory::claim_buffer, type, value_type); return BufferRef(try_head); } diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp index 13d6690e..6002afa1 100644 --- a/src/server/CompiledGraph.cpp +++ b/src/server/CompiledGraph.cpp @@ -31,7 +31,7 @@ namespace Server { /** Graph contains ambiguous feedback with no delay nodes. */ class FeedbackException : public std::exception { public: - FeedbackException(const BlockImpl* node, const BlockImpl* root=NULL) + FeedbackException(const BlockImpl* node, const BlockImpl* root=nullptr) : node(node) , root(root) {} diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 565f56b3..5f97452a 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -37,7 +37,7 @@ namespace Server { ControlBindings::ControlBindings(Engine& engine) : _engine(engine) - , _learn_binding(NULL) + , _learn_binding(nullptr) , _bindings(new Bindings()) , _feedback(new Buffer(*_engine.buffer_factory(), engine.world()->uris().atom_Sequence, @@ -68,7 +68,7 @@ ControlBindings::binding_key(const Atom& binding) const { const Ingen::URIs& uris = _engine.world()->uris(); Key key; - LV2_Atom* num = NULL; + LV2_Atom* num = nullptr; if (binding.type() == uris.atom_Object) { const LV2_Atom_Object_Body* obj = (const LV2_Atom_Object_Body*) binding.get_body(); @@ -340,7 +340,7 @@ bool ControlBindings::finish_learn(RunContext& context, Key key) { const Ingen::URIs& uris = context.engine().world()->uris(); - Binding* binding = _learn_binding.exchange(NULL); + Binding* binding = _learn_binding.exchange(nullptr); if (!binding || (key.type == Type::MIDI_NOTE && !binding->port->is_toggled())) { return false; } @@ -404,7 +404,7 @@ ControlBindings::pre_process(RunContext& ctx, Buffer* buffer) } // Set all controls bound to this key - const Binding k = {key, NULL}; + const Binding k = {key, nullptr}; for (Bindings::const_iterator i = _bindings->lower_bound(k); i != _bindings->end() && i->key == key; ++i) { diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index 20241fc0..aed1b607 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -67,7 +67,7 @@ public: /** One binding of a controller to a port. */ struct Binding : public boost::intrusive::set_base_hook<>, public Raul::Maid::Disposable { - Binding(Key k=Key(), PortImpl* p=NULL) : key(k), port(p) {} + Binding(Key k=Key(), PortImpl* p=nullptr) : key(k), port(p) {} inline bool operator<(const Binding& rhs) const { return key < rhs.key; } diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp index 706adda8..219d0cb1 100644 --- a/src/server/DirectDriver.hpp +++ b/src/server/DirectDriver.hpp @@ -57,7 +57,7 @@ public: } } - return NULL; + return nullptr; } virtual void add_port(RunContext& context, EnginePort* port) { diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index b01da97f..371ee5f4 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -158,7 +158,7 @@ DuplexPort::setup_buffers(RunContext& ctx, BufferFactory& bufs, uint32_t poly) void DuplexPort::set_is_driver_port(BufferFactory& bufs) { - _voices->at(0).buffer = new Buffer(bufs, buffer_type(), _value.type(), 0, true, NULL); + _voices->at(0).buffer = new Buffer(bufs, buffer_type(), _value.type(), 0, true, nullptr); PortImpl::set_is_driver_port(bufs); } diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 2e32e706..1884e25d 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -72,7 +72,7 @@ Engine::Engine(Ingen::World* world) , _block_factory(new BlockFactory(world)) , _broadcaster(new Broadcaster()) , _buffer_factory(new BufferFactory(*this, world->uris())) - , _control_bindings(NULL) + , _control_bindings(nullptr) , _event_writer(new EventWriter(*this)) , _interface(_event_writer) , _atom_interface(nullptr) @@ -81,10 +81,10 @@ Engine::Engine(Ingen::World* world) , _redo_stack(new UndoStack(_world->uris(), _world->uri_map())) , _pre_processor(new PreProcessor(*this)) , _post_processor(new PostProcessor(*this)) - , _root_graph(NULL) + , _root_graph(nullptr) , _worker(new Worker(world->log(), event_queue_size())) , _sync_worker(new Worker(world->log(), event_queue_size(), true)) - , _listener(NULL) + , _listener(nullptr) , _cycle_start_time(0) , _rand_engine(0) , _uniform_dist(0.0f, 1.0f) @@ -137,7 +137,7 @@ Engine::Engine(Ingen::World* world) Engine::~Engine() { - _root_graph = NULL; + _root_graph = nullptr; deactivate(); // Process all pending events @@ -289,7 +289,7 @@ Engine::steal_task(unsigned start_thread) } } } - return NULL; + return nullptr; } SPtr<Store> diff --git a/src/server/EnginePort.hpp b/src/server/EnginePort.hpp index c657f75a..c14f363c 100644 --- a/src/server/EnginePort.hpp +++ b/src/server/EnginePort.hpp @@ -38,8 +38,8 @@ class EnginePort : public Raul::Noncopyable public: explicit EnginePort(DuplexPort* port) : _graph_port(port) - , _buffer(NULL) - , _handle(NULL) + , _buffer(nullptr) + , _handle(nullptr) , _driver_index(0) {} diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 2cd17aa2..09018163 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -107,7 +107,7 @@ public: protected: Event(Engine& engine, SPtr<Interface> client, int32_t id, FrameTime time) : _engine(engine) - , _next(NULL) + , _next(nullptr) , _request_client(client) , _request_id(id) , _time(time) @@ -118,7 +118,7 @@ protected: /** Constructor for internal events only */ explicit Event(Engine& engine) : _engine(engine) - , _next(NULL) + , _next(nullptr) , _request_id(0) , _time(0) , _status(Status::NOT_PREPARED) diff --git a/src/server/GraphPlugin.hpp b/src/server/GraphPlugin.hpp index 9100b058..0314f9d6 100644 --- a/src/server/GraphPlugin.hpp +++ b/src/server/GraphPlugin.hpp @@ -46,7 +46,7 @@ public: Engine& engine, const LilvState* state) { - return NULL; + return nullptr; } const Raul::Symbol symbol() const { return Raul::Symbol("graph"); } diff --git a/src/server/InternalBlock.cpp b/src/server/InternalBlock.cpp index ffb5163f..3d8f7390 100644 --- a/src/server/InternalBlock.cpp +++ b/src/server/InternalBlock.cpp @@ -39,7 +39,7 @@ InternalBlock::duplicate(Engine& engine, BufferFactory& bufs = *engine.buffer_factory(); BlockImpl* copy = reinterpret_cast<InternalPlugin*>(_plugin)->instantiate( - bufs, symbol, _polyphonic, parent_graph(), engine, NULL); + bufs, symbol, _polyphonic, parent_graph(), engine, nullptr); for (size_t i = 0; i < num_ports(); ++i) { const Atom& value = port_impl(i)->value(); diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index 3342ef84..c81d7563 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -61,7 +61,7 @@ InternalPlugin::instantiate(BufferFactory& bufs, } else if (uri() == NS_INTERNALS "Trigger") { return new TriggerNode(this, bufs, symbol, polyphonic, parent, srate); } else { - return NULL; + return nullptr; } } diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 44f92dd8..0255c422 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -57,7 +57,7 @@ JackDriver::JackDriver(Engine& engine) : _engine(engine) , _sem(0) , _flag(false) - , _client(NULL) + , _client(nullptr) , _block_length(0) , _seq_size(0) , _sample_rate(0) @@ -88,7 +88,7 @@ JackDriver::attach(const std::string& server_name, const std::string uuid = _engine.world()->jack_uuid(); if (!uuid.empty()) { _client = jack_client_open(client_name.c_str(), - JackSessionID, NULL, + JackSessionID, nullptr, uuid.c_str()); _engine.log().info(fmt("Connected to Jack as `%1%' (UUID `%2%')\n") % client_name.c_str() % uuid); @@ -98,7 +98,7 @@ JackDriver::attach(const std::string& server_name, // Try supplied server name if (!_client && !server_name.empty()) { if ((_client = jack_client_open(client_name.c_str(), - JackServerName, NULL, + JackServerName, nullptr, server_name.c_str()))) { _engine.log().info(fmt("Connected to Jack server `%1%'\n") % server_name); @@ -108,7 +108,7 @@ JackDriver::attach(const std::string& server_name, // Either server name not specified, or supplied server name does not exist // Connect to default server if (!_client) { - if ((_client = jack_client_open(client_name.c_str(), JackNullOption, NULL))) + if ((_client = jack_client_open(client_name.c_str(), JackNullOption, nullptr))) _engine.log().info("Connected to default Jack server\n"); } @@ -152,7 +152,7 @@ JackDriver::activate() if (!_client) attach(world->conf().option("jack-server").ptr<char>(), - world->conf().option("jack-name").ptr<char>(), NULL); + world->conf().option("jack-name").ptr<char>(), nullptr); if (!_client) { return false; @@ -187,7 +187,7 @@ JackDriver::deactivate() if (_client) { jack_deactivate(_client); jack_client_close(_client); - _client = NULL; + _client = nullptr; } _engine.log().info("Deactivated Jack client\n"); @@ -203,7 +203,7 @@ JackDriver::get_port(const Raul::Path& path) } } - return NULL; + return nullptr; } void @@ -257,7 +257,7 @@ JackDriver::unregister_port(EnginePort& port) _engine.log().error("Failed to unregister Jack port\n"); } - port.set_handle(NULL); + port.set_handle(nullptr); } void @@ -315,7 +315,7 @@ JackDriver::port_property_internal(const jack_port_t* jport, EnginePort* JackDriver::create_port(DuplexPort* graph_port) { - EnginePort* eport = NULL; + EnginePort* eport = nullptr; if (graph_port->is_a(PortType::AUDIO) || graph_port->is_a(PortType::CV)) { // Audio buffer port, use Jack buffer directly eport = new EnginePort(graph_port); @@ -402,7 +402,7 @@ JackDriver::post_process_port(RunContext& context, EnginePort* port) // Reset graph port buffer pointer to no longer point to the Jack buffer if (graph_port->is_driver_port()) { - graph_port->set_driver_buffer(NULL, 0); + graph_port->set_driver_buffer(nullptr, 0); } } @@ -512,7 +512,7 @@ JackDriver::_shutdown_cb() { _engine.log().info("Jack shutdown, exiting\n"); _is_activated = false; - _client = NULL; + _client = nullptr; } int diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index e023e3d7..91490e69 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -63,7 +63,7 @@ LV2Block::LV2Block(LV2Plugin* plugin, SampleRate srate) : BlockImpl(plugin, symbol, polyphonic, parent, srate) , _lv2_plugin(plugin) - , _worker_iface(NULL) + , _worker_iface(nullptr) { assert(_lv2_plugin); } @@ -92,7 +92,7 @@ LV2Block::make_instance(URIs& uris, return SPtr<Instance>(); } - const LV2_Options_Interface* options_iface = NULL; + const LV2_Options_Interface* options_iface = nullptr; if (lilv_plugin_has_extension_data(lplug, uris.opt_interface)) { options_iface = (const LV2_Options_Interface*) lilv_instance_get_extension_data(inst, LV2_OPTIONS__interface); @@ -109,7 +109,7 @@ LV2Block::make_instance(URIs& uris, const LV2_Options_Option options[] = { { LV2_OPTIONS_PORT, p, uris.morph_currentType, sizeof(LV2_URID), uris.atom_URID, &port_type }, - { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL } + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, nullptr } }; options_iface->set(inst->lv2_handle, options); } @@ -131,8 +131,8 @@ LV2Block::make_instance(URIs& uris, PortImpl* const port = _ports->at(p); if (port->is_auto_morph()) { LV2_Options_Option options[] = { - { LV2_OPTIONS_PORT, p, uris.morph_currentType, 0, 0, NULL }, - { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, 0 } + { LV2_OPTIONS_PORT, p, uris.morph_currentType, 0, 0, nullptr }, + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, nullptr } }; options_iface->get(inst->lv2_handle, options); @@ -391,7 +391,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state) const LilvNode* preds[] = { uris.lv2_designation, uris.lv2_portProperty, uris.atom_supports, - 0 }; + nullptr }; for (int p = 0; preds[p]; ++p) { LilvNodes* values = lilv_port_get_value(plug, id, preds[p]); LILV_FOREACH(nodes, v, values) { @@ -434,14 +434,14 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state) } // Load initial state if no state is explicitly given - LilvState* default_state = NULL; + LilvState* default_state = nullptr; if (!state) { state = default_state = load_preset(_lv2_plugin->uri()); } // Apply state if (state) { - apply_state(NULL, state); + apply_state(nullptr, state); } if (default_state) { @@ -467,8 +467,8 @@ LV2Block::save_state(const std::string& dir) const LilvState* state = lilv_state_new_from_instance( _lv2_plugin->lilv_plugin(), const_cast<LV2Block*>(this)->instance(0), &world->uri_map().urid_map_feature()->urid_map, - NULL, dir.c_str(), dir.c_str(), dir.c_str(), NULL, NULL, - LV2_STATE_IS_POD|LV2_STATE_IS_PORTABLE, NULL); + nullptr, dir.c_str(), dir.c_str(), dir.c_str(), nullptr, nullptr, + LV2_STATE_IS_POD|LV2_STATE_IS_PORTABLE, nullptr); if (!state) { return false; @@ -481,7 +481,7 @@ LV2Block::save_state(const std::string& dir) const &world->uri_map().urid_map_feature()->urid_map, &world->uri_map().urid_unmap_feature()->urid_unmap, state, - NULL, + nullptr, dir.c_str(), "state.ttl"); @@ -501,13 +501,13 @@ LV2Block::duplicate(Engine& engine, LilvState* state = lilv_state_new_from_instance( _lv2_plugin->lilv_plugin(), instance(0), &engine.world()->uri_map().urid_map_feature()->urid_map, - NULL, NULL, NULL, NULL, NULL, NULL, LV2_STATE_IS_NATIVE, NULL); + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, LV2_STATE_IS_NATIVE, nullptr); // Duplicate and instantiate block LV2Block* dup = new LV2Block(_lv2_plugin, symbol, _polyphonic, parent, rate); if (!dup->instantiate(*engine.buffer_factory(), state)) { delete dup; - return NULL; + return nullptr; } dup->set_properties(properties()); @@ -644,13 +644,13 @@ LV2Block::apply_state(Worker* worker, const LilvState* state) sched = worker->schedule_feature()->feature(world, this); } - const LV2_Feature* state_features[2] = { NULL, NULL }; + const LV2_Feature* state_features[2] = { nullptr, nullptr }; if (sched) { state_features[0] = sched.get(); } for (uint32_t v = 0; v < _polyphony; ++v) { - lilv_state_restore(state, instance(v), NULL, NULL, 0, state_features); + lilv_state_restore(state, instance(v), nullptr, nullptr, 0, state_features); } } @@ -669,7 +669,7 @@ get_port_value(const char* port_symbol, return port->value().get_body(); } - return NULL; + return nullptr; } boost::optional<Resource> @@ -687,8 +687,8 @@ LV2Block::save_preset(const Raul::URI& uri, LilvState* state = lilv_state_new_from_instance( _lv2_plugin->lilv_plugin(), instance(0), lmap, - NULL, NULL, NULL, path.c_str(), - get_port_value, this, LV2_STATE_IS_NATIVE, NULL); + nullptr, nullptr, nullptr, path.c_str(), + get_port_value, this, LV2_STATE_IS_NATIVE, nullptr); if (state) { const Properties::const_iterator l = props.find(_uris.rdfs_label); @@ -696,7 +696,7 @@ LV2Block::save_preset(const Raul::URI& uri, lilv_state_set_label(state, l->second.ptr<char>()); } - lilv_state_save(lworld, lmap, lunmap, state, NULL, + lilv_state_save(lworld, lmap, lunmap, state, nullptr, dirname.c_str(), basename.c_str()); const Raul::URI uri(lilv_node_as_uri(lilv_state_get_uri(state))); @@ -732,7 +732,7 @@ LV2Block::set_port_buffer(uint32_t voice, lilv_instance_connect_port( instance(voice), port_num, - buf ? buf->port_data(_ports->at(port_num)->type(), offset) : NULL); + buf ? buf->port_data(_ports->at(port_num)->type(), offset) : nullptr); } } // namespace Server diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp index 1ef8db91..ef7c5ec9 100644 --- a/src/server/LV2Options.hpp +++ b/src/server/LV2Options.hpp @@ -48,7 +48,7 @@ public: sizeof(int32_t), _uris.atom_Int, &_seq_size }, { LV2_OPTIONS_INSTANCE, 0, _uris.param_sampleRate, sizeof(int32_t), _uris.atom_Int, &_sample_rate }, - { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL } + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, nullptr } }; LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature)); diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 0ba990d0..cd29c0b1 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -48,11 +48,11 @@ LV2Plugin::update_properties() LilvNode* minor = lilv_world_get(_world->lilv_world(), lilv_plugin_get_uri(_lilv_plugin), _uris.lv2_minorVersion, - NULL); + nullptr); LilvNode* micro = lilv_world_get(_world->lilv_world(), lilv_plugin_get_uri(_lilv_plugin), _uris.lv2_microVersion, - NULL); + nullptr); if (lilv_node_is_int(minor) && lilv_node_is_int(micro)) { set_property(_uris.lv2_minorVersion, @@ -98,7 +98,7 @@ LV2Plugin::instantiate(BufferFactory& bufs, if (!b->instantiate(bufs, state)) { delete b; - return NULL; + return nullptr; } else { return b; } @@ -117,7 +117,7 @@ LV2Plugin::load_presets() lilv_world_load_resource(lworld, preset); LilvNodes* labels = lilv_world_find_nodes( - lworld, preset, uris.rdfs_label, NULL); + lworld, preset, uris.rdfs_label, nullptr); if (labels) { const LilvNode* label = lilv_nodes_get_first(labels); diff --git a/src/server/PortAudioDriver.cpp b/src/server/PortAudioDriver.cpp index 1c0a1b0b..a97f5105 100644 --- a/src/server/PortAudioDriver.cpp +++ b/src/server/PortAudioDriver.cpp @@ -125,17 +125,17 @@ PortAudioDriver::activate() // Configure audio format _inputParameters.sampleFormat = paFloat32|paNonInterleaved; _inputParameters.suggestedLatency = in_dev->defaultLowInputLatency; - _inputParameters.hostApiSpecificStreamInfo = NULL; + _inputParameters.hostApiSpecificStreamInfo = nullptr; _outputParameters.sampleFormat = paFloat32|paNonInterleaved; _outputParameters.suggestedLatency = out_dev->defaultLowOutputLatency; - _outputParameters.hostApiSpecificStreamInfo = NULL; + _outputParameters.hostApiSpecificStreamInfo = nullptr; // Open stream PaError st = paNoError; if ((st = Pa_OpenStream( &_stream, - _inputParameters.channelCount ? &_inputParameters : NULL, - _outputParameters.channelCount ? &_outputParameters : NULL, + _inputParameters.channelCount ? &_inputParameters : nullptr, + _outputParameters.channelCount ? &_outputParameters : nullptr, in_dev->defaultSampleRate, _block_length, // paFramesPerBufferUnspecified, // FIXME: ? 0, @@ -173,7 +173,7 @@ PortAudioDriver::get_port(const Raul::Path& path) } } - return NULL; + return nullptr; } void @@ -214,7 +214,7 @@ PortAudioDriver::port_property(const Raul::Path& path, EnginePort* PortAudioDriver::create_port(DuplexPort* graph_port) { - EnginePort* eport = NULL; + EnginePort* eport = nullptr; if (graph_port->is_a(PortType::AUDIO) || graph_port->is_a(PortType::CV)) { // Audio buffer port, use Jack buffer directly eport = new EnginePort(graph_port); diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 50a48fbd..a3abe825 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -77,7 +77,7 @@ PortImpl::PortImpl(BufferFactory& bufs, , _is_driver_port(false) , _is_output(is_output) { - assert(block != NULL); + assert(block != nullptr); assert(_poly > 0); const Ingen::URIs& uris = bufs.uris(); @@ -398,7 +398,7 @@ void PortImpl::recycle_buffers() { for (uint32_t v = 0; v < _poly; ++v) - _voices->at(v).buffer = NULL; + _voices->at(v).buffer = nullptr; } void diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index 46d4b606..0cbd842c 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -78,7 +78,7 @@ public: }; struct Voice { - Voice() : buffer(NULL) {} + Voice() : buffer(nullptr) {} SetState set_state; BufferRef buffer; diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp index 211816c6..6beccd7c 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -37,8 +37,8 @@ namespace Server { PreProcessor::PreProcessor(Engine& engine) : _engine(engine) , _sem(0) - , _head(NULL) - , _tail(NULL) + , _head(nullptr) + , _tail(nullptr) , _block_state(BlockState::UNBLOCKED) , _exit_flag(false) , _thread(&PreProcessor::run, this) @@ -151,7 +151,7 @@ PreProcessor::process(RunContext& context, PostProcessor& dest, size_t limit) #endif Event* next = (Event*)last->next(); - last->next(NULL); + last->next(nullptr); dest.append(context, head, last); // Since _head was not NULL, we know it hasn't been changed since @@ -179,7 +179,7 @@ PreProcessor::run() ThreadManager::set_flag(THREAD_PRE_PROCESS); - Event* back = NULL; + Event* back = nullptr; while (!_exit_flag) { if (!_sem.timed_wait(std::chrono::seconds(1))) { continue; diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp index b2e3f269..d065c41f 100644 --- a/src/server/RunContext.cpp +++ b/src/server/RunContext.cpp @@ -30,7 +30,7 @@ namespace Server { struct Notification { - inline Notification(PortImpl* p = 0, + inline Notification(PortImpl* p = nullptr, FrameTime f = 0, LV2_URID k = 0, uint32_t s = 0, @@ -115,7 +115,7 @@ RunContext::emit_notifications(FrameTime end) } if (_event_sink->read(sizeof(note), ¬e) == sizeof(note)) { Atom value = _engine.world()->forge().alloc( - note.size, note.type, NULL); + note.size, note.type, nullptr); if (_event_sink->read(note.size, value.get_body()) == note.size) { i += note.size; const char* key = _engine.world()->uri_map().unmap_uri(note.key); diff --git a/src/server/RunContext.hpp b/src/server/RunContext.hpp index 8df9915b..954e11d8 100644 --- a/src/server/RunContext.hpp +++ b/src/server/RunContext.hpp @@ -80,10 +80,10 @@ public: */ bool notify(LV2_URID key = 0, FrameTime time = 0, - PortImpl* port = 0, + PortImpl* port = nullptr, uint32_t size = 0, LV2_URID type = 0, - const void* body = NULL); + const void* body = nullptr); /** Emit pending notifications in some other non-realtime thread. */ void emit_notifications(FrameTime end); diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp index de4c64ca..dad211ad 100644 --- a/src/server/UndoStack.cpp +++ b/src/server/UndoStack.cpp @@ -61,10 +61,10 @@ UndoStack::ignore_later_event(const LV2_Atom* first, const LV2_Atom_Object* f = (const LV2_Atom_Object*)first; const LV2_Atom_Object* s = (const LV2_Atom_Object*)second; if (f->body.otype == _uris.patch_Set && f->body.otype == s->body.otype) { - const LV2_Atom* f_subject = NULL; - const LV2_Atom* f_property = NULL; - const LV2_Atom* s_subject = NULL; - const LV2_Atom* s_property = NULL; + const LV2_Atom* f_subject = nullptr; + const LV2_Atom* f_property = nullptr; + const LV2_Atom* s_subject = nullptr; + const LV2_Atom* s_property = nullptr; lv2_atom_object_get(f, (LV2_URID)_uris.patch_subject, &f_subject, (LV2_URID)_uris.patch_property, &f_property, @@ -136,7 +136,7 @@ struct ListContext { SerdNode start_node(SerdWriter* writer) { const SerdNode node = ids.get(); - serd_writer_write_statement(writer, flags, NULL, &s, &p, &node, NULL, NULL); + serd_writer_write_statement(writer, flags, nullptr, &s, &p, &node, nullptr, nullptr); return node; } @@ -147,7 +147,7 @@ struct ListContext { // node rdf:first value p = serd_node_from_string(SERD_URI, NS_RDF "first"); flags = SERD_LIST_CONT; - serd_writer_write_statement(writer, flags|oflags, NULL, &node, &p, value, NULL, NULL); + serd_writer_write_statement(writer, flags|oflags, nullptr, &node, &p, value, nullptr, nullptr); end_node(writer, &node); } @@ -160,7 +160,7 @@ struct ListContext { void end(SerdWriter* writer) { const SerdNode nil = serd_node_from_string(SERD_URI, NS_RDF "nil"); - serd_writer_write_statement(writer, flags, NULL, &s, &p, &nil, NULL, NULL); + serd_writer_write_statement(writer, flags, nullptr, &s, &p, &nil, nullptr, nullptr); } BlankIDs& ids; @@ -181,7 +181,7 @@ UndoStack::write_entry(Sratom* sratom, // entry rdf:type ingen:UndoEntry SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time")); SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str)); - serd_writer_write_statement(writer, SERD_ANON_CONT, NULL, subject, &p, &o, NULL, NULL); + serd_writer_write_statement(writer, SERD_ANON_CONT, nullptr, subject, &p, &o, nullptr, nullptr); p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "events")); @@ -206,7 +206,7 @@ UndoStack::write_entry(Sratom* sratom, void UndoStack::save(FILE* stream, const char* name) { - SerdEnv* env = serd_env_new(NULL); + SerdEnv* env = serd_env_new(nullptr); serd_env_set_prefix_from_strings(env, USTR("atom"), USTR(LV2_ATOM_PREFIX)); serd_env_set_prefix_from_strings(env, USTR("ingen"), USTR(INGEN_NS)); serd_env_set_prefix_from_strings(env, USTR("patch"), USTR(LV2_PATCH_PREFIX)); diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 306c7533..8937b327 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -40,8 +40,8 @@ Connect::Connect(Engine& engine, const Ingen::Connect& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) - , _graph(NULL) - , _head(NULL) + , _graph(nullptr) + , _head(nullptr) {} bool diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index c83acb6e..b1cea1db 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -37,9 +37,9 @@ Copy::Copy(Engine& engine, const Ingen::Copy& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) - , _old_block(NULL) - , _parent(NULL) - , _block(NULL) + , _old_block(nullptr) + , _parent(nullptr) + , _block(nullptr) {} bool diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index c636bf3c..d2a7d350 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -44,8 +44,8 @@ CreateBlock::CreateBlock(Engine& engine, : Event(engine, client, id, timestamp) , _path(path) , _properties(properties) - , _graph(NULL) - , _block(NULL) + , _graph(nullptr) + , _block(nullptr) {} bool @@ -116,7 +116,7 @@ CreateBlock::pre_process(PreProcessContext& ctx) } // Load state from directory if given in properties - LilvState* state = NULL; + LilvState* state = nullptr; Properties::iterator s = _properties.find(uris.state_state); if (s != _properties.end() && s->second.type() == uris.forge.Path) { state = LV2Block::load_state(_engine.world(), s->second.ptr<char>()); diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index a22160ba..7a2c7304 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -40,8 +40,8 @@ CreateGraph::CreateGraph(Engine& engine, : Event(engine, client, id, timestamp) , _path(path) , _properties(properties) - , _graph(NULL) - , _parent(NULL) + , _graph(nullptr) + , _parent(nullptr) {} CreateGraph::~CreateGraph() diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index bc43ca41..e17b8b01 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -46,9 +46,9 @@ CreatePort::CreatePort(Engine& engine, , _path(path) , _port_type(PortType::UNKNOWN) , _buf_type(0) - , _graph(NULL) - , _graph_port(NULL) - , _engine_port(NULL) + , _graph(nullptr) + , _graph_port(nullptr) + , _engine_port(nullptr) , _properties(properties) { const Ingen::URIs& uris = _engine.world()->uris(); diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index b83dcef9..e50e5fa8 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -41,8 +41,8 @@ Delete::Delete(Engine& engine, const Ingen::Del& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) - , _engine_port(NULL) - , _disconnect_event(NULL) + , _engine_port(nullptr) + , _disconnect_event(nullptr) { if (uri_is_path(msg.uri)) { _path = uri_to_path(msg.uri); @@ -142,7 +142,7 @@ Delete::execute(RunContext& context) _engine.control_bindings()->remove(context, _removed_bindings); } - GraphImpl* parent = _block ? _block->parent_graph() : NULL; + GraphImpl* parent = _block ? _block->parent_graph() : nullptr; if (_port) { // Adjust port indices if necessary for (size_t i = 0; i < _ports_array->size(); ++i) { diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 0b26b797..e5ff8325 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -47,13 +47,13 @@ Delta::Delta(Engine& engine, SampleCount timestamp, const Ingen::Put& msg) : Event(engine, client, msg.seq, timestamp) - , _create_event(NULL) + , _create_event(nullptr) , _subject(msg.uri) , _properties(msg.properties) - , _object(NULL) - , _graph(NULL) - , _binding(NULL) - , _state(NULL) + , _object(nullptr) + , _graph(nullptr) + , _binding(nullptr) + , _state(nullptr) , _context(msg.ctx) , _type(Type::PUT) , _block(false) @@ -66,14 +66,14 @@ Delta::Delta(Engine& engine, SampleCount timestamp, const Ingen::Delta& msg) : Event(engine, client, msg.seq, timestamp) - , _create_event(NULL) + , _create_event(nullptr) , _subject(msg.uri) , _properties(msg.add) , _remove(msg.remove) - , _object(NULL) - , _graph(NULL) - , _binding(NULL) - , _state(NULL) + , _object(nullptr) + , _graph(nullptr) + , _binding(nullptr) + , _state(nullptr) , _context(msg.ctx) , _type(Type::PATCH) , _block(false) @@ -86,13 +86,13 @@ Delta::Delta(Engine& engine, SampleCount timestamp, const Ingen::SetProperty& msg) : Event(engine, client, msg.seq, timestamp) - , _create_event(NULL) + , _create_event(nullptr) , _subject(msg.subject) , _properties{{msg.predicate, msg.value}} - , _object(NULL) - , _graph(NULL) - , _binding(NULL) - , _state(NULL) + , _object(nullptr) + , _graph(nullptr) + , _binding(nullptr) + , _state(nullptr) , _context(msg.ctx) , _type(Type::SET) , _block(false) @@ -159,14 +159,14 @@ static LilvNode* get_file_node(LilvWorld* lworld, const URIs& uris, const Atom& value) { if (value.type() == uris.atom_Path) { - return lilv_new_file_uri(lworld, NULL, value.ptr<char>()); + return lilv_new_file_uri(lworld, nullptr, value.ptr<char>()); } else 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 NULL; + return nullptr; } bool @@ -324,7 +324,7 @@ Delta::pre_process(PreProcessContext& ctx) } } - BlockImpl* block = NULL; + BlockImpl* block = nullptr; PortImpl* port = dynamic_cast<PortImpl*>(_object); if (port) { if (key == uris.ingen_broadcast) { diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index f043d7dc..7e38ffe1 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -43,8 +43,8 @@ Disconnect::Disconnect(Engine& engine, const Ingen::Disconnect& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) - , _graph(NULL) - , _impl(NULL) + , _graph(nullptr) + , _impl(nullptr) { } @@ -150,7 +150,7 @@ Disconnect::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::NOT_FOUND, _msg.head); } - if (tail_block == NULL || head_block == NULL) { + if (tail_block == nullptr || head_block == nullptr) { return Event::pre_process_done(Status::PARENT_NOT_FOUND, _msg.head); } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index afb9c8cb..6d018c81 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -43,9 +43,9 @@ DisconnectAll::DisconnectAll(Engine& engine, const Ingen::DisconnectAll& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) - , _parent(NULL) - , _block(NULL) - , _port(NULL) + , _parent(nullptr) + , _block(nullptr) + , _port(nullptr) , _deleting(false) { } diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 64af9363..e4a5c760 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -39,8 +39,8 @@ Get::Get(Engine& engine, const Ingen::Get& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) - , _object(NULL) - , _plugin(NULL) + , _object(nullptr) + , _plugin(nullptr) {} bool @@ -56,9 +56,9 @@ Get::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::SUCCESS); } else if (uri_is_path(uri)) { if ((_object = _engine.store()->get(uri_to_path(uri)))) { - const BlockImpl* block = NULL; - const GraphImpl* graph = NULL; - const PortImpl* port = NULL; + const BlockImpl* block = nullptr; + const GraphImpl* graph = nullptr; + const PortImpl* port = nullptr; if ((graph = dynamic_cast<const GraphImpl*>(_object))) { _response.put_graph(graph); } else if ((block = dynamic_cast<const BlockImpl*>(_object))) { diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index 43d25aa7..38326c20 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -42,7 +42,7 @@ struct IngenJackModule : public Ingen::Module { const std::string server_name = s.is_valid() ? s.ptr<char>() : ""; driver->attach(server_name, world->conf().option("jack-name").ptr<char>(), - NULL); + nullptr); ((Server::Engine*)world->engine().get())->set_driver( SPtr<Server::Driver>(driver)); } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index b3489d6d..2ad2a1f1 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -106,7 +106,7 @@ public: *this) , _from_ui(ui_ring_size(block_length)) , _to_ui(ui_ring_size(block_length)) - , _root_graph(NULL) + , _root_graph(nullptr) , _notify_capacity(0) , _block_length(block_length) , _seq_size(seq_size) @@ -159,7 +159,7 @@ public: // No copying necessary, host buffers are used directly // Reset graph port buffer pointer to no longer point to the Jack buffer if (graph_port->is_driver_port()) { - graph_port->set_driver_buffer(NULL, 0); + graph_port->set_driver_buffer(nullptr, 0); } } @@ -202,7 +202,7 @@ public: } } - return NULL; + return nullptr; } /** Add a port. Called only during init or restore. */ @@ -217,7 +217,7 @@ public: /** Remove a port. Called only during init or restore. */ virtual void remove_port(RunContext& context, EnginePort* port) { const uint32_t index = port->graph_port()->index(); - _ports[index] = NULL; + _ports[index] = nullptr; } /** Unused since LV2 has no dynamic ports. */ @@ -289,7 +289,7 @@ public: void consume_from_ui() { const uint32_t read_space = _from_ui.read_space(); - void* buf = NULL; + void* buf = nullptr; for (uint32_t read = 0; read < read_space;) { LV2_Atom atom; if (!_from_ui.read(sizeof(LV2_Atom), &atom)) { @@ -423,11 +423,11 @@ ingen_lv2_main(SPtr<Engine> engine, LV2Driver* driver) struct IngenPlugin { IngenPlugin() - : world(NULL) - , main(NULL) - , map(NULL) + : world(nullptr) + , main(nullptr) + , map(nullptr) , argc(0) - , argv(NULL) + , argv(nullptr) {} Ingen::World* world; @@ -464,10 +464,10 @@ ingen_instantiate(const LV2_Descriptor* descriptor, const LV2_Feature*const* features) { // Get features from features array - LV2_URID_Map* map = NULL; - LV2_URID_Unmap* unmap = NULL; - LV2_Log_Log* log = NULL; - const LV2_Options_Option* options = NULL; + LV2_URID_Map* map = nullptr; + LV2_URID_Unmap* unmap = nullptr; + LV2_Log_Log* log = nullptr; + const LV2_Options_Option* options = nullptr; for (int i = 0; features[i]; ++i) { if (!strcmp(features[i]->URI, LV2_URID__map)) { map = (LV2_URID_Map*)features[i]->data; @@ -485,21 +485,21 @@ ingen_instantiate(const LV2_Descriptor* descriptor, if (!map) { lv2_log_error(&logger, "host did not provide URI map feature\n"); - return NULL; + return nullptr; } else if (!unmap) { lv2_log_error(&logger, "host did not provide URI unmap feature\n"); - return NULL; + return nullptr; } set_bundle_path(bundle_path); const std::string manifest_path = Ingen::bundle_file_path("manifest.ttl"); SerdNode manifest_node = serd_node_new_file_uri( - (const uint8_t*)manifest_path.c_str(), NULL, NULL, true); + (const uint8_t*)manifest_path.c_str(), nullptr, nullptr, true); Lib::Graphs graphs = find_graphs((const char*)manifest_node.buf); serd_node_free(&manifest_node); - const LV2Graph* graph = NULL; + const LV2Graph* graph = nullptr; for (const auto& g : graphs) { if (g->uri == descriptor->URI) { graph = g.get(); @@ -509,7 +509,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, if (!graph) { lv2_log_error(&logger, "could not find graph <%s>\n", descriptor->URI); - return NULL; + return nullptr; } IngenPlugin* plugin = new IngenPlugin(); @@ -642,7 +642,7 @@ ingen_deactivate(LV2_Handle instance) if (me->main) { me->main->join(); delete me->main; - me->main = NULL; + me->main = nullptr; } } @@ -685,8 +685,8 @@ ingen_save(LV2_Handle instance, { IngenPlugin* plugin = (IngenPlugin*)instance; - LV2_State_Map_Path* map_path = NULL; - LV2_State_Make_Path* make_path = NULL; + LV2_State_Map_Path* map_path = nullptr; + LV2_State_Make_Path* make_path = nullptr; get_state_features(features, &map_path, &make_path); if (!map_path || !make_path || !plugin->map) { plugin->world->log().error("Missing state:mapPath, state:makePath, or urid:Map\n"); @@ -731,8 +731,8 @@ ingen_restore(LV2_Handle instance, { IngenPlugin* plugin = (IngenPlugin*)instance; - LV2_State_Map_Path* map_path = NULL; - get_state_features(features, &map_path, NULL); + LV2_State_Map_Path* map_path = nullptr; + get_state_features(features, &map_path, nullptr); if (!map_path) { plugin->world->log().error("Missing state:mapPath\n"); return LV2_STATE_ERR_NO_FEATURE; @@ -788,7 +788,7 @@ ingen_extension_data(const char* uri) if (!strcmp(uri, LV2_STATE__interface)) { return &state; } - return NULL; + return nullptr; } LV2Graph::LV2Graph(const Parser::ResourceRecord& record) @@ -809,7 +809,7 @@ Lib::Lib(const char* bundle_path) Ingen::set_bundle_path(bundle_path); const std::string manifest_path = Ingen::bundle_file_path("manifest.ttl"); SerdNode manifest_node = serd_node_new_file_uri( - (const uint8_t*)manifest_path.c_str(), NULL, NULL, true); + (const uint8_t*)manifest_path.c_str(), nullptr, nullptr, true); graphs = find_graphs((const char*)manifest_node.buf); @@ -827,7 +827,7 @@ static const LV2_Descriptor* lib_get_plugin(LV2_Lib_Handle handle, uint32_t index) { Lib* lib = (Lib*)handle; - return index < lib->graphs.size() ? &lib->graphs[index]->descriptor : NULL; + return index < lib->graphs.size() ? &lib->graphs[index]->descriptor : nullptr; } /** LV2 plugin library entry point */ diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 754d76f2..9b157d54 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -225,7 +225,7 @@ NoteNode::note_on(RunContext& context, uint8_t note_num, uint8_t velocity, Frame assert(note_num <= 127); Key* key = &_keys[note_num]; - Voice* voice = NULL; + Voice* voice = nullptr; uint32_t voice_num = 0; if (key->state != Key::State::OFF) { @@ -242,7 +242,7 @@ NoteNode::note_on(RunContext& context, uint8_t note_num, uint8_t velocity, Frame } // If we didn't find a free one, steal the oldest - if (voice == NULL) { + if (voice == nullptr) { voice_num = 0; voice = &(*_voices)[0]; FrameTime oldest_time = (*_voices)[0].time; @@ -254,7 +254,7 @@ NoteNode::note_on(RunContext& context, uint8_t note_num, uint8_t velocity, Frame } } } - assert(voice != NULL); + assert(voice != nullptr); assert(voice == &(*_voices)[voice_num]); // Update stolen key, if applicable @@ -325,19 +325,19 @@ NoteNode::free_voice(RunContext& context, uint32_t voice, FrameTime time) assert(time >= context.start() && time <= context.end()); // Find a key to reassign to the freed voice (the newest, if there is one) - Key* replace_key = NULL; + Key* replace_key = nullptr; uint8_t replace_key_num = 0; for (uint8_t i = 0; i <= 127; ++i) { if (_keys[i].state == Key::State::ON_UNASSIGNED) { - if (replace_key == NULL || _keys[i].time > replace_key->time) { + if (replace_key == nullptr || _keys[i].time > replace_key->time) { replace_key = &_keys[i]; replace_key_num = i; } } } - if (replace_key != NULL) { // Found a key to assign to freed voice + if (replace_key != nullptr) { // Found a key to assign to freed voice assert(&_keys[replace_key_num] == replace_key); assert(replace_key->state == Key::State::ON_UNASSIGNED); diff --git a/src/server/mix.cpp b/src/server/mix.cpp index 897a26e6..3e7634fe 100644 --- a/src/server/mix.cpp +++ b/src/server/mix.cpp @@ -71,18 +71,18 @@ mix(const RunContext& context, } else if (dst->is_sequence()) { const LV2_Atom_Event* iters[num_srcs]; for (uint32_t i = 0; i < num_srcs; ++i) { - iters[i] = NULL; + iters[i] = nullptr; if (srcs[i]->is_sequence()) { const LV2_Atom_Sequence* seq = srcs[i]->get<const LV2_Atom_Sequence>(); iters[i] = lv2_atom_sequence_begin(&seq->body); if (is_end(srcs[i], iters[i])) { - iters[i] = NULL; + iters[i] = nullptr; } } } while (true) { - const LV2_Atom_Event* first = NULL; + const LV2_Atom_Event* first = nullptr; uint32_t first_i = 0; for (uint32_t i = 0; i < num_srcs; ++i) { const LV2_Atom_Event* const ev = iters[i]; @@ -99,7 +99,7 @@ mix(const RunContext& context, iters[first_i] = lv2_atom_sequence_next(first); if (is_end(srcs[first_i], iters[first_i])) { - iters[first_i] = NULL; + iters[first_i] = nullptr; } } else { break; |