update_engine: Update libchrome APIs to r369476
The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.
Change-Id: I42e65bda7f1dbdf6f6e0ebf356d2cfea6b729193
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index e56bb75..09304e4 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -171,8 +171,8 @@
const char* message_prefix) {
// Compute our download and overall progress.
unsigned new_overall_progress = 0;
- COMPILE_ASSERT(kProgressDownloadWeight + kProgressOperationsWeight == 100,
- progress_weight_dont_add_up);
+ static_assert(kProgressDownloadWeight + kProgressOperationsWeight == 100,
+ "Progress weights don't add up");
// Only consider download progress if its total size is known; otherwise
// adjust the operations weight to compensate for the absence of download
// progress. Also, make sure to cap the download portion at
@@ -409,8 +409,8 @@
}
// Extract the payload version from the metadata.
- COMPILE_ASSERT(sizeof(major_payload_version_) == kDeltaVersionSize,
- major_payload_version_size_mismatch);
+ static_assert(sizeof(major_payload_version_) == kDeltaVersionSize,
+ "Major payload version size mismatch");
memcpy(&major_payload_version_,
&payload[kDeltaVersionOffset],
kDeltaVersionSize);
@@ -435,8 +435,8 @@
return kMetadataParseInsufficientData;
// Next, parse the manifest size.
- COMPILE_ASSERT(sizeof(manifest_size_) == kDeltaManifestSizeSize,
- manifest_size_size_mismatch);
+ static_assert(sizeof(manifest_size_) == kDeltaManifestSizeSize,
+ "manifest_size size mismatch");
memcpy(&manifest_size_,
&payload[kDeltaManifestSizeOffset],
kDeltaManifestSizeSize);
@@ -444,9 +444,9 @@
if (GetMajorVersion() == kBrilloMajorPayloadVersion) {
// Parse the metadata signature size.
- COMPILE_ASSERT(sizeof(metadata_signature_size_) ==
- kDeltaMetadataSignatureSizeSize,
- metadata_signature_size_size_mismatch);
+ static_assert(sizeof(metadata_signature_size_) ==
+ kDeltaMetadataSignatureSizeSize,
+ "metadata_signature_size size mismatch");
uint64_t metadata_signature_size_offset;
if (!GetMetadataSignatureSizeOffset(&metadata_signature_size_offset)) {
*error = ErrorCode::kError;
diff --git a/payload_consumer/delta_performer.h b/payload_consumer/delta_performer.h
index 47ecfd8..0a60020 100644
--- a/payload_consumer/delta_performer.h
+++ b/payload_consumer/delta_performer.h
@@ -357,7 +357,7 @@
uint64_t buffer_offset_{0};
// Last |buffer_offset_| value updated as part of the progress update.
- uint64_t last_updated_buffer_offset_{kuint64max};
+ uint64_t last_updated_buffer_offset_{std::numeric_limits<uint64_t>::max()};
// The block size (parsed from the manifest).
uint32_t block_size_{0};
diff --git a/payload_consumer/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc
index 8192632..fa904f2 100644
--- a/payload_consumer/delta_performer_unittest.cc
+++ b/payload_consumer/delta_performer_unittest.cc
@@ -497,7 +497,7 @@
TEST_F(DeltaPerformerTest, ExtentsToByteStringTest) {
uint64_t test[] = {1, 1, 4, 2, 0, 1};
- COMPILE_ASSERT(arraysize(test) % 2 == 0, array_size_uneven);
+ static_assert(arraysize(test) % 2 == 0, "Array size uneven");
const uint64_t block_size = 4096;
const uint64_t file_length = 4 * block_size - 13;
diff --git a/payload_consumer/download_action.h b/payload_consumer/download_action.h
index 300d97e..4074fdd 100644
--- a/payload_consumer/download_action.h
+++ b/payload_consumer/download_action.h
@@ -168,7 +168,7 @@
// We want to be sure that we're compiled with large file support on linux,
// just in case we find ourselves downloading large images.
-COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit);
+static_assert(8 == sizeof(off_t), "off_t not 64 bit");
} // namespace chromeos_update_engine
diff --git a/payload_consumer/extent_writer_unittest.cc b/payload_consumer/extent_writer_unittest.cc
index 24ea5bf..efeab09 100644
--- a/payload_consumer/extent_writer_unittest.cc
+++ b/payload_consumer/extent_writer_unittest.cc
@@ -40,7 +40,7 @@
namespace chromeos_update_engine {
-COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64_bit);
+static_assert(sizeof(off_t) == 8, "off_t not 64 bit");
namespace {
const char kPathTemplate[] = "./ExtentWriterTest-file.XXXXXX";
diff --git a/payload_consumer/mtd_file_descriptor.cc b/payload_consumer/mtd_file_descriptor.cc
index da8fd58..3f0a33f 100644
--- a/payload_consumer/mtd_file_descriptor.cc
+++ b/payload_consumer/mtd_file_descriptor.cc
@@ -168,8 +168,8 @@
bool UbiFileDescriptor::IsUbi(const char* path) {
base::FilePath device_node(path);
base::FilePath ubi_name(device_node.BaseName());
- TEST_AND_RETURN_FALSE(
- base::StartsWithASCII(ubi_name.MaybeAsASCII(), "ubi", true));
+ TEST_AND_RETURN_FALSE(base::StartsWith(ubi_name.MaybeAsASCII(), "ubi",
+ base::CompareCase::SENSITIVE));
return static_cast<bool>(GetUbiVolumeInfo(path));
}