diff options
author | David Robillard <d@drobilla.net> | 2011-01-09 20:59:40 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-01-09 20:59:40 +0000 |
commit | c1775fa65273b5f5590a0319563159b13e901fbb (patch) | |
tree | e6704c3948b2b6204eec93621d71ceeb50ee1dfd /src | |
parent | 9a1cd7003886f89e2228d74d61130dc5d24c06a3 (diff) | |
download | patchage-c1775fa65273b5f5590a0319563159b13e901fbb.tar.gz patchage-c1775fa65273b5f5590a0319563159b13e901fbb.tar.bz2 patchage-c1775fa65273b5f5590a0319563159b13e901fbb.zip |
Code cleanups (cpplint).
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2804 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/AlsaDriver.cpp | 10 | ||||
-rw-r--r-- | src/AlsaDriver.hpp | 2 | ||||
-rw-r--r-- | src/Client.cpp | 4 | ||||
-rw-r--r-- | src/DBus.hpp | 2 | ||||
-rw-r--r-- | src/JackDbusDriver.cpp | 9 | ||||
-rw-r--r-- | src/JackDbusDriver.hpp | 3 | ||||
-rw-r--r-- | src/JackDriver.cpp | 23 | ||||
-rw-r--r-- | src/JackDriver.hpp | 4 | ||||
-rw-r--r-- | src/LashProxy.cpp | 9 | ||||
-rw-r--r-- | src/LashProxy.hpp | 3 | ||||
-rw-r--r-- | src/LoadProjectDialog.hpp | 2 | ||||
-rw-r--r-- | src/Patchage.cpp | 12 | ||||
-rw-r--r-- | src/PatchageCanvas.cpp | 8 | ||||
-rw-r--r-- | src/PatchageCanvas.hpp | 3 | ||||
-rw-r--r-- | src/PatchageEvent.cpp | 2 | ||||
-rw-r--r-- | src/PatchageEvent.hpp | 2 | ||||
-rw-r--r-- | src/PatchageModule.cpp | 10 | ||||
-rw-r--r-- | src/PatchageModule.hpp | 8 | ||||
-rw-r--r-- | src/PatchagePort.hpp | 13 | ||||
-rw-r--r-- | src/Project.cpp | 3 | ||||
-rw-r--r-- | src/ProjectList.cpp | 2 | ||||
-rw-r--r-- | src/ProjectPropertiesDialog.cpp | 2 | ||||
-rw-r--r-- | src/Session.cpp | 3 | ||||
-rw-r--r-- | src/Session.hpp | 1 | ||||
-rw-r--r-- | src/StateManager.cpp | 5 | ||||
-rw-r--r-- | src/binary_location.h | 2 |
26 files changed, 79 insertions, 68 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index c1928f5..6cb51ae 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -28,8 +28,8 @@ #include "PatchageModule.hpp" #include "PatchagePort.hpp" -using namespace std; -using namespace FlowCanvas; +using std::endl; +using std::string; AlsaDriver::AlsaDriver(Patchage* app) : _app(app) @@ -296,7 +296,7 @@ AlsaDriver::refresh_ports() boost::shared_ptr<PatchageModule> parent; boost::shared_ptr<PatchagePort> port; - set< boost::shared_ptr<PatchageModule> > to_resize; + std::set< boost::shared_ptr<PatchageModule> > to_resize; while (snd_seq_query_next_client (_seq, cinfo) >= 0) { snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); @@ -324,11 +324,11 @@ AlsaDriver::refresh_connections() boost::shared_ptr<PatchageModule> m; boost::shared_ptr<PatchagePort> p; - for (ItemList::iterator i = _app->canvas()->items().begin(); + for (FlowCanvas::ItemList::iterator i = _app->canvas()->items().begin(); i != _app->canvas()->items().end(); ++i) { m = boost::dynamic_pointer_cast<PatchageModule>(*i); if (m) { - for (PortVector::const_iterator j = m->ports().begin(); j != m->ports().end(); ++j) { + for (FlowCanvas::PortVector::const_iterator j = m->ports().begin(); j != m->ports().end(); ++j) { p = boost::dynamic_pointer_cast<PatchagePort>(*j); if (p->type() == ALSA_MIDI) add_connections(p); diff --git a/src/AlsaDriver.hpp b/src/AlsaDriver.hpp index d4f6f86..43647cc 100644 --- a/src/AlsaDriver.hpp +++ b/src/AlsaDriver.hpp @@ -35,7 +35,7 @@ class PatchagePort; class AlsaDriver : public Driver { public: - AlsaDriver(Patchage* app); + explicit AlsaDriver(Patchage* app); ~AlsaDriver(); void attach(bool launch_daemon = false); diff --git a/src/Client.cpp b/src/Client.cpp index 3baf3c0..41aaaca 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -16,10 +16,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <string> + #include "Client.hpp" #include "Patchage.hpp" -using namespace std; +using std::string; struct ClientImpl { Project* project; diff --git a/src/DBus.hpp b/src/DBus.hpp index 6475a05..a992f5a 100644 --- a/src/DBus.hpp +++ b/src/DBus.hpp @@ -27,7 +27,7 @@ class Patchage; class DBus { public: - DBus(Patchage* app); + explicit DBus(Patchage* app); bool call( bool response_expected, diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp index 11f1572..4c7e862 100644 --- a/src/JackDbusDriver.cpp +++ b/src/JackDbusDriver.cpp @@ -39,9 +39,6 @@ #include "PatchageEvent.hpp" #include "PatchageModule.hpp" -using namespace std; -using namespace FlowCanvas; - #define JACKDBUS_SERVICE "org.jackaudio.service" #define JACKDBUS_OBJECT "/org/jackaudio/Controller" #define JACKDBUS_IFACE_CONTROL "org.jackaudio.JackControl" @@ -1005,13 +1002,13 @@ JackDriver::is_realtime() const DBusMessage* reply_ptr; dbus_bool_t realtime; - if (!((JackDriver *)this)->call(true, JACKDBUS_IFACE_CONTROL, "IsRealtime", &reply_ptr, DBUS_TYPE_INVALID)) { + if (!this->call(true, JACKDBUS_IFACE_CONTROL, "IsRealtime", &reply_ptr, DBUS_TYPE_INVALID)) { return false; } - if (!dbus_message_get_args(reply_ptr, &((JackDriver *)this)->_dbus_error, DBUS_TYPE_BOOLEAN, &realtime, DBUS_TYPE_INVALID)) { + if (!dbus_message_get_args(reply_ptr, &this->_dbus_error, DBUS_TYPE_BOOLEAN, &realtime, DBUS_TYPE_INVALID)) { dbus_message_unref(reply_ptr); - dbus_error_free(&((JackDriver *)this)->_dbus_error); + dbus_error_free(&this->_dbus_error); error_msg("decoding reply of IsRealtime failed."); return false; } diff --git a/src/JackDbusDriver.hpp b/src/JackDbusDriver.hpp index 0511c42..d93bf06 100644 --- a/src/JackDbusDriver.hpp +++ b/src/JackDbusDriver.hpp @@ -18,6 +18,7 @@ #ifndef PATCHAGE_JACKDBUSDRIVER_HPP #define PATCHAGE_JACKDBUSDRIVER_HPP +#include <string> #include <boost/shared_ptr.hpp> #include <jack/jack.h> #include <jack/statistics.h> @@ -34,7 +35,7 @@ class PatchagePort; class JackDriver : public Driver { public: - JackDriver(Patchage* app); + explicit JackDriver(Patchage* app); ~JackDriver(); void attach(bool launch_daemon); diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 9dd0029..45e8b93 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -34,9 +34,8 @@ #include "PatchageEvent.hpp" #include "PatchageModule.hpp" -using namespace std; -using namespace FlowCanvas; - +using std::endl; +using std::string; JackDriver::JackDriver(Patchage* app) : _app(app) @@ -119,13 +118,13 @@ JackDriver::detach() void JackDriver::destroy_all() { - ItemList modules = _app->canvas()->items(); // copy - for (ItemList::iterator m = modules.begin(); m != modules.end(); ++m) { - SharedPtr<Module> module = PtrCast<Module>(*m); + FlowCanvas::ItemList modules = _app->canvas()->items(); // copy + for (FlowCanvas::ItemList::iterator m = modules.begin(); m != modules.end(); ++m) { + SharedPtr<FlowCanvas::Module> module = PtrCast<FlowCanvas::Module>(*m); if (!module) continue; - PortVector ports = module->ports(); // copy - for (PortVector::iterator p = ports.begin(); p != ports.end(); ++p) { + FlowCanvas::PortVector ports = module->ports(); // copy + for (FlowCanvas::PortVector::iterator p = ports.begin(); p != ports.end(); ++p) { boost::shared_ptr<PatchagePort> port = boost::dynamic_pointer_cast<PatchagePort>(*p); if ((port && port->type() == JACK_AUDIO) || (port->type() == JACK_MIDI)) { module->remove_port(port); @@ -346,14 +345,14 @@ JackDriver::refresh() boost::shared_ptr<PatchageModule> client2_module = _app->canvas()->find_module(client2_name, port2_type); - boost::shared_ptr<Port> port1 = client1_module->get_port(port1_name); - boost::shared_ptr<Port> port2 = client2_module->get_port(port2_name); + boost::shared_ptr<FlowCanvas::Port> port1 = client1_module->get_port(port1_name); + boost::shared_ptr<FlowCanvas::Port> port2 = client2_module->get_port(port2_name); if (!port1 || !port2) continue; - boost::shared_ptr<Port> src; - boost::shared_ptr<Port> dst; + boost::shared_ptr<FlowCanvas::Port> src; + boost::shared_ptr<FlowCanvas::Port> dst; if (port1->is_output() && port2->is_input()) { src = port1; diff --git a/src/JackDriver.hpp b/src/JackDriver.hpp index 9dbcd7b..79ca54f 100644 --- a/src/JackDriver.hpp +++ b/src/JackDriver.hpp @@ -18,11 +18,13 @@ #ifndef PATCHAGE_JACKDRIVER_HPP #define PATCHAGE_JACKDRIVER_HPP +#include <string> #include <boost/shared_ptr.hpp> #include <jack/jack.h> #include <jack/statistics.h> #include <glibmm/thread.h> #include "Driver.hpp" + class Patchage; class PatchageEvent; class PatchageFlowCanvas; @@ -38,7 +40,7 @@ class PatchageModule; class JackDriver : public Driver { public: - JackDriver(Patchage* app); + explicit JackDriver(Patchage* app); ~JackDriver(); void attach(bool launch_daemon); diff --git a/src/LashProxy.cpp b/src/LashProxy.cpp index 833683c..992060a 100644 --- a/src/LashProxy.cpp +++ b/src/LashProxy.cpp @@ -17,6 +17,10 @@ */ #include <string.h> + +#include <string> +#include <list> + #include <boost/shared_ptr.hpp> #include <boost/format.hpp> @@ -30,8 +34,9 @@ #define LASH_OBJECT "/" #define LASH_IFACE_CONTROL "org.nongnu.LASH.Control" -using namespace std; using boost::shared_ptr; +using std::list; +using std::string; struct LashProxyImpl { void init(Patchage* app); @@ -55,7 +60,7 @@ struct LashProxyImpl { int in_type, ...); - shared_ptr<Project> on_project_added(const string& name); + shared_ptr<Project> on_project_added(const std::string& name); shared_ptr<Client> on_client_added( shared_ptr<Project> project, diff --git a/src/LashProxy.hpp b/src/LashProxy.hpp index c803bff..6b2d394 100644 --- a/src/LashProxy.hpp +++ b/src/LashProxy.hpp @@ -19,6 +19,9 @@ #ifndef PATCHAGE_LASH_PROXY_HPP #define PATCHAGE_LASH_PROXY_HPP +#include <list> +#include <string> + #include "Patchage.hpp" struct ProjectInfo { diff --git a/src/LoadProjectDialog.hpp b/src/LoadProjectDialog.hpp index df5dbc9..cdab151 100644 --- a/src/LoadProjectDialog.hpp +++ b/src/LoadProjectDialog.hpp @@ -30,7 +30,7 @@ class ProjectInfo; class LoadProjectDialog { public: - LoadProjectDialog(Patchage* app); + explicit LoadProjectDialog(Patchage* app); void run(std::list<ProjectInfo>& projects); diff --git a/src/Patchage.cpp b/src/Patchage.cpp index ce41180..424b47c 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -57,7 +57,9 @@ #define LOG_TO_STATUS 1 -using namespace std; +using std::cout; +using std::endl; +using std::string; /* Gtk helpers (resize combo boxes) */ @@ -406,7 +408,7 @@ Patchage::update_load() return true; char tmp_buf[8]; - snprintf(tmp_buf, 8, "%zd", _jack_driver->get_xruns()); + snprintf(tmp_buf, sizeof(tmp_buf), "%zd", _jack_driver->get_xruns()); _main_xrun_progress->set_text(string(tmp_buf) + " Dropouts"); @@ -524,8 +526,8 @@ Patchage::status_msg(const string& msg) void Patchage::update_state() { - for (ItemList::iterator i = _canvas->items().begin(); i != _canvas->items().end(); ++i) { - SharedPtr<Module> module = PtrCast<Module>(*i); + for (FlowCanvas::ItemList::iterator i = _canvas->items().begin(); i != _canvas->items().end(); ++i) { + SharedPtr<FlowCanvas::Module> module = PtrCast<FlowCanvas::Module>(*i); if (module) module->load_location(); } @@ -739,7 +741,7 @@ Patchage::enqueue_resize(boost::shared_ptr<FlowCanvas::Module> module) void Patchage::flush_resize() { - for (set< boost::shared_ptr<FlowCanvas::Module> >::iterator i = _pending_resize.begin(); + for (std::set< boost::shared_ptr<FlowCanvas::Module> >::iterator i = _pending_resize.begin(); i != _pending_resize.end(); ++i) { (*i)->resize(); } diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index a8cd0e7..ae994e9 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -137,7 +137,8 @@ PatchageCanvas::find_port_by_name(const std::string& client_name, void -PatchageCanvas::connect(boost::shared_ptr<Connectable> port1, boost::shared_ptr<Connectable> port2) +PatchageCanvas::connect(boost::shared_ptr<FlowCanvas::Connectable> port1, + boost::shared_ptr<FlowCanvas::Connectable> port2) { boost::shared_ptr<PatchagePort> p1 = boost::dynamic_pointer_cast<PatchagePort>(port1); boost::shared_ptr<PatchagePort> p2 = boost::dynamic_pointer_cast<PatchagePort>(port2); @@ -160,7 +161,8 @@ PatchageCanvas::connect(boost::shared_ptr<Connectable> port1, boost::shared_ptr< void -PatchageCanvas::disconnect(boost::shared_ptr<Connectable> port1, boost::shared_ptr<Connectable> port2) +PatchageCanvas::disconnect(boost::shared_ptr<FlowCanvas::Connectable> port1, + boost::shared_ptr<FlowCanvas::Connectable> port2) { boost::shared_ptr<PatchagePort> input = boost::dynamic_pointer_cast<PatchagePort>(port1); boost::shared_ptr<PatchagePort> output = boost::dynamic_pointer_cast<PatchagePort>(port2); @@ -225,7 +227,7 @@ PatchageCanvas::add_module(const std::string& name, boost::shared_ptr<PatchageMo bool -PatchageCanvas::remove_item(boost::shared_ptr<Item> i) +PatchageCanvas::remove_item(boost::shared_ptr<FlowCanvas::Item> i) { // Remove item from canvas const bool ret = FlowCanvas::Canvas::remove_item(i); diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp index 128f318..e891cd3 100644 --- a/src/PatchageCanvas.hpp +++ b/src/PatchageCanvas.hpp @@ -19,6 +19,7 @@ #define PATCHAGE_PATCHAGECANVAS_HPP #include <map> +#include <string> #include "patchage-config.h" @@ -60,7 +61,7 @@ public: } void add_module(const std::string& name, boost::shared_ptr<PatchageModule> module); - bool remove_item(boost::shared_ptr<Item> i); + bool remove_item(boost::shared_ptr<FlowCanvas::Item> i); boost::shared_ptr<PatchagePort> remove_port(const PortID& id); diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index 694c628..3762f06 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -33,7 +33,7 @@ #include "AlsaDriver.hpp" #endif -using namespace std; +using std::endl; void PatchageEvent::execute(Patchage* patchage) diff --git a/src/PatchageEvent.hpp b/src/PatchageEvent.hpp index 09f5803..3a4135d 100644 --- a/src/PatchageEvent.hpp +++ b/src/PatchageEvent.hpp @@ -49,7 +49,7 @@ public: DISCONNECTION }; - PatchageEvent(Type type=NULL_EVENT) + explicit PatchageEvent(Type type=NULL_EVENT) : _str(NULL) , _type(type) {} diff --git a/src/PatchageModule.cpp b/src/PatchageModule.cpp index d129e2e..79ba901 100644 --- a/src/PatchageModule.cpp +++ b/src/PatchageModule.cpp @@ -43,7 +43,7 @@ PatchageModule::update_menu() if (_type == InputOutput) { bool has_in = false; bool has_out = false; - for (PortVector::iterator p = _ports.begin(); p != _ports.end(); ++p) { + for (FlowCanvas::PortVector::iterator p = _ports.begin(); p != _ports.end(); ++p) { if ((*p)->is_input()) { has_in = true; } else { @@ -79,7 +79,7 @@ PatchageModule::create_menu() void PatchageModule::load_location() { - boost::shared_ptr<Canvas> canvas = _canvas.lock(); + boost::shared_ptr<FlowCanvas::Canvas> canvas = _canvas.lock(); if (!canvas) return; @@ -116,14 +116,14 @@ PatchageModule::join() } void -PatchageModule::add_port(boost::shared_ptr<Port> port) +PatchageModule::add_port(boost::shared_ptr<FlowCanvas::Port> port) { FlowCanvas::Module::add_port(port); update_menu(); } void -PatchageModule::remove_port(boost::shared_ptr<Port> port) +PatchageModule::remove_port(boost::shared_ptr<FlowCanvas::Port> port) { FlowCanvas::Module::remove_port(port); update_menu(); @@ -132,6 +132,6 @@ PatchageModule::remove_port(boost::shared_ptr<Port> port) void PatchageModule::menu_disconnect_all() { - for (PortVector::iterator p = _ports.begin(); p != _ports.end(); ++p) + for (FlowCanvas::PortVector::iterator p = _ports.begin(); p != _ports.end(); ++p) (*p)->disconnect_all(); } diff --git a/src/PatchageModule.hpp b/src/PatchageModule.hpp index 3e7bcbd..734ff0f 100644 --- a/src/PatchageModule.hpp +++ b/src/PatchageModule.hpp @@ -24,18 +24,16 @@ #include "StateManager.hpp" -using namespace FlowCanvas; - class Patchage; -class PatchageModule : public Module +class PatchageModule : public FlowCanvas::Module { public: PatchageModule(Patchage* app, const std::string& name, ModuleType type, double x=0, double y=0); ~PatchageModule(); - void add_port(boost::shared_ptr<Port> port); - void remove_port(boost::shared_ptr<Port> port); + void add_port(boost::shared_ptr<FlowCanvas::Port> port); + void remove_port(boost::shared_ptr<FlowCanvas::Port> port); void split(); void join(); diff --git a/src/PatchagePort.hpp b/src/PatchagePort.hpp index 6783434..c343d58 100644 --- a/src/PatchagePort.hpp +++ b/src/PatchagePort.hpp @@ -34,19 +34,16 @@ #include <alsa/asoundlib.h> #endif -using namespace FlowCanvas; - - /** A Port on a PatchageModule */ class PatchagePort : public FlowCanvas::Port { public: - PatchagePort(boost::shared_ptr<Module> module, - PortType type, - const std::string& name, - bool is_input, - uint32_t color) + PatchagePort(boost::shared_ptr<FlowCanvas::Module> module, + PortType type, + const std::string& name, + bool is_input, + uint32_t color) : Port(module, name, is_input, color) , _type(type) { diff --git a/src/Project.cpp b/src/Project.cpp index 2e99727..38a2beb 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -19,8 +19,9 @@ #include "Project.hpp" #include "Client.hpp" -using namespace std; using boost::shared_ptr; +using std::string; +using std::list; struct ProjectImpl { string name; diff --git a/src/ProjectList.cpp b/src/ProjectList.cpp index 6093cc1..b0ce882 100644 --- a/src/ProjectList.cpp +++ b/src/ProjectList.cpp @@ -27,7 +27,7 @@ #include "Widget.hpp" using boost::shared_ptr; -using namespace std; +using std::string; struct ProjectList_column_record : public Gtk::TreeModel::ColumnRecord { Gtk::TreeModelColumn<Glib::ustring> name; diff --git a/src/ProjectPropertiesDialog.cpp b/src/ProjectPropertiesDialog.cpp index 243de10..1bdf02a 100644 --- a/src/ProjectPropertiesDialog.cpp +++ b/src/ProjectPropertiesDialog.cpp @@ -25,8 +25,6 @@ #include "Widget.hpp" using boost::shared_ptr; -using namespace std; - struct ProjectPropertiesDialogImpl { ProjectPropertiesDialogImpl(LashProxy* proxy, Glib::RefPtr<Gnome::Glade::Xml> xml); diff --git a/src/Session.cpp b/src/Session.cpp index a609990..c5a250d 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -19,8 +19,9 @@ #include "Project.hpp" #include "Session.hpp" -using namespace std; using boost::shared_ptr; +using std::list; +using std::string; struct SessionImpl { list< shared_ptr<Project> > projects; diff --git a/src/Session.hpp b/src/Session.hpp index c76e753..47a60cc 100644 --- a/src/Session.hpp +++ b/src/Session.hpp @@ -18,6 +18,7 @@ #ifndef PATCHAGE_SESSION_HPP #define PATCHAGE_SESSION_HPP +#include <string> #include <boost/shared_ptr.hpp> struct SessionImpl; diff --git a/src/StateManager.cpp b/src/StateManager.cpp index a733876..544725a 100644 --- a/src/StateManager.cpp +++ b/src/StateManager.cpp @@ -25,8 +25,9 @@ #include "StateManager.hpp" #include "Patchage.hpp" -using namespace std; - +using std::endl; +using std::map; +using std::string; StateManager::StateManager() : _window_location(0, 0) diff --git a/src/binary_location.h b/src/binary_location.h index 033dcae..ef10ab3 100644 --- a/src/binary_location.h +++ b/src/binary_location.h @@ -33,7 +33,7 @@ binary_location() Dl_info dli; const int ret = dladdr((void*)&binary_location, &dli); if (ret) { - char* const bin_loc = (char*)calloc(PATH_MAX, sizeof(char)); + char* const bin_loc = (char*)calloc(PATH_MAX, 1); realpath(dli.dli_fname, bin_loc); return bin_loc; } |