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/action_processor.h b/action_processor.h
index 61fd29f..adc4781 100644
--- a/action_processor.h
+++ b/action_processor.h
@@ -17,7 +17,7 @@
// a big thanks to that team for their high quality design, implementation,
// and documentation.
-// See action.h for an overview of this class and other other Action* classes.
+// See action.h for an overview of this class and other Action* classes.
// An ActionProcessor keeps a queue of Actions and processes them in order.
@@ -67,7 +67,7 @@
// they'll be processed.
std::deque<AbstractAction*> actions_;
- // A pointer to the currrently processing Action, if any.
+ // A pointer to the currently processing Action, if any.
AbstractAction* current_action_;
// A pointer to the delegate, or NULL if none.
diff --git a/constants.h b/constants.h
index 6eac886..05909fa 100644
--- a/constants.h
+++ b/constants.h
@@ -125,7 +125,7 @@
// The minimum average speed that downloads must sustain...
//
// This is set low because some devices may have very poor
-// connecticity and we want to make as much forward progress as
+// connectivity and we want to make as much forward progress as
// possible. For p2p this is high (25 kB/second) since we can assume
// high bandwidth (same LAN) and we want to fail fast.
const int kDownloadLowSpeedLimitBps = 1;
diff --git a/dbus_service.h b/dbus_service.h
index c546316..47953cb 100644
--- a/dbus_service.h
+++ b/dbus_service.h
@@ -164,7 +164,7 @@
gint64 new_size);
// Returns the version string of OS that was used before the last reboot
-// into an updated version. This is avalable only when rebooting into an
+// into an updated version. This is available only when rebooting into an
// update from previous version, otherwise an empty string is returned.
gboolean update_engine_service_get_prev_version(
UpdateEngineService* self,
diff --git a/delta_performer.h b/delta_performer.h
index 189fe3a..c663208 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -210,7 +210,7 @@
const DeltaArchiveManifest_InstallOperation& op);
// Verifies that the expected source partition hashes (if present) match the
- // hashes for the current partitions. Returns true if there're no expected
+ // hashes for the current partitions. Returns true if there are no expected
// hashes in the payload (e.g., if it's a new-style full update) or if the
// hashes match; returns false otherwise.
bool VerifySourcePartitions();
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index c2e4667..d68aa25 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -1264,7 +1264,7 @@
//
// 1. Whether it's an official build; and
// 2. Whether the Public RSA key to be used is in the root filesystem; and
- // 3. Whether the reponse has a public key
+ // 3. Whether the response has a public key
//
// We test all eight combinations to ensure that we only use the
// public key in the response if
diff --git a/fake_prefs.h b/fake_prefs.h
index 62cf738..240856a 100644
--- a/fake_prefs.h
+++ b/fake_prefs.h
@@ -52,7 +52,7 @@
PrefValue value;
};
- // Class to store compile-time type dependant constants.
+ // Class to store compile-time type-dependent constants.
template<typename T>
class PrefConsts {
public:
diff --git a/file_writer.h b/file_writer.h
index e2083c3..70d4778 100644
--- a/file_writer.h
+++ b/file_writer.h
@@ -31,7 +31,7 @@
virtual int Open(const char* path, int flags, mode_t mode) = 0;
// Wrapper around write. Returns true if all requested bytes
- // were written, or false on any error, reguardless of progress.
+ // were written, or false on any error, regardless of progress.
virtual bool Write(const void* bytes, size_t count) = 0;
// Same as the Write method above but returns a detailed |error| code
diff --git a/filesystem_copier_action_unittest.cc b/filesystem_copier_action_unittest.cc
index 4d67b5e..024b743 100644
--- a/filesystem_copier_action_unittest.cc
+++ b/filesystem_copier_action_unittest.cc
@@ -53,7 +53,7 @@
void ExitMainLoop() {
GMainContext* context = g_main_loop_get_context(loop_);
// We cannot use g_main_context_pending() alone to determine if it is safe
- // to quit the main loop here becasuse g_main_context_pending() may return
+ // to quit the main loop here because g_main_context_pending() may return
// FALSE when g_input_stream_read_async() in FilesystemCopierAction has
// been cancelled but the callback has not yet been invoked.
while (g_main_context_pending(context) || action_->IsCleanupPending()) {
@@ -107,7 +107,7 @@
// TODO(garnold) Temporarily disabling this test, see chromium-os:31082 for
// details; still trying to track down the root cause for these rare write
// failures and whether or not they are due to the test setup or an inherent
-// issue with the chroot environiment, library versions we use, etc.
+// issue with the chroot environment, library versions we use, etc.
TEST_F(FilesystemCopierActionTest, DISABLED_RunAsRootSimpleTest) {
ASSERT_EQ(0, getuid());
bool test = DoTest(false, false, true, 0);
diff --git a/hardware.cc b/hardware.cc
index 0ffd58f..a83d1b3 100644
--- a/hardware.cc
+++ b/hardware.cc
@@ -85,7 +85,7 @@
std::string disk_name = utils::GetDiskName(Hardware::BootKernelDevice());
if (disk_name.empty()) {
- LOG(ERROR) << "Failed to get the cuurent kernel boot disk name";
+ LOG(ERROR) << "Failed to get the current kernel boot disk name";
return std::vector<std::string>();
}
diff --git a/metrics.cc b/metrics.cc
index f98f3e5..2522159 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -366,7 +366,7 @@
// Only consider this download source (and send byte counts) as
// having been used if we downloaded a non-trivial amount of bytes
- // (e.g. at least 1 MiB) that contributed to the the
+ // (e.g. at least 1 MiB) that contributed to the
// update. Otherwise we're going to end up with a lot of zero-byte
// events in the histogram.
diff --git a/mock_http_fetcher.h b/mock_http_fetcher.h
index d5879f5..748acf1 100644
--- a/mock_http_fetcher.h
+++ b/mock_http_fetcher.h
@@ -97,7 +97,7 @@
// already a timeout callback, and it should be deleted by the caller,
// this will return false; otherwise true is returned.
// If skip_delivery is true, no bytes will be delivered, but the callbacks
- // still still be set if needed
+ // still be set if needed.
bool SendData(bool skip_delivery);
// Callback for when our glib main loop callback is called
diff --git a/multi_range_http_fetcher.h b/multi_range_http_fetcher.h
index 52f0b6f..5b167b2 100644
--- a/multi_range_http_fetcher.h
+++ b/multi_range_http_fetcher.h
@@ -17,7 +17,7 @@
// This class is a simple wrapper around an HttpFetcher. The client
// specifies a vector of byte ranges. MultiRangeHttpFetcher will fetch bytes
// from those offsets, using the same bash fetcher for all ranges. Thus, the
-// fetcher must support beginning a transfter after one has stopped. Pass -1
+// fetcher must support beginning a transfer after one has stopped. Pass -1
// as a length to specify unlimited length. It really only would make sense
// for the last range specified to have unlimited length, tho it is legal for
// other entries to have unlimited length.
diff --git a/omaha_request_params.h b/omaha_request_params.h
index f8bc13e..06461aa 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -297,7 +297,7 @@
// Fetches the value for a given key from
// /mnt/stateful_partition/etc/lsb-release if possible and |stateful_override|
// is true. Failing that, it looks for the key in /etc/lsb-release. If
- // |validator| is non-NULL, uses it to validate and ignore invalid valies.
+ // |validator| is non-NULL, uses it to validate and ignore invalid values.
std::string GetLsbValue(const std::string& key,
const std::string& default_value,
ValueValidator validator,
diff --git a/omaha_response.h b/omaha_response.h
index 2320840..c1e8e4d 100644
--- a/omaha_response.h
+++ b/omaha_response.h
@@ -61,7 +61,7 @@
// False if it's a full payload.
bool is_delta_payload;
- // True if the Omaha rule instructs us to disable the backoff logic
+ // True if the Omaha rule instructs us to disable the back-off logic
// on the client altogether. False otherwise.
bool disable_payload_backoff;
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index 5b4410c..4846a00 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -117,7 +117,7 @@
// Send the deadline data (if any) to Chrome through a file. This is a pretty
// hacky solution but should be OK for now.
//
- // TODO(petkov): Rearchitect this to avoid communication through a
+ // TODO(petkov): Re-architect this to avoid communication through a
// file. Ideally, we would include this information in D-Bus's GetStatus
// method and UpdateStatus signal. A potential issue is that update_engine may
// be unresponsive during an update download.
diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc
index 80aad60..51eab78 100644
--- a/omaha_response_handler_action_unittest.cc
+++ b/omaha_response_handler_action_unittest.cc
@@ -99,7 +99,7 @@
processor.EnqueueAction(&collector_action);
processor.StartProcessing();
EXPECT_TRUE(!processor.IsRunning())
- << "Update test to handle non-asynch actions";
+ << "Update test to handle non-async actions";
if (out)
*out = collector_action.object();
EXPECT_TRUE(delegate.code_set_);
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 548d25c..bef87bb 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.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.
-// This provides access to timestamps with nano-second resolution in
+// This provides access to timestamps with nanosecond resolution in
// struct stat, See NOTES in stat(2) for details.
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
@@ -388,7 +388,7 @@
void InitiateLookup(gchar **argv, TimeDelta timeout) {
// NOTE: if we fail early (i.e. in this method), we need to schedule
// an idle to report the error. This is because we guarantee that
- // the callback is always called from from the GLib mainloop (this
+ // the callback is always called from the GLib mainloop (this
// guarantee is useful for testing).
GError *error = NULL;
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index af83d4a..f76e47c 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -112,7 +112,7 @@
EXPECT_TRUE(utils::RecursiveUnlinkDir(temp_dir));
}
-// Check that IsP2PEnabled() corrresponds to the value of the crosh
+// Check that IsP2PEnabled() corresponds to the value of the crosh
// flag if Enterprise Policy indicates that p2p is not to be used.
TEST_F(P2PManagerTest, P2PEnabledEnterpriseSettingFalse) {
string temp_dir;
diff --git a/payload_generator/cycle_breaker.cc b/payload_generator/cycle_breaker.cc
index 10ef6fb..b4c14a9 100644
--- a/payload_generator/cycle_breaker.cc
+++ b/payload_generator/cycle_breaker.cc
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <set>
+#include <string>
#include <utility>
#include <base/strings/string_util.h>
@@ -151,10 +152,9 @@
if (counter == 10000) {
counter = 0;
std::string stack_str;
- for (vector<Vertex::Index>::const_iterator it = stack_.begin();
- it != stack_.end(); ++it) {
- stack_str += base::StringPrintf("%lu -> ",
- static_cast<long unsigned int>(*it));
+ for (Vertex::Index index : stack_) {
+ stack_str += std::to_string(index);
+ stack_str += " -> ";
}
LOG(INFO) << "stack: " << stack_str;
}
diff --git a/payload_generator/cycle_breaker.h b/payload_generator/cycle_breaker.h
index d0ae3fd..420f1e2 100644
--- a/payload_generator/cycle_breaker.h
+++ b/payload_generator/cycle_breaker.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_CYCLE_BREAKER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_CYCLE_BREAKER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_CYCLE_BREAKER_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_CYCLE_BREAKER_H_
// This is a modified implementation of Donald B. Johnson's algorithm for
// finding all elementary cycles (a.k.a. circuits) in a directed graph.
@@ -56,4 +56,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_CYCLE_BREAKER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_CYCLE_BREAKER_H_
diff --git a/payload_generator/delta_diff_generator.cc b/payload_generator/delta_diff_generator.cc
index 1367b17..4a383d0 100644
--- a/payload_generator/delta_diff_generator.cc
+++ b/payload_generator/delta_diff_generator.cc
@@ -218,7 +218,7 @@
// duplicate work. Here, we avoid visiting each source image inode
// more than once. Technically, we could have multiple operations
// that read the same blocks from the source image for diffing, but
- // we choose not to to avoid complexity. Eventually we will move away
+ // we choose not to avoid complexity. Eventually we will move away
// from using a graph/cycle detection/etc to generate diffs, and at that
// time, it will be easy (non-complex) to have many operations read
// from the same source blocks. At that time, this code can die. -adlr
@@ -1122,7 +1122,7 @@
return false;
}
-// Convertes the cuts, which must all have the same |old_dst| member,
+// Converts the cuts, which must all have the same |old_dst| member,
// to full. It does this by converting the |old_dst| to REPLACE or
// REPLACE_BZ, dropping all incoming edges to |old_dst|, and marking
// all temp nodes invalid.
diff --git a/payload_generator/extent_mapper.cc b/payload_generator/extent_mapper.cc
index 9e66619..ace463f 100644
--- a/payload_generator/extent_mapper.cc
+++ b/payload_generator/extent_mapper.cc
@@ -14,6 +14,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <algorithm>
+
#include "update_engine/payload_constants.h"
#include "update_engine/payload_generator/graph_types.h"
#include "update_engine/payload_generator/graph_utils.h"
diff --git a/payload_generator/extent_mapper.h b/payload_generator/extent_mapper.h
index bc46e47..24229e1 100644
--- a/payload_generator/extent_mapper.h
+++ b/payload_generator/extent_mapper.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_MAPPER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_MAPPER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_MAPPER_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_MAPPER_H_
#include <string>
#include <vector>
@@ -43,4 +43,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_MAPPER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_MAPPER_H_
diff --git a/payload_generator/filesystem_iterator.h b/payload_generator/filesystem_iterator.h
index 859965d..7df250f 100644
--- a/payload_generator/filesystem_iterator.h
+++ b/payload_generator/filesystem_iterator.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_FILESYSTEM_ITERATOR_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_FILESYSTEM_ITERATOR_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_FILESYSTEM_ITERATOR_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_FILESYSTEM_ITERATOR_H_
// This class is used to walk a filesystem. It will iterate over every file
// on the same device as the file passed in the ctor. Directories will be
@@ -76,6 +76,7 @@
bool IsErr() const {
return is_err_;
}
+
private:
// Helper for Increment.
void IncrementInternal();
@@ -105,7 +106,7 @@
// The device of the root path we've been asked to iterate.
dev_t root_dev_;
- // The root path we've been asked to iteratate.
+ // The root path we've been asked to iterate.
std::string root_path_;
// Exclude items w/ this prefix.
@@ -118,10 +119,10 @@
// or error occurs.
bool is_end_;
- // Generally false; set to true if an error occurrs.
+ // Generally false; set to true if an error occurs.
bool is_err_;
};
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_FILESYSTEM_ITERATOR_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_FILESYSTEM_ITERATOR_H_
diff --git a/payload_generator/filesystem_iterator_unittest.cc b/payload_generator/filesystem_iterator_unittest.cc
index 67ac177..7436c99 100644
--- a/payload_generator/filesystem_iterator_unittest.cc
+++ b/payload_generator/filesystem_iterator_unittest.cc
@@ -60,7 +60,7 @@
&sub_image, NULL));
ScopedPathUnlinker sub_image_unlinker(sub_image);
- // Create uniqely named main/sub mount points.
+ // Create uniquely named main/sub mount points.
string main_image_mount_point;
ASSERT_TRUE(utils::MakeTempDirectory(
"FilesystemIteratorTest.mount-XXXXXX",
diff --git a/payload_generator/full_update_generator.cc b/payload_generator/full_update_generator.cc
index fb18856..d4d6614 100644
--- a/payload_generator/full_update_generator.cc
+++ b/payload_generator/full_update_generator.cc
@@ -7,6 +7,8 @@
#include <fcntl.h>
#include <inttypes.h>
+#include <algorithm>
+#include <deque>
#include <memory>
#include <base/strings/string_util.h>
@@ -153,7 +155,7 @@
offset += chunk_size;
}
- // Need to wait for a chunk processor to complete and process its ouput
+ // Need to wait for a chunk processor to complete and process its output
// before spawning new processors.
shared_ptr<ChunkProcessor> processor = threads.front();
threads.pop_front();
diff --git a/payload_generator/full_update_generator.h b/payload_generator/full_update_generator.h
index 4ca1aa4..888fb6d 100644
--- a/payload_generator/full_update_generator.h
+++ b/payload_generator/full_update_generator.h
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_FULL_UPDATE_GENERATOR_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_FULL_UPDATE_GENERATOR_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_FULL_UPDATE_GENERATOR_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_FULL_UPDATE_GENERATOR_H_
#include <glib.h>
+#include <string>
+#include <vector>
+
#include "update_engine/payload_generator/graph_types.h"
namespace chromeos_update_engine {
@@ -38,4 +41,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_FULL_UPDATE_GENERATOR_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_FULL_UPDATE_GENERATOR_H_
diff --git a/payload_generator/graph_types.h b/payload_generator/graph_types.h
index c5531c2..a85346f 100644
--- a/payload_generator/graph_types.h
+++ b/payload_generator/graph_types.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_TYPES_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_TYPES_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_TYPES_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_TYPES_H_
#include <map>
#include <set>
@@ -80,4 +80,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_TYPES_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_TYPES_H_
diff --git a/payload_generator/graph_utils.cc b/payload_generator/graph_utils.cc
index b3c4231..dd5d9df 100644
--- a/payload_generator/graph_utils.cc
+++ b/payload_generator/graph_utils.cc
@@ -139,7 +139,7 @@
LOG(INFO) << "Graph length: " << graph.size();
for (Graph::size_type i = 0, e = graph.size(); i != e; ++i) {
string type_str = "UNK";
- switch(graph[i].op.type()) {
+ switch (graph[i].op.type()) {
case DeltaArchiveManifest_InstallOperation_Type_BSDIFF:
type_str = "BSDIFF";
break;
diff --git a/payload_generator/graph_utils.h b/payload_generator/graph_utils.h
index 0489793..6712067 100644
--- a/payload_generator/graph_utils.h
+++ b/payload_generator/graph_utils.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_UTILS_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_UTILS_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_UTILS_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_UTILS_H_
#include <vector>
@@ -62,4 +62,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_UTILS_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_GRAPH_UTILS_H_
diff --git a/payload_generator/metadata.h b/payload_generator/metadata.h
index 452e303..cf3d043 100644
--- a/payload_generator/metadata.h
+++ b/payload_generator/metadata.h
@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
+
+#include <string>
+#include <vector>
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/graph_types.h"
@@ -34,4 +37,4 @@
}; // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
diff --git a/payload_generator/tarjan.h b/payload_generator/tarjan.h
index 544cee3..48ec9a2 100644
--- a/payload_generator/tarjan.h
+++ b/payload_generator/tarjan.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_TARJAN_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_TARJAN_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_TARJAN_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_TARJAN_H_
-// This is an implemenation of Tarjan's algorithm which finds all
+// This is an implementation of Tarjan's algorithm which finds all
// Strongly Connected Components in a graph.
// Note: a true Tarjan algorithm would find all strongly connected components
@@ -37,4 +37,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_TARJAN_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_TARJAN_H_
diff --git a/payload_generator/tarjan_unittest.cc b/payload_generator/tarjan_unittest.cc
index a5fbac2..552c32e 100644
--- a/payload_generator/tarjan_unittest.cc
+++ b/payload_generator/tarjan_unittest.cc
@@ -4,6 +4,7 @@
#include "update_engine/payload_generator/tarjan.h"
+#include <string>
#include <utility>
#include <base/logging.h>
diff --git a/payload_generator/topological_sort.h b/payload_generator/topological_sort.h
index be130ce..6e81d91 100644
--- a/payload_generator/topological_sort.h
+++ b/payload_generator/topological_sort.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_TOPOLOGICAL_SORT_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_TOPOLOGICAL_SORT_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_TOPOLOGICAL_SORT_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_TOPOLOGICAL_SORT_H_
#include <vector>
@@ -27,4 +27,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_TOPOLOGICAL_SORT_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_TOPOLOGICAL_SORT_H_
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.