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/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_