Fix cpplint issues
Existing cpplint issues block uploading CLs, fix most of them.
Test: m checkbuild
Change-Id: I3477d388659c93c1ca517c4ad37502e0a71014ad
diff --git a/aosp/apex_handler_android_unittest.cc b/aosp/apex_handler_android_unittest.cc
index 847ccaa..8c58e47 100644
--- a/aosp/apex_handler_android_unittest.cc
+++ b/aosp/apex_handler_android_unittest.cc
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#include <utility>
#include <filesystem>
+#include <utility>
#include "update_engine/aosp/apex_handler_android.h"
diff --git a/aosp/update_attempter_android_integration_test.cc b/aosp/update_attempter_android_integration_test.cc
index 46f35f1..16f8337 100644
--- a/aosp/update_attempter_android_integration_test.cc
+++ b/aosp/update_attempter_android_integration_test.cc
@@ -35,16 +35,16 @@
#include "update_engine/aosp/daemon_state_android.h"
#include "update_engine/aosp/update_attempter_android.h"
#include "update_engine/common/constants.h"
-#include "update_engine/common/prefs.h"
-#include "update_engine/common/testing_constants.h"
-#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/prefs.h"
#include "update_engine/common/test_utils.h"
+#include "update_engine/common/testing_constants.h"
#include "update_engine/common/utils.h"
#include "update_engine/payload_consumer/file_descriptor.h"
-#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_consumer/install_plan.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/payload_file.h"
diff --git a/aosp/update_attempter_android_unittest.cc b/aosp/update_attempter_android_unittest.cc
index d67bf01..a3f25b9 100644
--- a/aosp/update_attempter_android_unittest.cc
+++ b/aosp/update_attempter_android_unittest.cc
@@ -36,19 +36,19 @@
#include "update_engine/aosp/boot_control_android.h"
#include "update_engine/aosp/daemon_state_android.h"
#include "update_engine/common/constants.h"
-#include "update_engine/common/prefs.h"
-#include "update_engine/common/testing_constants.h"
-#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/mock_action_processor.h"
#include "update_engine/common/mock_metrics_reporter.h"
+#include "update_engine/common/prefs.h"
#include "update_engine/common/test_utils.h"
+#include "update_engine/common/testing_constants.h"
#include "update_engine/common/utils.h"
-#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_consumer/install_plan.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/payload_file.h"
diff --git a/common/download_action.h b/common/download_action.h
index 887dd04..ee6c8be 100644
--- a/common/download_action.h
+++ b/common/download_action.h
@@ -73,13 +73,13 @@
// A good calling pattern is:
// DownloadAction(prefs, boot_contol, hardware,
// new WhateverHttpFetcher, false);
- DownloadAction(PrefsInterface* prefs,
- BootControlInterface* boot_control,
- HardwareInterface* hardware,
- HttpFetcher* http_fetcher,
- bool interactive,
- std::string update_certs_path = constants::kUpdateCertificatesPath
- );
+ DownloadAction(
+ PrefsInterface* prefs,
+ BootControlInterface* boot_control,
+ HardwareInterface* hardware,
+ HttpFetcher* http_fetcher,
+ bool interactive,
+ std::string update_certs_path = constants::kUpdateCertificatesPath);
~DownloadAction() override;
// InstallPlanAction overrides.
@@ -166,4 +166,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_COMMON_DOWNLOAD_ACTION_H_
+#endif // UPDATE_ENGINE_COMMON_DOWNLOAD_ACTION_H_
diff --git a/download_action_android_unittest.cc b/download_action_android_unittest.cc
index 0f7ecdc..bef4342 100644
--- a/download_action_android_unittest.cc
+++ b/download_action_android_unittest.cc
@@ -32,8 +32,8 @@
#include "update_engine/common/mock_action_processor.h"
#include "update_engine/common/mock_http_fetcher.h"
#include "update_engine/common/mock_prefs.h"
-#include "update_engine/common/testing_constants.h"
#include "update_engine/common/test_utils.h"
+#include "update_engine/common/testing_constants.h"
#include "update_engine/common/utils.h"
#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/payload_consumer/payload_constants.h"
diff --git a/payload_consumer/certificate_parser_android_unittest.cc b/payload_consumer/certificate_parser_android_unittest.cc
index 9603f96..278f626 100644
--- a/payload_consumer/certificate_parser_android_unittest.cc
+++ b/payload_consumer/certificate_parser_android_unittest.cc
@@ -21,9 +21,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/testing_constants.h"
-#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/utils.h"
#include "update_engine/payload_consumer/payload_verifier.h"
#include "update_engine/payload_generator/payload_signer.h"
diff --git a/payload_consumer/extent_map.h b/payload_consumer/extent_map.h
index b275e2d..a985cb5 100644
--- a/payload_consumer/extent_map.h
+++ b/payload_consumer/extent_map.h
@@ -20,10 +20,11 @@
#include <functional>
#include <map>
#include <utility>
+#include <vector>
#include "update_engine/common/utils.h"
-#include "update_engine/payload_generator/extent_utils.h"
#include "update_engine/payload_generator/extent_ranges.h"
+#include "update_engine/payload_generator/extent_utils.h"
#include "update_engine/update_metadata.pb.h"
namespace chromeos_update_engine {
diff --git a/payload_consumer/extent_map_unittest.cc b/payload_consumer/extent_map_unittest.cc
index 88a587b..d8137a0 100644
--- a/payload_consumer/extent_map_unittest.cc
+++ b/payload_consumer/extent_map_unittest.cc
@@ -16,6 +16,7 @@
#include <gtest/gtest.h>
#include <optional>
+#include <vector>
#include "update_engine/payload_consumer/extent_map.h"
#include "update_engine/payload_generator/extent_ranges.h"
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index 2bd81ae..db0af4e 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -26,8 +26,8 @@
#include <base/strings/stringprintf.h>
#include "update_engine/common/utils.h"
-#include "update_engine/update_metadata.pb.h"
#include "update_engine/payload_consumer/payload_constants.h"
+#include "update_engine/update_metadata.pb.h"
using std::string;
using std::vector;
diff --git a/payload_consumer/mount_history.cc b/payload_consumer/mount_history.cc
index d699ad9..7fe4850 100644
--- a/payload_consumer/mount_history.cc
+++ b/payload_consumer/mount_history.cc
@@ -72,7 +72,7 @@
if (magic == 0xEF53) {
// Timestamps can be updated by fsck without updating mount count,
// log if any timestamp differ
- if (! (write_time == created_time && check_time == created_time)) {
+ if (!(write_time == created_time && check_time == created_time)) {
LOG(WARNING) << "Device have been modified after being created. "
<< "Filesystem created on "
<< base::Time::FromTimeT(created_time) << ", "
diff --git a/payload_consumer/xor_extent_writer.cc b/payload_consumer/xor_extent_writer.cc
index b0a8c08..31567f2 100644
--- a/payload_consumer/xor_extent_writer.cc
+++ b/payload_consumer/xor_extent_writer.cc
@@ -16,6 +16,7 @@
#include <algorithm>
#include <optional>
+#include <vector>
#include "update_engine/common/utils.h"
#include "update_engine/payload_consumer/xor_extent_writer.h"
diff --git a/payload_consumer/xor_extent_writer.h b/payload_consumer/xor_extent_writer.h
index 94b5a9e..35565ea 100644
--- a/payload_consumer/xor_extent_writer.h
+++ b/payload_consumer/xor_extent_writer.h
@@ -17,6 +17,8 @@
#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_XOR_EXTENT_WRITER_H_
#define UPDATE_ENGINE_PAYLOAD_CONSUMER_XOR_EXTENT_WRITER_H_
+#include <vector>
+
#include "update_engine/payload_consumer/block_extent_writer.h"
#include "update_engine/payload_consumer/extent_map.h"
#include "update_engine/payload_consumer/extent_reader.h"
diff --git a/payload_generator/cow_size_estimator.cc b/payload_generator/cow_size_estimator.cc
index 8e2c66d..3a23f44 100644
--- a/payload_generator/cow_size_estimator.cc
+++ b/payload_generator/cow_size_estimator.cc
@@ -16,6 +16,7 @@
#include "update_engine/payload_generator/cow_size_estimator.h"
+#include <algorithm>
#include <functional>
#include <string>
#include <utility>
@@ -26,10 +27,10 @@
#include "update_engine/common/cow_operation_convert.h"
#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/vabc_partition_writer.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/extent_utils.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/payload_consumer/vabc_partition_writer.h"
namespace chromeos_update_engine {
using android::snapshot::CowWriter;
diff --git a/payload_generator/deflate_utils.h b/payload_generator/deflate_utils.h
index c055876..d69a551 100644
--- a/payload_generator/deflate_utils.h
+++ b/payload_generator/deflate_utils.h
@@ -17,9 +17,11 @@
#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_DEFLATE_UTILS_H_
#define UPDATE_ENGINE_PAYLOAD_GENERATOR_DEFLATE_UTILS_H_
-#include <puffin/puffdiff.h>
+#include <string>
#include <vector>
+#include <puffin/puffdiff.h>
+
#include "update_engine/payload_generator/filesystem_interface.h"
#include "update_engine/payload_generator/payload_generation_config.h"
diff --git a/payload_generator/extent_utils.h b/payload_generator/extent_utils.h
index 712cc92..bd9fc8b 100644
--- a/payload_generator/extent_utils.h
+++ b/payload_generator/extent_utils.h
@@ -17,6 +17,7 @@
#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_UTILS_H_
#define UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_UTILS_H_
+#include <limits>
#include <string>
#include <vector>
diff --git a/payload_generator/merge_sequence_generator.cc b/payload_generator/merge_sequence_generator.cc
index 6cbb57b..cb43221 100644
--- a/payload_generator/merge_sequence_generator.cc
+++ b/payload_generator/merge_sequence_generator.cc
@@ -17,6 +17,7 @@
#include "update_engine/payload_generator/merge_sequence_generator.h"
#include <algorithm>
+#include <limits>
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
diff --git a/test_http_server.cc b/test_http_server.cc
index a2f1e05..388949f 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -253,14 +253,14 @@
if (start_modulo) {
string partial = line.substr(start_modulo, remaining_len);
ssize_t ret = WriteString(fd, partial);
- if ((success = (ret >= 0 && (size_t)ret == partial.length())))
+ if ((success = (ret >= 0 && static_cast<size_t>(ret) == partial.length())))
remaining_len -= partial.length();
}
// Output full lines up to the maximal line boundary below the end offset.
while (success && remaining_len >= line_len) {
ssize_t ret = WriteString(fd, line);
- if ((success = (ret >= 0 && (size_t)ret == line_len)))
+ if ((success = (ret >= 0 && static_cast<size_t>(ret) == line_len)))
remaining_len -= line_len;
}
@@ -268,7 +268,7 @@
if (success && remaining_len) {
string partial = line.substr(0, remaining_len);
ssize_t ret = WriteString(fd, partial);
- if ((success = (ret >= 0 && (size_t)ret == partial.length())))
+ if ((success = (ret >= 0 && static_cast<size_t>(ret) == partial.length())))
remaining_len -= partial.length();
}