From 7c19aa2a97c1e19b27b66c58a84c46489101950e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 4 Feb 2010 17:21:44 +0000 Subject: Use std::string::empty where possible (faster, and less prone to C string errors). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2420 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/HTTPEngineReceiver.cpp | 2 +- src/engine/JackDriver.cpp | 6 +++--- src/engine/LV2Plugin.cpp | 2 +- src/engine/NodeBase.hpp | 2 -- src/engine/NodeFactory.cpp | 6 +++--- src/engine/events/CreateNode.cpp | 2 +- src/engine/events/CreatePort.cpp | 1 + 7 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/engine') diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp index 025243eb..dbda1ddd 100644 --- a/src/engine/HTTPEngineReceiver.cpp +++ b/src/engine/HTTPEngineReceiver.cpp @@ -117,7 +117,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const // Special GET paths if (msg->method == SOUP_METHOD_GET) { - if (path == Path::root.str() || path == "") { + if (path == Path::root.str() || path.empty()) { const string r = string("@prefix rdfs: .\n") .append("\n<> rdfs:seeAlso ;") .append("\n rdfs:seeAlso ;") diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp index fc2e5e59..e903586e 100644 --- a/src/engine/JackDriver.cpp +++ b/src/engine/JackDriver.cpp @@ -219,13 +219,13 @@ JackDriver::supports(Shared::PortType port_type, Shared::EventType event_type) bool JackDriver::attach(const std::string& server_name, - const std::string& client_name, - void* jack_client) + const std::string& client_name, + void* jack_client) { assert(!_client); if (!jack_client) { // Try supplied server name - if (server_name != "") { + if (!server_name.empty()) { _client = jack_client_open(client_name.c_str(), JackServerName, NULL, server_name.c_str()); if (_client) diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp index 95cb93f0..d522307a 100644 --- a/src/engine/LV2Plugin.cpp +++ b/src/engine/LV2Plugin.cpp @@ -97,7 +97,7 @@ const std::string& LV2Plugin::library_path() const { static const std::string empty_string; - if (_library_path == "") { + if (_library_path.empty()) { SLV2Value v = slv2_plugin_get_library_uri(_slv2_plugin); if (v) { _library_path = slv2_uri_to_path(slv2_value_as_uri(v)); diff --git a/src/engine/NodeBase.hpp b/src/engine/NodeBase.hpp index 950a79a3..637c8560 100644 --- a/src/engine/NodeBase.hpp +++ b/src/engine/NodeBase.hpp @@ -40,8 +40,6 @@ namespace Shared { class ClientInterface; } /** Common implementation stuff for Node. - * - * Pretty much just attributes and getters/setters are here. * * \ingroup engine */ diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp index de321077..335feb26 100644 --- a/src/engine/NodeFactory.cpp +++ b/src/engine/NodeFactory.cpp @@ -86,7 +86,7 @@ NodeFactory::plugin(const Raul::URI& uri) PluginImpl* NodeFactory::plugin(const string& type, const string& lib, const string& label) { - if (type != "LADSPA" || lib == "" || label == "") + if (type != "LADSPA" || lib.empty() || label.empty()) return NULL; #ifdef HAVE_LADSPA_H @@ -206,12 +206,12 @@ NodeFactory::load_ladspa_plugins() } // Yep, this should use an sstream alright.. - while (ladspa_path != "") { + while (!ladspa_path.empty()) { const string dir = ladspa_path.substr(0, ladspa_path.find(':')); if (ladspa_path.find(':') != string::npos) ladspa_path = ladspa_path.substr(ladspa_path.find(':')+1); else - ladspa_path = ""; + ladspa_path.clear(); DIR* pdir = opendir(dir.c_str()); if (pdir == NULL) diff --git a/src/engine/events/CreateNode.cpp b/src/engine/events/CreateNode.cpp index 426044ee..4f5b4877 100644 --- a/src/engine/events/CreateNode.cpp +++ b/src/engine/events/CreateNode.cpp @@ -83,7 +83,7 @@ CreateNode::pre_process() _patch = _engine.engine_store()->find_patch(_path.parent()); - _plugin = (_plugin_label == "") + _plugin = (_plugin_label.empty()) ? _engine.node_factory()->plugin(_plugin_uri.str()) : _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label); diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp index b12f25dc..f1656019 100644 --- a/src/engine/events/CreatePort.cpp +++ b/src/engine/events/CreatePort.cpp @@ -98,6 +98,7 @@ CreatePort::pre_process() if (_patch->parent()) _patch_port->set_property(uris.rdf_instanceOf, _patch_port->meta_uri()); + _patch_port->properties().insert(_properties.begin(), _properties.end()); _patch_port->meta().properties().insert(_properties.begin(), _properties.end()); if (_patch_port) { -- cgit v1.2.1