diff options
author | Alex Vakulenko <avakulenko@chromium.org> | 2014-06-16 17:18:44 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-18 08:46:04 +0000 |
commit | 8a5322984f2d81bcbfd8d44c59747a11bd9b904b (patch) | |
tree | 691f393705f4aa8b6e2476817e1046f6e572efca | |
parent | 45170bcb5e3b5e076e9307c695faf25faac395c8 (diff) | |
download | shill-8a5322984f2d81bcbfd8d44c59747a11bd9b904b.tar.gz |
shill: Fix most of warnings from cpplint
Fix most cpplinter's warnings. On a few occasisions, the warnings
produced were false-positives, so added explicit // NOLINT comment
overrides.
There were a few instances of disallowed non-const reference usage
(reported as runtime/reference error by cpplint) for
"DBus::Error &error" which should potentially be changed
to pointers to comply with C++ coding style but I will let Shill
owners do that since there is quite a few of those and the
change isn't brain-dead simple...
BUG=None
TEST=platform2 still compiles and all unit tests pass.
Change-Id: Ic2e31896aa13d20eeb1a85dee74f3db8cccfde2e
Reviewed-on: https://chromium-review.googlesource.com/204164
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
215 files changed, 699 insertions, 508 deletions
diff --git a/accessor_interface.h b/accessor_interface.h index 682695b4..5230bfd5 100644 --- a/accessor_interface.h +++ b/accessor_interface.h @@ -7,7 +7,7 @@ #include <map> #include <string> -#include <tr1/memory> +#include <memory> #include <utility> #include <vector> @@ -60,27 +60,27 @@ typedef std::vector<uint16> Uint16s; // Using a smart pointer here allows pointers to classes derived from // AccessorInterface<> to be stored in maps and other STL container types. -typedef std::tr1::shared_ptr<AccessorInterface<bool>> BoolAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<int16>> Int16Accessor; -typedef std::tr1::shared_ptr<AccessorInterface<int32>> Int32Accessor; +typedef std::shared_ptr<AccessorInterface<bool>> BoolAccessor; +typedef std::shared_ptr<AccessorInterface<int16>> Int16Accessor; +typedef std::shared_ptr<AccessorInterface<int32>> Int32Accessor; // See comment above RpcIdentifiers typedef, for the reason why the // RpcIdentifiersAccessor exists (even though it has the same // underlying type as StringsAccessor). -typedef std::tr1::shared_ptr< +typedef std::shared_ptr< AccessorInterface<RpcIdentifier>> RpcIdentifierAccessor; -typedef std::tr1::shared_ptr< - AccessorInterface<std::vector<std::string>>>RpcIdentifiersAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<std::string>> StringAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<Stringmap>> StringmapAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<Stringmaps>> StringmapsAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<Strings>> StringsAccessor; -typedef std::tr1::shared_ptr< +typedef std::shared_ptr< + AccessorInterface<std::vector<std::string>>> RpcIdentifiersAccessor; +typedef std::shared_ptr<AccessorInterface<std::string>> StringAccessor; +typedef std::shared_ptr<AccessorInterface<Stringmap>> StringmapAccessor; +typedef std::shared_ptr<AccessorInterface<Stringmaps>> StringmapsAccessor; +typedef std::shared_ptr<AccessorInterface<Strings>> StringsAccessor; +typedef std::shared_ptr< AccessorInterface<KeyValueStore>> KeyValueStoreAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<uint8>> Uint8Accessor; -typedef std::tr1::shared_ptr<AccessorInterface<uint16>> Uint16Accessor; -typedef std::tr1::shared_ptr<AccessorInterface<Uint16s>> Uint16sAccessor; -typedef std::tr1::shared_ptr<AccessorInterface<uint32>> Uint32Accessor; -typedef std::tr1::shared_ptr<AccessorInterface<uint64>> Uint64Accessor; +typedef std::shared_ptr<AccessorInterface<uint8>> Uint8Accessor; +typedef std::shared_ptr<AccessorInterface<uint16>> Uint16Accessor; +typedef std::shared_ptr<AccessorInterface<Uint16s>> Uint16sAccessor; +typedef std::shared_ptr<AccessorInterface<uint32>> Uint32Accessor; +typedef std::shared_ptr<AccessorInterface<uint64>> Uint64Accessor; } // namespace shill diff --git a/active_passive_out_of_credits_detector.cc b/active_passive_out_of_credits_detector.cc index ea02fd05..313ab955 100644 --- a/active_passive_out_of_credits_detector.cc +++ b/active_passive_out_of_credits_detector.cc @@ -111,7 +111,7 @@ void ActivePassiveOutOfCreditsDetector::OnNoNetworkRouting(int reason) { void ActivePassiveOutOfCreditsDetector::SetupConnectionHealthChecker() { DCHECK(service()->connection()); - // TODO: Consider moving health_checker_remote_ips() out of manager + // TODO(thieule): Consider moving health_checker_remote_ips() out of manager // (crbug.com/304974). if (!health_checker_.get()) { health_checker_.reset( diff --git a/active_passive_out_of_credits_detector_unittest.cc b/active_passive_out_of_credits_detector_unittest.cc index de1e23c5..3660f86e 100644 --- a/active_passive_out_of_credits_detector_unittest.cc +++ b/active_passive_out_of_credits_detector_unittest.cc @@ -4,6 +4,9 @@ #include "shill/active_passive_out_of_credits_detector.h" +#include <string> +#include <vector> + #include <gtest/gtest.h> #include "shill/event_dispatcher.h" diff --git a/arp_packet_unittest.cc b/arp_packet_unittest.cc index a6fda5a1..a952718f 100644 --- a/arp_packet_unittest.cc +++ b/arp_packet_unittest.cc @@ -32,7 +32,7 @@ const uint8 kMACAddress1[] = { 0x88, 0x87, 0x86, 0x85, 0x84, 0x83 }; const uint8 kInsertedByte[] = { 0x00 }; const size_t kArpPaddingSizeV4 = 18; const size_t kArpPaddingSizeV6 = 0; -} // namespace {} +} // namespace class ArpPacketTest : public Test { public: diff --git a/async_connection.cc b/async_connection.cc index 85c4f14d..eb649373 100644 --- a/async_connection.cc +++ b/async_connection.cc @@ -38,7 +38,7 @@ AsyncConnection::~AsyncConnection() { } bool AsyncConnection::Start(const IPAddress &address, int port) { - DCHECK(fd_ < 0); + DCHECK_LT(fd_, 0); fd_ = sockets_->Socket(PF_INET, SOCK_STREAM, 0); if (fd_ < 0 || diff --git a/async_connection_unittest.cc b/async_connection_unittest.cc index ba056995..ac8a154f 100644 --- a/async_connection_unittest.cc +++ b/async_connection_unittest.cc @@ -34,7 +34,7 @@ const char kConnectAddress[] = "10.11.12.13"; const int kConnectPort = 10203; const int kErrorNumber = 30405; const int kSocketFD = 60708; -} // namespace {} +} // namespace class AsyncConnectionTest : public Test { public: diff --git a/attribute_list.h b/attribute_list.h index 71de599f..88f9cec6 100644 --- a/attribute_list.h +++ b/attribute_list.h @@ -10,7 +10,7 @@ #include <map> #include <string> -#include <tr1/memory> +#include <memory> #include <base/bind.h> @@ -25,7 +25,7 @@ class NetlinkRawAttribute; class AttributeList : public base::RefCounted<AttributeList> { public: - typedef std::tr1::shared_ptr<NetlinkAttribute> AttributePointer; + typedef std::shared_ptr<NetlinkAttribute> AttributePointer; typedef base::Callback<NetlinkAttribute *(int id)> NewFromIdMethod; AttributeList() {} diff --git a/byte_string.cc b/byte_string.cc index d9814a6a..5d2917ee 100644 --- a/byte_string.cc +++ b/byte_string.cc @@ -156,7 +156,7 @@ bool ByteString::Equals(const ByteString &b) const { } Vector::const_iterator lhs(begin_); Vector::const_iterator rhs(b.begin_); - while(lhs != data_.end()) { + while (lhs != data_.end()) { if (*lhs++ != *rhs++) { return false; } diff --git a/byte_string_unittest.cc b/byte_string_unittest.cc index db57115f..f8e17b7d 100644 --- a/byte_string_unittest.cc +++ b/byte_string_unittest.cc @@ -26,7 +26,7 @@ const char kTest2HexString[] = "0102030A"; const unsigned int kTest2Uint32 = 0x0102030a; const unsigned char kTest3[] = { 0, 0, 0, 0 }; const char kTest4[] = "Hello world"; -} // namespace {} +} // namespace class ByteStringTest : public Test { public: diff --git a/callbacks.h b/callbacks.h index 1b166606..83c5ca83 100644 --- a/callbacks.h +++ b/callbacks.h @@ -6,6 +6,7 @@ #define SHILL_CALLBACKS_ #include <string> +#include <vector> #include <base/callback.h> diff --git a/cellular.cc b/cellular.cc index ea63851a..6bd83d73 100644 --- a/cellular.cc +++ b/cellular.cc @@ -638,7 +638,7 @@ void Cellular::CreateService() { // TODO(pprabhu) Make profile matching more robust (crbug.com/369755) string service_id; if (home_provider_info_->IsMobileNetworkOperatorKnown() && - !home_provider_info_->uuid().empty()){ + !home_provider_info_->uuid().empty()) { service_id = home_provider_info_->uuid(); } else if (serving_operator_info_->IsMobileNetworkOperatorKnown() && !serving_operator_info_->uuid().empty()) { @@ -1567,7 +1567,7 @@ void Cellular::UpdateServingOperator( service_name += home_provider_info->operator_name() + " | "; } service_name += operator_info->operator_name(); - } else if(!operator_info->mccmnc().empty()){ + } else if (!operator_info->mccmnc().empty()) { // We could not get a name for the operator, just use the code. service_name = "cellular_" + operator_info->mccmnc(); } else { @@ -5,6 +5,7 @@ #ifndef SHILL_CELLULAR_H_ #define SHILL_CELLULAR_H_ +#include <map> #include <string> #include <vector> @@ -414,7 +415,7 @@ class Cellular : public Device, public RPCTaskDelegate { public: // |cellular| must have lifespan longer than this object. In practice this // is enforced because |cellular| owns this object. - MobileOperatorInfoObserver(Cellular *cellular); + explicit MobileOperatorInfoObserver(Cellular *cellular); virtual ~MobileOperatorInfoObserver(); void set_capability(CellularCapability *capability) { diff --git a/cellular_capability_classic.cc b/cellular_capability_classic.cc index 39265c3e..e335dca8 100644 --- a/cellular_capability_classic.cc +++ b/cellular_capability_classic.cc @@ -56,7 +56,7 @@ static Cellular::ModemState ConvertClassicToModemState(uint32 classic_state) { return Cellular::kModemStateConnected; default: return Cellular::kModemStateUnknown; - }; + } } CellularCapabilityClassic::CellularCapabilityClassic( diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc index 415f59ca..eb5dd426 100644 --- a/cellular_capability_universal.cc +++ b/cellular_capability_universal.cc @@ -668,11 +668,11 @@ void CellularCapabilityUniversal::UpdateServiceActivationState() { subscription_state_ == kSubscriptionStateUnprovisioned) && !sim_identifier.empty() && (state == PendingActivationStore::kStatePending || - state == PendingActivationStore::kStatePendingTimeout)) + state == PendingActivationStore::kStatePendingTimeout)) { activation_state = kActivationStateActivating; - else if (activation_required) + } else if (activation_required) { activation_state = kActivationStateNotActivated; - else { + } else { activation_state = kActivationStateActivated; // Mark an activated service for auto-connect by default. Since data from diff --git a/cellular_capability_universal_cdma_unittest.cc b/cellular_capability_universal_cdma_unittest.cc index e1081112..3597e514 100644 --- a/cellular_capability_universal_cdma_unittest.cc +++ b/cellular_capability_universal_cdma_unittest.cc @@ -49,7 +49,7 @@ namespace shill { class CellularCapabilityUniversalCDMATest : public testing::Test { public: - CellularCapabilityUniversalCDMATest(EventDispatcher *dispatcher) + explicit CellularCapabilityUniversalCDMATest(EventDispatcher *dispatcher) : dispatcher_(dispatcher), capability_(NULL), device_adaptor_(NULL), @@ -338,14 +338,14 @@ TEST_F(CellularCapabilityUniversalCDMAMainTest, ActivateAutomatic) { // Cases when activation fails because |activation_code| is not available. EXPECT_CALL(*mock_serving_operator_info_, IsMobileNetworkOperatorKnown()) .WillRepeatedly(Return(false)); - EXPECT_CALL(*cdma_proxy, Activate(_,_,_,_)).Times(0); + EXPECT_CALL(*cdma_proxy, Activate(_, _, _, _)).Times(0); capability_->ActivateAutomatic(); Mock::VerifyAndClearExpectations(mock_serving_operator_info_); Mock::VerifyAndClearExpectations(modem_cdma_proxy_.get()); EXPECT_CALL(*mock_serving_operator_info_, IsMobileNetworkOperatorKnown()) .WillRepeatedly(Return(true)); mock_serving_operator_info_->SetEmptyDefaultsForProperties(); - EXPECT_CALL(*cdma_proxy, Activate(_,_,_,_)).Times(0); + EXPECT_CALL(*cdma_proxy, Activate(_, _, _, _)).Times(0); capability_->ActivateAutomatic(); Mock::VerifyAndClearExpectations(mock_serving_operator_info_); Mock::VerifyAndClearExpectations(modem_cdma_proxy_.get()); @@ -361,9 +361,9 @@ TEST_F(CellularCapabilityUniversalCDMAMainTest, ActivateAutomatic) { .WillOnce(Return(PendingActivationStore::kStatePending)) .WillOnce(Return(PendingActivationStore::kStateActivated)); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - SetActivationState(_,_,_)) + SetActivationState(_, _, _)) .Times(0); - EXPECT_CALL(*cdma_proxy, Activate(_,_,_,_)).Times(0); + EXPECT_CALL(*cdma_proxy, Activate(_, _, _, _)).Times(0); capability_->ActivateAutomatic(); capability_->ActivateAutomatic(); Mock::VerifyAndClearExpectations(modem_info_.mock_pending_activation_store()); @@ -374,9 +374,9 @@ TEST_F(CellularCapabilityUniversalCDMAMainTest, ActivateAutomatic) { .WillOnce(Return(PendingActivationStore::kStateUnknown)) .WillOnce(Return(PendingActivationStore::kStateFailureRetry)); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - SetActivationState(_,_, PendingActivationStore::kStatePending)) + SetActivationState(_, _, PendingActivationStore::kStatePending)) .Times(2); - EXPECT_CALL(*cdma_proxy, Activate(_,_,_,_)).Times(2); + EXPECT_CALL(*cdma_proxy, Activate(_, _, _, _)).Times(2); capability_->ActivateAutomatic(); capability_->ActivateAutomatic(); Mock::VerifyAndClearExpectations(modem_info_.mock_pending_activation_store()); @@ -466,7 +466,7 @@ TEST_F(CellularCapabilityUniversalCDMAMainTest, TEST_F(CellularCapabilityUniversalCDMAMainTest, IsActivating) { EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .WillOnce(Return(PendingActivationStore::kStatePending)) .WillOnce(Return(PendingActivationStore::kStatePending)) .WillOnce(Return(PendingActivationStore::kStateFailureRetry)) @@ -568,10 +568,10 @@ TEST_F(CellularCapabilityUniversalCDMAMainTest, SetupConnectProperties) { TEST_F(CellularCapabilityUniversalCDMADispatcherTest, UpdatePendingActivationState) { capability_->activation_state_ = MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATED; - EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_,_)) + EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_, _)) .Times(1); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .Times(0); EXPECT_CALL(*modem_info_.mock_dispatcher(), PostTask(_)).Times(0); capability_->UpdatePendingActivationState(); @@ -579,10 +579,10 @@ TEST_F(CellularCapabilityUniversalCDMADispatcherTest, Mock::VerifyAndClearExpectations(modem_info_.mock_dispatcher()); capability_->activation_state_ = MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING; - EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_,_)) + EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_, _)) .Times(0); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .Times(2) .WillRepeatedly(Return(PendingActivationStore::kStateUnknown)); EXPECT_CALL(*modem_info_.mock_dispatcher(), PostTask(_)).Times(0); @@ -591,10 +591,10 @@ TEST_F(CellularCapabilityUniversalCDMADispatcherTest, Mock::VerifyAndClearExpectations(modem_info_.mock_dispatcher()); capability_->activation_state_ = MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED; - EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_,_)) + EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_, _)) .Times(0); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .Times(2) .WillRepeatedly(Return(PendingActivationStore::kStatePending)); EXPECT_CALL(*modem_info_.mock_dispatcher(), PostTask(_)).Times(0); @@ -602,10 +602,10 @@ TEST_F(CellularCapabilityUniversalCDMADispatcherTest, Mock::VerifyAndClearExpectations(modem_info_.mock_pending_activation_store()); Mock::VerifyAndClearExpectations(modem_info_.mock_dispatcher()); - EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_,_)) + EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_, _)) .Times(0); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .Times(2) .WillRepeatedly(Return(PendingActivationStore::kStateFailureRetry)); EXPECT_CALL(*modem_info_.mock_dispatcher(), PostTask(_)).Times(1); @@ -613,10 +613,10 @@ TEST_F(CellularCapabilityUniversalCDMADispatcherTest, Mock::VerifyAndClearExpectations(modem_info_.mock_pending_activation_store()); Mock::VerifyAndClearExpectations(modem_info_.mock_dispatcher()); - EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_,_)) + EXPECT_CALL(*modem_info_.mock_pending_activation_store(), RemoveEntry(_, _)) .Times(0); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .Times(4) .WillOnce(Return(PendingActivationStore::kStateActivated)) .WillOnce(Return(PendingActivationStore::kStateActivated)) diff --git a/cellular_capability_universal_unittest.cc b/cellular_capability_universal_unittest.cc index 30496312..fb080f58 100644 --- a/cellular_capability_universal_unittest.cc +++ b/cellular_capability_universal_unittest.cc @@ -65,7 +65,7 @@ MATCHER_P(HasApn, expected_apn, "") { class CellularCapabilityUniversalTest : public testing::TestWithParam<string> { public: - CellularCapabilityUniversalTest(EventDispatcher *dispatcher) + explicit CellularCapabilityUniversalTest(EventDispatcher *dispatcher) : dispatcher_(dispatcher), modem_info_(NULL, dispatcher, NULL, NULL, NULL), modem_3gpp_proxy_(new mm1::MockModemModem3gppProxy()), @@ -1775,7 +1775,7 @@ TEST_F(CellularCapabilityUniversalMainTest, ActivationWaitForRegisterTimeout) { // Reset not done. capability_->reset_done_ = false; - EXPECT_CALL(*modem_proxy, Reset(_,_,_)).Times(1); + EXPECT_CALL(*modem_proxy, Reset(_, _, _)).Times(1); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), GetActivationState(PendingActivationStore::kIdentifierICCID, _)) .WillOnce(Return(PendingActivationStore::kStatePending)); diff --git a/cellular_service.cc b/cellular_service.cc index cf3a82eb..99ddddb3 100644 --- a/cellular_service.cc +++ b/cellular_service.cc @@ -129,7 +129,7 @@ void CellularService::HelpRegisterDerivedStringmap( void CellularService::HelpRegisterDerivedBool( const string &name, - bool(CellularService::*get)(Error *), + bool(CellularService::*get)(Error *error), bool(CellularService::*set)(const bool&, Error *)) { mutable_store()->RegisterDerivedBool( name, diff --git a/cellular_service.h b/cellular_service.h index 749a5551..209eb15a 100644 --- a/cellular_service.h +++ b/cellular_service.h @@ -153,7 +153,7 @@ class CellularService : public Service { bool(CellularService::*set)(const Stringmap &value, Error *error)); void HelpRegisterDerivedBool( const std::string &name, - bool(CellularService::*get)(Error *), + bool(CellularService::*get)(Error *error), bool(CellularService::*set)(const bool&, Error *)); virtual std::string GetDeviceRpcId(Error *error) const; diff --git a/cellular_unittest.cc b/cellular_unittest.cc index ef6e259e..eb41544d 100644 --- a/cellular_unittest.cc +++ b/cellular_unittest.cc @@ -608,12 +608,12 @@ const Stringmaps CellularTest::kTestNetworksCellular = {kLongNameProperty, "some_long_name"}, {kShortNameProperty, "short"}}}; const int CellularTest::kStrength = 90; -string CellularTest::kHomeProviderCode = "10001"; -string CellularTest::kHomeProviderCountry = "us"; -string CellularTest::kHomeProviderName = "HomeProviderName"; -string CellularTest::kServingOperatorCode = "10002"; -string CellularTest::kServingOperatorCountry = "ca"; -string CellularTest::kServingOperatorName = "ServingOperatorName"; +string CellularTest::kHomeProviderCode = "10001"; // NOLINT(runtime/string) +string CellularTest::kHomeProviderCountry = "us"; // NOLINT +string CellularTest::kHomeProviderName = "HomeProviderName"; // NOLINT +string CellularTest::kServingOperatorCode = "10002"; // NOLINT +string CellularTest::kServingOperatorCountry = "ca"; // NOLINT +string CellularTest::kServingOperatorName = "ServingOperatorName"; // NOLINT TEST_F(CellularTest, GetStateString) { EXPECT_EQ("CellularStateDisabled", @@ -1278,7 +1278,7 @@ TEST_F(CellularTest, HandleNewRegistrationStateForServiceRequiringActivation) { EXPECT_CALL(*mock_home_provider_info_, olp_list()) .WillRepeatedly(ReturnRef(olp_list)); EXPECT_CALL(*modem_info_.mock_pending_activation_store(), - GetActivationState(_,_)) + GetActivationState(_, _)) .WillRepeatedly(Return(PendingActivationStore::kStateUnknown)); device_->state_ = Cellular::kStateDisabled; diff --git a/connection.cc b/connection.cc index e4efebf1..b5e00db9 100644 --- a/connection.cc +++ b/connection.cc @@ -7,6 +7,8 @@ #include <arpa/inet.h> #include <linux/rtnetlink.h> +#include <set> + #include "shill/device_info.h" #include "shill/logging.h" #include "shill/resolver.h" @@ -253,7 +255,7 @@ void Connection::RequestRouting() { } void Connection::ReleaseRouting() { - DCHECK(routing_request_count_ > 0); + DCHECK_GT(routing_request_count_, 0); if (--routing_request_count_ == 0) { DeviceRefPtr device = device_info_->GetDevice(interface_index_); DCHECK(device.get()); diff --git a/connection_health_checker.cc b/connection_health_checker.cc index 77261a17..d7213263 100644 --- a/connection_health_checker.cc +++ b/connection_health_checker.cc @@ -105,7 +105,7 @@ ConnectionHealthChecker::~ConnectionHealthChecker() { } bool ConnectionHealthChecker::health_check_in_progress() const { - return health_check_in_progress_; + return health_check_in_progress_; } void ConnectionHealthChecker::AddRemoteIP(IPAddress ip) { @@ -199,7 +199,7 @@ void ConnectionHealthChecker::SetConnection(ConnectionRefPtr connection) { const char *ConnectionHealthChecker::ResultToString( ConnectionHealthChecker::Result result) { - switch(result) { + switch (result) { case kResultUnknown: return "Unknown"; case kResultConnectionFailure: @@ -357,7 +357,7 @@ void ConnectionHealthChecker::VerifySentData() { NextHealthCheckSample(); } -//TODO(pprabhu): Scrub IP address logging. +// TODO(pprabhu): Scrub IP address logging. bool ConnectionHealthChecker::GetSocketInfo(int sock_fd, SocketInfo *sock_info) { struct sockaddr_storage addr; diff --git a/connection_health_checker.h b/connection_health_checker.h index 936cc2c3..7e2e9a8e 100644 --- a/connection_health_checker.h +++ b/connection_health_checker.h @@ -5,6 +5,7 @@ #ifndef SHILL_CONNECTION_HEALTH_CHECKER_H_ #define SHILL_CONNECTION_HEALTH_CHECKER_H_ +#include <string> #include <vector> #include <base/basictypes.h> @@ -40,7 +41,6 @@ class SocketInfoReader; // -(3)- Connectivity OK (TCP connection established, is healthy) class ConnectionHealthChecker { public: - enum Result { // There was some problem in the setup of ConnctionHealthChecker. // Could not attempt a tcp connection. @@ -99,24 +99,24 @@ class ConnectionHealthChecker { dispatcher_ = dispatcher; } void set_sock_fd(int sock_fd) { sock_fd_ = sock_fd; } - short num_connection_failures() const { return num_connection_failures_; } - void set_num_connection_failures(short val) { + int16_t num_connection_failures() const { return num_connection_failures_; } + void set_num_connection_failures(int16_t val) { num_connection_failures_ = val; } - short num_tx_queue_polling_attempts() const { + int16_t num_tx_queue_polling_attempts() const { return num_tx_queue_polling_attempts_; } - void set_num_tx_queue_polling_attempts(short val) { + void set_num_tx_queue_polling_attempts(int16_t val) { num_tx_queue_polling_attempts_ = val; } - short num_congested_queue_detected() const { + int16_t num_congested_queue_detected() const { return num_congested_queue_detected_; } - void set_num_congested_queue_detected(short val) { + void set_num_congested_queue_detected(int16_t val) { num_congested_queue_detected_ = val; } - short num_successful_sends() const { return num_successful_sends_; } - void set_num_successful_sends(short val) { + int16_t num_successful_sends() const { return num_successful_sends_; } + void set_num_successful_sends(int16_t val) { num_successful_sends_ = val; } void set_old_transmit_queue_value(uint64 val) { @@ -212,13 +212,13 @@ class ConnectionHealthChecker { bool health_check_in_progress_; // Number of connection failures in currently active health check. - short num_connection_failures_; + int16_t num_connection_failures_; // Number of times we have checked the tx-queue for the current send attempt. - short num_tx_queue_polling_attempts_; - // Number of out of credit scenarios detected in currentl health check. - short num_congested_queue_detected_; + int16_t num_tx_queue_polling_attempts_; + // Number of out of credit scenarios detected in current health check. + int16_t num_congested_queue_detected_; // Number of successful send attempts currently active health check. - short num_successful_sends_; + int16_t num_successful_sends_; // Snooze time while polling for updated /proc/tcpinfo int tcp_state_update_wait_milliseconds_; diff --git a/connection_health_checker_unittest.cc b/connection_health_checker_unittest.cc index 43ac0e60..fcc803f7 100644 --- a/connection_health_checker_unittest.cc +++ b/connection_health_checker_unittest.cc @@ -57,10 +57,10 @@ const char kProxyIPAddressLocal[] = "192.23.34.1"; const char kProxyIPv6AddressLocal[] = "::ffff:192.23.34.1"; const char kProxyURLRemote[] = "http://www.google.com"; const int kProxyFD = 100; -const short kProxyPortLocal = 5540; -const short kProxyPortRemote = 80; +const int16_t kProxyPortLocal = 5540; +const int16_t kProxyPortRemote = 80; const int kSocketError = 3000; -} // namespace {} +} // namespace MATCHER_P(IsSameIPAddress, ip_addr, "") { return arg.Equals(ip_addr); @@ -257,7 +257,6 @@ class ConnectionHealthCheckerTest : public Test { .InSequence(seq_) .WillOnce(DoAll(SetArgumentPointee<0>(info_list), Return(true))); - } void ExpectSuccessfulStart() { EXPECT_CALL(remote_ips_, Empty()).WillRepeatedly(Return(false)); @@ -396,7 +395,7 @@ TEST_F(ConnectionHealthCheckerTest, AddRemoteURL) { } // Will pass ownership of dns_clients elements. for (int i = 0; i < NumDNSQueries(); ++i) { - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)) + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)) .InSequence(seq_) .WillOnce(Return(dns_client_buffer[i])); } @@ -416,13 +415,13 @@ TEST_F(ConnectionHealthCheckerTest, AddRemoteURL) { } // Will pass ownership of dns_clients elements. for (int i = 0; i < NumDNSQueries(); ++i) { - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)) + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)) .InSequence(seq_) .WillOnce(Return(dns_client_buffer[i])); } EXPECT_CALL(remote_ips_, AddUnique(_)); health_checker_->AddRemoteURL(kProxyURLRemote); - for(int i = 0; i < NumDNSQueries() - 1; ++i) { + for (int i = 0; i < NumDNSQueries() - 1; ++i) { InvokeGetDNSResultFailure(); } InvokeGetDNSResultSuccess(remote_ip); @@ -440,7 +439,7 @@ TEST_F(ConnectionHealthCheckerTest, AddRemoteURL) { } // Will pass ownership of dns_clients elements. for (int i = 0; i < NumDNSQueries(); ++i) { - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)) + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)) .InSequence(seq_) .WillOnce(Return(dns_client_buffer[i])); } @@ -462,13 +461,13 @@ TEST_F(ConnectionHealthCheckerTest, GetSocketInfo) { vector<SocketInfo> info_list; // GetSockName fails. - EXPECT_CALL(*socket_, GetSockName(_,_,_)) + EXPECT_CALL(*socket_, GetSockName(_, _, _)) .WillOnce(Return(-1)); EXPECT_FALSE(health_checker_->GetSocketInfo(kProxyFD, &sock_info)); Mock::VerifyAndClearExpectations(socket_); // GetSockName returns IPv6. - EXPECT_CALL(*socket_, GetSockName(_,_,_)) + EXPECT_CALL(*socket_, GetSockName(_, _, _)) .WillOnce( Invoke(this, &ConnectionHealthCheckerTest::GetSockNameReturnsIPv6)); @@ -587,16 +586,16 @@ TEST_F(ConnectionHealthCheckerTest, NextHealthCheckSample) { dispatcher_.DispatchPendingEvents(); VerifyAndClearAllExpectations(); - EXPECT_CALL(*tcp_connection_, Start(_,_)).WillOnce(Return(true)); + EXPECT_CALL(*tcp_connection_, Start(_, _)).WillOnce(Return(true)); health_checker_->NextHealthCheckSample(); VerifyAndClearAllExpectations(); // This test assumes that there are at least 2 connection attempts left // before ConnectionHealthChecker gives up. - EXPECT_CALL(*tcp_connection_, Start(_,_)) + EXPECT_CALL(*tcp_connection_, Start(_, _)) .WillOnce(Return(false)) .WillOnce(Return(true)); - short num_connection_failures = health_checker_->num_connection_failures(); + int16_t num_connection_failures = health_checker_->num_connection_failures(); health_checker_->NextHealthCheckSample(); EXPECT_EQ(num_connection_failures + 1, health_checker_->num_connection_failures()); @@ -735,7 +734,7 @@ TEST_F(ConnectionHealthCheckerTest, VerifySentData) { // Flow: Start() -> Start() // Expectation: Only one AsyncConnection is setup TEST_F(ConnectionHealthCheckerTest, StartStartSkipsSecond) { - EXPECT_CALL(*tcp_connection_, Start(_,_)) + EXPECT_CALL(*tcp_connection_, Start(_, _)) .WillOnce(Return(true)); EXPECT_CALL(remote_ips_, Empty()).WillRepeatedly(Return(false)); EXPECT_CALL(remote_ips_, GetRandomIP()) @@ -748,7 +747,7 @@ TEST_F(ConnectionHealthCheckerTest, StartStartSkipsSecond) { // Flow: Start() -> Stop() before ConnectionComplete() // Expectation: No call to |result_callback| TEST_F(ConnectionHealthCheckerTest, StartStopNoCallback) { - EXPECT_CALL(*tcp_connection_, Start(_,_)) + EXPECT_CALL(*tcp_connection_, Start(_, _)) .WillOnce(Return(true)); EXPECT_CALL(*tcp_connection_, Stop()); EXPECT_CALL(*this, ResultCallbackTarget(_)) diff --git a/connection_info_reader_unittest.cc b/connection_info_reader_unittest.cc index 679cbbf3..92d90c4a 100644 --- a/connection_info_reader_unittest.cc +++ b/connection_info_reader_unittest.cc @@ -9,7 +9,6 @@ #include <base/file_util.h> #include <base/files/scoped_temp_dir.h> #include <base/strings/stringprintf.h> -#include <base/strings/stringprintf.h> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -41,7 +40,7 @@ class ConnectionInfoReaderUnderTest : public ConnectionInfoReader { // Mock out GetConnectionInfoFilePath to use a temporary created connection // info file instead of the actual path in procfs (i.e. // /proc/net/ip_conntrack). - MOCK_CONST_METHOD0(GetConnectionInfoFilePath, FilePath ()); + MOCK_CONST_METHOD0(GetConnectionInfoFilePath, FilePath()); }; class ConnectionInfoReaderTest : public testing::Test { diff --git a/control_interface.h b/control_interface.h index 7d524cf2..7643f2ee 100644 --- a/control_interface.h +++ b/control_interface.h @@ -39,7 +39,7 @@ class ControlInterface { static void RpcIdToStorageId(std::string *rpc_id) { CHECK(rpc_id); - DCHECK(rpc_id->at(0) == '/'); + DCHECK_EQ(rpc_id->at(0), '/'); rpc_id->erase(0, 1); std::replace(rpc_id->begin(), rpc_id->end(), '/', '_'); } diff --git a/crypto_des_cbc.h b/crypto_des_cbc.h index 079c0d93..099e8c6b 100644 --- a/crypto_des_cbc.h +++ b/crypto_des_cbc.h @@ -5,6 +5,7 @@ #ifndef SHILL_CRYPTO_DES_CBC_ #define SHILL_CRYPTO_DES_CBC_ +#include <string> #include <vector> #include <base/basictypes.h> diff --git a/crypto_des_cbc_unittest.cc b/crypto_des_cbc_unittest.cc index 2998fd66..4937aa23 100644 --- a/crypto_des_cbc_unittest.cc +++ b/crypto_des_cbc_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include <base/file_util.h> #include <base/files/scoped_temp_dir.h> #include <gtest/gtest.h> @@ -26,7 +28,7 @@ const char kPlainText[] = "Hello world! ~123"; const char kCipherText[] = "02:MbxzeBqK3HVeS3xfjyhbe47Xx+szYgOp"; const char kPlainVersion1[] = "This is a test!"; const char kCipherVersion1[] = "bKlHDISdHMFfmfgBTT5I0w=="; -} // namespace {} +} // namespace class CryptoDESCBCTest : public Test { public: diff --git a/crypto_provider.h b/crypto_provider.h index dd51316c..45febcf3 100644 --- a/crypto_provider.h +++ b/crypto_provider.h @@ -5,6 +5,8 @@ #ifndef SHILL_CRYPTO_PROVIDER_ #define SHILL_CRYPTO_PROVIDER_ +#include <string> + #include <base/files/file_path.h> #include <base/memory/scoped_vector.h> #include <gtest/gtest_prod.h> // for FRIEND_TEST diff --git a/crypto_provider_unittest.cc b/crypto_provider_unittest.cc index 624a77e5..b7e89e4a 100644 --- a/crypto_provider_unittest.cc +++ b/crypto_provider_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include <base/file_util.h> #include <base/files/scoped_temp_dir.h> #include <gtest/gtest.h> @@ -26,7 +28,7 @@ const char kEmptyText[] = ""; const char kPlainText[] = "This is a test!"; const char kROT47Text[] = "rot47:%9:D :D 2 E6DEP"; const char kDESCBCText[] = "des-cbc:02:bKlHDISdHMFc0teQd4mAVrXgwlSj6iA+"; -} // namespace {} +} // namespace class CryptoProviderTest : public Test { public: diff --git a/crypto_rot47.h b/crypto_rot47.h index c99242ff..b98aeafc 100644 --- a/crypto_rot47.h +++ b/crypto_rot47.h @@ -5,6 +5,8 @@ #ifndef SHILL_CRYPTO_ROT47_ #define SHILL_CRYPTO_ROT47_ +#include <string> + #include <base/basictypes.h> #include "shill/crypto_interface.h" diff --git a/crypto_rot47_unittest.cc b/crypto_rot47_unittest.cc index 742c16af..1e889322 100644 --- a/crypto_rot47_unittest.cc +++ b/crypto_rot47_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include <gtest/gtest.h> #include "shill/crypto_rot47.h" @@ -15,7 +17,7 @@ namespace { const char kEmpty[] = ""; const char kPlainText[] = "~{\"Hello world!\" OPQ ['1234']}"; const char kCipherText[] = "OLQw6==@ H@C=5PQ ~!\" ,V`abcV.N"; -} // namespace {} +} // namespace class CryptoROT47Test : public Test { protected: diff --git a/crypto_util_proxy.h b/crypto_util_proxy.h index 875734b2..df9813c5 100644 --- a/crypto_util_proxy.h +++ b/crypto_util_proxy.h @@ -71,6 +71,7 @@ class CryptoUtilProxy : public base::SupportsWeakPtr<CryptoUtilProxy> { const std::string &data, const ResultStringCallback &result_callback, Error *error); + private: friend class CryptoUtilProxyTest; friend class MockCryptoUtilProxy; diff --git a/crypto_util_proxy_unittest.cc b/crypto_util_proxy_unittest.cc index 50eda2e7..73de962d 100644 --- a/crypto_util_proxy_unittest.cc +++ b/crypto_util_proxy_unittest.cc @@ -74,7 +74,7 @@ MATCHER_P(IsCryptoUtilCommandLine, command, "") { } return true; -}; +} MATCHER_P(ErrorIsOfType, error_type, "") { if (error_type != arg.type()) { @@ -82,7 +82,7 @@ MATCHER_P(ErrorIsOfType, error_type, "") { } return true; -}; +} class CryptoUtilProxyTest : public testing::Test { public: @@ -132,9 +132,9 @@ class CryptoUtilProxyTest : public testing::Test { .WillOnce(Return(true)); EXPECT_CALL(minijail_, RunPipesAndDestroy(_, IsCryptoUtilCommandLine(command), - NotNull(), // pid - NotNull(), // stdin - NotNull(), // stdout + NotNull(), // pid + NotNull(), // stdin + NotNull(), // stdout NULL)) // stderr .WillOnce(Invoke(this, &CryptoUtilProxyTest::HandleRunPipesAndDestroy)); // We should always schedule a shim timeout callback. @@ -388,7 +388,6 @@ TEST_F(CryptoUtilProxyTest, ShimLifeTime) { ErrorIsOfType(Error::kSuccess))).Times(1); ExpectCleanup(Error(Error::kSuccess)); crypto_util_proxy_.HandleShimOutput(&data); - } } // namespace shill diff --git a/dbus_adaptor.cc b/dbus_adaptor.cc index 4a648997..753052c2 100644 --- a/dbus_adaptor.cc +++ b/dbus_adaptor.cc @@ -43,37 +43,37 @@ bool DBusAdaptor::SetProperty(PropertyStore *store, Error e; bool ret; - if (DBusAdaptor::IsBool(value.signature())) + if (DBusAdaptor::IsBool(value.signature())) { ret = store->SetBoolProperty(name, value.reader().get_bool(), &e); - else if (DBusAdaptor::IsByte(value.signature())) + } else if (DBusAdaptor::IsByte(value.signature())) { ret = store->SetUint8Property(name, value.reader().get_byte(), &e); - else if (DBusAdaptor::IsInt16(value.signature())) + } else if (DBusAdaptor::IsInt16(value.signature())) { ret = store->SetInt16Property(name, value.reader().get_int16(), &e); - else if (DBusAdaptor::IsInt32(value.signature())) + } else if (DBusAdaptor::IsInt32(value.signature())) { ret = store->SetInt32Property(name, value.reader().get_int32(), &e); - else if (DBusAdaptor::IsPath(value.signature())) + } else if (DBusAdaptor::IsPath(value.signature())) { ret = store->SetStringProperty(name, value.reader().get_path(), &e); - else if (DBusAdaptor::IsString(value.signature())) + } else if (DBusAdaptor::IsString(value.signature())) { ret = store->SetStringProperty(name, value.reader().get_string(), &e); - else if (DBusAdaptor::IsStringmap(value.signature())) + } else if (DBusAdaptor::IsStringmap(value.signature())) { ret = store->SetStringmapProperty(name, value.operator map<string, string>(), &e); - else if (DBusAdaptor::IsStringmaps(value.signature())) { + } else if (DBusAdaptor::IsStringmaps(value.signature())) { SLOG(DBus, 1) << " can't yet handle setting type " << value.signature(); ret = false; e.Populate(Error::kInternalError); - } else if (DBusAdaptor::IsStrings(value.signature())) + } else if (DBusAdaptor::IsStrings(value.signature())) { ret = store->SetStringsProperty(name, value.operator vector<string>(), &e); - else if (DBusAdaptor::IsUint16(value.signature())) + } else if (DBusAdaptor::IsUint16(value.signature())) { ret = store->SetUint16Property(name, value.reader().get_uint16(), &e); - else if (DBusAdaptor::IsUint16s(value.signature())) + } else if (DBusAdaptor::IsUint16s(value.signature())) { ret = store->SetUint16sProperty(name, value.operator vector<uint16>(), &e); - else if (DBusAdaptor::IsUint32(value.signature())) + } else if (DBusAdaptor::IsUint32(value.signature())) { ret = store->SetUint32Property(name, value.reader().get_uint32(), &e); - else if (DBusAdaptor::IsUint64(value.signature())) + } else if (DBusAdaptor::IsUint64(value.signature())) { ret = store->SetUint64Property(name, value.reader().get_uint64(), &e); - else if (DBusAdaptor::IsKeyValueStore(value.signature())) { + } else if (DBusAdaptor::IsKeyValueStore(value.signature())) { SLOG(DBus, 1) << " can't yet handle setting type " << value.signature(); ret = false; e.Populate(Error::kInternalError); diff --git a/dbus_adaptor_unittest.cc b/dbus_adaptor_unittest.cc index 57cdbd27..76500ecf 100644 --- a/dbus_adaptor_unittest.cc +++ b/dbus_adaptor_unittest.cc @@ -184,16 +184,11 @@ TEST_F(DBusAdaptorTest, Signatures) { template <typename T> class DBusAdaptorTypedTest : public DBusAdaptorTest { - public: - DBusAdaptorTypedTest() - : property_(T()) // value-initialize primitives - {} - protected: T *property() { return &property_; } private: - T property_; + T property_{}; // value-initialize primitives }; TYPED_TEST_CASE(DBusAdaptorTypedTest, PropertyStoreTest::PropertyTypes); @@ -308,7 +303,6 @@ TEST_F(DBusAdaptorTest, ClearProperty) { Return(false))); EXPECT_TRUE(DBusAdaptor::ClearProperty(&store, "valid property", &e1)); EXPECT_FALSE(DBusAdaptor::ClearProperty(&store, "invalid property", &e2)); - } TEST_F(DBusAdaptorTest, ArgsToKeyValueStore) { diff --git a/dbus_async_call_helper.h b/dbus_async_call_helper.h index 2e952c5e..7c0cc189 100644 --- a/dbus_async_call_helper.h +++ b/dbus_async_call_helper.h @@ -31,7 +31,8 @@ namespace shill { template< typename TraceMsgT, typename ProxyT, typename CallT, typename CallbackT, typename... ArgTypes> -void BeginAsyncDBusCall(const TraceMsgT &trace_msg, ProxyT &proxy, +void BeginAsyncDBusCall(const TraceMsgT &trace_msg, + ProxyT &proxy, // NOLINT(runtime/references) const CallT &call, const CallbackT &callback, Error *error, void(*error_converter)(const DBus::Error &, Error *), diff --git a/dbus_manager_unittest.cc b/dbus_manager_unittest.cc index 10cad6e2..cfc2a732 100644 --- a/dbus_manager_unittest.cc +++ b/dbus_manager_unittest.cc @@ -111,8 +111,7 @@ TEST_F(DBusManagerTest, GetNameOwnerFails) { } TEST_F(DBusManagerTest, - GetNameOwnerReturnsAfterDBusManagerAndNameWatcherDestroyed) -{ + GetNameOwnerReturnsAfterDBusManagerAndNameWatcherDestroyed) { MockDBusServiceProxy *proxy = ExpectCreateDBusServiceProxy(); EXPECT_CALL(*proxy, set_name_owner_changed_callback(_)); diff --git a/dbus_objectmanager_proxy.h b/dbus_objectmanager_proxy.h index cd8ea6c3..d62fb809 100644 --- a/dbus_objectmanager_proxy.h +++ b/dbus_objectmanager_proxy.h @@ -4,7 +4,9 @@ // found in the LICENSE file. #ifndef SHILL_DBUS_OBJECTMANAGER_PROXY_H_ #define SHILL_DBUS_OBJECTMANAGER_PROXY_H_ + #include <string> +#include <vector> #include "shill/dbus_objectmanager_proxy_interface.h" #include "shill/dbus_proxies/dbus-objectmanager.h" diff --git a/dbus_objectmanager_proxy_interface.h b/dbus_objectmanager_proxy_interface.h index deb175aa..4ea8e434 100644 --- a/dbus_objectmanager_proxy_interface.h +++ b/dbus_objectmanager_proxy_interface.h @@ -3,7 +3,10 @@ // found in the LICENSE file. #ifndef SHILL_DBUS_OBJECTMANAGER_INTERFACE_H_ #define SHILL_DBUS_OBJECTMANAGER_INTERFACE_H_ + +#include <map> #include <string> +#include <vector> #include <base/basictypes.h> #include <base/callback.h> diff --git a/dbus_properties_proxy.h b/dbus_properties_proxy.h index 04aa2141..8cd52480 100644 --- a/dbus_properties_proxy.h +++ b/dbus_properties_proxy.h @@ -5,6 +5,9 @@ #ifndef SHILL_DBUS_PROPERTIES_PROXY_ #define SHILL_DBUS_PROPERTIES_PROXY_ +#include <string> +#include <vector> + #include <base/basictypes.h> #include "shill/dbus_proxies/dbus-properties.h" diff --git a/dbus_properties_proxy_interface.h b/dbus_properties_proxy_interface.h index a08bbf42..3fa90c69 100644 --- a/dbus_properties_proxy_interface.h +++ b/dbus_properties_proxy_interface.h @@ -5,6 +5,7 @@ #ifndef SHILL_DBUS_PROPERTIES_PROXY_INTERFACE_ #define SHILL_DBUS_PROPERTIES_PROXY_INTERFACE_ +#include <string> #include <vector> #include <base/callback.h> diff --git a/dbus_service_proxy.h b/dbus_service_proxy.h index 3d37518f..4a20cfc0 100644 --- a/dbus_service_proxy.h +++ b/dbus_service_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_DBUS_SERVICE_PROXY_H_ #define SHILL_DBUS_SERVICE_PROXY_H_ +#include <string> + #include "shill/dbus_proxies/dbus-service.h" #include "shill/dbus_service_proxy_interface.h" @@ -27,7 +29,7 @@ class DBusServiceProxy : public DBusServiceProxyInterface { class Proxy : public org::freedesktop::DBus_proxy, public DBus::ObjectProxy { public: - Proxy(DBus::Connection *connection); + explicit Proxy(DBus::Connection *connection); virtual ~Proxy(); void set_name_owner_changed_callback( diff --git a/default_profile.cc b/default_profile.cc index 94d1c107..c17c63f3 100644 --- a/default_profile.cc +++ b/default_profile.cc @@ -118,7 +118,7 @@ void DefaultProfile::LoadManagerProperties(Manager::Properties *manager_props) { if (!storage()->GetInt(kStorageId, kStorageConnectionIdSalt, &manager_props->connection_id_salt)) { srand(time(NULL)); - manager_props->connection_id_salt = rand(); + manager_props->connection_id_salt = rand(); // NOLINT - rand } } @@ -892,7 +892,7 @@ void Device::OnLinkMonitorGatewayChange() { void Device::PerformFallbackDNSTest() { // Return if DNS client already running. - if(fallback_dns_test_client_.get()) { + if (fallback_dns_test_client_.get()) { return; } diff --git a/device_dbus_adaptor.h b/device_dbus_adaptor.h index e41d1f4e..d24279c4 100644 --- a/device_dbus_adaptor.h +++ b/device_dbus_adaptor.h @@ -7,6 +7,7 @@ #include <map> #include <string> +#include <vector> #include <base/basictypes.h> diff --git a/device_info.cc b/device_info.cc index bda42a1f..cac5835d 100644 --- a/device_info.cc +++ b/device_info.cc @@ -628,7 +628,7 @@ ByteString DeviceInfo::GetMACAddressFromKernel(int interface_index) const { struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); ifr.ifr_ifindex = interface_index; - strcpy(ifr.ifr_ifrn.ifrn_name, info->name.c_str()); + strcpy(ifr.ifr_ifrn.ifrn_name, info->name.c_str()); // NOLINT(runtime/printf) int err = sockets_->Ioctl(fd, SIOCGIFHWADDR, &ifr); if (err < 0) { LOG(ERROR) << __func__ << ": Unable to read MAC address: " << errno; diff --git a/device_stub.h b/device_stub.h index 3936deb4..fccde805 100644 --- a/device_stub.h +++ b/device_stub.h @@ -8,6 +8,7 @@ #include <base/memory/ref_counted.h> #include <base/memory/scoped_ptr.h> +#include <string> #include <vector> #include "shill/device.h" diff --git a/device_unittest.cc b/device_unittest.cc index 9fa9c761..6910b480 100644 --- a/device_unittest.cc +++ b/device_unittest.cc @@ -758,7 +758,6 @@ TEST_F(DeviceTest, TrafficMonitor) { StartTrafficMonitor(); EXPECT_CALL(*traffic_monitor, Stop()).Times(0); StopTrafficMonitor(); - } TEST_F(DeviceTest, TrafficMonitorCancelledOnSelectService) { @@ -1335,7 +1334,7 @@ TEST_F(DevicePortalDetectionTest, PortalDetectionDNSFailure) { EXPECT_CALL(*service_.get(), SetState(Service::kStatePortal)); EXPECT_CALL(*connection_.get(), is_default()) .WillOnce(Return(false)); - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)) + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)) .WillOnce(Return(dns_client)); EXPECT_CALL(*dns_client, Start(_, _)) .WillOnce(Return(true)); @@ -1356,7 +1355,7 @@ TEST_F(DevicePortalDetectionTest, PortalDetectionDNSFailure) { EXPECT_CALL(*service_.get(), SetState(Service::kStatePortal)); EXPECT_CALL(*connection_.get(), is_default()) .WillOnce(Return(false)); - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)) + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)) .WillOnce(Return(dns_client)); EXPECT_CALL(*dns_client, Start(_, _)) .WillOnce(Return(true)); @@ -1377,7 +1376,7 @@ TEST_F(DevicePortalDetectionTest, PortalDetectionDNSFailure) { EXPECT_CALL(*service_.get(), SetState(Service::kStatePortal)); EXPECT_CALL(*connection_.get(), is_default()) .WillOnce(Return(false)); - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)) + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)) .WillOnce(Return(dns_client)); EXPECT_CALL(*dns_client, Start(_, _)) .WillOnce(Return(false)); @@ -1397,7 +1396,7 @@ TEST_F(DevicePortalDetectionTest, PortalDetectionDNSFailure) { EXPECT_CALL(*service_.get(), SetState(Service::kStatePortal)); EXPECT_CALL(*connection_.get(), is_default()) .WillOnce(Return(false)); - EXPECT_CALL(*dns_client_factory, CreateDNSClient(_,_,_,_,_,_)).Times(0); + EXPECT_CALL(*dns_client_factory, CreateDNSClient(_, _, _, _, _, _)).Times(0); PortalDetectorCallback(PortalDetector::Result( PortalDetector::kPhaseConnection, PortalDetector::kStatusFailure, diff --git a/dhcp_config.cc b/dhcp_config.cc index 9d710eec..fbca08cb 100644 --- a/dhcp_config.cc +++ b/dhcp_config.cc @@ -4,6 +4,8 @@ #include "shill/dhcp_config.h" +#include <vector> + #include <arpa/inet.h> #include <stdlib.h> #include <sys/wait.h> diff --git a/dhcp_config.h b/dhcp_config.h index 938199e7..97d7deb6 100644 --- a/dhcp_config.h +++ b/dhcp_config.h @@ -5,6 +5,9 @@ #ifndef SHILL_DHCP_CONFIG_ #define SHILL_DHCP_CONFIG_ +#include <map> +#include <string> + #include <base/cancelable_callback.h> #include <base/files/file_path.h> #include <base/memory/scoped_ptr.h> diff --git a/dhcp_config_unittest.cc b/dhcp_config_unittest.cc index 8da33391..5dbaa70d 100644 --- a/dhcp_config_unittest.cc +++ b/dhcp_config_unittest.cc @@ -4,6 +4,9 @@ #include "shill/dhcp_config.h" +#include <string> +#include <vector> + #include <base/bind.h> #include <base/file_util.h> #include <base/files/scoped_temp_dir.h> @@ -47,7 +50,7 @@ const bool kArpGateway = true; const bool kHasHostname = true; const bool kHasLeaseSuffix = true; const bool kMinimalConfig = true; -} // namespace {} +} // namespace class DHCPConfigTest : public PropertyStoreTest { public: @@ -435,7 +438,7 @@ class DHCPConfigCallbackTest : public DHCPConfigTest { void DoNothing() {} -} // namespace {} +} // namespace TEST_F(DHCPConfigCallbackTest, ProcessEventSignalFail) { DHCPConfig::Configuration conf; diff --git a/dhcp_provider_unittest.cc b/dhcp_provider_unittest.cc index b63b40ff..c0e243ef 100644 --- a/dhcp_provider_unittest.cc +++ b/dhcp_provider_unittest.cc @@ -24,7 +24,7 @@ const char kHostName[] = "testhostname"; const char kStorageIdentifier[] = "teststorageidentifier"; const bool kArpGateway = false; const bool kMinimalConfig = false; -} // namespace {} +} // namespace class DHCPProviderTest : public Test { public: diff --git a/dhcpcd_proxy.h b/dhcpcd_proxy.h index 5f046747..8307a25a 100644 --- a/dhcpcd_proxy.h +++ b/dhcpcd_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_DHCPCD_PROXY_ #define SHILL_DHCPCD_PROXY_ +#include <string> + #include <base/basictypes.h> #include "shill/dbus_proxies/dhcpcd.h" diff --git a/diagnostics_reporter.cc b/diagnostics_reporter.cc index 9c7941ef..c49cd611 100644 --- a/diagnostics_reporter.cc +++ b/diagnostics_reporter.cc @@ -4,6 +4,8 @@ #include "shill/diagnostics_reporter.h" +#include <vector> + #include <base/file_util.h> #include "shill/minijail.h" diff --git a/diagnostics_reporter_unittest.cc b/diagnostics_reporter_unittest.cc index e88be56c..77650bf1 100644 --- a/diagnostics_reporter_unittest.cc +++ b/diagnostics_reporter_unittest.cc @@ -72,13 +72,12 @@ TEST_F(DiagnosticsReporterTest, IsReportingEnabled) { } TEST_F(DiagnosticsReporterTest, OnConnectivityEventThrottle) { - const uint64 kLastStash = 50; - const uint64 kNow = kLastStash + GetLogStashThrottleSeconds() - 1; + using timeval_seconds_t = decltype(timeval::tv_sec); + const timeval_seconds_t kLastStash = 50; + auto kNow = kLastStash + + static_cast<timeval_seconds_t>(GetLogStashThrottleSeconds() - 1); SetLastLogStash(kLastStash); - const struct timeval now = { - .tv_sec = static_cast<long int>(kNow), - .tv_usec = 0 - }; + const struct timeval now = {kNow, 0}; EXPECT_CALL(time_, GetTimeMonotonic(_)) .WillOnce(DoAll(SetArgumentPointee<0>(now), Return(0))); reporter_.OnConnectivityEvent(); @@ -86,19 +85,15 @@ TEST_F(DiagnosticsReporterTest, OnConnectivityEventThrottle) { } TEST_F(DiagnosticsReporterTest, OnConnectivityEvent) { + using timeval_seconds_t = decltype(timeval::tv_sec); const uint64 kInitStash = 0; SetLastLogStash(kInitStash); // Test that the initial call is not throttled. - const uint64 kNow0 = kInitStash + 1; - const struct timeval now0 = { - .tv_sec = static_cast<long int>(kNow0), - .tv_usec = 0 - }; - const uint64 kNow1 = kNow0 + GetLogStashThrottleSeconds() + 1; - const struct timeval now1 = { - .tv_sec = static_cast<long int>(kNow1), - .tv_usec = 0 - }; + auto kNow0 = static_cast<timeval_seconds_t>(kInitStash + 1); + const struct timeval now0 = {kNow0, 0}; + auto kNow1 = kNow0 + + static_cast<timeval_seconds_t>(GetLogStashThrottleSeconds() + 1); + const struct timeval now1 = {kNow1, 0}; base::ScopedTempDir temp_dir_; ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); FilePath stashed_net_log = temp_dir_.path().Append("stashed-net-log"); diff --git a/dns_client.cc b/dns_client.cc index f2d0ae41..aabe651f 100644 --- a/dns_client.cc +++ b/dns_client.cc @@ -12,7 +12,7 @@ #include <map> #include <set> #include <string> -#include <tr1/memory> +#include <memory> #include <vector> #include <base/bind.h> @@ -49,8 +49,8 @@ struct DNSClientState { DNSClientState() : channel(NULL), start_time{} {} ares_channel channel; - map< ares_socket_t, std::tr1::shared_ptr<IOHandler> > read_handlers; - map< ares_socket_t, std::tr1::shared_ptr<IOHandler> > write_handlers; + map< ares_socket_t, std::shared_ptr<IOHandler> > read_handlers; + map< ares_socket_t, std::shared_ptr<IOHandler> > write_handlers; struct timeval start_time; }; @@ -262,9 +262,9 @@ void DNSClient::ReceiveDNSReplyCB(void *arg, int status, } bool DNSClient::RefreshHandles() { - map< ares_socket_t, std::tr1::shared_ptr<IOHandler> > old_read = + map< ares_socket_t, std::shared_ptr<IOHandler> > old_read = resolver_state_->read_handlers; - map< ares_socket_t, std::tr1::shared_ptr<IOHandler> > old_write = + map< ares_socket_t, std::shared_ptr<IOHandler> > old_write = resolver_state_->write_handlers; resolver_state_->read_handlers.clear(); @@ -284,7 +284,7 @@ bool DNSClient::RefreshHandles() { resolver_state_->read_handlers[sockets[i]] = old_read[sockets[i]]; } else { resolver_state_->read_handlers[sockets[i]] = - std::tr1::shared_ptr<IOHandler> ( + std::shared_ptr<IOHandler> ( dispatcher_->CreateReadyHandler(sockets[i], IOHandler::kModeInput, read_callback)); @@ -295,7 +295,7 @@ bool DNSClient::RefreshHandles() { resolver_state_->write_handlers[sockets[i]] = old_write[sockets[i]]; } else { resolver_state_->write_handlers[sockets[i]] = - std::tr1::shared_ptr<IOHandler> ( + std::shared_ptr<IOHandler> ( dispatcher_->CreateReadyHandler(sockets[i], IOHandler::kModeOutput, write_callback)); diff --git a/dns_client_unittest.cc b/dns_client_unittest.cc index 43d4fc75..f9085cce 100644 --- a/dns_client_unittest.cc +++ b/dns_client_unittest.cc @@ -52,7 +52,7 @@ const ares_channel kAresChannel = const int kAresFd = 10203; const int kAresTimeoutMS = 2000; // ARES transaction timeout const int kAresWaitMS = 1000; // Time period ARES asks caller to wait -} // namespace {} +} // namespace class DNSClientTest : public Test { public: diff --git a/eap_credentials.cc b/eap_credentials.cc index 02b31a73..e02a9e3d 100644 --- a/eap_credentials.cc +++ b/eap_credentials.cc @@ -475,7 +475,7 @@ bool EapCredentials::ClientAuthenticationUsesCryptoToken() const { void EapCredentials::HelpRegisterDerivedString( PropertyStore *store, const string &name, - string(EapCredentials::*get)(Error *), + string(EapCredentials::*get)(Error *error), bool(EapCredentials::*set)(const string&, Error *)) { store->RegisterDerivedString( name, @@ -487,7 +487,7 @@ void EapCredentials::HelpRegisterWriteOnlyDerivedString( PropertyStore *store, const string &name, bool(EapCredentials::*set)(const string &, Error *), - void(EapCredentials::*clear)(Error *), + void(EapCredentials::*clear)(Error *error), const string *default_value) { store->RegisterDerivedString( name, @@ -496,4 +496,4 @@ void EapCredentials::HelpRegisterWriteOnlyDerivedString( this, set, clear, default_value))); } -} +} // namespace shill diff --git a/eap_listener_unittest.cc b/eap_listener_unittest.cc index abcc93ad..0ec57711 100644 --- a/eap_listener_unittest.cc +++ b/eap_listener_unittest.cc @@ -9,6 +9,8 @@ #include <netinet/in.h> #include <string.h> +#include <algorithm> + #include <base/bind.h> #include <gtest/gtest.h> @@ -5,6 +5,7 @@ #ifndef SHILL_ETHERNET_ #define SHILL_ETHERNET_ +#include <map> #include <string> #include <base/cancelable_callback.h> diff --git a/ethernet_service.h b/ethernet_service.h index ce037f22..74933ae1 100644 --- a/ethernet_service.h +++ b/ethernet_service.h @@ -5,6 +5,8 @@ #ifndef SHILL_ETHERNET_SERVICE_ #define SHILL_ETHERNET_SERVICE_ +#include <string> + #include <base/basictypes.h> #include <gtest/gtest_prod.h> // for FRIEND_TEST diff --git a/geolocation_info.cc b/geolocation_info.cc index 85bafdc9..841eae84 100644 --- a/geolocation_info.cc +++ b/geolocation_info.cc @@ -26,7 +26,7 @@ const string &GeolocationInfo::GetFieldValue( return properties_.find(key)->second; } -bool GeolocationInfo::Equals(const GeolocationInfo &info) const{ +bool GeolocationInfo::Equals(const GeolocationInfo &info) const { return properties_ == info.properties_; } diff --git a/glib_io_input_handler.cc b/glib_io_input_handler.cc index df0770c8..059d3629 100644 --- a/glib_io_input_handler.cc +++ b/glib_io_input_handler.cc @@ -70,7 +70,7 @@ static gboolean DispatchIOHandler(GIOChannel *chan, if (status == G_IO_STATUS_EOF) { LOG(INFO) << "InputHandler on fd " << fd << " closing due to EOF."; - CHECK(len == 0); + CHECK_EQ(len, 0); return FALSE; } return TRUE; diff --git a/hook_table.h b/hook_table.h index bf9d4dc5..bb261ec7 100644 --- a/hook_table.h +++ b/hook_table.h @@ -103,7 +103,7 @@ class HookTable { // This callback is created in Run() and is queued to the event dispatcher to // run after a timeout period. If all the actions complete before the - // timeout, then this callback is cancelled. + // timeout, then this callback is canceled. base::CancelableClosure timeout_callback_; // Used for setting a timeout action to run in case all the actions do not diff --git a/http_proxy.cc b/http_proxy.cc index e7834604..2eda85e0 100644 --- a/http_proxy.cc +++ b/http_proxy.cc @@ -138,7 +138,7 @@ bool HTTPProxy::Start(EventDispatcher *dispatcher, void HTTPProxy::Stop() { SLOG(HTTPProxy, 3) << "In " << __func__; - if (!sockets_ ) { + if (!sockets_) { return; } diff --git a/http_proxy_unittest.cc b/http_proxy_unittest.cc index f378652f..b3f00b71 100644 --- a/http_proxy_unittest.cc +++ b/http_proxy_unittest.cc @@ -80,7 +80,7 @@ const int kServerFD = 10204; const int kClientFD = 10205; const int kServerPort = 40506; const int kConnectPort = 443; -} // namespace {} +} // namespace MATCHER_P(IsIPAddress, address, "") { IPAddress ip_address(IPAddress::kFamilyIPv4); @@ -106,6 +106,7 @@ class HTTPProxyTest : public Test { reinterpret_cast<Manager*>(NULL))), connection_(new StrictMock<MockConnection>(device_info_.get())), proxy_(connection_) { } + protected: virtual void SetUp() { EXPECT_CALL(*connection_.get(), interface_name()) @@ -231,8 +232,8 @@ class HTTPProxyTest : public Test { if (proxy_.is_route_requested_) { EXPECT_CALL(*connection_.get(), ReleaseRouting()); } - } - void ExpectClientInput(int fd) { + } + void ExpectClientInput(int fd) { EXPECT_CALL(sockets(), Accept(kProxyFD, _, _)) .WillOnce(Return(fd)); EXPECT_CALL(sockets(), SetNonBlocking(fd)) diff --git a/http_request_unittest.cc b/http_request_unittest.cc index 87a41412..6d822f3c 100644 --- a/http_request_unittest.cc +++ b/http_request_unittest.cc @@ -57,7 +57,7 @@ const char *kDNSServers[] = { kDNSServer0, kDNSServer1 }; const char kServerAddress[] = "10.1.1.1"; const int kServerFD = 10203; const int kServerPort = 80; -} // namespace {} +} // namespace MATCHER_P(IsIPAddress, address, "") { IPAddress ip_address(IPAddress::kFamilyIPv4); @@ -86,6 +86,7 @@ class HTTPRequestTest : public Test { reinterpret_cast<Metrics*>(NULL), reinterpret_cast<Manager*>(NULL))), connection_(new StrictMock<MockConnection>(device_info_.get())) { } + protected: class CallbackTarget { public: diff --git a/ip_address.cc b/ip_address.cc index 715b81e9..9dc465f5 100644 --- a/ip_address.cc +++ b/ip_address.cc @@ -23,7 +23,7 @@ namespace shill { namespace { const size_t kBitsPerByte = 8; -} // namespace +} // namespace // static const IPAddress::Family IPAddress::kFamilyUnknown = AF_UNSPEC; diff --git a/ip_address_store.cc b/ip_address_store.cc index c0064e52..67c759ef 100644 --- a/ip_address_store.cc +++ b/ip_address_store.cc @@ -46,7 +46,7 @@ bool IPAddressStore::Empty() const { IPAddress IPAddressStore::GetRandomIP() { if (ip_addresses_.empty()) return IPAddress(IPAddress::kFamilyUnknown); - int index = rand() % ip_addresses_.size(); + int index = rand() % ip_addresses_.size(); // NOLINT(runtime/threadsafe_fn) IPAddresses::const_iterator cit = ip_addresses_.begin(); advance(cit, index); return *cit; diff --git a/ip_address_store_unittest.cc b/ip_address_store_unittest.cc index eaa23a58..d2e6eddb 100644 --- a/ip_address_store_unittest.cc +++ b/ip_address_store_unittest.cc @@ -18,7 +18,7 @@ namespace { const char kIPAddress_0_0_0_0[] = "0.0.0.0"; const char kIPAddress_8_8_8_8[] = "8.8.8.8"; const char kIPAddress_7_7_7_7[] = "7.7.7.7"; -} // namespace {} +} // namespace class IPAddressStoreTest : public Test { public: diff --git a/ip_address_unittest.cc b/ip_address_unittest.cc index 20a3e821..8da87d49 100644 --- a/ip_address_unittest.cc +++ b/ip_address_unittest.cc @@ -29,7 +29,7 @@ const unsigned char kV6Address2[] = { 0x19, 0x80, 0x00, 0x00, 0x10, 0x00, 0x1b, 0x02, 0x1a, 0xa9, 0x05, 0xff, 0x7e, 0xbf }; -} // namespace {} +} // namespace class IPAddressTest : public Test { protected: diff --git a/ipconfig_dbus_adaptor.h b/ipconfig_dbus_adaptor.h index e2325619..fe7af29f 100644 --- a/ipconfig_dbus_adaptor.h +++ b/ipconfig_dbus_adaptor.h @@ -7,6 +7,7 @@ #include <map> #include <string> +#include <vector> #include <base/basictypes.h> #include <dbus-c++/dbus.h> diff --git a/ipconfig_unittest.cc b/ipconfig_unittest.cc index 91d052b9..debaba76 100644 --- a/ipconfig_unittest.cc +++ b/ipconfig_unittest.cc @@ -29,7 +29,7 @@ namespace shill { namespace { const char kDeviceName[] = "testdevice"; -} // namespace {} +} // namespace class IPConfigTest : public Test { public: diff --git a/key_file_store.h b/key_file_store.h index 946d6eed..07c6c168 100644 --- a/key_file_store.h +++ b/key_file_store.h @@ -5,6 +5,10 @@ #ifndef SHILL_KEY_FILE_STORE_ #define SHILL_KEY_FILE_STORE_ +#include <set> +#include <string> +#include <vector> + #include <base/files/file_path.h> #include <gtest/gtest_prod.h> // for FRIEND_TEST @@ -75,7 +79,7 @@ class KeyFileStore : public StoreInterface { int *value) const override; virtual bool SetInt(const std::string &group, const std::string &key, - int value) override ; + int value) override; virtual bool GetUint64(const std::string &group, const std::string &key, uint64 *value) const override; @@ -94,6 +98,7 @@ class KeyFileStore : public StoreInterface { virtual bool SetCryptedString(const std::string &group, const std::string &key, const std::string &value) override; + private: FRIEND_TEST(KeyFileStoreTest, OpenClose); FRIEND_TEST(KeyFileStoreTest, OpenFail); diff --git a/key_file_store_unittest.cc b/key_file_store_unittest.cc index 4098c429..957fe4bc 100644 --- a/key_file_store_unittest.cc +++ b/key_file_store_unittest.cc @@ -4,6 +4,10 @@ #include "shill/key_file_store.h" +#include <set> +#include <string> +#include <vector> + #include <base/file_util.h> #include <base/files/file_enumerator.h> #include <base/files/scoped_temp_dir.h> @@ -26,7 +30,7 @@ namespace shill { namespace { const char kPlainText[] = "This is a test!"; const char kROT47Text[] = "rot47:%9:D :D 2 E6DEP"; -} // namespace {} +} // namespace class KeyFileStoreTest : public Test { public: diff --git a/key_value_store_unittest.cc b/key_value_store_unittest.cc index a3ee1346..21c2ab95 100644 --- a/key_value_store_unittest.cc +++ b/key_value_store_unittest.cc @@ -29,9 +29,9 @@ TEST_F(KeyValueStoreTest, Bool) { EXPECT_EQ(kDefaultValue, store_.LookupBool(kKey, kDefaultValue)); store_.SetBool(kKey, kValue); EXPECT_TRUE(store_.ContainsBool(kKey)); - // TODO: investigate if a newer version of gtest handles EXPECT_EQ for bools - // in a manner that gcc 4.7 is happy with. (Inproper conversion from "false" - // to "NULL".) + // TODO(shenhan): investigate if a newer version of gtest handles EXPECT_EQ + // for bools in a manner that gcc 4.7 is happy with. (Improper conversion from + // "false" to "NULL"). EXPECT_EQ(static_cast<int>(kValue), static_cast<int>(store_.LookupBool(kKey, kDefaultValue))); EXPECT_EQ(static_cast<int>(kValue), diff --git a/l2tp_ipsec_driver.h b/l2tp_ipsec_driver.h index 8a5874a7..7dc706b8 100644 --- a/l2tp_ipsec_driver.h +++ b/l2tp_ipsec_driver.h @@ -7,6 +7,8 @@ #include <sys/types.h> +#include <map> +#include <string> #include <vector> #include <base/files/file_path.h> diff --git a/link_monitor.h b/link_monitor.h index b16eb594..c15596b9 100644 --- a/link_monitor.h +++ b/link_monitor.h @@ -7,6 +7,8 @@ #include <time.h> +#include <string> + #include <base/callback.h> #include <base/cancelable_callback.h> #include <base/memory/scoped_ptr.h> diff --git a/link_monitor_unittest.cc b/link_monitor_unittest.cc index 0cb48317..aa364f19 100644 --- a/link_monitor_unittest.cc +++ b/link_monitor_unittest.cc @@ -4,6 +4,8 @@ #include "shill/link_monitor.h" +#include <string> + #include <base/bind.h> #include <gtest/gtest.h> @@ -1158,7 +1158,6 @@ void Manager::VerifyDestination(const string &certificate, error->Populate(Error::kOperationFailed, "Unable to find connected WiFi service."); return; - } } crypto_util_proxy_->VerifyDestination(certificate, public_key, nonce, @@ -1218,7 +1217,7 @@ void Manager::VerifyAndEncryptCredentials(const string &certificate, int Manager::CalcConnectionId(std::string gateway_ip, std::string gateway_mac) { - return (int)(std::hash<std::string>()(gateway_ip + gateway_mac + + return static_cast<int>(std::hash<std::string>()(gateway_ip + gateway_mac + std::to_string(props_.connection_id_salt))); } @@ -1315,7 +1314,7 @@ void Manager::HelpRegisterConstDerivedRpcIdentifiers( void Manager::HelpRegisterDerivedString( const string &name, - string(Manager::*get)(Error *), + string(Manager::*get)(Error *error), bool(Manager::*set)(const string&, Error *)) { store_.RegisterDerivedString( name, @@ -1332,7 +1331,7 @@ void Manager::HelpRegisterConstDerivedStrings( void Manager::HelpRegisterDerivedBool( const string &name, - bool(Manager::*get)(Error *), + bool(Manager::*get)(Error *error), bool(Manager::*set)(const bool&, Error *)) { store_.RegisterDerivedBool( name, @@ -482,7 +482,7 @@ class Manager : public base::SupportsWeakPtr<Manager> { RpcIdentifiers(Manager::*get)(Error *)); void HelpRegisterDerivedString( const std::string &name, - std::string(Manager::*get)(Error *), + std::string(Manager::*get)(Error *error), bool(Manager::*set)(const std::string&, Error *)); void HelpRegisterConstDerivedStrings( const std::string &name, diff --git a/manager_dbus_adaptor.cc b/manager_dbus_adaptor.cc index 7e759866..96ca287b 100644 --- a/manager_dbus_adaptor.cc +++ b/manager_dbus_adaptor.cc @@ -369,7 +369,7 @@ map<string, ::DBus::Variant> ManagerDBusAdaptor::GetNetworksForGeolocation( for (const auto &network : manager_->GetNetworksForGeolocation()) { Stringmaps value; // Convert GeolocationInfos to their Stringmaps equivalent. - for(const auto &info : network.second) { + for (const auto &info : network.second) { value.push_back(info.properties()); } networks[network.first] = StringmapsToVariant(value); diff --git a/manager_dbus_adaptor.h b/manager_dbus_adaptor.h index db9eb558..6692de04 100644 --- a/manager_dbus_adaptor.h +++ b/manager_dbus_adaptor.h @@ -7,6 +7,7 @@ #include <map> #include <string> +#include <vector> #include <base/basictypes.h> #include <dbus-c++/dbus.h> diff --git a/memory_log.cc b/memory_log.cc index c7f74bfb..b76e12b7 100644 --- a/memory_log.cc +++ b/memory_log.cc @@ -120,11 +120,12 @@ ssize_t MemoryLog::FlushToFile(const FilePath &file_path) { return -1; } base::ScopedFILE file_closer(f); - long maximum_pw_string_size = sysconf(_SC_GETPW_R_SIZE_MAX); - if (maximum_pw_string_size < 0) { + auto maxpw_size = sysconf(_SC_GETPW_R_SIZE_MAX); + if (maxpw_size < 0) { LOG(ERROR) << "Setup for changing ownership of memory log file failed"; return -1; } + size_t maximum_pw_string_size = static_cast<size_t>(maxpw_size); struct passwd chronos; struct passwd *pwresult = NULL; scoped_ptr<char[]> buf(new char[maximum_pw_string_size]); diff --git a/memory_log_unittest.cc b/memory_log_unittest.cc index f55699b7..6fd0f23d 100644 --- a/memory_log_unittest.cc +++ b/memory_log_unittest.cc @@ -70,8 +70,8 @@ TEST_F(MemoryLogTest, NormalLoggingStillWorks) { // Test that no matter what we did, CHECK still kills the process. TEST_F(MemoryLogDeathTest, CheckLogsStillWork) { - EXPECT_DEATH( { CHECK(false) << "diediedie"; }, - "Check failed: false. diediedie"); + EXPECT_DEATH({ CHECK(false) << "diediedie"; }, + "Check failed: false. diediedie"); } TEST_F(MemoryLogTest, MemoryLogIsLogging) { @@ -223,7 +223,6 @@ TEST_F(MemoryLogTest, MemoryLogMessageInterceptorWorks) { ASSERT_EQ(3, MemoryLog::GetInstance()->TestGetNumberMessages()); NOTIMPLEMENTED(); ASSERT_EQ(4, MemoryLog::GetInstance()->TestGetNumberMessages()); - } } // namespace shill @@ -15,7 +15,7 @@ #include "shill/wifi_service.h" using std::string; -using std::tr1::shared_ptr; +using std::shared_ptr; namespace shill { @@ -6,6 +6,8 @@ #define SHILL_METRICS_H_ #include <list> +#include <map> +#include <string> #include <base/memory/scoped_vector.h> #include <metrics/metrics_library.h> @@ -733,7 +735,7 @@ class Metrics { TimerReportersByState start_on_state; TimerReportersByState stop_on_state; }; - typedef std::map<const Service *, std::tr1::shared_ptr<ServiceMetrics> > + typedef std::map<const Service *, std::shared_ptr<ServiceMetrics> > ServiceMetricsLookupMap; struct DeviceMetrics { @@ -748,7 +750,7 @@ class Metrics { scoped_ptr<chromeos_metrics::TimerReporter> auto_connect_timer; int auto_connect_tries; }; - typedef std::map<const int, std::tr1::shared_ptr<DeviceMetrics> > + typedef std::map<const int, std::shared_ptr<DeviceMetrics> > DeviceMetricsLookupMap; static const uint16 kWiFiBandwidth5MHz; diff --git a/metrics_unittest.cc b/metrics_unittest.cc index 0f2da458..f3e81716 100644 --- a/metrics_unittest.cc +++ b/metrics_unittest.cc @@ -5,6 +5,7 @@ #include "shill/metrics.h" #include <string> +#include <vector> #include <chromeos/dbus/service_constants.h> #include <metrics/metrics_library_mock.h> @@ -69,6 +69,7 @@ class Minijail { std::vector<char *> args, pid_t *pid, int *stdin, int *stdout, int *stderr); + protected: Minijail(); diff --git a/mm1_modem_location_proxy.cc b/mm1_modem_location_proxy.cc index 8b04255b..edd76491 100644 --- a/mm1_modem_location_proxy.cc +++ b/mm1_modem_location_proxy.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mm1_modem_location_proxy.h" +#include "shill/mm1_modem_location_proxy.h" #include "shill/cellular_error.h" #include "shill/dbus_async_call_helper.h" diff --git a/mm1_modem_modem3gpp_proxy.h b/mm1_modem_modem3gpp_proxy.h index ca8aedcb..17b64ba6 100644 --- a/mm1_modem_modem3gpp_proxy.h +++ b/mm1_modem_modem3gpp_proxy.h @@ -6,6 +6,7 @@ #define SHILL_MM1_MODEM_MODEM3GPP_PROXY_ #include <string> +#include <vector> #include "dbus_proxies/org.freedesktop.ModemManager1.Modem.Modem3gpp.h" #include "shill/dbus_properties.h" diff --git a/mm1_modem_proxy.cc b/mm1_modem_proxy.cc index 017781d7..3e4563f6 100644 --- a/mm1_modem_proxy.cc +++ b/mm1_modem_proxy.cc @@ -18,7 +18,7 @@ namespace mm1 { template<typename TraceMsgT, typename CallT, typename CallbackT, typename... ArgTypes> void ModemProxy::BeginCall( - const TraceMsgT &trace_msg, const CallT &call, CallbackT &callback, + const TraceMsgT &trace_msg, const CallT &call, const CallbackT &callback, Error *error, int timeout, ArgTypes... rest) { BeginAsyncDBusCall(trace_msg, proxy_, call, callback, error, &CellularError::FromMM1DBusError, timeout, rest...); diff --git a/mm1_modem_proxy.h b/mm1_modem_proxy.h index be9c458e..09c9830b 100644 --- a/mm1_modem_proxy.h +++ b/mm1_modem_proxy.h @@ -6,6 +6,7 @@ #define SHILL_MM1_MODEM_PROXY_H_ #include <string> +#include <vector> #include "dbus_proxies/org.freedesktop.ModemManager1.Modem.h" #include "shill/dbus_properties.h" @@ -118,8 +119,9 @@ class ModemProxy : public ModemProxyInterface { template<typename TraceMsgT, typename CallT, typename CallbackT, typename... ArgTypes> void BeginCall( - const TraceMsgT &trace_msg, const CallT &call, CallbackT &callback, - Error *error, int timeout, ArgTypes... rest); + const TraceMsgT &trace_msg, const CallT &call, + const CallbackT &callback, Error *error, int timeout, + ArgTypes... rest); DISALLOW_COPY_AND_ASSIGN(ModemProxy); }; diff --git a/mm1_modem_proxy_interface.h b/mm1_modem_proxy_interface.h index 5f354e85..f9bced0d 100644 --- a/mm1_modem_proxy_interface.h +++ b/mm1_modem_proxy_interface.h @@ -6,6 +6,7 @@ #define SHILL_MM1_MODEM_PROXY_INTERFACE_H_ #include <string> +#include <vector> #include <base/basictypes.h> diff --git a/mm1_sim_proxy.cc b/mm1_sim_proxy.cc index dd7eae9f..639d57c2 100644 --- a/mm1_sim_proxy.cc +++ b/mm1_sim_proxy.cc @@ -16,7 +16,7 @@ namespace mm1 { template<typename TraceMsgT, typename CallT, typename CallbackT, typename... ArgTypes> void SimProxy::BeginCall( - const TraceMsgT &trace_msg, const CallT &call, CallbackT &callback, + const TraceMsgT &trace_msg, const CallT &call, const CallbackT &callback, Error *error, int timeout, ArgTypes... rest) { BeginAsyncDBusCall(trace_msg, proxy_, call, callback, error, &CellularError::FromMM1DBusError, timeout, rest...); diff --git a/mm1_sim_proxy.h b/mm1_sim_proxy.h index 2df1ffd3..922589be 100644 --- a/mm1_sim_proxy.h +++ b/mm1_sim_proxy.h @@ -74,8 +74,9 @@ class SimProxy : public SimProxyInterface { template<typename TraceMsgT, typename CallT, typename CallbackT, typename... ArgTypes> void BeginCall( - const TraceMsgT &trace_msg, const CallT &call, CallbackT &callback, - Error *error, int timeout, ArgTypes... rest); + const TraceMsgT &trace_msg, const CallT &call, + const CallbackT &callback, Error *error, int timeout, + ArgTypes... rest); DISALLOW_COPY_AND_ASSIGN(SimProxy); }; diff --git a/mobile_operator_info_impl.cc b/mobile_operator_info_impl.cc index 95db98ff..79f56387 100644 --- a/mobile_operator_info_impl.cc +++ b/mobile_operator_info_impl.cc @@ -397,12 +397,12 @@ void MobileOperatorInfoImpl::PreprocessDatabase() { const RepeatedPtrField<string> &mccmncs = data.mccmnc(); for (const auto &mccmnc : mccmncs) { - InsertIntoStringToMNOListMap(mccmnc_to_mnos_, mccmnc, &mno); + InsertIntoStringToMNOListMap(&mccmnc_to_mnos_, mccmnc, &mno); } const RepeatedPtrField<string> &sids = data.sid(); - for (const auto &sid: sids) { - InsertIntoStringToMNOListMap(sid_to_mnos_, sid, &mno); + for (const auto &sid : sids) { + InsertIntoStringToMNOListMap(&sid_to_mnos_, sid, &mno); } const RepeatedPtrField<LocalizedName> &localized_names = @@ -410,7 +410,7 @@ void MobileOperatorInfoImpl::PreprocessDatabase() { for (const auto &localized_name : localized_names) { // LocalizedName::name is a required field. DCHECK(localized_name.has_name()); - InsertIntoStringToMNOListMap(name_to_mnos_, + InsertIntoStringToMNOListMap(&name_to_mnos_, localized_name.name(), &mno); } @@ -427,20 +427,16 @@ void MobileOperatorInfoImpl::PreprocessDatabase() { // same |key|. If you do that, the function is too dumb to deduplicate the // |value|s, and two copies will get stored. void MobileOperatorInfoImpl::InsertIntoStringToMNOListMap( - StringToMNOListMap &table, + StringToMNOListMap *table, const string &key, const MobileNetworkOperator *value) { - if (table.find(key) == table.end()) { - vector<const MobileNetworkOperator *> empty_mno_list; - table[key] = empty_mno_list; // |empty_mno_list| copied. - } - table[key].push_back(value); + (*table)[key].push_back(value); } bool MobileOperatorInfoImpl::AppendToCandidatesByMCCMNC(const string &mccmnc) { // First check that we haven't determined candidates using SID. if (operator_code_type_ == kOperatorCodeTypeSID) { - LOG(WARNING) << "SID update will be overriden by the MCCMNC update for " + LOG(WARNING) << "SID update will be overridden by the MCCMNC update for " "determining MNO."; candidates_by_operator_code_.clear(); } diff --git a/mobile_operator_info_impl.h b/mobile_operator_info_impl.h index a0b3f6d8..dc187c04 100644 --- a/mobile_operator_info_impl.h +++ b/mobile_operator_info_impl.h @@ -5,6 +5,7 @@ #ifndef SHILL_MOBILE_OPERATOR_IMPL_H_ #define SHILL_MOBILE_OPERATOR_IMPL_H_ +#include <map> #include <string> #include <vector> @@ -75,7 +76,7 @@ class MobileOperatorInfoImpl { // Default databases to load. static const char *const kDefaultDatabasePaths[]; // MCCMNC can be of length 5 or 6. When using this constant, keep in mind that - // the lenght of MCCMNC can by |kMCCMNCMinLen| or |kMCCMNCMinLen + 1|. + // the length of MCCMNC can by |kMCCMNCMinLen| or |kMCCMNCMinLen + 1|. static const int kMCCMNCMinLen; // /////////////////////////////////////////////////////////////////////////// @@ -85,7 +86,7 @@ class MobileOperatorInfoImpl { // same |key|. If you do that, the function is too dumb to deduplicate the // |value|s, and two copies will get stored. void InsertIntoStringToMNOListMap( - StringToMNOListMap &table, + StringToMNOListMap *table, const std::string &key, const mobile_operator_db::MobileNetworkOperator *value); diff --git a/mobile_operator_info_unittest.cc b/mobile_operator_info_unittest.cc index 161606e5..59660f15 100644 --- a/mobile_operator_info_unittest.cc +++ b/mobile_operator_info_unittest.cc @@ -119,6 +119,7 @@ class MobileOperatorInfoInitTest : public Test { // Owned by |operator_info_| and tied to its life cycle. MobileOperatorInfoImpl *operator_info_impl_; + private: DISALLOW_COPY_AND_ASSIGN(MobileOperatorInfoInitTest); }; @@ -300,6 +301,7 @@ class MobileOperatorInfoMainTest MockMobileOperatorInfoObserver observer_; const EventCheckingPolicy event_checking_policy_; + private: DISALLOW_COPY_AND_ASSIGN(MobileOperatorInfoMainTest); }; @@ -982,7 +984,7 @@ TEST_P(MobileOperatorInfoMainTest, MNOByMCCMNCAndSID) { class MobileOperatorInfoDataTest : public MobileOperatorInfoMainTest { public: - MobileOperatorInfoDataTest() : MobileOperatorInfoMainTest() {} + MobileOperatorInfoDataTest() : MobileOperatorInfoMainTest() {} // Same as MobileOperatorInfoMainTest, except that the database used is // different. @@ -1165,6 +1167,7 @@ class MobileOperatorInfoDataTest : public MobileOperatorInfoMainTest { // Extra data to be verified only against user updates. string sid_; + private: DISALLOW_COPY_AND_ASSIGN(MobileOperatorInfoDataTest); }; @@ -1450,6 +1453,7 @@ class MobileOperatorInfoObserverTest : public MobileOperatorInfoMainTest { // Data. MockMobileOperatorInfoObserver second_observer_; + private: DISALLOW_COPY_AND_ASSIGN(MobileOperatorInfoObserverTest); }; diff --git a/mock_adaptors.h b/mock_adaptors.h index a301a717..a457be04 100644 --- a/mock_adaptors.h +++ b/mock_adaptors.h @@ -6,6 +6,7 @@ #define SHILL_MOCK_ADAPTORS_ #include <string> +#include <vector> #include <gmock/gmock.h> diff --git a/mock_certificate_file.h b/mock_certificate_file.h index fe12e858..ae708bed 100644 --- a/mock_certificate_file.h +++ b/mock_certificate_file.h @@ -5,6 +5,9 @@ #ifndef SHILL_MOCK_CERTFICATE_FILE_H_ #define SHILL_MOCK_CERTFICATE_FILE_H_ +#include <string> +#include <vector> + #include <gmock/gmock.h> #include "shill/certificate_file.h" diff --git a/mock_connection.h b/mock_connection.h index 9e04b476..e041e059 100644 --- a/mock_connection.h +++ b/mock_connection.h @@ -5,6 +5,9 @@ #ifndef SHILL_MOCK_CONNECTION_H_ #define SHILL_MOCK_CONNECTION_H_ +#include <string> +#include <vector> + #include <base/basictypes.h> #include <gmock/gmock.h> @@ -14,7 +17,7 @@ namespace shill { class MockConnection : public Connection { public: - MockConnection(const DeviceInfo *device_info); + explicit MockConnection(const DeviceInfo *device_info); virtual ~MockConnection(); MOCK_METHOD1(UpdateFromIPConfig, void(const IPConfigRefPtr &config)); diff --git a/mock_connection_health_checker.h b/mock_connection_health_checker.h index 08d31b26..7f43f733 100644 --- a/mock_connection_health_checker.h +++ b/mock_connection_health_checker.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_CONNECTION_HEALTH_CHECKER_H_ #define SHILL_MOCK_CONNECTION_HEALTH_CHECKER_H_ +#include <string> + #include <gmock/gmock.h> #include "shill/connection_health_checker.h" diff --git a/mock_crypto_util_proxy.cc b/mock_crypto_util_proxy.cc index a00c8e06..5a67410e 100644 --- a/mock_crypto_util_proxy.cc +++ b/mock_crypto_util_proxy.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mock_crypto_util_proxy.h" +#include "shill/mock_crypto_util_proxy.h" #include <string> #include <vector> @@ -32,7 +32,7 @@ bool MockCryptoUtilProxy::RealVerifyDestination( const ResultBoolCallback &result_callback, Error *error) { return CryptoUtilProxy::VerifyDestination(certificate, public_key, - nonce,signed_data, + nonce, signed_data, destination_udn, ssid, bssid, result_callback, error); } diff --git a/mock_crypto_util_proxy.h b/mock_crypto_util_proxy.h index 74754e9f..8b945126 100644 --- a/mock_crypto_util_proxy.h +++ b/mock_crypto_util_proxy.h @@ -71,6 +71,7 @@ class MockCryptoUtilProxy const std::string &input, const StringCallback &result_handler); + private: DISALLOW_COPY_AND_ASSIGN(MockCryptoUtilProxy); }; diff --git a/mock_dbus_properties_proxy.h b/mock_dbus_properties_proxy.h index 745f9870..8435ad18 100644 --- a/mock_dbus_properties_proxy.h +++ b/mock_dbus_properties_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_DBUS_PROPERTIES_PROXY_H_ #define SHILL_MOCK_DBUS_PROPERTIES_PROXY_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_dbus_service_proxy.h b/mock_dbus_service_proxy.h index 96945378..2dd08fd8 100644 --- a/mock_dbus_service_proxy.h +++ b/mock_dbus_service_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_DBUS_SERVICE_PROXY_H_ #define SHILL_MOCK_DBUS_SERVICE_PROXY_H_ +#include <string> + #include <gmock/gmock.h> #include "shill/dbus_service_proxy_interface.h" @@ -24,6 +26,7 @@ class MockDBusServiceProxy : public DBusServiceProxyInterface { MOCK_METHOD1(set_name_owner_changed_callback, void(const NameOwnerChangedCallback &callback)); + private: DISALLOW_COPY_AND_ASSIGN(MockDBusServiceProxy); }; diff --git a/mock_device.h b/mock_device.h index fca68ffb..f530b8d9 100644 --- a/mock_device.h +++ b/mock_device.h @@ -6,6 +6,7 @@ #define SHILL_MOCK_DEVICE_ #include <string> +#include <vector> #include <base/memory/ref_counted.h> #include <gmock/gmock.h> diff --git a/mock_device_info.h b/mock_device_info.h index 45b11ed9..8b8e3227 100644 --- a/mock_device_info.h +++ b/mock_device_info.h @@ -5,6 +5,7 @@ #ifndef SHILL_MOCK_DEVICE_INFO_ #define SHILL_MOCK_DEVICE_INFO_ +#include <string> #include <vector> #include <base/basictypes.h> diff --git a/mock_dns_client.h b/mock_dns_client.h index 62706e34..723533f6 100644 --- a/mock_dns_client.h +++ b/mock_dns_client.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_DNS_CLIENT_H_ #define SHILL_MOCK_DNS_CLIENT_H_ +#include <string> + #include "shill/dns_client.h" #include <base/basictypes.h> diff --git a/mock_eap_credentials.h b/mock_eap_credentials.h index 5986714e..36cd45ee 100644 --- a/mock_eap_credentials.h +++ b/mock_eap_credentials.h @@ -5,6 +5,10 @@ #ifndef SHILL_MOCK_EAP_CREDENTIALS_H_ #define SHILL_MOCK_EAP_CREDENTIALS_H_ +#include <map> +#include <string> +#include <vector> + #include "shill/eap_credentials.h" #include <gmock/gmock.h> diff --git a/mock_ethernet_service.h b/mock_ethernet_service.h index 1ef0de93..beb808bb 100644 --- a/mock_ethernet_service.h +++ b/mock_ethernet_service.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_ETHERNET_SERVICE_H_ #define SHILL_MOCK_ETHERNET_SERVICE_H_ +#include <string> + #include <gmock/gmock.h> #include "shill/ethernet_service.h" @@ -18,7 +20,7 @@ class MockEthernetService : public EthernetService { MOCK_METHOD2(AddEAPCertification, bool(const std::string &name, size_t depth)); - MOCK_METHOD0(ClearEAPCertification, void ()); + MOCK_METHOD0(ClearEAPCertification, void()); MOCK_METHOD2(Configure, void(const KeyValueStore &args, Error *error)); MOCK_METHOD2(DisconnectWithFailure, void(ConnectFailure failure, Error *error)); diff --git a/mock_external_task.h b/mock_external_task.h index 62c74554..8a3b9790 100644 --- a/mock_external_task.h +++ b/mock_external_task.h @@ -5,6 +5,10 @@ #ifndef SHILL_MOCK_EXTERNAL_TASK_H_ #define SHILL_MOCK_EXTERNAL_TASK_H_ +#include <map> +#include <string> +#include <vector> + #include <gmock/gmock.h> #include "shill/external_task.h" @@ -12,7 +16,7 @@ namespace shill { class MockExternalTask : public ExternalTask { -public: + public: MockExternalTask(ControlInterface *control, GLib *glib, const base::WeakPtr<RPCTaskDelegate> &task_delegate, @@ -28,7 +32,7 @@ public: MOCK_METHOD0(Stop, void()); MOCK_METHOD0(OnDelete, void()); -private: + private: DISALLOW_COPY_AND_ASSIGN(MockExternalTask); }; diff --git a/mock_file_io.h b/mock_file_io.h index eb11e59b..f04f62ce 100644 --- a/mock_file_io.h +++ b/mock_file_io.h @@ -13,7 +13,7 @@ namespace shill { class MockFileIO : public FileIO { public: - MockFileIO() {}; + MockFileIO() {} virtual ~MockFileIO() {} MOCK_METHOD3(Write, ssize_t(int fd, const void *buf, size_t count)); MOCK_METHOD3(Read, ssize_t(int fd, void *buf, size_t count)); diff --git a/mock_glib.h b/mock_glib.h index ec32ee15..a8598dd3 100644 --- a/mock_glib.h +++ b/mock_glib.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_GLIB_H_ #define SHILL_MOCK_GLIB_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_http_request.h b/mock_http_request.h index 6c2d4862..936e9682 100644 --- a/mock_http_request.h +++ b/mock_http_request.h @@ -15,7 +15,7 @@ namespace shill { class MockHTTPRequest : public HTTPRequest { public: - MockHTTPRequest(ConnectionRefPtr connection); + explicit MockHTTPRequest(ConnectionRefPtr connection); virtual ~MockHTTPRequest(); MOCK_METHOD3(Start, HTTPRequest::Result( diff --git a/mock_link_monitor.h b/mock_link_monitor.h index 690669d0..de7655b5 100644 --- a/mock_link_monitor.h +++ b/mock_link_monitor.h @@ -22,6 +22,7 @@ class MockLinkMonitor : public LinkMonitor { MOCK_CONST_METHOD0(GetResponseTimeMilliseconds, int()); MOCK_CONST_METHOD0(IsGatewayFound, bool()); + private: DISALLOW_COPY_AND_ASSIGN(MockLinkMonitor); }; diff --git a/mock_manager.h b/mock_manager.h index 7372c72b..385e4e56 100644 --- a/mock_manager.h +++ b/mock_manager.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_MANAGER_H_ #define SHILL_MOCK_MANAGER_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_metrics.h b/mock_metrics.h index 4b4f48b6..84177ec8 100644 --- a/mock_metrics.h +++ b/mock_metrics.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_METRICS_ #define SHILL_MOCK_METRICS_ +#include <string> + #include "shill/metrics.h" #include <gmock/gmock.h> diff --git a/mock_minijail.h b/mock_minijail.h index da0a0993..d6ddcfd4 100644 --- a/mock_minijail.h +++ b/mock_minijail.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_MINIJAIL_H_ #define SHILL_MOCK_MINIJAIL_H_ +#include <vector> + #include <base/basictypes.h> #include <gmock/gmock.h> @@ -18,7 +20,7 @@ class MockMinijail : public Minijail { virtual ~MockMinijail(); MOCK_METHOD0(New, struct minijail *()); - MOCK_METHOD1(Destroy, void (struct minijail *)); + MOCK_METHOD1(Destroy, void(struct minijail *)); MOCK_METHOD2(DropRoot, bool(struct minijail *jail, const char *user)); MOCK_METHOD2(UseCapabilities, void(struct minijail *jail, uint64_t capmask)); diff --git a/mock_mm1_modem_modem3gpp_proxy.h b/mock_mm1_modem_modem3gpp_proxy.h index 3baf5faf..8f52a1ae 100644 --- a/mock_mm1_modem_modem3gpp_proxy.h +++ b/mock_mm1_modem_modem3gpp_proxy.h @@ -28,6 +28,7 @@ class MockModemModem3gppProxy : public ModemModem3gppProxyInterface { const DBusPropertyMapsCallback &callback, int timeout)); + private: DISALLOW_COPY_AND_ASSIGN(MockModemModem3gppProxy); }; diff --git a/mock_mm1_modem_proxy.h b/mock_mm1_modem_proxy.h index afe77452..7089ce8a 100644 --- a/mock_mm1_modem_proxy.h +++ b/mock_mm1_modem_proxy.h @@ -6,6 +6,7 @@ #define SHILL_MM1_MOCK_MODEM_PROXY_H_ #include <string> +#include <vector> #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_mm1_sim_proxy.h b/mock_mm1_sim_proxy.h index c21e205a..0110c857 100644 --- a/mock_mm1_sim_proxy.h +++ b/mock_mm1_sim_proxy.h @@ -40,7 +40,7 @@ class MockSimProxy : public SimProxyInterface { const ResultCallback &callback, int timeout)); -private: + private: DISALLOW_COPY_AND_ASSIGN(MockSimProxy); }; diff --git a/mock_modem_gobi_proxy.h b/mock_modem_gobi_proxy.h index 66ece244..3eef2162 100644 --- a/mock_modem_gobi_proxy.h +++ b/mock_modem_gobi_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_MODEM_GOBI_PROXY_H_ #define SHILL_MOCK_MODEM_GOBI_PROXY_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_modem_info.cc b/mock_modem_info.cc index 721fe0bd..5d5d2798 100644 --- a/mock_modem_info.cc +++ b/mock_modem_info.cc @@ -29,23 +29,23 @@ void MockModemInfo::SetMockMembers() { mock_pending_activation_store_ = static_cast<MockPendingActivationStore*>(pending_activation_store()); // These are replaced by mocks only if current unset in ModemInfo. - if(control_interface() == NULL) { + if (control_interface() == NULL) { mock_control_.reset(new MockControl()); set_control_interface(mock_control_.get()); } - if(dispatcher() == NULL) { + if (dispatcher() == NULL) { mock_dispatcher_.reset(new MockEventDispatcher()); set_event_dispatcher(mock_dispatcher_.get()); } - if(metrics() == NULL) { + if (metrics() == NULL) { mock_metrics_.reset(new MockMetrics(dispatcher())); set_metrics(mock_metrics_.get()); } - if(glib() == NULL) { + if (glib() == NULL) { mock_glib_.reset(new MockGLib()); set_glib(mock_glib_.get()); } - if(manager() == NULL) { + if (manager() == NULL) { mock_manager_.reset(new MockManager(control_interface(), dispatcher(), metrics(), glib())); set_manager(mock_manager_.get()); diff --git a/mock_modem_info.h b/mock_modem_info.h index f62e89c9..cac8d3cf 100644 --- a/mock_modem_info.h +++ b/mock_modem_info.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_MODEM_INFO_ #define SHILL_MOCK_MODEM_INFO_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_netlink_manager.h b/mock_netlink_manager.h index 9f9eee81..0a234397 100644 --- a/mock_netlink_manager.h +++ b/mock_netlink_manager.h @@ -8,6 +8,7 @@ #include "shill/netlink_manager.h" #include <map> +#include <string> #include <gmock/gmock.h> @@ -5,6 +5,9 @@ #ifndef SHILL_MOCK_NSS_ #define SHILL_MOCK_NSS_ +#include <string> +#include <vector> + #include <gmock/gmock.h> #include "shill/nss.h" diff --git a/mock_openvpn_driver.h b/mock_openvpn_driver.h index c4885293..6291d5e2 100644 --- a/mock_openvpn_driver.h +++ b/mock_openvpn_driver.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_OPENVPN_DRIVER_ #define SHILL_MOCK_OPENVPN_DRIVER_ +#include <string> + #include <gmock/gmock.h> #include "shill/openvpn_driver.h" diff --git a/mock_openvpn_management_server.h b/mock_openvpn_management_server.h index 33966f4f..a816dd3c 100644 --- a/mock_openvpn_management_server.h +++ b/mock_openvpn_management_server.h @@ -5,6 +5,9 @@ #ifndef SHILL_MOCK_OPENVPN_MANAGEMENT_SERVER_H_ #define SHILL_MOCK_OPENVPN_MANAGEMENT_SERVER_H_ +#include <string> +#include <vector> + #include <gmock/gmock.h> #include "shill/openvpn_management_server.h" diff --git a/mock_pending_activation_store.h b/mock_pending_activation_store.h index aaa14eca..50b5937e 100644 --- a/mock_pending_activation_store.h +++ b/mock_pending_activation_store.h @@ -20,7 +20,7 @@ class MockPendingActivationStore : public PendingActivationStore { virtual ~MockPendingActivationStore(); MOCK_METHOD2(InitStorage, - bool(GLib *glib,const base::FilePath &storage_path)); + bool(GLib *glib, const base::FilePath &storage_path)); MOCK_CONST_METHOD2(GetActivationState, State(IdentifierType type, const std::string &iccid)); MOCK_METHOD3(SetActivationState, diff --git a/mock_portal_detector.h b/mock_portal_detector.h index 9a15eb9d..2370d124 100644 --- a/mock_portal_detector.h +++ b/mock_portal_detector.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_PORTAL_DETECTOR_H_ #define SHILL_MOCK_PORTAL_DETECTOR_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> @@ -14,7 +16,7 @@ namespace shill { class MockPortalDetector : public PortalDetector { public: - MockPortalDetector(ConnectionRefPtr connection); + explicit MockPortalDetector(ConnectionRefPtr connection); virtual ~MockPortalDetector(); MOCK_METHOD1(Start, bool(const std::string &)); diff --git a/mock_power_manager.h b/mock_power_manager.h index f2e272a7..a35a187d 100644 --- a/mock_power_manager.h +++ b/mock_power_manager.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_POWER_MANAGER_H_ #define SHILL_MOCK_POWER_MANAGER_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_power_manager_proxy.h b/mock_power_manager_proxy.h index 7878fdd0..fc54152a 100644 --- a/mock_power_manager_proxy.h +++ b/mock_power_manager_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_POWER_MANAGER_PROXY_H_ #define SHILL_MOCK_POWER_MANAGER_PROXY_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> diff --git a/mock_ppp_device.h b/mock_ppp_device.h index 57a75aa2..2e98c0a5 100644 --- a/mock_ppp_device.h +++ b/mock_ppp_device.h @@ -5,6 +5,9 @@ #ifndef SHILL_MOCK_PPP_DEVICE_H_ #define SHILL_MOCK_PPP_DEVICE_H_ +#include <map> +#include <string> + #include <gmock/gmock.h> #include "shill/ppp_device.h" diff --git a/mock_ppp_device_factory.h b/mock_ppp_device_factory.h index 10ed8512..2c5f2a9d 100644 --- a/mock_ppp_device_factory.h +++ b/mock_ppp_device_factory.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_PPP_DEVICE_FACTORY_H_ #define SHILL_MOCK_PPP_DEVICE_FACTORY_H_ +#include <string> + #include <base/lazy_instance.h> #include <gmock/gmock.h> diff --git a/mock_proxy_factory.cc b/mock_proxy_factory.cc index 12d20b71..6c7112ad 100644 --- a/mock_proxy_factory.cc +++ b/mock_proxy_factory.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mock_proxy_factory.h" +#include "shill/mock_proxy_factory.h" namespace shill { diff --git a/mock_proxy_factory.h b/mock_proxy_factory.h index 1a100d3b..0c765086 100644 --- a/mock_proxy_factory.h +++ b/mock_proxy_factory.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_PROXY_FACTORY_H_ #define SHILL_MOCK_PROXY_FACTORY_H_ +#include <string> + #include "shill/proxy_factory.h" #include <gmock/gmock.h> diff --git a/mock_sockets.h b/mock_sockets.h index 896859b7..03ee1bc5 100644 --- a/mock_sockets.h +++ b/mock_sockets.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_SOCKETS_H_ #define SHILL_MOCK_SOCKETS_H_ +#include <string> + #include "shill/sockets.h" #include <base/basictypes.h> diff --git a/mock_traffic_monitor.h b/mock_traffic_monitor.h index d910d475..c8152c70 100644 --- a/mock_traffic_monitor.h +++ b/mock_traffic_monitor.h @@ -19,6 +19,7 @@ class MockTrafficMonitor : public TrafficMonitor { MOCK_METHOD0(Start, void()); MOCK_METHOD0(Stop, void()); + private: DISALLOW_COPY_AND_ASSIGN(MockTrafficMonitor); }; diff --git a/mock_virtual_device.h b/mock_virtual_device.h index fe1c874d..c10f2460 100644 --- a/mock_virtual_device.h +++ b/mock_virtual_device.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_VIRTUAL_DEVICE_H_ #define SHILL_MOCK_VIRTUAL_DEVICE_H_ +#include <string> + #include <gmock/gmock.h> #include "shill/virtual_device.h" diff --git a/mock_vpn_driver.h b/mock_vpn_driver.h index ae35e334..221de7d5 100644 --- a/mock_vpn_driver.h +++ b/mock_vpn_driver.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_VPN_DRIVER_ #define SHILL_MOCK_VPN_DRIVER_ +#include <string> + #include <gmock/gmock.h> #include "shill/vpn_driver.h" diff --git a/mock_vpn_provider.h b/mock_vpn_provider.h index a8d98725..02ec0300 100644 --- a/mock_vpn_provider.h +++ b/mock_vpn_provider.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_VPN_PROVIDER_ #define SHILL_MOCK_VPN_PROVIDER_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> @@ -23,6 +25,7 @@ class MockVPNProvider : public VPNProvider { int interface_index)); MOCK_CONST_METHOD0(HasActiveService, bool()); + private: DISALLOW_COPY_AND_ASSIGN(MockVPNProvider); }; diff --git a/mock_wimax_device_proxy.h b/mock_wimax_device_proxy.h index 8ad52ea1..3cab77d1 100644 --- a/mock_wimax_device_proxy.h +++ b/mock_wimax_device_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_WIMAX_DEVICE_PROXY_H_ #define SHILL_MOCK_WIMAX_DEVICE_PROXY_H_ +#include <string> + #include <base/basictypes.h> #include <gmock/gmock.h> @@ -42,6 +44,7 @@ class MockWiMaxDeviceProxy : public WiMaxDeviceProxyInterface { MOCK_METHOD1(Name, std::string(Error *error)); MOCK_METHOD1(Networks, RpcIdentifiers(Error *error)); + private: DISALLOW_COPY_AND_ASSIGN(MockWiMaxDeviceProxy); }; diff --git a/mock_wimax_network_proxy.h b/mock_wimax_network_proxy.h index 69486931..40f90cc9 100644 --- a/mock_wimax_network_proxy.h +++ b/mock_wimax_network_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_WIMAX_NETWORK_PROXY_H_ #define SHILL_MOCK_WIMAX_NETWORK_PROXY_H_ +#include <string> + #include <gmock/gmock.h> #include "shill/wimax_network_proxy_interface.h" @@ -26,6 +28,7 @@ class MockWiMaxNetworkProxy : public WiMaxNetworkProxyInterface { MOCK_METHOD1(RSSI, int(Error *error)); MOCK_METHOD1(SignalStrength, int(Error *error)); + private: DISALLOW_COPY_AND_ASSIGN(MockWiMaxNetworkProxy); }; diff --git a/mock_wimax_provider.h b/mock_wimax_provider.h index b8ba84d2..6a401ada 100644 --- a/mock_wimax_provider.h +++ b/mock_wimax_provider.h @@ -5,6 +5,8 @@ #ifndef SHILL_MOCK_WIMAX_PROVIDER_H_ #define SHILL_MOCK_WIMAX_PROVIDER_H_ +#include <string> + #include <gmock/gmock.h> #include "shill/wimax_provider.h" @@ -34,7 +34,7 @@ bool Modem1::GetLinkName(const DBusPropertiesMap &modem_props, } vector<DBus::Struct<string, uint32>> ports = props_it->second; - for (const auto &port_pair: ports) { + for (const auto &port_pair : ports) { if (port_pair._2 == MM_MODEM_PORT_TYPE_NET) { net_port = port_pair._1; break; diff --git a/modem_cdma_proxy.h b/modem_cdma_proxy.h index 0df2e26a..5872c279 100644 --- a/modem_cdma_proxy.h +++ b/modem_cdma_proxy.h @@ -88,6 +88,7 @@ class ModemCDMAProxy : public ModemCDMAProxyInterface { Proxy proxy_; + private: DISALLOW_COPY_AND_ASSIGN(ModemCDMAProxy); }; diff --git a/modem_gobi_proxy.h b/modem_gobi_proxy.h index 0a62e652..bc6bb78d 100644 --- a/modem_gobi_proxy.h +++ b/modem_gobi_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_MODEM_GOBI_PROXY_H_ #define SHILL_MODEM_GOBI_PROXY_H_ +#include <string> + #include <base/basictypes.h> #include "shill/dbus_proxies/modem-gobi.h" diff --git a/modem_gsm_card_proxy.cc b/modem_gsm_card_proxy.cc index a4277cbb..1447c790 100644 --- a/modem_gsm_card_proxy.cc +++ b/modem_gsm_card_proxy.cc @@ -20,7 +20,7 @@ namespace shill { template<typename TraceMsgT, typename CallT, typename CallbackT, typename... ArgTypes> void ModemGSMCardProxy::BeginCall( - const TraceMsgT &trace_msg, const CallT &call, CallbackT &callback, + const TraceMsgT &trace_msg, const CallT &call, const CallbackT &callback, Error *error, int timeout, ArgTypes... rest) { BeginAsyncDBusCall(trace_msg, proxy_, call, callback, error, &CellularError::FromDBusError, timeout, rest...); diff --git a/modem_gsm_card_proxy.h b/modem_gsm_card_proxy.h index d238de29..13e3d238 100644 --- a/modem_gsm_card_proxy.h +++ b/modem_gsm_card_proxy.h @@ -88,8 +88,9 @@ class ModemGSMCardProxy : public ModemGSMCardProxyInterface { template<typename TraceMsgT, typename CallT, typename CallbackT, typename... ArgTypes> void BeginCall( - const TraceMsgT &trace_msg, const CallT &call, CallbackT &callback, - Error *error, int timeout, ArgTypes... rest); + const TraceMsgT &trace_msg, const CallT &call, + const CallbackT &callback, Error *error, int timeout, + ArgTypes... rest); DISALLOW_COPY_AND_ASSIGN(ModemGSMCardProxy); }; diff --git a/modem_manager.cc b/modem_manager.cc index 2540eae3..00bc6952 100644 --- a/modem_manager.cc +++ b/modem_manager.cc @@ -16,7 +16,7 @@ #include "shill/proxy_factory.h" using std::string; -using std::tr1::shared_ptr; +using std::shared_ptr; using std::vector; namespace shill { diff --git a/modem_manager.h b/modem_manager.h index c22d5d82..e7e1e0b6 100644 --- a/modem_manager.h +++ b/modem_manager.h @@ -7,7 +7,7 @@ #include <map> #include <string> -#include <tr1/memory> +#include <memory> #include <vector> #include <base/basictypes.h> @@ -53,7 +53,7 @@ class ModemManager { void OnDeviceInfoAvailable(const std::string &link_name); protected: - typedef std::map<std::string, std::tr1::shared_ptr<Modem> > Modems; + typedef std::map<std::string, std::shared_ptr<Modem> > Modems; const std::string &owner() const { return owner_; } const std::string &service() const { return service_; } @@ -69,7 +69,7 @@ class ModemManager { bool ModemExists(const std::string &path) const; // Put the modem into our modem map - void RecordAddedModem(std::tr1::shared_ptr<Modem> modem); + void RecordAddedModem(std::shared_ptr<Modem> modem); // Removes a modem on |path|. void RemoveModem(const std::string &path); @@ -122,7 +122,7 @@ class ModemManagerClassic : public ModemManager { virtual void Disconnect(); virtual void AddModemClassic(const std::string &path); - virtual void InitModemClassic(std::tr1::shared_ptr<ModemClassic> modem); + virtual void InitModemClassic(std::shared_ptr<ModemClassic> modem); private: scoped_ptr<ModemManagerProxyInterface> proxy_; // DBus service proxy @@ -144,7 +144,7 @@ class ModemManager1 : public ModemManager { protected: void AddModem1(const std::string &path, const DBusInterfaceToProperties &properties); - virtual void InitModem1(std::tr1::shared_ptr<Modem1> modem, + virtual void InitModem1(std::shared_ptr<Modem1> modem, const DBusInterfaceToProperties &properties); // ModemManager methods diff --git a/modem_manager_1.cc b/modem_manager_1.cc index b19ad202..d06576af 100644 --- a/modem_manager_1.cc +++ b/modem_manager_1.cc @@ -15,7 +15,7 @@ using base::Bind; using std::string; -using std::tr1::shared_ptr; +using std::shared_ptr; using std::vector; namespace shill { diff --git a/modem_manager_unittest.cc b/modem_manager_unittest.cc index 28f3455b..fe532641 100644 --- a/modem_manager_unittest.cc +++ b/modem_manager_unittest.cc @@ -19,7 +19,7 @@ #include "shill/testing.h" using std::string; -using std::tr1::shared_ptr; +using std::shared_ptr; using std::vector; using testing::_; using testing::Invoke; diff --git a/modem_unittest.cc b/modem_unittest.cc index c317a238..1f0b65e6 100644 --- a/modem_unittest.cc +++ b/modem_unittest.cc @@ -269,7 +269,6 @@ TEST_F(ModemTest, GetDeviceParams) { EXPECT_TRUE(modem_->GetDeviceParams(&mac_address, &interface_index)); EXPECT_EQ(2, interface_index); EXPECT_EQ(kAddressAsString, mac_address); - } TEST_F(ModemTest, RejectPPPModem) { diff --git a/netlink_attribute.h b/netlink_attribute.h index 43e4575d..294ffcfe 100644 --- a/netlink_attribute.h +++ b/netlink_attribute.h @@ -8,6 +8,7 @@ #include <netlink/attr.h> #include <string> +#include <vector> #include <base/basictypes.h> diff --git a/netlink_message.cc b/netlink_message.cc index 3c6be3a2..9494790d 100644 --- a/netlink_message.cc +++ b/netlink_message.cc @@ -8,6 +8,7 @@ #include <netlink/msg.h> #include <netlink/netlink.h> +#include <algorithm> #include <map> #include <string> diff --git a/nl80211_attribute.h b/nl80211_attribute.h index fa5148da..bfa9e8c3 100644 --- a/nl80211_attribute.h +++ b/nl80211_attribute.h @@ -7,6 +7,8 @@ #include <netlink/attr.h> +#include <string> + #include <base/basictypes.h> #include "shill/netlink_attribute.h" diff --git a/openvpn_driver.h b/openvpn_driver.h index a44d9cef..b44b7a4f 100644 --- a/openvpn_driver.h +++ b/openvpn_driver.h @@ -26,7 +26,7 @@ namespace base { template<typename T> class WeakPtr; -} // namespace base; +} // namespace base namespace shill { diff --git a/openvpn_management_server_unittest.cc b/openvpn_management_server_unittest.cc index be86084f..2c04ca56 100644 --- a/openvpn_management_server_unittest.cc +++ b/openvpn_management_server_unittest.cc @@ -31,7 +31,7 @@ namespace { MATCHER_P(VoidStringEq, value, "") { return value == reinterpret_cast<const char *>(arg); } -} // namespace {} +} // namespace class OpenVPNManagementServerTest : public testing::Test { public: diff --git a/pending_activation_store.cc b/pending_activation_store.cc index 97c8e175..3bf7f67c 100644 --- a/pending_activation_store.cc +++ b/pending_activation_store.cc @@ -62,7 +62,7 @@ string FormattedIdentifier(PendingActivationStore::IdentifierType type, // static string PendingActivationStore::IdentifierTypeToGroupId(IdentifierType type) { - switch(type) { + switch (type) { case kIdentifierICCID: return kIccidGroupId; case kIdentifierMEID: diff --git a/portal_detector_unittest.cc b/portal_detector_unittest.cc index 9fc2d8d6..774b218f 100644 --- a/portal_detector_unittest.cc +++ b/portal_detector_unittest.cc @@ -43,7 +43,7 @@ const char kURL[] = "http://www.chromium.org"; const char kDNSServer0[] = "8.8.8.8"; const char kDNSServer1[] = "8.8.4.4"; const char *kDNSServers[] = { kDNSServer0, kDNSServer1 }; -} // namespace {} +} // namespace MATCHER_P(IsResult, result, "") { return (result.phase == arg.phase && diff --git a/property_accessor.h b/property_accessor.h index 99df286c..d6691ae7 100644 --- a/property_accessor.h +++ b/property_accessor.h @@ -188,7 +188,7 @@ class CustomAccessor : public AccessorInterface<T> { // the initializer list. T default_value_; T(C::*const getter_)(Error *error); - bool(C::*const setter_)(const T &value, Error *error); + bool(C::*const setter_)(const T &value, Error *error); // NOLINT - "casting" void(C::*const clearer_)(Error *error); DISALLOW_COPY_AND_ASSIGN(CustomAccessor); }; @@ -241,7 +241,7 @@ class CustomWriteOnlyAccessor : public AccessorInterface<T> { private: C *const target_; - bool(C::*const setter_)(const T &value, Error *error); + bool(C::*const setter_)(const T &value, Error *error); // NOLINT - "casting" void(C::*const clearer_)(Error *error); // |default_value_| is non-const because it can't be initialized in // the initializer list. @@ -330,7 +330,8 @@ class CustomMappedAccessor : public AccessorInterface<T> { C *const target_; void(C::*const clearer_)(const A &argument, Error *error); T(C::*const getter_)(const A &argument, Error *error); - bool(C::*const setter_)(const A &argument, const T &value, Error *error); + bool(C::*const setter_)(const A &argument, // NOLINT - "casting" + const T &value, Error *error); A argument_; DISALLOW_COPY_AND_ASSIGN(CustomMappedAccessor); }; diff --git a/property_accessor_unittest.cc b/property_accessor_unittest.cc index ea335d22..9cd03951 100644 --- a/property_accessor_unittest.cc +++ b/property_accessor_unittest.cc @@ -491,7 +491,7 @@ class StringMapWrapper { return true; } - map<string,string> value_; + map<string, string> value_; }; TEST(PropertyAccessorTest, CustomMappedAccessor) { diff --git a/property_iterator.h b/property_iterator.h index bb252c03..12990da3 100644 --- a/property_iterator.h +++ b/property_iterator.h @@ -38,7 +38,7 @@ class ReadablePropertyConstIterator { private: friend class PropertyStore; - typedef std::tr1::shared_ptr<AccessorInterface<V> > VAccessorPtr; + typedef std::shared_ptr<AccessorInterface<V> > VAccessorPtr; explicit ReadablePropertyConstIterator( const typename std::map<std::string, VAccessorPtr> &collection) diff --git a/property_observer.h b/property_observer.h index e024cdc0..9b33af00 100644 --- a/property_observer.h +++ b/property_observer.h @@ -7,7 +7,7 @@ #include <base/basictypes.h> #include <base/callback.h> -#include <tr1/memory> +#include <memory> #include "shill/accessor_interface.h" #include "shill/error.h" @@ -25,7 +25,7 @@ class PropertyObserver : public PropertyObserverInterface { public: typedef base::Callback<void(const T &new_value)> Callback; - PropertyObserver(std::tr1::shared_ptr<AccessorInterface<T>> accessor, + PropertyObserver(std::shared_ptr<AccessorInterface<T>> accessor, Callback callback) : accessor_(accessor), callback_(callback) { Error unused_error; @@ -49,7 +49,7 @@ class PropertyObserver : public PropertyObserverInterface { private: friend class PropertyObserverTest; - std::tr1::shared_ptr<AccessorInterface<T>> accessor_; + std::shared_ptr<AccessorInterface<T>> accessor_; Callback callback_; T saved_value_; diff --git a/property_store.cc b/property_store.cc index 5620e6d1..6bb5b189 100644 --- a/property_store.cc +++ b/property_store.cc @@ -137,31 +137,31 @@ bool PropertyStore::GetUint64Property(const string &name, bool PropertyStore::SetBoolProperty(const string &name, bool value, Error *error) { - return SetProperty(name, value, error, bool_properties_, "a bool"); + return SetProperty(name, value, error, &bool_properties_, "a bool"); } bool PropertyStore::SetInt16Property(const string &name, int16 value, Error *error) { - return SetProperty(name, value, error, int16_properties_, "an int16"); + return SetProperty(name, value, error, &int16_properties_, "an int16"); } bool PropertyStore::SetInt32Property(const string &name, int32 value, Error *error) { - return SetProperty(name, value, error, int32_properties_, "an int32."); + return SetProperty(name, value, error, &int32_properties_, "an int32."); } bool PropertyStore::SetStringProperty(const string &name, const string &value, Error *error) { - return SetProperty(name, value, error, string_properties_, "a string"); + return SetProperty(name, value, error, &string_properties_, "a string"); } bool PropertyStore::SetStringmapProperty(const string &name, const map<string, string> &values, Error *error) { - return SetProperty(name, values, error, stringmap_properties_, + return SetProperty(name, values, error, &stringmap_properties_, "a string map"); } @@ -169,50 +169,51 @@ bool PropertyStore::SetStringmapsProperty( const string &name, const vector<map<string, string> > &values, Error *error) { - return SetProperty(name, values, error, stringmaps_properties_, + return SetProperty(name, values, error, &stringmaps_properties_, "a stringmaps"); } bool PropertyStore::SetStringsProperty(const string &name, const vector<string> &values, Error *error) { - return SetProperty(name, values, error, strings_properties_, "a string list"); + return SetProperty(name, values, error, &strings_properties_, + "a string list"); } bool PropertyStore::SetUint8Property(const string &name, uint8 value, Error *error) { - return SetProperty(name, value, error, uint8_properties_, "a uint8"); + return SetProperty(name, value, error, &uint8_properties_, "a uint8"); } bool PropertyStore::SetUint16Property(const string &name, uint16 value, Error *error) { - return SetProperty(name, value, error, uint16_properties_, "a uint16"); + return SetProperty(name, value, error, &uint16_properties_, "a uint16"); } bool PropertyStore::SetUint16sProperty(const string &name, const vector<uint16> &value, Error *error) { - return SetProperty(name, value, error, uint16s_properties_, "a uint16 list"); + return SetProperty(name, value, error, &uint16s_properties_, "a uint16 list"); } bool PropertyStore::SetUint32Property(const string &name, uint32 value, Error *error) { - return SetProperty(name, value, error, uint32_properties_, "a uint32"); + return SetProperty(name, value, error, &uint32_properties_, "a uint32"); } bool PropertyStore::SetUint64Property(const string &name, uint64 value, Error *error) { - return SetProperty(name, value, error, uint64_properties_, "a uint64"); + return SetProperty(name, value, error, &uint64_properties_, "a uint64"); } bool PropertyStore::SetRpcIdentifierProperty(const string &name, const RpcIdentifier &value, Error *error) { - return SetProperty(name, value, error, rpc_identifier_properties_, + return SetProperty(name, value, error, &rpc_identifier_properties_, "an rpc_identifier"); } @@ -637,12 +638,12 @@ bool PropertyStore::GetProperty( const string &name, V *value, Error *error, - const map< string, std::tr1::shared_ptr< + const map< string, std::shared_ptr< AccessorInterface<V> > >&collection, const string &value_type_english) const { SLOG(Property, 2) << "Getting " << name << " as " << value_type_english << "."; - typename map< string, std::tr1::shared_ptr< + typename map< string, std::shared_ptr< AccessorInterface<V> > >::const_iterator it = collection.find(name); if (it != collection.end()) { V val = it->second->Get(error); @@ -660,20 +661,20 @@ bool PropertyStore::GetProperty( } } return error->IsSuccess(); -}; +} template <class V> bool PropertyStore::SetProperty( const string &name, const V &value, Error *error, - map< string, std::tr1::shared_ptr< AccessorInterface<V> > >&collection, + map< string, std::shared_ptr< AccessorInterface<V> > >* collection, const string &value_type_english) { bool ret = false; SLOG(Property, 2) << "Setting " << name << " as " << value_type_english << "."; - if (ContainsKey(collection, name)) { - ret = collection[name]->Set(value, error); + if (ContainsKey(*collection, name)) { + ret = (*collection)[name]->Set(value, error); if (ret) { if (!property_changed_callback_.is_null()) { property_changed_callback_.Run(name); @@ -690,6 +691,6 @@ bool PropertyStore::SetProperty( } } return ret; -}; +} } // namespace shill diff --git a/property_store.h b/property_store.h index 326cf04f..cf4eb0b7 100644 --- a/property_store.h +++ b/property_store.h @@ -135,7 +135,7 @@ class PropertyStore { // // |name| is the key used to access the property. If the property // cannot be cleared, |error| is set, and the method returns false. - // Otherwrise, |error| is unchanged, and the method returns true. + // Otherwise, |error| is unchanged, and the method returns true. virtual bool ClearProperty(const std::string &name, Error *error); // Accessors for iterators over property maps. Useful for dumping all @@ -143,12 +143,12 @@ class PropertyStore { ReadablePropertyConstIterator<bool> GetBoolPropertiesIter() const; ReadablePropertyConstIterator<int16> GetInt16PropertiesIter() const; ReadablePropertyConstIterator<int32> GetInt32PropertiesIter() const; - ReadablePropertyConstIterator<KeyValueStore> GetKeyValueStorePropertiesIter( - ) const; - ReadablePropertyConstIterator<RpcIdentifier> GetRpcIdentifierPropertiesIter( - ) const; - ReadablePropertyConstIterator<RpcIdentifiers> GetRpcIdentifiersPropertiesIter( - ) const; + ReadablePropertyConstIterator<KeyValueStore> + GetKeyValueStorePropertiesIter() const; + ReadablePropertyConstIterator<RpcIdentifier> + GetRpcIdentifierPropertiesIter() const; + ReadablePropertyConstIterator<RpcIdentifiers> + GetRpcIdentifiersPropertiesIter() const; ReadablePropertyConstIterator<std::string> GetStringPropertiesIter() const; ReadablePropertyConstIterator<Stringmap> GetStringmapPropertiesIter() const; ReadablePropertyConstIterator<Stringmaps> GetStringmapsPropertiesIter() const; @@ -232,7 +232,7 @@ class PropertyStore { const std::string &name, V *value, Error *error, - const std::map< std::string, std::tr1::shared_ptr< + const std::map< std::string, std::shared_ptr< AccessorInterface<V> > > &collection, const std::string &value_type_english) const; @@ -241,7 +241,7 @@ class PropertyStore { const std::string &name, const V &value, Error *error, - std::map< std::string, std::tr1::shared_ptr< AccessorInterface<V> > > &, + std::map< std::string, std::shared_ptr< AccessorInterface<V> > > *, const std::string &value_type_english); // These are std::maps instead of something cooler because the common diff --git a/proxy_factory.h b/proxy_factory.h index 41bef5d6..f46dc52f 100644 --- a/proxy_factory.h +++ b/proxy_factory.h @@ -50,7 +50,7 @@ class ModemSimpleProxyInterface; class ModemTimeProxyInterface; class SimProxyInterface; -} // namespace mm1 +} // namespace mm1 // Global DBus proxy factory that can be mocked out in tests. class ProxyFactory { diff --git a/resolver_unittest.cc b/resolver_unittest.cc index 5a5dbdc2..f7b14493 100644 --- a/resolver_unittest.cc +++ b/resolver_unittest.cc @@ -35,7 +35,7 @@ const char kExpectedIgnoredSearchOutput[] = "nameserver 8.8.9.9\n" "search google.com\n" "options single-request timeout:1 attempts:5\n"; -} // namespace {} +} // namespace class ResolverTest : public Test { public: diff --git a/routing_table.cc b/routing_table.cc index a08c3a87..bef96d74 100644 --- a/routing_table.cc +++ b/routing_table.cc @@ -19,7 +19,6 @@ #include <string> #include <base/bind.h> -#include <base/containers/hash_tables.h> #include <base/files/file_path.h> #include <base/file_util.h> #include <base/memory/scoped_ptr.h> diff --git a/routing_table.h b/routing_table.h index 5d5556b3..81949a64 100644 --- a/routing_table.h +++ b/routing_table.h @@ -7,10 +7,10 @@ #include <deque> #include <string> +#include <unordered_map> #include <vector> #include <base/callback.h> -#include <base/containers/hash_tables.h> #include <base/lazy_instance.h> #include <base/memory/ref_counted.h> #include <base/memory/scoped_ptr.h> @@ -32,8 +32,7 @@ struct RoutingTableEntry; class RoutingTable { public: typedef std::vector<RoutingTableEntry> TableEntryVector; - typedef base::hash_map<int, TableEntryVector> Tables; // NOLINT - // NOLINT above: hash_map from base, no need to #include <hash_map>. + typedef std::unordered_map<int, TableEntryVector> Tables; struct Query { // Callback::Run(interface_index, entry) diff --git a/routing_table_unittest.cc b/routing_table_unittest.cc index d9391de1..3abdcd17 100644 --- a/routing_table_unittest.cc +++ b/routing_table_unittest.cc @@ -24,7 +24,6 @@ using base::Bind; using base::Callback; using base::Unretained; -using base::hash_map; using std::deque; using std::vector; using testing::_; @@ -59,7 +58,7 @@ class RoutingTableTest : public Test { RTNLHandler::GetInstance()->Stop(); } - hash_map<int, vector<RoutingTableEntry> > *GetRoutingTables() { + std::unordered_map<int, vector<RoutingTableEntry>> *GetRoutingTables() { return &routing_table_->tables_; } @@ -289,8 +288,8 @@ TEST_F(RoutingTableTest, RouteAddDelete) { kTestDeviceIndex0, entry0); - hash_map<int, vector<RoutingTableEntry> > *tables = - GetRoutingTables(); + std::unordered_map<int, vector<RoutingTableEntry>> *tables = + GetRoutingTables(); // We should have a single table, which should in turn have a single entry. EXPECT_EQ(1, tables->size()); @@ -605,7 +604,8 @@ TEST_F(RoutingTableTest, RequestHostRoute) { kTestRequestSeq, RTPROT_UNSPEC); - hash_map<int, vector<RoutingTableEntry> > *tables = GetRoutingTables(); + std::unordered_map<int, vector<RoutingTableEntry>> *tables = + GetRoutingTables(); // We should have a single table, which should in turn have a single entry. EXPECT_EQ(1, tables->size()); diff --git a/rpc_task_dbus_adaptor.h b/rpc_task_dbus_adaptor.h index d1e4dde5..d5422eeb 100644 --- a/rpc_task_dbus_adaptor.h +++ b/rpc_task_dbus_adaptor.h @@ -5,6 +5,9 @@ #ifndef SHILL_RPC_TASK_DBUS_ADAPTOR_H_ #define SHILL_RPC_TASK_DBUS_ADAPTOR_H_ +#include <map> +#include <string> + #include <base/basictypes.h> #include "shill/adaptor_interfaces.h" diff --git a/rpc_task_unittest.cc b/rpc_task_unittest.cc index f7a435b5..5a98eee2 100644 --- a/rpc_task_unittest.cc +++ b/rpc_task_unittest.cc @@ -46,7 +46,6 @@ void RPCTaskTest::GetLogin(string *user, string *password) { void RPCTaskTest::Notify(const string &reason, const map<string, string> &dict) { - notify_calls_++; last_notify_reason_ = reason; last_notify_dict_ = dict; diff --git a/rtnl_handler.h b/rtnl_handler.h index 42e51ac9..197c88d4 100644 --- a/rtnl_handler.h +++ b/rtnl_handler.h @@ -9,7 +9,6 @@ #include <vector> #include <base/callback.h> -#include <base/containers/hash_tables.h> #include <base/lazy_instance.h> #include <base/memory/ref_counted.h> #include <base/memory/scoped_ptr.h> diff --git a/rtnl_message.cc b/rtnl_message.cc index 319fc6f4..76928f3e 100644 --- a/rtnl_message.cc +++ b/rtnl_message.cc @@ -248,12 +248,14 @@ ByteString RTNLMessage::Encode() const { size_t header_length = hdr.hdr.nlmsg_len; ByteString attributes; - base::hash_map<uint16, ByteString>::const_iterator attr; - for (attr = attributes_.begin(); attr != attributes_.end(); ++attr) { + for (auto attr = attributes_.begin(); attr != attributes_.end(); ++attr) { size_t len = RTA_LENGTH(attr->second.GetLength()); hdr.hdr.nlmsg_len = NLMSG_ALIGN(hdr.hdr.nlmsg_len) + RTA_ALIGN(len); - struct rtattr rt_attr = { static_cast<unsigned short>(len), attr->first }; + struct rtattr rt_attr = { + static_cast<unsigned short>(len), // NOLINT(runtime/int) + attr->first + }; ByteString attr_header(reinterpret_cast<unsigned char *>(&rt_attr), sizeof(rt_attr)); attr_header.Resize(RTA_ALIGN(attr_header.GetLength())); diff --git a/rtnl_message.h b/rtnl_message.h index a7eb8e8a..d2d8dafc 100644 --- a/rtnl_message.h +++ b/rtnl_message.h @@ -5,8 +5,9 @@ #ifndef SHILL_RTNL_MESSAGE_ #define SHILL_RTNL_MESSAGE_ +#include <unordered_map> + #include <base/basictypes.h> -#include <base/containers/hash_tables.h> #include <base/stl_util.h> #include "shill/byte_string.h" @@ -19,172 +20,171 @@ namespace shill { struct RTNLHeader; class RTNLMessage { - public: - enum Type { - kTypeUnknown, - kTypeLink, - kTypeAddress, - kTypeRoute - }; - - enum Mode { - kModeUnknown, - kModeGet, - kModeAdd, - kModeDelete, - kModeQuery - }; - - struct LinkStatus { - LinkStatus() - : type(0), - flags(0), - change(0) {} - LinkStatus(unsigned int in_type, - unsigned int in_flags, - unsigned int in_change) - : type(in_type), - flags(in_flags), - change(in_change) {} - unsigned int type; - unsigned int flags; - unsigned int change; - }; - - struct AddressStatus { - AddressStatus() - : prefix_len(0), - flags(0), - scope(0) {} - AddressStatus(unsigned char prefix_len_in, - unsigned char flags_in, - unsigned char scope_in) - : prefix_len(prefix_len_in), - flags(flags_in), - scope(scope_in) {} - unsigned char prefix_len; - unsigned char flags; - unsigned char scope; - }; - - struct RouteStatus { - RouteStatus() - : dst_prefix(0), - src_prefix(0), - table(0), - protocol(0), - scope(0), - type(0), - flags(0) {} - RouteStatus(unsigned char dst_prefix_in, - unsigned char src_prefix_in, - unsigned char table_in, - unsigned char protocol_in, - unsigned char scope_in, - unsigned char type_in, - unsigned char flags_in) - : dst_prefix(dst_prefix_in), - src_prefix(src_prefix_in), - table(table_in), - protocol(protocol_in), - scope(scope_in), - type(type_in), - flags(flags_in) {} - unsigned char dst_prefix; - unsigned char src_prefix; - unsigned char table; - unsigned char protocol; - unsigned char scope; - unsigned char type; - unsigned char flags; - }; - - // Empty constructor - RTNLMessage(); - // Build an RTNL message from arguments - RTNLMessage(Type type, - Mode mode, - unsigned int flags, - uint32 seq, - uint32 pid, - int interface_index, - IPAddress::Family family); - - // Parse an RTNL message. Returns true on success. - bool Decode(const ByteString &data); - // Encode an RTNL message. Returns empty ByteString on failure. - ByteString Encode() const; - // Reset all fields. - void Reset(); - - // Getters and setters - Type type() const { return type_; } - Mode mode() const { return mode_; } - uint16 flags() const { return flags_; } - uint32 seq() const { return seq_; } - void set_seq(uint32 seq) { seq_ = seq; } - uint32 pid() const { return pid_; } - uint32 interface_index() const { return interface_index_; } - IPAddress::Family family() const { return family_; } - - const LinkStatus &link_status() const { return link_status_; } - void set_link_status(const LinkStatus &link_status) { - link_status_ = link_status; - } - const AddressStatus &address_status() const { return address_status_; } - void set_address_status(const AddressStatus &address_status) { - address_status_ = address_status; - } - const RouteStatus &route_status() const { return route_status_; } - void set_route_status(const RouteStatus &route_status) { - route_status_ = route_status; - } - // GLint hates "unsigned short", and I don't blame it, but that's the - // type that's used in the system headers. Use uint16 instead and hope - // that the conversion never ends up truncating on some strange platform. - bool HasAttribute(uint16 attr) const { - return ContainsKey(attributes_, attr); - } - const ByteString GetAttribute(uint16 attr) const { - return HasAttribute(attr) ? - attributes_.find(attr)->second : ByteString(0); - } - void SetAttribute(uint16 attr, const ByteString &val) { - attributes_[attr] = val; - } - - private: - bool DecodeInternal(const ByteString &msg); - bool DecodeLink(const RTNLHeader *hdr, + public: + enum Type { + kTypeUnknown, + kTypeLink, + kTypeAddress, + kTypeRoute + }; + + enum Mode { + kModeUnknown, + kModeGet, + kModeAdd, + kModeDelete, + kModeQuery + }; + + struct LinkStatus { + LinkStatus() + : type(0), + flags(0), + change(0) {} + LinkStatus(unsigned int in_type, + unsigned int in_flags, + unsigned int in_change) + : type(in_type), + flags(in_flags), + change(in_change) {} + unsigned int type; + unsigned int flags; + unsigned int change; + }; + + struct AddressStatus { + AddressStatus() + : prefix_len(0), + flags(0), + scope(0) {} + AddressStatus(unsigned char prefix_len_in, + unsigned char flags_in, + unsigned char scope_in) + : prefix_len(prefix_len_in), + flags(flags_in), + scope(scope_in) {} + unsigned char prefix_len; + unsigned char flags; + unsigned char scope; + }; + + struct RouteStatus { + RouteStatus() + : dst_prefix(0), + src_prefix(0), + table(0), + protocol(0), + scope(0), + type(0), + flags(0) {} + RouteStatus(unsigned char dst_prefix_in, + unsigned char src_prefix_in, + unsigned char table_in, + unsigned char protocol_in, + unsigned char scope_in, + unsigned char type_in, + unsigned char flags_in) + : dst_prefix(dst_prefix_in), + src_prefix(src_prefix_in), + table(table_in), + protocol(protocol_in), + scope(scope_in), + type(type_in), + flags(flags_in) {} + unsigned char dst_prefix; + unsigned char src_prefix; + unsigned char table; + unsigned char protocol; + unsigned char scope; + unsigned char type; + unsigned char flags; + }; + + // Empty constructor + RTNLMessage(); + // Build an RTNL message from arguments + RTNLMessage(Type type, + Mode mode, + unsigned int flags, + uint32 seq, + uint32 pid, + int interface_index, + IPAddress::Family family); + + // Parse an RTNL message. Returns true on success. + bool Decode(const ByteString &data); + // Encode an RTNL message. Returns empty ByteString on failure. + ByteString Encode() const; + // Reset all fields. + void Reset(); + + // Getters and setters + Type type() const { return type_; } + Mode mode() const { return mode_; } + uint16 flags() const { return flags_; } + uint32 seq() const { return seq_; } + void set_seq(uint32 seq) { seq_ = seq; } + uint32 pid() const { return pid_; } + uint32 interface_index() const { return interface_index_; } + IPAddress::Family family() const { return family_; } + + const LinkStatus &link_status() const { return link_status_; } + void set_link_status(const LinkStatus &link_status) { + link_status_ = link_status; + } + const AddressStatus &address_status() const { return address_status_; } + void set_address_status(const AddressStatus &address_status) { + address_status_ = address_status; + } + const RouteStatus &route_status() const { return route_status_; } + void set_route_status(const RouteStatus &route_status) { + route_status_ = route_status; + } + // GLint hates "unsigned short", and I don't blame it, but that's the + // type that's used in the system headers. Use uint16 instead and hope + // that the conversion never ends up truncating on some strange platform. + bool HasAttribute(uint16 attr) const { + return ContainsKey(attributes_, attr); + } + const ByteString GetAttribute(uint16 attr) const { + return HasAttribute(attr) ? + attributes_.find(attr)->second : ByteString(0); + } + void SetAttribute(uint16 attr, const ByteString &val) { + attributes_[attr] = val; + } + + private: + bool DecodeInternal(const ByteString &msg); + bool DecodeLink(const RTNLHeader *hdr, + Mode mode, + rtattr **attr_data, + int *attr_length); + bool DecodeAddress(const RTNLHeader *hdr, + Mode mode, + rtattr **attr_data, + int *attr_length); + bool DecodeRoute(const RTNLHeader *hdr, Mode mode, rtattr **attr_data, int *attr_length); - bool DecodeAddress(const RTNLHeader *hdr, - Mode mode, - rtattr **attr_data, - int *attr_length); - bool DecodeRoute(const RTNLHeader *hdr, - Mode mode, - rtattr **attr_data, - int *attr_length); - bool EncodeLink(RTNLHeader *hdr) const; - bool EncodeAddress(RTNLHeader *hdr) const; - bool EncodeRoute(RTNLHeader *hdr) const; - - Type type_; - Mode mode_; - uint16 flags_; - uint32 seq_; - uint32 pid_; - unsigned int interface_index_; - IPAddress::Family family_; - LinkStatus link_status_; - AddressStatus address_status_; - RouteStatus route_status_; - base::hash_map<uint16, ByteString> attributes_; // NOLINT - // NOLINT above: hash_map from base, no need to #include <hash_map> - - DISALLOW_COPY_AND_ASSIGN(RTNLMessage); + bool EncodeLink(RTNLHeader *hdr) const; + bool EncodeAddress(RTNLHeader *hdr) const; + bool EncodeRoute(RTNLHeader *hdr) const; + + Type type_; + Mode mode_; + uint16 flags_; + uint32 seq_; + uint32 pid_; + unsigned int interface_index_; + IPAddress::Family family_; + LinkStatus link_status_; + AddressStatus address_status_; + RouteStatus route_status_; + std::unordered_map<uint16, ByteString> attributes_; + + DISALLOW_COPY_AND_ASSIGN(RTNLMessage); }; } // namespace shill diff --git a/rtnl_message_unittest.cc b/rtnl_message_unittest.cc index ffb5d309..adbad3af 100644 --- a/rtnl_message_unittest.cc +++ b/rtnl_message_unittest.cc @@ -7,6 +7,8 @@ #include <linux/netlink.h> #include <linux/rtnetlink.h> +#include <string> + #include <gtest/gtest.h> #include "shill/byte_string.h" @@ -347,7 +349,7 @@ const unsigned char kAddNeighborMessage[] = { 0x04, 0x00, 0x00, 0x00, }; -} // namespace {} +} // namespace class RTNLMessageTest : public Test { protected: @@ -7,6 +7,7 @@ #include <time.h> #include <stdio.h> +#include <algorithm> #include <map> #include <string> #include <vector> @@ -658,7 +659,7 @@ void Service::Configure(const KeyValueStore &args, Error *error) { bool Service::DoPropertiesMatch(const KeyValueStore &args) const { SLOG(Service, 5) << "Checking bool properties:"; - for (const auto &bool_it: args.bool_properties()) { + for (const auto &bool_it : args.bool_properties()) { SLOG(Service, 5) << " " << bool_it.first; Error get_error; bool value; @@ -1219,7 +1220,7 @@ bool Service::IsPortalDetectionAuto() const { void Service::HelpRegisterDerivedBool( const string &name, - bool(Service::*get)(Error *), + bool(Service::*get)(Error *error), bool(Service::*set)(const bool&, Error *), void(Service::*clear)(Error *)) { store_.RegisterDerivedBool( @@ -1229,7 +1230,7 @@ void Service::HelpRegisterDerivedBool( void Service::HelpRegisterDerivedInt32( const string &name, - int32(Service::*get)(Error *), + int32(Service::*get)(Error *error), bool(Service::*set)(const int32&, Error *)) { store_.RegisterDerivedInt32( name, @@ -1238,7 +1239,7 @@ void Service::HelpRegisterDerivedInt32( void Service::HelpRegisterDerivedString( const string &name, - string(Service::*get)(Error *), + string(Service::*get)(Error *error), bool(Service::*set)(const string&, Error *)) { store_.RegisterDerivedString( name, @@ -1278,7 +1279,7 @@ void Service::HelpRegisterConstDerivedString( void Service::HelpRegisterObservedDerivedBool( const string &name, - bool(Service::*get)(Error *), + bool(Service::*get)(Error *error), bool(Service::*set)(const bool&, Error *), void(Service::*clear)(Error *)) { BoolAccessor accessor( @@ -799,7 +799,7 @@ class Service : public base::RefCounted<Service> { std::deque<Timestamp> misconnects_; // Failures to connect. base::CancelableClosure reenable_auto_connect_task_; - uint64 auto_connect_cooldown_milliseconds_ ; + uint64 auto_connect_cooldown_milliseconds_; ProfileRefPtr profile_; PropertyStore store_; diff --git a/service_dbus_adaptor.h b/service_dbus_adaptor.h index 18fc738b..f059ac0e 100644 --- a/service_dbus_adaptor.h +++ b/service_dbus_adaptor.h @@ -7,6 +7,7 @@ #include <map> #include <string> +#include <vector> #include <base/basictypes.h> diff --git a/service_property_change_notifier.h b/service_property_change_notifier.h index ef3ffb37..7e8c6793 100644 --- a/service_property_change_notifier.h +++ b/service_property_change_notifier.h @@ -26,7 +26,7 @@ class ServiceAdaptorInterface; // property change notifier. class ServicePropertyChangeNotifier { public: - ServicePropertyChangeNotifier(ServiceAdaptorInterface *adaptor); + explicit ServicePropertyChangeNotifier(ServiceAdaptorInterface *adaptor); virtual ~ServicePropertyChangeNotifier(); virtual void AddBoolPropertyObserver(const std::string &name, diff --git a/service_property_change_test.cc b/service_property_change_test.cc index 4fdcd91c..6dbdc924 100644 --- a/service_property_change_test.cc +++ b/service_property_change_test.cc @@ -171,4 +171,4 @@ void TestCustomSetterNoopChange(ServiceRefPtr service, } } -} // namespace shill +} // namespace shill diff --git a/shims/netfilter_queue_processor.h b/shims/netfilter_queue_processor.h index aa5771b4..f078078b 100644 --- a/shims/netfilter_queue_processor.h +++ b/shims/netfilter_queue_processor.h @@ -9,7 +9,7 @@ #include <sys/time.h> #include <deque> -#include <tr1/memory> +#include <memory> #include <base/basictypes.h> @@ -116,7 +116,7 @@ class NetfilterQueueProcessor { uint32_t destination; }; - typedef std::tr1::shared_ptr<ListenerEntry> ListenerEntryPtr; + typedef std::shared_ptr<ListenerEntry> ListenerEntryPtr; // Called by the netlink_queue code when a packet arrives for the // input queue. diff --git a/socket_info_reader_unittest.cc b/socket_info_reader_unittest.cc index fc4cc5e1..6fb59b8b 100644 --- a/socket_info_reader_unittest.cc +++ b/socket_info_reader_unittest.cc @@ -55,8 +55,8 @@ class SocketInfoReaderUnderTest : public SocketInfoReader { // Mock out GetTcpv4SocketInfoFilePath and GetTcpv6SocketInfoFilePath to // use a temporary created socket info file instead of the actual path // in procfs (i.e. /proc/net/tcp and /proc/net/tcp6). - MOCK_CONST_METHOD0(GetTcpv4SocketInfoFilePath, FilePath ()); - MOCK_CONST_METHOD0(GetTcpv6SocketInfoFilePath, FilePath ()); + MOCK_CONST_METHOD0(GetTcpv4SocketInfoFilePath, FilePath()); + MOCK_CONST_METHOD0(GetTcpv6SocketInfoFilePath, FilePath()); }; class SocketInfoReaderTest : public testing::Test { diff --git a/static_ip_parameters_unittest.cc b/static_ip_parameters_unittest.cc index d5aa6f01..502a0a3c 100644 --- a/static_ip_parameters_unittest.cc +++ b/static_ip_parameters_unittest.cc @@ -34,7 +34,7 @@ static const char kNameServer1[] = "10.0.1.252"; static const char kNameServers[] = "10.0.1.253,10.0.1.252"; static const char kPeerAddress[] = "10.0.0.2"; static const int32 kPrefixLen = 24; -} // namespace {} +} // namespace class StaticIpParametersTest : public Test { public: diff --git a/supplicant_eap_state_handler_unittest.cc b/supplicant_eap_state_handler_unittest.cc index cae11dd4..7416209f 100644 --- a/supplicant_eap_state_handler_unittest.cc +++ b/supplicant_eap_state_handler_unittest.cc @@ -126,7 +126,7 @@ TEST_F(SupplicantEAPStateHandlerTest, EAPFailureRemoteTLSIndication) { TEST_F(SupplicantEAPStateHandlerTest, BadRemoteCertificateVerification) { StartEAP(); const string kStrangeParameter("ennui"); - EXPECT_CALL(log_, Log(logging::LOG_ERROR, _,EndsWith( + EXPECT_CALL(log_, Log(logging::LOG_ERROR, _, EndsWith( string("Unexpected ") + WPASupplicant::kEAPStatusRemoteCertificateVerification + " parameter: " + kStrangeParameter))); @@ -142,7 +142,7 @@ TEST_F(SupplicantEAPStateHandlerTest, BadRemoteCertificateVerification) { TEST_F(SupplicantEAPStateHandlerTest, ParameterNeeded) { StartEAP(); const string kAuthenticationParameter("nudge nudge say no more"); - EXPECT_CALL(log_, Log(logging::LOG_ERROR, _,EndsWith( + EXPECT_CALL(log_, Log(logging::LOG_ERROR, _, EndsWith( string("aborted due to missing authentication parameter: ") + kAuthenticationParameter))); EXPECT_FALSE(handler_.ParseStatus( diff --git a/traffic_monitor.h b/traffic_monitor.h index 4a6ba1aa..adf7c9e7 100644 --- a/traffic_monitor.h +++ b/traffic_monitor.h @@ -10,6 +10,8 @@ #include <gtest/gtest_prod.h> // for FRIEND_TEST #include <map> +#include <string> +#include <vector> #include "shill/connection_info.h" #include "shill/connection_info_reader.h" @@ -27,7 +29,7 @@ class TrafficMonitor { public: // Network problem detected by traffic monitor. enum NetworkProblem { - kNetworkProblemCongestedTxQueue=0, + kNetworkProblemCongestedTxQueue = 0, kNetworkProblemDNSFailure, kNetworkProblemMax }; diff --git a/traffic_monitor_unittest.cc b/traffic_monitor_unittest.cc index 225f2892..a36bffb5 100644 --- a/traffic_monitor_unittest.cc +++ b/traffic_monitor_unittest.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> +#include <vector> + #include "shill/traffic_monitor.h" #include <base/bind.h> @@ -131,13 +134,13 @@ class TrafficMonitorTest : public Test { }; // static -const string TrafficMonitorTest::kLocalIpAddr = "127.0.0.1"; +const string TrafficMonitorTest::kLocalIpAddr = "127.0.0.1"; // NOLINT - string const uint16 TrafficMonitorTest::kLocalPort1 = 1234; const uint16 TrafficMonitorTest::kLocalPort2 = 2345; const uint16 TrafficMonitorTest::kLocalPort3 = 3456; const uint16 TrafficMonitorTest::kLocalPort4 = 4567; const uint16 TrafficMonitorTest::kLocalPort5 = 4567; -const string TrafficMonitorTest::kRemoteIpAddr = "192.168.1.1"; +const string TrafficMonitorTest::kRemoteIpAddr = "192.168.1.1"; // NOLINT - str const uint16 TrafficMonitorTest::kRemotePort = 5678; const uint64 TrafficMonitorTest::kTxQueueLength1 = 111; const uint64 TrafficMonitorTest::kTxQueueLength2 = 222; diff --git a/virtual_device.cc b/virtual_device.cc index 7de67a38..167c4e6d 100644 --- a/virtual_device.cc +++ b/virtual_device.cc @@ -16,7 +16,7 @@ namespace shill { namespace { const char kHardwareAddressEmpty[] = ""; -} // namespace {} +} // namespace VirtualDevice::VirtualDevice(ControlInterface *control, EventDispatcher *dispatcher, diff --git a/virtual_device.h b/virtual_device.h index 013f2d96..5943a3b9 100644 --- a/virtual_device.h +++ b/virtual_device.h @@ -5,6 +5,8 @@ #ifndef SHILL_VIRTUAL_DEVICE_H_ #define SHILL_VIRTUAL_DEVICE_H_ +#include <string> + #include <base/basictypes.h> #include "shill/device.h" diff --git a/virtual_device_unittest.cc b/virtual_device_unittest.cc index eeba1446..2eb27b2a 100644 --- a/virtual_device_unittest.cc +++ b/virtual_device_unittest.cc @@ -26,7 +26,7 @@ namespace shill { namespace { const char kTestDeviceName[] = "tun0"; const int kTestInterfaceIndex = 5; -} // namespace {} +} // namespace class VirtualDeviceTest : public testing::Test { public: diff --git a/vpn_driver.h b/vpn_driver.h index e9f521d9..b5ebc92a 100644 --- a/vpn_driver.h +++ b/vpn_driver.h @@ -6,6 +6,7 @@ #define SHILL_VPN_DRIVER_H_ #include <string> +#include <vector> #include <base/basictypes.h> #include <base/cancelable_callback.h> diff --git a/vpn_driver_unittest.cc b/vpn_driver_unittest.cc index de2f2b50..b851c490 100644 --- a/vpn_driver_unittest.cc +++ b/vpn_driver_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <vector> + #include "shill/vpn_driver.h" #include <base/stl_util.h> diff --git a/vpn_provider_unittest.cc b/vpn_provider_unittest.cc index c63e5055..e3135621 100644 --- a/vpn_provider_unittest.cc +++ b/vpn_provider_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <set> + #include "shill/vpn_provider.h" #include <chromeos/dbus/service_constants.h> diff --git a/vpn_service.h b/vpn_service.h index 13e8d9cd..b6dc7b5e 100644 --- a/vpn_service.h +++ b/vpn_service.h @@ -5,6 +5,8 @@ #ifndef SHILL_VPN_SERVICE_ #define SHILL_VPN_SERVICE_ +#include <string> + #include <base/memory/scoped_ptr.h> #include <gtest/gtest_prod.h> // for FRIEND_TEST diff --git a/vpn_service_unittest.cc b/vpn_service_unittest.cc index dfb98f58..50f6d2a5 100644 --- a/vpn_service_unittest.cc +++ b/vpn_service_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include "shill/vpn_service.h" #include <chromeos/dbus/service_constants.h> @@ -892,7 +892,7 @@ void WiFi::HandleDisconnect() { RestartFastScanAttempts(); } -void WiFi::ServiceDisconnected(WiFiServiceRefPtr affected_service){ +void WiFi::ServiceDisconnected(WiFiServiceRefPtr affected_service) { // Check if service was explicitly disconnected due to failure or // is explicitly disconnected by user. if (!affected_service->IsInFailState() && @@ -2441,7 +2441,7 @@ void WiFi::OnReceivedStationInfo(const Nl80211Message &nl80211_message) { if (transmit_info->GetU16AttributeValue( NL80211_RATE_INFO_BITRATE, &u16_rate)) { - rate = (uint32) u16_rate; + rate = static_cast<uint32>(u16_rate); } else { transmit_info->GetU32AttributeValue(NL80211_RATE_INFO_BITRATE32, &rate); } diff --git a/wifi_endpoint.cc b/wifi_endpoint.cc index 677321d2..d6a13f0f 100644 --- a/wifi_endpoint.cc +++ b/wifi_endpoint.cc @@ -19,7 +19,6 @@ #include "shill/supplicant_bss_proxy_interface.h" #include "shill/tethering.h" #include "shill/wifi.h" -#include "shill/wifi_endpoint.h" #include "shill/wpa_supplicant.h" using base::StringPrintf; @@ -130,7 +129,7 @@ void WiFiEndpoint::PropertiesChanged( } void WiFiEndpoint::UpdateSignalStrength(int16 strength) { - if (signal_strength_ == strength ) { + if (signal_strength_ == strength) { return; } @@ -299,7 +298,7 @@ WiFiEndpoint *WiFiEndpoint::MakeEndpoint(ProxyFactory *proxy_factory, } return new WiFiEndpoint( - proxy_factory, wifi, bssid, args); // |bssid| fakes an RPC ID + proxy_factory, wifi, bssid, args); // |bssid| fakes an RPC ID } // static diff --git a/wifi_endpoint.h b/wifi_endpoint.h index c8ff3143..0e4ec88a 100644 --- a/wifi_endpoint.h +++ b/wifi_endpoint.h @@ -115,7 +115,7 @@ class WiFiEndpoint : public Endpoint { FRIEND_TEST(WiFiServiceTest, GetTethering); FRIEND_TEST(WiFiServiceUpdateFromEndpointsTest, EndpointModified); FRIEND_TEST(WiFiServiceUpdateFromEndpointsTest, Ieee80211w); - // for physical_mode_ + // for physical_mode_ FRIEND_TEST(WiFiServiceUpdateFromEndpointsTest, PhysicalMode); enum KeyManagement { diff --git a/wifi_provider.h b/wifi_provider.h index 7594f88d..7b5973e4 100644 --- a/wifi_provider.h +++ b/wifi_provider.h @@ -9,6 +9,8 @@ #include <deque> #include <map> +#include <string> +#include <vector> #include <gtest/gtest_prod.h> // for FRIEND_TEST diff --git a/wifi_service.cc b/wifi_service.cc index ffadedf0..287c7b33 100644 --- a/wifi_service.cc +++ b/wifi_service.cc @@ -492,7 +492,7 @@ void WiFiService::HelpRegisterDerivedString( void WiFiService::HelpRegisterWriteOnlyDerivedString( const string &name, bool(WiFiService::*set)(const string &, Error *), - void(WiFiService::*clear)(Error *), + void(WiFiService::*clear)(Error *error), const string *default_value) { mutable_store()->RegisterDerivedString( name, @@ -859,7 +859,7 @@ void WiFiService::ParseWEPPassphrase(const string &passphrase, case IEEE_80211::kWEP40AsciiLen + 2: case IEEE_80211::kWEP104AsciiLen + 2: if (CheckWEPKeyIndex(passphrase, error)) { - base::StringToInt(passphrase.substr(0,1), &key_index_local); + base::StringToInt(passphrase.substr(0, 1), &key_index_local); password_text = passphrase.substr(2); } break; @@ -873,9 +873,9 @@ void WiFiService::ParseWEPPassphrase(const string &passphrase, break; case IEEE_80211::kWEP40HexLen + 2: case IEEE_80211::kWEP104HexLen + 2: - if(CheckWEPKeyIndex(passphrase, error) && + if (CheckWEPKeyIndex(passphrase, error) && CheckWEPIsHex(passphrase.substr(2), error)) { - base::StringToInt(passphrase.substr(0,1), &key_index_local); + base::StringToInt(passphrase.substr(0, 1), &key_index_local); password_text = passphrase.substr(2); is_hex = true; } else if (CheckWEPPrefix(passphrase, error) && @@ -890,7 +890,7 @@ void WiFiService::ParseWEPPassphrase(const string &passphrase, if (CheckWEPKeyIndex(passphrase, error) && CheckWEPPrefix(passphrase.substr(2), error) && CheckWEPIsHex(passphrase.substr(4), error)) { - base::StringToInt(passphrase.substr(0,1), &key_index_local); + base::StringToInt(passphrase.substr(0, 1), &key_index_local); password_text = passphrase.substr(4); is_hex = true; } diff --git a/wifi_service.h b/wifi_service.h index 1ae7db5c..9e0319db 100644 --- a/wifi_service.h +++ b/wifi_service.h @@ -175,7 +175,7 @@ class WiFiService : public Service { FRIEND_TEST(MetricsTest, WiFiServicePostReadyAdHoc); FRIEND_TEST(MetricsTest, WiFiServicePostReadyEAP); FRIEND_TEST(WiFiMainTest, CurrentBSSChangedUpdateServiceEndpoint); - FRIEND_TEST(WiFiProviderTest, OnEndpointAddedWithSecurity); // security_ + FRIEND_TEST(WiFiProviderTest, OnEndpointAddedWithSecurity); // security_ FRIEND_TEST(WiFiServiceTest, AutoConnect); FRIEND_TEST(WiFiServiceTest, ClearWriteOnlyDerivedProperty); // passphrase_ FRIEND_TEST(WiFiServiceTest, ComputeCipher8021x); diff --git a/wifi_service_unittest.cc b/wifi_service_unittest.cc index be612511..9f4f3afb 100644 --- a/wifi_service_unittest.cc +++ b/wifi_service_unittest.cc @@ -4,6 +4,7 @@ #include "shill/wifi_service.h" +#include <limits> #include <map> #include <set> #include <string> diff --git a/wifi_unittest.cc b/wifi_unittest.cc index fdd38642..46e6cb4c 100644 --- a/wifi_unittest.cc +++ b/wifi_unittest.cc @@ -1742,7 +1742,6 @@ TEST_F(WiFiMainTest, DisconnectCurrentServiceWithPending) { EXPECT_CALL(*service0, SetState(Service::kStateIdle)).Times(AtLeast(1)); EXPECT_CALL(*service0, SetFailure(_)).Times(0); ReportCurrentBSSChanged(WPASupplicant::kCurrentBSSNull); - } TEST_F(WiFiMainTest, TimeoutPendingServiceWithEndpoints) { @@ -4,6 +4,8 @@ #include "shill/wimax.h" +#include <string> + #include <base/bind.h> #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> @@ -6,6 +6,7 @@ #define SHILL_WIMAX_H_ #include <set> +#include <string> #include <base/cancelable_callback.h> #include <base/memory/weak_ptr.h> diff --git a/wimax_device_proxy.h b/wimax_device_proxy.h index 92e3062c..11dc6030 100644 --- a/wimax_device_proxy.h +++ b/wimax_device_proxy.h @@ -5,6 +5,9 @@ #ifndef SHILL_WIMAX_DEVICE_PROXY_H_ #define SHILL_WIMAX_DEVICE_PROXY_H_ +#include <string> +#include <vector> + #include <base/callback.h> #include "wimax_manager/dbus_proxies/org.chromium.WiMaxManager.Device.h" diff --git a/wimax_manager_proxy.h b/wimax_manager_proxy.h index f271a532..6f327610 100644 --- a/wimax_manager_proxy.h +++ b/wimax_manager_proxy.h @@ -5,6 +5,7 @@ #ifndef SHILL_WIMAX_MANAGER_PROXY_H_ #define SHILL_WIMAX_MANAGER_PROXY_H_ +#include <string> #include <vector> #include <base/basictypes.h> diff --git a/wimax_network_proxy.h b/wimax_network_proxy.h index a1cab4f3..84503cf5 100644 --- a/wimax_network_proxy.h +++ b/wimax_network_proxy.h @@ -5,6 +5,8 @@ #ifndef SHILL_WIMAX_NETWORK_PROXY_H_ #define SHILL_WIMAX_NETWORK_PROXY_H_ +#include <string> + #include <base/callback.h> #include "wimax_manager/dbus_proxies/org.chromium.WiMaxManager.Network.h" diff --git a/wimax_provider.h b/wimax_provider.h index d8187b31..73ae1e11 100644 --- a/wimax_provider.h +++ b/wimax_provider.h @@ -6,6 +6,7 @@ #define SHILL_WIMAX_PROVIDER_H_ #include <map> +#include <string> #include <base/basictypes.h> #include <base/memory/scoped_ptr.h> diff --git a/wimax_service.h b/wimax_service.h index 9f0ef46c..b18ff4af 100644 --- a/wimax_service.h +++ b/wimax_service.h @@ -5,6 +5,8 @@ #ifndef SHILL_WIMAX_SERVICE_H_ #define SHILL_WIMAX_SERVICE_H_ +#include <string> + #include <gtest/gtest_prod.h> // for FRIEND_TEST #include "shill/refptr_types.h" diff --git a/wimax_service_unittest.cc b/wimax_service_unittest.cc index c9f65d3c..ec22cc41 100644 --- a/wimax_service_unittest.cc +++ b/wimax_service_unittest.cc @@ -4,6 +4,8 @@ #include "shill/wimax_service.h" +#include <string> + #include <base/strings/string_util.h> #include <chromeos/dbus/service_constants.h> #include <gtest/gtest.h> |