From 3f6829abef9cc03bc344c4cad1bc7abe9490d1fd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Apr 2012 01:44:21 +0000 Subject: Lint. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4289 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/GraphObject.hpp | 6 +++++- ingen/Interface.hpp | 6 +++++- ingen/Status.hpp | 2 +- ingen/client/NodeModel.hpp | 2 +- ingen/client/PortModel.hpp | 11 +++++++++-- ingen/client/ThreadedSigClientInterface.hpp | 2 +- ingen/serialisation/Parser.hpp | 2 +- ingen/serialisation/Serialiser.hpp | 7 +++++-- ingen/shared/ClashAvoider.hpp | 5 ++++- ingen/shared/Forge.hpp | 2 +- ingen/shared/World.hpp | 5 ++++- src/gui/App.hpp | 11 ++++++----- src/gui/BreadCrumbs.hpp | 6 +++--- src/gui/Configuration.cpp | 8 ++++---- src/gui/Configuration.hpp | 2 +- src/gui/ControlPanel.hpp | 6 +++--- src/gui/LoadPluginWindow.cpp | 10 ++++++---- src/gui/LoadPluginWindow.hpp | 10 ++++++++-- src/gui/NodeControlWindow.cpp | 3 ++- src/gui/PatchBox.hpp | 11 +++++++---- src/gui/PatchCanvas.cpp | 6 +++--- src/gui/PatchCanvas.hpp | 4 ++-- src/gui/PatchTreeWindow.hpp | 7 +++++-- src/gui/PatchView.hpp | 1 - src/gui/Port.hpp | 5 ++++- src/gui/PortMenu.cpp | 2 +- src/gui/SubpatchModule.cpp | 4 ++-- src/gui/Window.hpp | 8 ++++---- src/gui/WindowFactory.cpp | 4 ++-- src/gui/WindowFactory.hpp | 8 ++++++-- src/http/HTTPEngineSender.hpp | 3 +-- src/osc/OSCClientReceiver.cpp | 2 +- src/osc/OSCEngineSender.hpp | 3 +-- src/osc/OSCSender.hpp | 2 +- src/serialisation/Serialiser.cpp | 2 +- src/server/AudioBuffer.hpp | 6 ++++-- src/server/BufferFactory.hpp | 2 +- src/server/EngineStore.hpp | 2 +- src/server/NodeImpl.cpp | 2 +- src/server/NodeImpl.hpp | 5 ++++- src/server/PatchImpl.cpp | 4 ++-- src/server/PostProcessor.hpp | 2 +- src/server/ServerInterfaceImpl.hpp | 2 +- src/server/ingen_lv2.cpp | 4 ++-- src/server/internals/Delay.cpp | 16 ++++++++-------- src/server/internals/Delay.hpp | 17 +++++++---------- src/server/internals/Note.hpp | 8 ++++++-- src/server/util.hpp | 16 ++++++++-------- src/shared/ClashAvoider.cpp | 4 ++-- src/shared/ResourceImpl.cpp | 4 ++-- wscript | 4 ++++ 51 files changed, 165 insertions(+), 111 deletions(-) diff --git a/ingen/GraphObject.hpp b/ingen/GraphObject.hpp index 3a8119c9..65d2eb55 100644 --- a/ingen/GraphObject.hpp +++ b/ingen/GraphObject.hpp @@ -21,7 +21,11 @@ #include "ingen/Resource.hpp" -namespace Raul { class Atom; class Path; class Symbol; } +namespace Raul { +class Atom; +class Path; +class Symbol; +} namespace Ingen { diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp index cf0fae08..c1472e5e 100644 --- a/ingen/Interface.hpp +++ b/ingen/Interface.hpp @@ -20,7 +20,11 @@ #include "ingen/Resource.hpp" #include "ingen/Status.hpp" -namespace Raul { class Atom; class Path; class URI; } +namespace Raul { +class Atom; +class Path; +class URI; +} namespace Ingen { diff --git a/ingen/Status.hpp b/ingen/Status.hpp index 8dc819ea..79655e3d 100644 --- a/ingen/Status.hpp +++ b/ingen/Status.hpp @@ -58,7 +58,7 @@ ingen_status_string(Status st) case CREATION_FAILED: return "Creation failed"; case DIRECTION_MISMATCH: return "Direction mismatch"; case EXISTS: return "Object exists"; - case INTERNAL_ERROR: return "Internal error" ; + case INTERNAL_ERROR: return "Internal error"; case INVALID_PARENT_PATH: return "Invalid parent path"; case INVALID_POLY: return "Invalid polyphony"; case NOT_FOUND: return "Object not found"; diff --git a/ingen/client/NodeModel.hpp b/ingen/client/NodeModel.hpp index f01ea641..310fbcc1 100644 --- a/ingen/client/NodeModel.hpp +++ b/ingen/client/NodeModel.hpp @@ -85,7 +85,7 @@ protected: NodeModel(Shared::URIs& uris, SharedPtr plugin, const Raul::Path& path); - NodeModel(const Raul::Path& path); + explicit NodeModel(const Raul::Path& path); void add_child(SharedPtr c); bool remove_child(SharedPtr c); diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 2307e5fe..d9fce5e4 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -100,8 +100,15 @@ private: void add_child(SharedPtr c) { throw; } bool remove_child(SharedPtr c) { throw; } - void connected_to(SharedPtr p) { ++_connections; _signal_connection.emit(p); } - void disconnected_from(SharedPtr p) { --_connections; _signal_disconnection.emit(p); } + void connected_to(SharedPtr p) { + ++_connections; + _signal_connection.emit(p); + } + + void disconnected_from(SharedPtr p) { + --_connections; + _signal_disconnection.emit(p); + } void set(SharedPtr model); diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp index c06524c1..c4859e0a 100644 --- a/ingen/client/ThreadedSigClientInterface.hpp +++ b/ingen/client/ThreadedSigClientInterface.hpp @@ -50,7 +50,7 @@ namespace Client { class ThreadedSigClientInterface : public SigClientInterface { public: - ThreadedSigClientInterface(uint32_t queue_size) + explicit ThreadedSigClientInterface(uint32_t queue_size) : _sigs(queue_size) , response_slot(_signal_response.make_slot()) , error_slot(_signal_error.make_slot()) diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index 2c353f3f..ceaaa99c 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -40,7 +40,7 @@ namespace Serialisation { */ class Parser { public: - Parser(Shared::World& world); + explicit Parser(Shared::World& world); virtual ~Parser() {} diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index 6a4a2705..cfc11c02 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -36,7 +36,10 @@ class Node; class Port; class Connection; -namespace Shared { class World; class Store; } +namespace Shared { +class World; +class Store; +} namespace Serialisation { @@ -47,7 +50,7 @@ namespace Serialisation { class Serialiser { public: - Serialiser(Shared::World& world); + explicit Serialiser(Shared::World& world); virtual ~Serialiser(); typedef GraphObject::Properties Properties; diff --git a/ingen/shared/ClashAvoider.hpp b/ingen/shared/ClashAvoider.hpp index 54d0d8cc..224eb509 100644 --- a/ingen/shared/ClashAvoider.hpp +++ b/ingen/shared/ClashAvoider.hpp @@ -23,7 +23,10 @@ #include "ingen/Interface.hpp" -namespace Raul { class Atom; class Path; } +namespace Raul { +class Atom; +class Path; +} namespace Ingen { namespace Shared { diff --git a/ingen/shared/Forge.hpp b/ingen/shared/Forge.hpp index 842477f0..084ca4fb 100644 --- a/ingen/shared/Forge.hpp +++ b/ingen/shared/Forge.hpp @@ -25,7 +25,7 @@ namespace Ingen { class Forge : public Raul::Forge { public: - Forge(Shared::LV2URIMap& map); + explicit Forge(Shared::LV2URIMap& map); std::string str(const Raul::Atom& atom); }; diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp index 94a3e787..f43afaa0 100644 --- a/ingen/shared/World.hpp +++ b/ingen/shared/World.hpp @@ -37,7 +37,10 @@ namespace Ingen { class EngineBase; class Interface; -namespace Serialisation { class Serialiser; class Parser; } +namespace Serialisation { +class Serialiser; +class Parser; +} namespace Shared { diff --git a/src/gui/App.hpp b/src/gui/App.hpp index afe812a9..a66a83a8 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -88,8 +88,12 @@ public: bool can_control(const Client::PortModel* port) const; bool signal() const { return _enable_signal; } - bool disable_signals() { bool old = _enable_signal; _enable_signal = false; return old; } void enable_signals(bool b) { _enable_signal = b; } + bool disable_signals() { + bool old = _enable_signal; + _enable_signal = false; + return old; + } uint32_t sample_rate() const; @@ -109,8 +113,6 @@ public: SharedPtr serialiser(); - static inline App& instance() { assert(_instance); return *_instance; } - static SharedPtr create(Ingen::Shared::World* world); void run(); @@ -133,7 +135,7 @@ protected: LexicalCompare > Icons; Icons _icons; - App(Ingen::Shared::World* world); + explicit App(Ingen::Shared::World* world); bool animate(); void response(int32_t id, Ingen::Status status); @@ -145,7 +147,6 @@ protected: static void* icon_destroyed(void* data); static Gtk::Main* _main; - static App* _instance; SharedPtr _client; SharedPtr _store; diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp index 39b7db42..0a0ca55b 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -39,7 +39,7 @@ namespace GUI { class BreadCrumbs : public Gtk::HBox { public: - BreadCrumbs(App& app); + explicit BreadCrumbs(App& app); SharedPtr view(const Raul::Path& path); @@ -64,7 +64,7 @@ private: : _path(path) , _view(view) { - assert( !view || view->patch()->path() == path); + assert(!view || view->patch()->path() == path); set_border_width(0); set_path(path); set_can_focus(false); @@ -72,7 +72,7 @@ private: } void set_view(SharedPtr view) { - assert( !view || view->patch()->path() == _path); + assert(!view || view->patch()->path() == _path); _view = view; } diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp index 23246719..a6d06487 100644 --- a/src/gui/Configuration.cpp +++ b/src/gui/Configuration.cpp @@ -40,11 +40,11 @@ Configuration::Configuration(App& app) // Colours from the Tango palette with modified V : _app(app) , _name_style(HUMAN) - , _audio_port_color( 0x4A8A0EFF) // Green + , _audio_port_color(0x4A8A0EFF) // Green , _control_port_color(0x244678FF) // Blue - , _event_port_color( 0x960909FF) // Red - , _string_port_color( 0x5C3566FF) // Plum - , _value_port_color( 0xBABDB6FF) // Aluminum + , _event_port_color(0x960909FF) // Red + , _string_port_color(0x5C3566FF) // Plum + , _value_port_color(0xBABDB6FF) // Aluminum { } diff --git a/src/gui/Configuration.hpp b/src/gui/Configuration.hpp index 0b33016b..c3aec5fc 100644 --- a/src/gui/Configuration.hpp +++ b/src/gui/Configuration.hpp @@ -41,7 +41,7 @@ class Port; class Configuration { public: - Configuration(App& app); + explicit Configuration(App& app); ~Configuration(); void load_settings(std::string filename = ""); diff --git a/src/gui/ControlPanel.hpp b/src/gui/ControlPanel.hpp index 2c3551e5..50bdfb26 100644 --- a/src/gui/ControlPanel.hpp +++ b/src/gui/ControlPanel.hpp @@ -60,8 +60,8 @@ public: void enable_port(const Raul::Path& path); void disable_port(const Raul::Path& path); - size_t num_controls() const { return _controls.size(); } - std::pair ideal_size() const { return _ideal_size; } + size_t num_controls() const { return _controls.size(); } + std::pair ideal_size() const { return _ideal_size; } // Callback for Control void value_changed_atom(SharedPtr port, @@ -74,7 +74,7 @@ public: private: App* _app; - std::pair _ideal_size; + std::pair _ideal_size; std::vector _controls; Gtk::VBox* _control_box; bool _callback_enabled; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 067a706e..ccad9a2c 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -81,10 +81,10 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, row[_criteria_columns._col_label] = "Name contains"; row[_criteria_columns._col_criteria] = CriteriaColumns::NAME; _filter_combo->set_active(iter); - iter = _criteria_liststore->append(); row = *iter; + row = *(iter = _criteria_liststore->append()); row[_criteria_columns._col_label] = "Type contains"; row[_criteria_columns._col_criteria] = CriteriaColumns::TYPE; - iter = _criteria_liststore->append(); row = *iter; + row = *(iter = _criteria_liststore->append()); row[_criteria_columns._col_label] = "URI contains"; row[_criteria_columns._col_criteria] = CriteriaColumns::URI; _filter_combo->pack_start(_criteria_columns._col_label); @@ -406,9 +406,11 @@ LoadPluginWindow::filter_changed() field = name.get_string(); break; case CriteriaColumns::TYPE: - field = plugin->type_uri().str(); break; + field = plugin->type_uri().str(); + break; case CriteriaColumns::URI: - field = plugin->uri().str(); break; + field = plugin->uri().str(); + break; default: throw; } diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index 86ec5b2a..9d456e4a 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -32,7 +32,10 @@ namespace Ingen { -namespace Client { class PatchModel; class PluginModel; } +namespace Client { +class PatchModel; +class PluginModel; +} namespace GUI { @@ -86,7 +89,10 @@ private: public: enum Criteria { NAME, TYPE, URI, }; - CriteriaColumns() { add(_col_label); add(_col_criteria); } + CriteriaColumns() { + add(_col_label); + add(_col_criteria); + } Gtk::TreeModelColumn _col_label; Gtk::TreeModelColumn _col_criteria; diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp index ddc99348..c0b82f89 100644 --- a/src/gui/NodeControlWindow.cpp +++ b/src/gui/NodeControlWindow.cpp @@ -95,7 +95,8 @@ NodeControlWindow::~NodeControlWindow() void NodeControlWindow::resize() { - pair controls_size = _control_panel->ideal_size(); + pair controls_size = _control_panel->ideal_size(); + int width = controls_size.first; int height = controls_size.second; diff --git a/src/gui/PatchBox.hpp b/src/gui/PatchBox.hpp index c7d4168a..bc5c8c9a 100644 --- a/src/gui/PatchBox.hpp +++ b/src/gui/PatchBox.hpp @@ -23,14 +23,17 @@ #include "Window.hpp" -namespace Raul { class Atom; class Path; } +namespace Raul { +class Atom; +class Path; +} namespace Ingen { namespace Client { - class PatchModel; - class PortModel; - class ObjectModel; +class PatchModel; +class PortModel; +class ObjectModel; } namespace GUI { diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 589f4214..b322f29f 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -359,7 +359,7 @@ PatchCanvas::add_plugin(SharedPtr p) Glib::RefPtr icon = _app.icon_from_path( PluginModel::get_lv2_icon_path(p->lilv_plugin()), 16); - pair range = _class_menus.equal_range(class_uri_str); + pair range = _class_menus.equal_range(class_uri_str); if (range.first == _class_menus.end() || range.first == range.second || range.first->second.menu == _plugin_menu) { _classless_menu->items().push_back( @@ -534,7 +534,7 @@ PatchCanvas::disconnect(Ganv::Node* src_port, void PatchCanvas::auto_menu_position(int& x, int& y, bool& push_in) { - std::pair scroll_offsets; + std::pair scroll_offsets; get_scroll_offsets(scroll_offsets.first, scroll_offsets.second); if (_auto_position_count > 0 && scroll_offsets != _auto_position_scroll_offsets) @@ -768,7 +768,7 @@ PatchCanvas::generate_port_name( char num_buf[5]; uint32_t i = 1; for ( ; i < 9999; ++i) { - snprintf(num_buf, 5, "%u", i); + snprintf(num_buf, sizeof(num_buf), "%u", i); symbol = sym_base + "_"; symbol += num_buf; if (!_patch->get_port(symbol)) diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp index 2b97d650..82827b68 100644 --- a/src/gui/PatchCanvas.hpp +++ b/src/gui/PatchCanvas.hpp @@ -129,8 +129,8 @@ private: typedef std::map, Ganv::Module*> Views; Views _views; - int _auto_position_count; - std::pair _auto_position_scroll_offsets; + int _auto_position_count; + std::pair _auto_position_scroll_offsets; int _last_click_x; int _last_click_y; diff --git a/src/gui/PatchTreeWindow.hpp b/src/gui/PatchTreeWindow.hpp index cb266695..d82624b8 100644 --- a/src/gui/PatchTreeWindow.hpp +++ b/src/gui/PatchTreeWindow.hpp @@ -67,8 +67,11 @@ protected: struct PatchTreeModelColumns : public Gtk::TreeModel::ColumnRecord { - PatchTreeModelColumns() - { add(name_col); add(enabled_col); add(patch_model_col); } + PatchTreeModelColumns() { + add(name_col); + add(enabled_col); + add(patch_model_col); + } Gtk::TreeModelColumn name_col; Gtk::TreeModelColumn enabled_col; diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp index 39e8bab1..7db0dd85 100644 --- a/src/gui/PatchView.hpp +++ b/src/gui/PatchView.hpp @@ -25,7 +25,6 @@ #include "raul/URI.hpp" namespace Raul { class Atom; } -namespace Ganv { class Port; class Item; } namespace Ingen { diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index e8801e5f..f0872e39 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -23,7 +23,10 @@ #include "raul/SharedPtr.hpp" #include "raul/WeakPtr.hpp" -namespace Raul { class Atom; class URI; } +namespace Raul { +class Atom; +class URI; +} namespace Ingen { diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index df256d15..e774dc29 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -60,7 +60,7 @@ PortMenu::init(App& app, SharedPtr port, bool patch_port) _reset_range_menuitem->signal_activate().connect( sigc::mem_fun(this, &PortMenu::on_menu_reset_range)); - if ( ! PtrCast(port->parent()) ) { + if (!PtrCast(port->parent())) { _polyphonic_menuitem->set_sensitive(false); _rename_menuitem->set_sensitive(false); _destroy_menuitem->set_sensitive(false); diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index fd3c20bf..b17d2e30 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -97,9 +97,9 @@ SubpatchModule::browse_to_patch() SharedPtr parent = PtrCast(_patch->parent()); - PatchWindow* const preferred = ( (parent) + PatchWindow* const preferred = (parent) ? app().window_factory()->patch_window(parent) - : NULL ); + : NULL; app().window_factory()->present_patch(_patch, preferred); } diff --git a/src/gui/Window.hpp b/src/gui/Window.hpp index 0b2ad045..6ce1a857 100644 --- a/src/gui/Window.hpp +++ b/src/gui/Window.hpp @@ -31,8 +31,8 @@ class App; class Window : public Gtk::Window { public: - Window() : Gtk::Window(), _app(NULL) {} - Window(BaseObjectType* cobject) : Gtk::Window(cobject), _app(NULL) {} + Window() : Gtk::Window(), _app(NULL) {} + explicit Window(BaseObjectType* cobject) : Gtk::Window(cobject), _app(NULL) {} virtual void init_window(App& app) { _app = &app; } @@ -54,8 +54,8 @@ public: class Dialog : public Gtk::Dialog { public: - Dialog() : Gtk::Dialog(), _app(NULL) {} - Dialog(BaseObjectType* cobject) : Gtk::Dialog(cobject), _app(NULL) {} + Dialog() : Gtk::Dialog(), _app(NULL) {} + explicit Dialog(BaseObjectType* cobject) : Gtk::Dialog(cobject), _app(NULL) {} virtual void init_dialog(App& app) { _app = &app; } diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index a8deb459..fe3e2053 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -150,7 +150,7 @@ WindowFactory::present_patch(SharedPtr patch, PatchWindow* preferred, SharedPtr view) { - assert( !view || view->patch() == patch); + assert(!view || view->patch() == patch); PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -175,7 +175,7 @@ PatchWindow* WindowFactory::new_patch_window(SharedPtr patch, SharedPtr view) { - assert( !view || view->patch() == patch); + assert(!view || view->patch() == patch); PatchWindow* win = NULL; WidgetFactory::get_widget_derived("patch_win", win); diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index 69e66e72..a962856c 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -28,7 +28,11 @@ namespace Raul { class Path; } namespace Ingen { -namespace Client { class PatchModel; class NodeModel; class ObjectModel; } +namespace Client { +class PatchModel; +class NodeModel; +class ObjectModel; +} namespace GUI { @@ -52,7 +56,7 @@ class UploadPatchWindow; */ class WindowFactory { public: - WindowFactory(App& app); + explicit WindowFactory(App& app); ~WindowFactory(); size_t num_open_patch_windows(); diff --git a/src/http/HTTPEngineSender.hpp b/src/http/HTTPEngineSender.hpp index f64eaa93..6f1d9cc5 100644 --- a/src/http/HTTPEngineSender.hpp +++ b/src/http/HTTPEngineSender.hpp @@ -55,8 +55,7 @@ public: Raul::URI uri() const { return _engine_url; } - inline int32_t next_id() - { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } + inline int32_t next_id() { return (_id == -1) ? -1 : _id++; } void set_response_id(int32_t id) { _id = id; } diff --git a/src/osc/OSCClientReceiver.cpp b/src/osc/OSCClientReceiver.cpp index 8717af24..7cba4c40 100644 --- a/src/osc/OSCClientReceiver.cpp +++ b/src/osc/OSCClientReceiver.cpp @@ -60,7 +60,7 @@ OSCClientReceiver::start(bool dump_osc) // Attempt preferred port if (_listen_port != 0) { char port_str[8]; - snprintf(port_str, 8, "%d", _listen_port); + snprintf(port_str, sizeof(port_str), "%d", _listen_port); _st = lo_server_thread_new(port_str, lo_error_cb); } diff --git a/src/osc/OSCEngineSender.hpp b/src/osc/OSCEngineSender.hpp index d9a34e75..9c1ef2f1 100644 --- a/src/osc/OSCEngineSender.hpp +++ b/src/osc/OSCEngineSender.hpp @@ -50,8 +50,7 @@ public: Raul::URI uri() const { return _engine_url; } - inline int32_t next_id() - { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } + inline int32_t next_id() { return (_id == -1) ? -1 : _id++; } void set_response_id(int32_t id) { _id = id; } diff --git a/src/osc/OSCSender.hpp b/src/osc/OSCSender.hpp index bff16e08..22a720c2 100644 --- a/src/osc/OSCSender.hpp +++ b/src/osc/OSCSender.hpp @@ -26,7 +26,7 @@ namespace Shared { class OSCSender { public: - OSCSender(size_t max_packet_size); + explicit OSCSender(size_t max_packet_size); virtual ~OSCSender() {} lo_address address() const { return _address; } diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index d0d0e0d8..d8978677 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -60,7 +60,7 @@ namespace Ingen { namespace Serialisation { struct Serialiser::Impl { - Impl(Shared::World& world) + explicit Impl(Shared::World& world) : _root_path("/") , _world(world) {} diff --git a/src/server/AudioBuffer.hpp b/src/server/AudioBuffer.hpp index 087c799f..51fb9ec2 100644 --- a/src/server/AudioBuffer.hpp +++ b/src/server/AudioBuffer.hpp @@ -62,8 +62,10 @@ public: : (_capacity - sizeof(LV2_Atom_Vector)) / sizeof(Sample); } - inline Sample& value_at(size_t offset) const - { assert(offset < nframes()); return data()[offset]; } + inline Sample& value_at(size_t offset) const { + assert(offset < nframes()); + return data()[offset]; + } void prepare_read(Context& context); void prepare_write(Context& context) {} diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 08f7680b..1ec11ca1 100644 --- a/src/server/BufferFactory.hpp +++ b/src/server/BufferFactory.hpp @@ -61,7 +61,7 @@ public: void set_block_length(SampleCount block_length); Ingen::Forge& forge(); - Ingen::Shared::URIs& uris() { assert(_uris); return *_uris.get(); } + Ingen::Shared::URIs& uris() { return *_uris.get(); } Engine& engine() { return _engine; } private: diff --git a/src/server/EngineStore.hpp b/src/server/EngineStore.hpp index d2bc9b64..e6e05f00 100644 --- a/src/server/EngineStore.hpp +++ b/src/server/EngineStore.hpp @@ -45,7 +45,7 @@ class PortImpl; class EngineStore : public Ingen::Shared::Store { public: - EngineStore(SharedPtr f) : _factory(f) {} + explicit EngineStore(SharedPtr f) : _factory(f) {} ~EngineStore(); SharedPtr buffer_factory() const { return _factory; } diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index 36074649..f6d57146 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -109,7 +109,7 @@ NodeImpl::deactivate() assert(_activated); _activated = false; for (uint32_t i = 0; i < _polyphony; ++i) { - for (unsigned long j = 0; j < num_ports(); ++j) { + for (uint32_t j = 0; j < num_ports(); ++j) { PortImpl* const port = _ports->at(j); if (port->is_output() && port->buffer(i)) port->buffer(i)->clear(); diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index db13bf17..10ed41eb 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -32,7 +32,10 @@ #include "PortType.hpp" #include "types.hpp" -namespace Raul { template class List; class Maid; } +namespace Raul { +template class List; +class Maid; +} namespace Ingen { diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index 08c66c38..3f8905f1 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -425,10 +425,10 @@ PatchImpl::build_ports_array() const size_t i = 0; - for (Ports::const_iterator p = _inputs.begin(); p != _inputs.end(); ++p,++i) + for (Ports::const_iterator p = _inputs.begin(); p != _inputs.end(); ++p, ++i) result->at(i) = *p; - for (Ports::const_iterator p = _outputs.begin(); p != _outputs.end(); ++p,++i) + for (Ports::const_iterator p = _outputs.begin(); p != _outputs.end(); ++p, ++i) result->at(i) = *p; assert(i == n); diff --git a/src/server/PostProcessor.hpp b/src/server/PostProcessor.hpp index d2920411..0f99a572 100644 --- a/src/server/PostProcessor.hpp +++ b/src/server/PostProcessor.hpp @@ -42,7 +42,7 @@ class Engine; class PostProcessor { public: - PostProcessor(Engine& engine); + explicit PostProcessor(Engine& engine); ~PostProcessor(); /** Push a list of events on to the process queue. diff --git a/src/server/ServerInterfaceImpl.hpp b/src/server/ServerInterfaceImpl.hpp index 160f4219..be725cd8 100644 --- a/src/server/ServerInterfaceImpl.hpp +++ b/src/server/ServerInterfaceImpl.hpp @@ -45,7 +45,7 @@ class ServerInterfaceImpl : public EventSource, public Interface { public: - ServerInterfaceImpl(Engine& engine); + explicit ServerInterfaceImpl(Engine& engine); virtual ~ServerInterfaceImpl(); Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index dace8087..cb144c49 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -67,7 +67,7 @@ struct LV2Patch { /** Ingen LV2 library. */ class Lib { public: - Lib(const char* bundle_path); + explicit Lib(const char* bundle_path); typedef std::vector< SharedPtr > Patches; @@ -307,7 +307,7 @@ using namespace Ingen::Server; class MainThread : public Raul::Thread { public: - MainThread(SharedPtr engine) : _engine(engine) {} + explicit MainThread(SharedPtr engine) : _engine(engine) {} private: virtual void _run() { diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index 7d735eb7..e2838d31 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -156,7 +156,7 @@ DelayNode::process(ProcessContext& context) const uint32_t buffer_mask = plugin_data->_buffer_mask; const unsigned int sample_rate = plugin_data->_srate; float delay_samples = plugin_data->_delay_samples; - long write_phase = plugin_data->_write_phase; + int64_t write_phase = plugin_data->_write_phase; const uint32_t sample_count = context.nframes(); if (write_phase == 0) { @@ -165,11 +165,11 @@ DelayNode::process(ProcessContext& context) } if (delay_time == _last_delay_time) { - const long idelay_samples = (long)delay_samples; - const float frac = delay_samples - idelay_samples; + const int64_t idelay_samples = (int64_t)delay_samples; + const float frac = delay_samples - idelay_samples; for (uint32_t i = 0; i < sample_count; i++) { - long read_phase = write_phase - (long)delay_samples; + int64_t read_phase = write_phase - (int64_t)delay_samples; const float read = cube_interp(frac, buffer_at(read_phase - 1), buffer_at(read_phase), @@ -185,10 +185,10 @@ DelayNode::process(ProcessContext& context) for (uint32_t i = 0; i < sample_count; i++) { delay_samples += delay_samples_slope; write_phase++; - const long read_phase = write_phase - (long)delay_samples; - const long idelay_samples = (long)delay_samples; - const float frac = delay_samples - idelay_samples; - const float read = cube_interp(frac, + const int64_t read_phase = write_phase - (int64_t)delay_samples; + const int64_t idelay_samples = (int64_t)delay_samples; + const float frac = delay_samples - idelay_samples; + const float read = cube_interp(frac, buffer_at(read_phase - 1), buffer_at(read_phase), buffer_at(read_phase + 1), diff --git a/src/server/internals/Delay.hpp b/src/server/internals/Delay.hpp index 7c7c05e6..4cca4ed7 100644 --- a/src/server/internals/Delay.hpp +++ b/src/server/internals/Delay.hpp @@ -54,20 +54,17 @@ public: float delay_samples() const { return _delay_samples; } private: - inline float& buffer_at(long phase) const { return _buffer[phase & _buffer_mask]; } + inline float& buffer_at(int64_t phase) const { return _buffer[phase & _buffer_mask]; } InputPort* _delay_port; InputPort* _in_port; OutputPort* _out_port; - - typedef long Phase; - - float* _buffer; - uint32_t _buffer_length; - uint32_t _buffer_mask; - Phase _write_phase; - float _last_delay_time; - float _delay_samples; + float* _buffer; + uint32_t _buffer_length; + uint32_t _buffer_mask; + uint64_t _write_phase; + float _last_delay_time; + float _delay_samples; }; } // namespace Server diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 4053c052..8e83a404 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -68,14 +68,18 @@ private: struct Key { enum State { OFF, ON_ASSIGNED, ON_UNASSIGNED }; Key() : state(OFF), voice(0), time(0) {} - State state; uint32_t voice; SampleCount time; + State state; + uint32_t voice; + SampleCount time; }; /** Voice, one of these always exists for each voice */ struct Voice { enum State { FREE, ACTIVE, HOLDING }; Voice() : state(FREE), note(0), time(0) {} - State state; uint8_t note; SampleCount time; + State state; + uint8_t note; + SampleCount time; }; float note_to_freq(int num); diff --git a/src/server/util.hpp b/src/server/util.hpp index d0b4f2bd..372ae084 100644 --- a/src/server/util.hpp +++ b/src/server/util.hpp @@ -32,9 +32,9 @@ #ifdef USE_ASSEMBLY # if SIZEOF_VOID_P==8 -# define cpuid(a,b,c,d,n) asm("xchgq %%rbx, %1; cpuid; xchgq %%rbx, %1": "=a" (a), "=r" (b), "=c" (c), "=d" (d) : "a" (n)); +# define cpuid(a, b, c, d, n) asm("xchgq %%rbx, %1; cpuid; xchgq %%rbx, %1": "=a" (a), "=r" (b), "=c" (c), "=d" (d) : "a" (n)); # else -# define cpuid(a,b,c,d,n) asm("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1": "=a" (a), "=r" (b), "=c" (c), "=d" (d) : "a" (n)); +# define cpuid(a, b, c, d, n) asm("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1": "=a" (a), "=r" (b), "=c" (c), "=d" (d) : "a" (n)); # endif #endif @@ -51,14 +51,14 @@ set_denormal_flags() unsigned long a, b, c, d0, d1; int stepping, model, family, extfamily; - cpuid(a,b,c,d1,1); + cpuid(a, b, c, d1, 1); if (d1 & 1<<25) { /* It has SSE support */ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); - family = (a >> 8) & 0xf; - extfamily = (a >> 20) & 0xff; - model = (a >> 4) & 0xf; - stepping = a & 0xf; - cpuid(a,b,c,d0,0); + family = (a >> 8) & 0xF; + extfamily = (a >> 20) & 0xFF; + model = (a >> 4) & 0xF; + stepping = a & 0xF; + cpuid(a, b, c, d0, 0); if (b == 0x756e6547) { /* It's an Intel */ if (family == 15 && extfamily == 0 && model == 0 && stepping < 7) { return; diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index c2789ce7..7f0bceae 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -84,7 +84,7 @@ ClashAvoider::map_path(const Raul::Path& in) if (!exists(in) && _symbol_map.find(in) == _symbol_map.end()) { InsertRecord i = _symbol_map.insert(make_pair(in, in)); assert(i.second); - debug << " (3) " << i.first->second << endl;; + debug << " (3) " << i.first->second << endl; return i.first->second; // Append _2 _3 etc until an unused symbol is found @@ -115,7 +115,7 @@ ClashAvoider::map_path(const Raul::Path& in) debug << "HIT: offset = " << offset << ", str = " << str << endl; offset = _store.child_name_offset(in.parent(), name, false); _offsets.insert(make_pair(base_path, offset)); - debug << " (4) " << i.first->second << endl;; + debug << " (4) " << i.first->second << endl; return i.first->second; } else { debug << "MISSED OFFSET: " << in << " => " << ss.str() << endl; diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 2a2ceb96..5ec07b13 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -33,7 +33,7 @@ ResourceImpl::add_property(const Raul::URI& uri, { // Ignore duplicate statements typedef Resource::Properties::const_iterator iterator; - const std::pair range = _properties.equal_range(uri); + const std::pair range = _properties.equal_range(uri); for (iterator i = range.first; i != range.second && i != _properties.end(); ++i) { if (i->second == value && i->second.context() == ctx) { return; @@ -117,7 +117,7 @@ ResourceImpl::type(const URIs& uris, bool& is_output) { typedef Resource::Properties::const_iterator iterator; - const std::pair types_range = properties.equal_range(uris.rdf_type); + const std::pair types_range = properties.equal_range(uris.rdf_type); patch = node = port = is_output = false; for (iterator i = types_range.first; i != types_range.second; ++i) { diff --git a/wscript b/wscript index 24848bb8..0cf9ab8f 100644 --- a/wscript +++ b/wscript @@ -1,5 +1,6 @@ #!/usr/bin/env python import os +import subprocess import waflib.Options as Options from waflib.extras import autowaf as autowaf @@ -179,3 +180,6 @@ def build(bld): bld.env['LV2DIR'] + '/ingen.lv2/libingen_lv2.so') bld.add_post_fun(autowaf.run_ldconfig) + +def lint(ctx): + subprocess.call('cpplint.py --filter=-whitespace/comments,-whitespace/tab,-whitespace/braces,-whitespace/labels,-build/header_guard,-readability/casting,-readability/todo,-build/include,-build/namespaces,-whitespace/line_length,-runtime/rtti,-runtime/references,-whitespace/blank_line,-runtime/sizeof,-readability/streams,-whitespace/operators,-whitespace/parens `find -name *.cpp -or -name *.hpp`', shell=True) -- cgit v1.2.1