AU: Update Downloader to support our image formats.
The downloader used to be dumb in the sense that it would pipe output
to either a DirectFileWriter or a DirectFileWriter via a
GzipDecompressingFileWriter, depending on if we were downloading an
update that was compressed or not. Sadly, things have gotten more
complex: we need to download to two partitions (kernel + rootfs), and
we may stream data via a DeltaPerformer (a type of FileWriter) to the
disk. Thus, the Downloader streams to either
1. gzip decompress->split_writer->direct to disk OR
2. delta performer
Other misc changes: Change FilesystemCopierAction to support
optionally copying the kernel partition rather than root partition.
InstallPlan struct: add an entry for destiation kernel partition.
Test Utils: a new ScopedTempFile class
Utils: support for getting the booted kernel partition device.
BUG=None
TEST=attached unittests
Review URL: http://codereview.chromium.org/1694025
diff --git a/split_file_writer.cc b/split_file_writer.cc
index e868947..690d4e3 100644
--- a/split_file_writer.cc
+++ b/split_file_writer.cc
@@ -49,8 +49,9 @@
// to the first FileWriter.
if (bytes_received_ < static_cast<off_t>(sizeof(uint64_t))) {
// Write more to the initial buffer
- size_t bytes_to_copy = min(count,
- sizeof(first_length_buf_) - bytes_received_);
+ size_t bytes_to_copy = min(static_cast<off_t>(count),
+ static_cast<off_t>(sizeof(first_length_buf_)) -
+ bytes_received_);
memcpy(&first_length_buf_[bytes_received_], bytes, bytes_to_copy);
bytes_received_ += bytes_to_copy;
count -= bytes_to_copy;