Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pulse: avoid passing primitives by reference

  • Loading branch information...
commit ab16b8a89c399c513a7fba8e0bc68f0e700cfd2c 1 parent 03beb5b
@falconindy authored
Showing with 15 additions and 15 deletions.
  1. +7 −7 pulse.cc
  2. +8 −8 pulse.h
View
14 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<Device>& 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<Device>& 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<Device>& 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);
}
View
16 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<Device>& 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<Device>& 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<Device>& 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<Device>& 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<Device>& 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<Card>& GetCards() const { return cards_; }
@@ -232,7 +232,7 @@ class PulseClient {
void populate_sinks();
void populate_sources();
- Device* get_device(vector<Device>& devices, const uint32_t& index);
+ Device* get_device(vector<Device>& devices, const uint32_t index);
Device* get_device(vector<Device>& devices, const string& name);
void remove_device(Device& device);
Please sign in to comment.
Something went wrong with that request. Please try again.