update_engine: fixed remaining linter and some spelling errors
Fixed remaining errors from cpplint as well as some spelling errors
mostly in comments.
BUG=None
TEST=FEATURES=test emerge-link update_engine
Change-Id: I484988ab846ac5a3c68c016ddccfb247f225ec27
Reviewed-on: https://chromium-review.googlesource.com/208897
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc
index 512f7a8..8200879 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -137,7 +137,7 @@
string BoxedValue::ValuePrinter<Stage>(const void *value) {
const Stage* val = reinterpret_cast<const Stage*>(value);
switch (*val) {
- case Stage::kIdle:
+ case Stage::kIdle:
return "Idle";
case Stage::kCheckingForUpdate:
return "Checking For Update";
diff --git a/update_manager/boxed_value.h b/update_manager/boxed_value.h
index 2ce24e9..4b8517f 100644
--- a/update_manager/boxed_value.h
+++ b/update_manager/boxed_value.h
@@ -14,12 +14,12 @@
// BoxedValue is a class to hold pointers of a given type that deletes them when
// the instance goes out of scope, as scoped_ptr<T> does. The main difference
// with it is that the type T is not part of the class, i.e., this isn't a
-// parametric class. The class has a parametric contructor that accepts a
+// parametric class. The class has a parametric constructor that accepts a
// const T* which will define the type of the object passed on delete.
//
// It is safe to use this class in linked containers such as std::list and
// std::map but the object can't be copied. This means that you need to
-// construct the BoxedValue inplace using a container method like emplace()
+// construct the BoxedValue in place using a container method like emplace()
// or move it with std::move().
//
// list<BoxedValue> lst;
@@ -54,10 +54,10 @@
// The move constructor takes ownership of the pointer since the semantics of
// it allows to render the passed BoxedValue undefined. You need to use the
- // move constructor explictly preventing it from accidental references,
+ // move constructor explicitly preventing it from accidental references,
// like in:
// BoxedValue new_box(std::move(other_box));
- BoxedValue(BoxedValue&& other)
+ BoxedValue(BoxedValue&& other) // NOLINT(build/c++11)
: value_(other.value_), deleter_(other.deleter_),
printer_(other.printer_) {
other.value_ = NULL;
diff --git a/update_manager/boxed_value_unittest.cc b/update_manager/boxed_value_unittest.cc
index b42b361..1b03cdd 100644
--- a/update_manager/boxed_value_unittest.cc
+++ b/update_manager/boxed_value_unittest.cc
@@ -28,7 +28,7 @@
// The DeleterMarker flags a bool variable when the class is destroyed.
class DeleterMarker {
public:
- DeleterMarker(bool* marker) : marker_(marker) { *marker_ = false; }
+ explicit DeleterMarker(bool* marker) : marker_(marker) { *marker_ = false; }
~DeleterMarker() { *marker_ = true; }
@@ -74,7 +74,7 @@
TEST(UmBoxedValueTest, MixedList) {
list<BoxedValue> lst;
// This is mostly a compile test.
- lst.emplace_back(new const int(42));
+ lst.emplace_back(new const int(42)); // NOLINT(readability/casting)
lst.emplace_back(new const string("Hello world!"));
bool marker;
lst.emplace_back(new const DeleterMarker(&marker));
@@ -103,14 +103,15 @@
}
TEST(UmBoxedValueTest, Int64ToString) {
- // -123456789012345 doensn't fit in 32-bit integers.
+ // -123456789012345 doesn't fit in 32-bit integers.
EXPECT_EQ("-123456789012345", BoxedValue(
new int64_t(-123456789012345LL)).ToString());
}
TEST(UmBoxedValueTest, UnsignedIntToString) {
// 4294967295 is the biggest possible 32-bit unsigned integer.
- EXPECT_EQ("4294967295", BoxedValue(new unsigned int(4294967295U)).ToString());
+ EXPECT_EQ("4294967295",
+ BoxedValue(new unsigned int(4294967295U)).ToString()); // NOLINT
}
TEST(UmBoxedValueTest, UnsignedInt64ToString) {
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index 98095bf..cba74e2 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -75,7 +75,7 @@
// chances of downloading from the URLs that appear earlier in the response
// (because download from a local server URL that appears earlier in a
// response is preferable than downloading from the next URL which could be
- // a internet URL and thus could be more expensive).
+ // an Internet URL and thus could be more expensive).
case ErrorCode::kError:
case ErrorCode::kDownloadTransferError:
case ErrorCode::kDownloadWriteError:
@@ -94,7 +94,7 @@
// regular retries at the next update check.
// 2. We have successfully downloaded the payload: In this case, the
// payload attempt number would have been incremented and would take care
- // of the backoff at the next update check.
+ // of the back-off at the next update check.
// In either case, there's no need to update URL index or failure count.
case ErrorCode::kOmahaRequestError:
case ErrorCode::kOmahaResponseHandlerError:
@@ -449,7 +449,7 @@
int interval = *server_dictated_poll_interval;
int fuzz = 0;
- // If no poll interval was dictated by server compute a backoff period,
+ // If no poll interval was dictated by server compute a back-off period,
// starting from a predetermined base periodic interval and increasing
// exponentially by the number of consecutive failed attempts.
if (interval == 0) {
@@ -465,11 +465,11 @@
}
}
- // We cannot backoff longer than the predetermined maximum interval.
+ // We cannot back off longer than the predetermined maximum interval.
if (interval > kTimeoutMaxBackoffInterval)
interval = kTimeoutMaxBackoffInterval;
- // We cannot backoff shorter than the predetermined periodic interval. Also,
+ // We cannot back off shorter than the predetermined periodic interval. Also,
// in this case set the fuzz to a predetermined regular value.
if (interval <= kTimeoutPeriodicInterval) {
interval = kTimeoutPeriodicInterval;
diff --git a/update_manager/chromeos_policy.h b/update_manager/chromeos_policy.h
index 9c9fe9d..c954f9d 100644
--- a/update_manager/chromeos_policy.h
+++ b/update_manager/chromeos_policy.h
@@ -112,9 +112,9 @@
// number of failures associated with that URL; and |download_url_error_codes|
// the list of failures occurring since the latest evaluation.
//
- // Upon successly deciding a URL to use, returns |EvalStatus::kSucceeded| and
- // writes the current URL index and the number of failures associated with it
- // in |result|. Otherwise, returns |EvalStatus::kFailed|.
+ // Upon successfully deciding a URL to use, returns |EvalStatus::kSucceeded|
+ // and writes the current URL index and the number of failures associated with
+ // it in |result|. Otherwise, returns |EvalStatus::kFailed|.
EvalStatus UpdateDownloadUrl(EvaluationContext* ec, State* state,
std::string* error,
UpdateDownloadUrlResult* result,
diff --git a/update_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
index 9ea2d6a..ef609c1 100644
--- a/update_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -293,7 +293,7 @@
}
TEST_F(UmChromeOSPolicyTest, UpdateCheckAllowedWaitsForOOBE) {
- // Update checks are defferred until OOBE is completed.
+ // Update checks are deferred until OOBE is completed.
// Ensure that update is not allowed even if wait period is satisfied.
Time next_update_check;
@@ -329,7 +329,7 @@
}
TEST_F(UmChromeOSPolicyTest, UpdateCheckAllowedWithAttributes) {
- // Update check is allowed, reponse includes attributes for use in the
+ // Update check is allowed, response includes attributes for use in the
// request.
SetUpdateCheckAllowed(true);
diff --git a/update_manager/device_policy_provider.h b/update_manager/device_policy_provider.h
index b39a7db..ba5d4d9 100644
--- a/update_manager/device_policy_provider.h
+++ b/update_manager/device_policy_provider.h
@@ -37,7 +37,7 @@
// Returns a non-negative scatter interval used for updates.
virtual Variable<base::TimeDelta>* var_scatter_factor() = 0;
- // Variable returing the set of connection types allowed for updates. The
+ // Variable returning the set of connection types allowed for updates. The
// identifiers returned are consistent with the ones returned by the
// ShillProvider.
virtual Variable<std::set<ConnectionType>>*
diff --git a/update_manager/evaluation_context.h b/update_manager/evaluation_context.h
index c277178..9ed6f26 100644
--- a/update_manager/evaluation_context.h
+++ b/update_manager/evaluation_context.h
@@ -43,7 +43,7 @@
//
// ...
// // Run a closure when any of the used async variables changes its value or
-// // the timeout for requery the values happens again.
+// // the timeout for re-query the values happens again.
// ec->RunOnValueChangeOrTimeout(closure);
// // If the provided |closure| wants to re-evaluate the policy, it should
// // call ec->ResetEvaluation() to start a new evaluation.
@@ -132,7 +132,8 @@
// A callback used for triggering re-evaluation upon a value change or poll
// timeout, or notifying about the evaluation context expiration. It is up to
- // the caller to determine whether or not expiration occured via is_expired().
+ // the caller to determine whether or not expiration occurred via
+ // is_expired().
scoped_ptr<base::Closure> callback_;
// The EventId returned by the event loop identifying the timeout callback.
diff --git a/update_manager/event_loop.h b/update_manager/event_loop.h
index 129761c..c639f88 100644
--- a/update_manager/event_loop.h
+++ b/update_manager/event_loop.h
@@ -18,7 +18,7 @@
typedef guint EventId;
-// A null EventId doesn't idenify any valid event.
+// A null EventId doesn't identify any valid event.
static constexpr EventId kEventIdNull = 0;
// Schedules the passed |callback| to run from the GLib's main loop after a
diff --git a/update_manager/fake_state.h b/update_manager/fake_state.h
index eaaf68e..f47aa78 100644
--- a/update_manager/fake_state.h
+++ b/update_manager/fake_state.h
@@ -33,7 +33,7 @@
virtual ~FakeState() {}
- // Downcasted detters to access the fake instances during testing.
+ // Downcasted getters to access the fake instances during testing.
virtual FakeConfigProvider* config_provider() override {
return &config_provider_;
}
diff --git a/update_manager/generic_variables.h b/update_manager/generic_variables.h
index 9d00b7e..ad9f0c1 100644
--- a/update_manager/generic_variables.h
+++ b/update_manager/generic_variables.h
@@ -153,7 +153,7 @@
// SetValue and UnsetValue to modify the current value of the variable and
// notify the registered observers whenever the value changed.
//
-// The type T needs to be copy-constructable, default-constructable and have an
+// The type T needs to be copy-constructible, default-constructible and have an
// operator== (to determine if the value changed), which makes this class
// suitable for basic types.
template<typename T>
diff --git a/update_manager/generic_variables_unittest.cc b/update_manager/generic_variables_unittest.cc
index 51ae4bd..bbf3996 100644
--- a/update_manager/generic_variables_unittest.cc
+++ b/update_manager/generic_variables_unittest.cc
@@ -70,7 +70,7 @@
TEST_F(UmPollCopyVariableTest, UseCopyConstructorTest) {
- // Ensures that CopyVariables indeed uses the copy contructor.
+ // Ensures that CopyVariables indeed uses the copy constructor.
const CopyConstructorTestClass source;
ASSERT_FALSE(source.copied_);
diff --git a/update_manager/policy.cc b/update_manager/policy.cc
index 41ff8c1..5572974 100644
--- a/update_manager/policy.cc
+++ b/update_manager/policy.cc
@@ -22,4 +22,4 @@
return "Invalid";
}
-} // namespace chromeos_update_engine
+} // namespace chromeos_update_manager
diff --git a/update_manager/policy.h b/update_manager/policy.h
index 64869c0..df21fde 100644
--- a/update_manager/policy.h
+++ b/update_manager/policy.h
@@ -162,7 +162,7 @@
// that need to be persisted has changed, returns
// EvalStatus::kAskMeAgainLater. Arguments include an |interactive| flag that
// tells whether the update is user initiated, and an |update_state| that
- // encapsulates data pertaining to the currnet ongoing update process.
+ // encapsulates data pertaining to the current ongoing update process.
virtual EvalStatus UpdateCanStart(
EvaluationContext* ec,
State* state,
diff --git a/update_manager/real_device_policy_provider_unittest.cc b/update_manager/real_device_policy_provider_unittest.cc
index 3b3d3e9..91453d9 100644
--- a/update_manager/real_device_policy_provider_unittest.cc
+++ b/update_manager/real_device_policy_provider_unittest.cc
@@ -123,7 +123,7 @@
UmTestUtils::ExpectVariableHasValue(true,
provider_->var_device_policy_is_loaded());
- // Test that at least one variable is set, to ensure the refresh ocurred.
+ // Test that at least one variable is set, to ensure the refresh occurred.
UmTestUtils::ExpectVariableHasValue(string("mychannel"),
provider_->var_release_channel());
UmTestUtils::ExpectVariableNotSet(
diff --git a/update_manager/real_random_provider.cc b/update_manager/real_random_provider.cc
index c151c4f..abbeed7 100644
--- a/update_manager/real_random_provider.cc
+++ b/update_manager/real_random_provider.cc
@@ -5,6 +5,8 @@
#include <stdio.h>
#include <unistd.h>
+#include <string>
+
#include <base/files/file_path.h>
#include <base/files/scoped_file.h>
#include <base/strings/stringprintf.h>
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index faa6e05..3468517 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -65,7 +65,7 @@
virtual void SetUp() {
// By default, initialize the provider so that it gets an initial connection
// status from shill. This simulates the common case where shill is
- // available and respoding during RealShillProvider initialization.
+ // available and responding during RealShillProvider initialization.
Init(true);
}
@@ -121,7 +121,7 @@
SetupGetPropertiesFail(kFakeManagerProxy);
}
- // Check that provider initializes corrrectly.
+ // Check that provider initializes correctly.
ASSERT_TRUE(provider_->Init());
// All mocked calls should have been exercised by now.
diff --git a/update_manager/real_time_provider.cc b/update_manager/real_time_provider.cc
index 9067bdd..e9ac3c2 100644
--- a/update_manager/real_time_provider.cc
+++ b/update_manager/real_time_provider.cc
@@ -4,6 +4,8 @@
#include "update_engine/update_manager/real_time_provider.h"
+#include <string>
+
#include <base/time/time.h>
#include "update_engine/clock_interface.h"
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index 6c4c435..6e34fe4 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -66,7 +66,7 @@
fake_clock_ = fake_sys_state_.fake_clock();
provider_.reset(new RealUpdaterProvider(&fake_sys_state_));
UMTEST_ASSERT_NOT_NULL(provider_.get());
- // Check that provider initializes corrrectly.
+ // Check that provider initializes correctly.
ASSERT_TRUE(provider_->Init());
}
diff --git a/update_manager/shill_provider.h b/update_manager/shill_provider.h
index a275b07..b7e47b6 100644
--- a/update_manager/shill_provider.h
+++ b/update_manager/shill_provider.h
@@ -44,7 +44,7 @@
// not connected.
virtual Variable<ConnectionTethering>* var_conn_tethering() = 0;
- // A variable retruning the time when network connection last changed.
+ // A variable returning the time when network connection last changed.
// Initialized to current time.
virtual Variable<base::Time>* var_conn_last_changed() = 0;
diff --git a/update_manager/update_manager-inl.h b/update_manager/update_manager-inl.h
index b5d3651..982ec93 100644
--- a/update_manager/update_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -105,7 +105,7 @@
R* result, ActualArgs... args) {
scoped_refptr<EvaluationContext> ec(
new EvaluationContext(clock_, evaluation_timeout_));
- // A PolicyRequest allways consists on a single evaluation on a new
+ // A PolicyRequest always consists on a single evaluation on a new
// EvaluationContext.
// IMPORTANT: To ensure that ActualArgs can be converted to ExpectedArgs, we
// explicitly instantiate EvaluatePolicy with the latter in lieu of the
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index 7040a34..8f81be5 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -106,7 +106,7 @@
// A policy that sleeps and returns EvalStatus::kAskMeAgainlater. Will check
// that time is greater than a given threshold (if non-zero). Increments a
-// counter every time it is being querie, if a pointer to it is provided.
+// counter every time it is being queried, if a pointer to it is provided.
class DelayPolicy : public DefaultPolicy {
public:
DelayPolicy(int sleep_secs, base::Time time_threshold, int* num_called_p)
diff --git a/update_manager/variable.h b/update_manager/variable.h
index de8b523..e90d07e 100644
--- a/update_manager/variable.h
+++ b/update_manager/variable.h
@@ -40,7 +40,7 @@
};
// This class is a base class with the common functionality that doesn't
-// deppend on the variable's type, implemented by all the variables.
+// depend on the variable's type, implemented by all the variables.
class BaseVariable {
public:
// Interface for observing changes on variable value.