From ab16b8a89c399c513a7fba8e0bc68f0e700cfd2c Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 22 Aug 2013 23:16:52 -0400 Subject: pulse: avoid passing primitives by reference --- pulse.cc | 14 +++++++------- pulse.h | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pulse.cc b/pulse.cc index 131c0c0..233dfc2 100644 --- a/pulse.cc +++ b/pulse.cc @@ -141,7 +141,7 @@ void PulseClient::Populate() { populate_cards(); } -Card* PulseClient::GetCard(const uint32_t& index) { +Card* PulseClient::GetCard(const uint32_t index) { for (Card& card : cards_) { if (card.index_ == index) return &card; } @@ -165,7 +165,7 @@ Card* PulseClient::GetCard(const Device& device) { } Device* PulseClient::get_device(vector& devices, - const uint32_t& index) { + const uint32_t index) { for (Device& device : devices) { if (device.index_ == index) return &device; } @@ -181,7 +181,7 @@ Device* PulseClient::get_device(vector& devices, const string& name) { } } -Device* PulseClient::GetDevice(const uint32_t& index, enum DeviceType type) { +Device* PulseClient::GetDevice(const uint32_t index, enum DeviceType type) { switch (type) { case DEVTYPE_SINK: return GetSink(index); @@ -223,7 +223,7 @@ const vector& PulseClient::GetDevices(enum DeviceType type) const { throw std::runtime_error("Impossible DeviceType encountered in GetDevices"); } -Device* PulseClient::GetSink(const uint32_t& index) { +Device* PulseClient::GetSink(const uint32_t index) { return get_device(sinks_, index); } @@ -231,7 +231,7 @@ Device* PulseClient::GetSink(const string& name) { return get_device(sinks_, name); } -Device* PulseClient::GetSource(const uint32_t& index) { +Device* PulseClient::GetSource(const uint32_t index) { return get_device(sources_, index); } @@ -239,7 +239,7 @@ Device* PulseClient::GetSource(const string& name) { return get_device(sources_, name); } -Device* PulseClient::GetSinkInput(const uint32_t& index) { +Device* PulseClient::GetSinkInput(const uint32_t index) { return get_device(sink_inputs_, index); } @@ -247,7 +247,7 @@ Device* PulseClient::GetSinkInput(const string& name) { return get_device(sink_inputs_, name); } -Device* PulseClient::GetSourceOutput(const uint32_t& index) { +Device* PulseClient::GetSourceOutput(const uint32_t index) { return get_device(source_outputs_, index); } diff --git a/pulse.h b/pulse.h index e0b2bd3..2d980f0 100644 --- a/pulse.h +++ b/pulse.h @@ -42,7 +42,7 @@ struct Operations { pa_operation* (*SetDefault)(pa_context*, const char*, pa_context_success_cb_t, void*); pa_operation* (*Kill)(pa_context*, uint32_t, pa_context_success_cb_t, void*); - pa_operation* (*Move)(pa_context *, uint32_t, uint32_t, + pa_operation* (*Move)(pa_context*, uint32_t, uint32_t, pa_context_success_cb_t, void *); }; @@ -147,33 +147,33 @@ class PulseClient { void Populate(); // Get a device by index or name and type, or all devices by type. - Device* GetDevice(const uint32_t& index, enum DeviceType type); + Device* GetDevice(const uint32_t index, enum DeviceType type); Device* GetDevice(const string& name, enum DeviceType type); const vector& GetDevices(enum DeviceType type) const; // Get a sink by index or name, or all sinks. - Device* GetSink(const uint32_t& index); + Device* GetSink(const uint32_t index); Device* GetSink(const string& name); const vector& GetSinks() const { return sinks_; } // Get a source by index or name, or all sources. - Device* GetSource(const uint32_t& index); + Device* GetSource(const uint32_t index); Device* GetSource(const string& name); const vector& GetSources() const { return sources_; } // Get a sink input by index or name, or all sink inputs. - Device* GetSinkInput(const uint32_t& name); + Device* GetSinkInput(const uint32_t name); Device* GetSinkInput(const string& name); const vector& GetSinkInputs() const { return sink_inputs_; } // Get a source output by index or name, or all source outputs. - Device* GetSourceOutput(const uint32_t& name); + Device* GetSourceOutput(const uint32_t name); Device* GetSourceOutput(const string& name); const vector& GetSourceOutputs() const { return source_outputs_; } // Get a card by index or name, all cards, or get the card which // a sink is attached to. - Card* GetCard(const uint32_t& index); + Card* GetCard(const uint32_t index); Card* GetCard(const string& name); Card* GetCard(const Device& device); const vector& GetCards() const { return cards_; } @@ -232,7 +232,7 @@ class PulseClient { void populate_sinks(); void populate_sources(); - Device* get_device(vector& devices, const uint32_t& index); + Device* get_device(vector& devices, const uint32_t index); Device* get_device(vector& devices, const string& name); void remove_device(Device& device); -- cgit v1.2.3