summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/attribute_list.cc6
-rw-r--r--net/attribute_list.h6
-rw-r--r--net/event_history.cc2
-rw-r--r--net/event_history.h2
-rw-r--r--net/event_history_unittest.cc8
-rw-r--r--net/netlink_attribute.cc8
-rw-r--r--net/netlink_attribute.h10
-rw-r--r--net/netlink_message.cc2
-rw-r--r--net/netlink_message.h2
-rw-r--r--net/nl80211_attribute.cc2
-rw-r--r--net/nl80211_attribute.h2
-rw-r--r--net/rtnl_message_unittest.cc6
12 files changed, 28 insertions, 28 deletions
diff --git a/net/attribute_list.cc b/net/attribute_list.cc
index 6065c49f..e0844a7f 100644
--- a/net/attribute_list.cc
+++ b/net/attribute_list.cc
@@ -38,7 +38,7 @@ using std::string;
namespace shill {
bool AttributeList::CreateAttribute(
- int id, AttributeList::NewFromIdMethod factory) {
+ int id, const AttributeList::NewFromIdMethod& factory) {
if (ContainsKey(attributes_, id)) {
VLOG(7) << "Trying to re-add attribute " << id << ", not overwriting";
return true;
@@ -300,7 +300,7 @@ bool AttributeList::CreateSsidAttribute(int id, const char* id_string) {
return true;
}
-bool AttributeList::SetStringAttributeValue(int id, string value) {
+bool AttributeList::SetStringAttributeValue(int id, const string& value) {
NetlinkAttribute* attribute = GetAttribute(id);
if (!attribute)
return false;
@@ -361,7 +361,7 @@ bool AttributeList::GetRawAttributeValue(int id,
return true;
}
-bool AttributeList::SetRawAttributeValue(int id, ByteString value) {
+bool AttributeList::SetRawAttributeValue(int id, const ByteString& value) {
NetlinkAttribute* attribute = GetAttribute(id);
if (!attribute)
return false;
diff --git a/net/attribute_list.h b/net/attribute_list.h
index 18f325bf..6d1a45d0 100644
--- a/net/attribute_list.h
+++ b/net/attribute_list.h
@@ -49,7 +49,7 @@ class SHILL_EXPORT AttributeList : public base::RefCounted<AttributeList> {
// Instantiates an NetlinkAttribute of the appropriate type from |id|,
// and adds it to |attributes_|.
- bool CreateAttribute(int id, NewFromIdMethod factory);
+ bool CreateAttribute(int id, const NewFromIdMethod& factory);
// Helper function for creating control attribute.
bool CreateControlAttribute(int id);
@@ -117,7 +117,7 @@ class SHILL_EXPORT AttributeList : public base::RefCounted<AttributeList> {
bool CreateStringAttribute(int id, const char* id_string);
// SSID attributes are derived from string attributes.
bool CreateSsidAttribute(int id, const char* id_string);
- bool SetStringAttributeValue(int id, std::string value);
+ bool SetStringAttributeValue(int id, const std::string& value);
bool GetStringAttributeValue(int id, std::string* value) const;
bool CreateNestedAttribute(int id, const char* id_string);
@@ -129,7 +129,7 @@ class SHILL_EXPORT AttributeList : public base::RefCounted<AttributeList> {
bool CreateRawAttribute(int id, const char* id_string);
// |value| should point to the data (after the |nlattr| header, if there is
// one).
- bool SetRawAttributeValue(int id, ByteString value);
+ bool SetRawAttributeValue(int id, const ByteString& value);
bool GetRawAttributeValue(int id, ByteString* output) const;
// This retrieves a string from any kind of attribute.
diff --git a/net/event_history.cc b/net/event_history.cc
index cd269f74..c0992853 100644
--- a/net/event_history.cc
+++ b/net/event_history.cc
@@ -50,7 +50,7 @@ std::vector<std::string> EventHistory::ExtractWallClockToStrings() const {
return strings;
}
-void EventHistory::RecordEventInternal(Timestamp now) {
+void EventHistory::RecordEventInternal(const Timestamp& now) {
events_.push_back(now);
while (!events_.empty() && max_events_specified_ &&
(events_.size() > static_cast<size_t>(max_events_saved_))) {
diff --git a/net/event_history.h b/net/event_history.h
index 615262d9..9b2ac878 100644
--- a/net/event_history.h
+++ b/net/event_history.h
@@ -82,7 +82,7 @@ class SHILL_EXPORT EventHistory {
friend class ServiceTest; // RecordEventInternal, time_
friend class WakeOnWiFiTest; // time_
- void RecordEventInternal(Timestamp now);
+ void RecordEventInternal(const Timestamp& now);
void ExpireEventsBeforeInternal(int seconds_ago, Timestamp now,
ClockType clock_type);
diff --git a/net/event_history_unittest.cc b/net/event_history_unittest.cc
index fe4eb15d..80c8f54a 100644
--- a/net/event_history_unittest.cc
+++ b/net/event_history_unittest.cc
@@ -61,18 +61,18 @@ class EventHistoryTest : public ::testing::Test {
deque<Timestamp>* GetEvents() { return &event_history_->events_; }
- void RecordEvent(Timestamp now) {
+ void RecordEvent(const Timestamp& now) {
EXPECT_CALL(time_, GetNow()).WillOnce(Return(now));
event_history_->RecordEvent();
}
- void ExpireEventsBefore(int seconds_ago, Timestamp now,
+ void ExpireEventsBefore(int seconds_ago, const Timestamp& now,
EventHistory::ClockType clock_type) {
EXPECT_CALL(time_, GetNow()).WillOnce(Return(now));
event_history_->ExpireEventsBefore(seconds_ago, clock_type);
}
- void RecordEventAndExpireEventsBefore(int seconds_ago, Timestamp now,
+ void RecordEventAndExpireEventsBefore(int seconds_ago, const Timestamp& now,
EventHistory::ClockType clock_type) {
EXPECT_CALL(time_, GetNow()).WillOnce(Return(now));
event_history_->RecordEventAndExpireEventsBefore(seconds_ago, clock_type);
@@ -91,7 +91,7 @@ class EventHistoryTest : public ::testing::Test {
int CountEventsWithinInterval(int seconds_ago,
EventHistory::ClockType clock_type,
- Timestamp now) {
+ const Timestamp& now) {
EXPECT_CALL(time_, GetNow()).WillOnce(Return(now));
return event_history_->CountEventsWithinInterval(seconds_ago, clock_type);
}
diff --git a/net/netlink_attribute.cc b/net/netlink_attribute.cc
index 3248a499..2d3d1955 100644
--- a/net/netlink_attribute.cc
+++ b/net/netlink_attribute.cc
@@ -356,7 +356,7 @@ bool NetlinkAttribute::GetStringValue(string* value) const {
return false;
}
-bool NetlinkAttribute::SetStringValue(string value) {
+bool NetlinkAttribute::SetStringValue(const string& value) {
LOG(ERROR) << "Attribute is not of type 'String'";
return false;
}
@@ -382,7 +382,7 @@ bool NetlinkAttribute::GetRawValue(ByteString* value) const {
return false;
}
-bool NetlinkAttribute::SetRawValue(const ByteString new_value) {
+bool NetlinkAttribute::SetRawValue(const ByteString& new_value) {
LOG(ERROR) << "Attribute is not of type 'Raw'";
return false;
}
@@ -745,7 +745,7 @@ bool NetlinkStringAttribute::GetStringValue(string* output) const {
return true;
}
-bool NetlinkStringAttribute::SetStringValue(const string new_value) {
+bool NetlinkStringAttribute::SetStringValue(const string& new_value) {
value_ = new_value;
has_a_value_ = true;
return true;
@@ -1049,7 +1049,7 @@ bool NetlinkRawAttribute::GetRawValue(ByteString* output) const {
return true;
}
-bool NetlinkRawAttribute::SetRawValue(const ByteString new_value) {
+bool NetlinkRawAttribute::SetRawValue(const ByteString& new_value) {
data_ = new_value;
has_a_value_ = true;
return true;
diff --git a/net/netlink_attribute.h b/net/netlink_attribute.h
index b1ab1500..2736c642 100644
--- a/net/netlink_attribute.h
+++ b/net/netlink_attribute.h
@@ -90,7 +90,7 @@ class SHILL_EXPORT NetlinkAttribute {
virtual bool SetFlagValue(bool value);
virtual bool GetStringValue(std::string* value) const;
- virtual bool SetStringValue(const std::string value);
+ virtual bool SetStringValue(const std::string& value);
virtual bool GetNestedAttributeList(AttributeListRefPtr* value);
virtual bool ConstGetNestedAttributeList(
@@ -98,7 +98,7 @@ class SHILL_EXPORT NetlinkAttribute {
virtual bool SetNestedHasAValue();
virtual bool GetRawValue(ByteString* value) const;
- virtual bool SetRawValue(const ByteString value);
+ virtual bool SetRawValue(const ByteString& value);
// Prints the attribute info -- for debugging.
virtual void Print(int log_level, int indent) const;
@@ -243,7 +243,7 @@ class SHILL_EXPORT NetlinkStringAttribute : public NetlinkAttribute {
: NetlinkAttribute(id, id_string, kType, kMyTypeString) {}
virtual bool InitFromValue(const ByteString& data);
virtual bool GetStringValue(std::string* value) const;
- virtual bool SetStringValue(const std::string new_value);
+ virtual bool SetStringValue(const std::string& new_value);
virtual bool ToString(std::string* value) const;
virtual ByteString Encode() const;
std::string value() const { return value_; }
@@ -292,7 +292,7 @@ class NetlinkNestedAttribute : public NetlinkAttribute {
struct NestedData {
typedef base::Callback<bool (AttributeList* list, size_t id,
const std::string& attribute_name,
- ByteString data)> AttributeParser;
+ const ByteString& data)> AttributeParser;
typedef std::map<size_t, NestedData> NestedDataMap;
NestedData();
@@ -369,7 +369,7 @@ class NetlinkRawAttribute : public NetlinkAttribute {
// Gets the value of the data (the header is not stored).
virtual bool GetRawValue(ByteString* value) const;
// Should set the value of the data (not the attribute header).
- virtual bool SetRawValue(const ByteString value);
+ virtual bool SetRawValue(const ByteString& value);
virtual bool ToString(std::string* value) const;
virtual ByteString Encode() const;
diff --git a/net/netlink_message.cc b/net/netlink_message.cc
index 752f0984..a4469a38 100644
--- a/net/netlink_message.cc
+++ b/net/netlink_message.cc
@@ -267,7 +267,7 @@ void UnknownMessage::Print(int header_log_level,
//
bool NetlinkMessageFactory::AddFactoryMethod(uint16_t message_type,
- FactoryMethod factory) {
+ const FactoryMethod& factory) {
if (ContainsKey(factories_, message_type)) {
LOG(WARNING) << "Message type " << message_type << " already exists.";
return false;
diff --git a/net/netlink_message.h b/net/netlink_message.h
index 5a879549..37e84c73 100644
--- a/net/netlink_message.h
+++ b/net/netlink_message.h
@@ -243,7 +243,7 @@ class SHILL_EXPORT NetlinkMessageFactory {
// Adds a message factory for a specific message_type. Intended to be used
// at initialization.
- bool AddFactoryMethod(uint16_t message_type, FactoryMethod factory);
+ bool AddFactoryMethod(uint16_t message_type, const FactoryMethod& factory);
// Ownership of the message is passed to the caller and, as such, he should
// delete it.
diff --git a/net/nl80211_attribute.cc b/net/nl80211_attribute.cc
index 89600c15..54b5877f 100644
--- a/net/nl80211_attribute.cc
+++ b/net/nl80211_attribute.cc
@@ -123,7 +123,7 @@ Nl80211AttributeBss::Nl80211AttributeBss()
bool Nl80211AttributeBss::ParseInformationElements(
AttributeList* attribute_list, size_t id, const string& attribute_name,
- ByteString data) {
+ const ByteString& data) {
if (!attribute_list) {
LOG(ERROR) << "NULL |attribute_list| parameter";
return false;
diff --git a/net/nl80211_attribute.h b/net/nl80211_attribute.h
index b9a793a9..71c0e7a3 100644
--- a/net/nl80211_attribute.h
+++ b/net/nl80211_attribute.h
@@ -581,7 +581,7 @@ class Nl80211AttributeBss : public NetlinkNestedAttribute {
static bool ParseInformationElements(AttributeList* attribute_list,
size_t id,
const std::string& attribute_name,
- ByteString data);
+ const ByteString& data);
DISALLOW_COPY_AND_ASSIGN(Nl80211AttributeBss);
};
diff --git a/net/rtnl_message_unittest.cc b/net/rtnl_message_unittest.cc
index 3e74d93c..9824526f 100644
--- a/net/rtnl_message_unittest.cc
+++ b/net/rtnl_message_unittest.cc
@@ -389,10 +389,10 @@ class RTNLMessageTest : public Test {
int interface_index,
unsigned int flags,
unsigned int change,
- ByteString address,
- ByteString name,
+ const ByteString& address,
+ const ByteString& name,
uint32_t mtu,
- ByteString qdisc,
+ const ByteString& qdisc,
int oper_state) {
RTNLMessage msg;
EXPECT_TRUE(msg.Decode(packet));