From 650c6d5824222a8879df5c5ba9645c264ed3b84f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 23 Feb 2010 20:25:53 +0000 Subject: Fix various code quality issues found by cppcheck (e.g. uninitialized members, larger than necessary variable scope, memory leaks, etc). git-svn-id: svn://localhost/ardour2/branches/3.0@6710 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audio_library.h | 2 +- libs/ardour/ardour/audio_unit.h | 2 +- libs/ardour/ardour/control_protocol_manager.h | 6 ++++-- libs/ardour/ardour/delivery.h | 1 + libs/ardour/ardour/export_graph_builder.h | 2 +- libs/ardour/ardour/export_handler.h | 2 +- libs/ardour/ardour/lv2_plugin.h | 2 +- libs/ardour/ardour/plugin.h | 2 +- libs/ardour/ardour/rc_configuration.h | 1 + libs/ardour/ardour/route_group.h | 6 +++--- libs/ardour/ardour/session.h | 2 +- libs/ardour/ardour/session_event.h | 23 ++++++++++++----------- libs/ardour/ardour/types.h | 17 ++++++----------- libs/ardour/ardour/vst_plugin.h | 2 +- 14 files changed, 35 insertions(+), 35 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index aada317dbd..2009ec39a7 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -35,7 +35,7 @@ class AudioLibrary void set_tags (std::string member, std::vector tags); std::vector get_tags (std::string member); - void search_members_and (std::vector& results, const std::vector tags); + void search_members_and (std::vector& results, const std::vector& tags); void save_changes(); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 9fbc188562..6d2b2410fd 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -96,7 +96,7 @@ class AUPlugin : public ARDOUR::Plugin int set_state(const XMLNode& node); bool save_preset (std::string name); - bool load_preset (const std::string preset_label); + bool load_preset (const std::string& preset_label); std::vector get_presets (); std::string current_preset() const; diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index 6fedc95c6c..ad5bb3166e 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -45,8 +45,10 @@ struct ControlProtocolInfo { bool supports_feedback; XMLNode* state; - ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {} - ~ControlProtocolInfo() { if (state) { delete state; } } + ControlProtocolInfo() : descriptor (0), protocol (0), requested(false), + mandatory(false), supports_feedback(false), state (0) + {} + ~ControlProtocolInfo() { delete state; } }; class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index a7ccd96a2d..b2bd283ef8 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -59,6 +59,7 @@ public: Delivery (Session& s, boost::shared_ptr mm, const std::string& name, Role); Delivery (Session&, boost::shared_ptr mm, const XMLNode&); + ~Delivery (); bool set_name (const std::string& name); std::string display_name() const; diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index 2f57aaf583..f98ffeb8eb 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -98,7 +98,7 @@ class ExportGraphBuilder class SFC { public: // This constructor so that this can be constructed like a Normalizer - SFC (ExportGraphBuilder &) {} + SFC (ExportGraphBuilder &) : data_width(0) {} FloatSinkPtr init (FileSpec const & new_config, nframes_t max_frames); void add_child (FileSpec const & new_config); bool operator== (FileSpec const & other_config) const; diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index 971c0c4940..05fbddecf5 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -140,7 +140,7 @@ class ExportHandler : public ExportElementFactory struct CDMarkerStatus { CDMarkerStatus (std::string out_file, TimespanPtr timespan, FormatPtr format, std::string filename) : - out (out_file.c_str()), timespan (timespan), format (format), filename (filename), + out (out_file.c_str()), timespan (timespan), format (format), filename (filename), marker(0), track_number (1), track_position (0), track_duration (0), track_start_frame (0), index_number (1), index_position (0) {} diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 157d9144b8..d42c34a546 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -116,7 +116,7 @@ class LV2Plugin : public ARDOUR::Plugin XMLNode& get_state(); int set_state(const XMLNode& node, int version); bool save_preset(std::string uri); - bool load_preset(const std::string uri); + bool load_preset(const std::string& uri); virtual std::vector get_presets(); bool has_editor() const; diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 4770c43511..8731697906 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -127,7 +127,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual bool parameter_is_output(uint32_t) const = 0; virtual bool save_preset (std::string) = 0; - virtual bool load_preset (const std::string uri); + virtual bool load_preset (const std::string& uri); struct PresetRecord { PresetRecord(const std::string& u, const std::string& l) : uri(u), label(l) {} diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h index ad31aac44e..35b22106dd 100644 --- a/libs/ardour/ardour/rc_configuration.h +++ b/libs/ardour/ardour/rc_configuration.h @@ -35,6 +35,7 @@ class RCConfiguration : public Configuration { public: RCConfiguration(); + ~RCConfiguration(); void map_parameters (boost::function&); int set_state (XMLNode const &, int version); diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index f3109a707d..7f3d25454a 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -93,19 +93,19 @@ class RouteGroup : public SessionObject int remove (boost::shared_ptr); void apply (void (Route::*func)(void *), void *src) { - for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { + for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { ((*i).get()->*func)(src); } } template void apply (void (Route::*func)(T, void *), T val, void *src) { - for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { + for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { ((*i).get()->*func)(val, src); } } template void foreach_route (T *obj, void (T::*func)(Route&)) { - for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { + for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { (obj->*func)(**i); } } diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 9294d56fcc..02c5cc2391 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -411,7 +411,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi PBD::Signal0 route_group_removed; void foreach_route_group (boost::function f) { - for (std::list::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) { + for (std::list::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) { f (*i); } } diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 2ce2d5225a..882142c68d 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -120,15 +120,16 @@ private: }; class SessionEventManager { - public: - SessionEventManager () : pending_events (2048){} - virtual ~SessionEventManager() {} +public: + SessionEventManager () : pending_events (2048), + auto_loop_event(0), punch_out_event(0), punch_in_event(0) {} + virtual ~SessionEventManager() {} - virtual void queue_event (SessionEvent *ev) = 0; + virtual void queue_event (SessionEvent *ev) = 0; void clear_events (SessionEvent::Type type); - - protected: - RingBuffer pending_events; + +protected: + RingBuffer pending_events; typedef std::list Events; Events events; Events immediate_events; @@ -138,8 +139,8 @@ class SessionEventManager { SessionEvent *auto_loop_event; SessionEvent *punch_out_event; - SessionEvent *punch_in_event; - + SessionEvent *punch_in_event; + void dump_events () const; void merge_event (SessionEvent*); void replace_event (SessionEvent::Type, nframes64_t action_frame, nframes64_t target = 0); @@ -150,8 +151,8 @@ class SessionEventManager { void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0); void remove_event (nframes64_t frame, SessionEvent::Type type); - virtual void process_event(SessionEvent*) = 0; - virtual void set_next_event () = 0; + virtual void process_event(SessionEvent*) = 0; + virtual void set_next_event () = 0; }; } /* namespace */ diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 4380662540..54c965ce67 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -438,19 +438,14 @@ namespace ARDOUR { MeterPointChange = 0x1 }; - RouteProcessorChange () { - type = GeneralChange; - } + RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true) + {} - RouteProcessorChange (Type t) { - type = t; - meter_visibly_changed = true; - } + RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true) + {} - RouteProcessorChange (Type t, bool m) { - type = t; - meter_visibly_changed = m; - } + RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m) + {} /** type of change; "GeneralChange" means anything could have changed */ Type type; diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 753d94294f..513f24d493 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -79,7 +79,7 @@ class VSTPlugin : public ARDOUR::Plugin bool parameter_is_input(uint32_t i) const { return true; } bool parameter_is_output(uint32_t i) const { return false; } - bool load_preset (const std::string preset_label ); + bool load_preset (const std::string& preset_label); bool save_preset (std::string name); bool has_editor () const; -- cgit v1.2.3