AU: Minor DeltaPerformer cleanup.
- Use DCHECK rather than DCHECK_EQ to avoid printing of non-readable
characters on failure.
- Don't store the return-by-value result of StringPrintf as a
reference.
BUG=chromium:196378
TEST=unit tests
Change-Id: Ibf912061627c56a9f5d82f6979b6fb8e3f7c6717
Reviewed-on: https://gerrit.chromium.org/gerrit/49879
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
diff --git a/delta_performer.cc b/delta_performer.cc
index 940bfa5..360272f 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -610,9 +610,10 @@
const Extent& extent = operation.dst_extents(i);
const size_t bytes = extent.num_blocks() * block_size_;
if (extent.start_block() == kSparseHole) {
- DCHECK_EQ(&buf[bytes_written],
- std::search_n(&buf[bytes_written], &buf[bytes_written + bytes],
- bytes, 0));
+ DCHECK(buf.begin() + bytes_written ==
+ std::search_n(buf.begin() + bytes_written,
+ buf.begin() + bytes_written + bytes,
+ bytes, 0));
} else {
TEST_AND_RETURN_FALSE(
utils::PWriteAll(fd,
@@ -690,7 +691,7 @@
DiscardBufferHeadBytes(operation.data_length());
int fd = is_kernel_partition ? kernel_fd_ : fd_;
- const string& path = StringPrintf("/dev/fd/%d", fd);
+ const string path = StringPrintf("/dev/fd/%d", fd);
// If this is a non-idempotent operation, request a delayed exit and clear the
// update state in case the operation gets interrupted. Do this as late as