Fix unittest build in x86_64.

Some size_t values (generally resulting from X.size() calls) were
compared to off_t values (such as utils::FileSize()) which resulted
in a compile error on x86_64 targets. This patch fixes those issues
with explicit casts in the unittests since the range of the expected
values is small enough.

Bug: 26955860
TEST=`mma` on edison-eng and brilloemulator_x86_64-eng.

Change-Id: I2d09d356e1b97ab6527b17596fe20d425da6d519
diff --git a/common/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc
index 91f85db..aaa538c 100644
--- a/common/http_fetcher_unittest.cc
+++ b/common/http_fetcher_unittest.cc
@@ -923,7 +923,7 @@
                const string& url,
                const vector<pair<off_t, off_t>>& ranges,
                const string& expected_prefix,
-               off_t expected_size,
+               size_t expected_size,
                HttpResponseCode expected_response_code) {
   MultiHttpFetcherTestDelegate delegate(expected_response_code);
   delegate.fetcher_.reset(fetcher_in);
diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc
index 6c4e5af..24468b9 100644
--- a/common/utils_unittest.cc
+++ b/common/utils_unittest.cc
@@ -413,7 +413,8 @@
   string contents;
   EXPECT_TRUE(utils::ReadFile(path.value(), &contents));
   EXPECT_EQ(contents, expected_contents);
-  EXPECT_EQ(utils::FileSize(path.value()), expected_contents.size());
+  EXPECT_EQ(static_cast<off_t>(expected_contents.size()),
+            utils::FileSize(path.value()));
 }
 
 TEST(UtilsTest, ConvertToOmahaInstallDate) {
diff --git a/payload_consumer/delta_performer_integration_test.cc b/payload_consumer/delta_performer_integration_test.cc
index f0aea95..34ce0de 100644
--- a/payload_consumer/delta_performer_integration_test.cc
+++ b/payload_consumer/delta_performer_integration_test.cc
@@ -543,10 +543,12 @@
   // Extend the "partitions" holding the file system a bit.
   EXPECT_EQ(0, HANDLE_EINTR(truncate(state->a_img.c_str(),
                                      state->image_size + 1024 * 1024)));
-  EXPECT_EQ(state->image_size + 1024 * 1024, utils::FileSize(state->a_img));
+  EXPECT_EQ(static_cast<off_t>(state->image_size + 1024 * 1024),
+            utils::FileSize(state->a_img));
   EXPECT_EQ(0, HANDLE_EINTR(truncate(state->b_img.c_str(),
                                      state->image_size + 1024 * 1024)));
-  EXPECT_EQ(state->image_size + 1024 * 1024, utils::FileSize(state->b_img));
+  EXPECT_EQ(static_cast<off_t>(state->image_size + 1024 * 1024),
+            utils::FileSize(state->b_img));
 
   if (signature_test == kSignatureGeneratedPlaceholder ||
       signature_test == kSignatureGeneratedPlaceholderMismatch) {
@@ -745,7 +747,7 @@
   (*performer)->set_public_key_path(kUnittestPublicKeyPath);
   DeltaPerformerIntegrationTest::SetSupportedVersion(*performer, minor_version);
 
-  EXPECT_EQ(state->image_size,
+  EXPECT_EQ(static_cast<off_t>(state->image_size),
             HashCalculator::RawHashOfFile(
                 state->a_img,
                 state->image_size,
@@ -892,7 +894,7 @@
 
   EXPECT_EQ(state->image_size, partitions[0].target_size);
   brillo::Blob expected_new_rootfs_hash;
-  EXPECT_EQ(state->image_size,
+  EXPECT_EQ(static_cast<off_t>(state->image_size),
             HashCalculator::RawHashOfFile(state->b_img,
                                           state->image_size,
                                           &expected_new_rootfs_hash));
diff --git a/payload_consumer/download_action_unittest.cc b/payload_consumer/download_action_unittest.cc
index 51d3c3a..d12b4ae 100644
--- a/payload_consumer/download_action_unittest.cc
+++ b/payload_consumer/download_action_unittest.cc
@@ -307,7 +307,8 @@
   const off_t resulting_file_size(utils::FileSize(temp_file.GetPath()));
   EXPECT_GE(resulting_file_size, 0);
   if (resulting_file_size != 0)
-    EXPECT_EQ(kMockHttpFetcherChunkSize, resulting_file_size);
+    EXPECT_EQ(kMockHttpFetcherChunkSize,
+              static_cast<size_t>(resulting_file_size));
 }
 
 }  // namespace
diff --git a/payload_consumer/extent_writer_unittest.cc b/payload_consumer/extent_writer_unittest.cc
index efeab09..6884c0b 100644
--- a/payload_consumer/extent_writer_unittest.cc
+++ b/payload_consumer/extent_writer_unittest.cc
@@ -86,7 +86,8 @@
   EXPECT_TRUE(direct_writer.Write(bytes.data(), bytes.size()));
   EXPECT_TRUE(direct_writer.End());
 
-  EXPECT_EQ(kBlockSize + bytes.size(), utils::FileSize(path_));
+  EXPECT_EQ(static_cast<off_t>(kBlockSize + bytes.size()),
+            utils::FileSize(path_));
 
   brillo::Blob result_file;
   EXPECT_TRUE(utils::ReadFile(path_, &result_file));
@@ -153,7 +154,7 @@
   }
   EXPECT_TRUE(direct_writer.End());
 
-  EXPECT_EQ(data.size(), utils::FileSize(path_));
+  EXPECT_EQ(static_cast<off_t>(data.size()), utils::FileSize(path_));
 
   brillo::Blob result_file;
   EXPECT_TRUE(utils::ReadFile(path_, &result_file));
@@ -202,7 +203,7 @@
   ASSERT_TRUE(zero_pad_writer.Write(data.data(), bytes_to_write));
   EXPECT_TRUE(zero_pad_writer.End());
 
-  EXPECT_EQ(data.size(), utils::FileSize(path_));
+  EXPECT_EQ(static_cast<off_t>(data.size()), utils::FileSize(path_));
 
   brillo::Blob result_file;
   EXPECT_TRUE(utils::ReadFile(path_, &result_file));
@@ -251,7 +252,7 @@
   EXPECT_TRUE(direct_writer.End());
 
   // check file size, then data inside
-  ASSERT_EQ(2 * kBlockSize, utils::FileSize(path_));
+  ASSERT_EQ(static_cast<off_t>(2 * kBlockSize), utils::FileSize(path_));
 
   brillo::Blob resultant_data;
   EXPECT_TRUE(utils::ReadFile(path_, &resultant_data));
diff --git a/payload_generator/ab_generator_unittest.cc b/payload_generator/ab_generator_unittest.cc
index b505a8f..60bdf26 100644
--- a/payload_generator/ab_generator_unittest.cc
+++ b/payload_generator/ab_generator_unittest.cc
@@ -313,7 +313,8 @@
     expected_blob = expected_data;
   }
   ASSERT_EQ(expected_blob.size(), new_op.data_length());
-  ASSERT_EQ(blob_data.size() + expected_blob.size(), data_file_size);
+  ASSERT_EQ(blob_data.size() + expected_blob.size(),
+            static_cast<size_t>(data_file_size));
   brillo::Blob new_op_blob(new_op.data_length());
   ssize_t bytes_read;
   ASSERT_TRUE(utils::PReadAll(data_fd,
diff --git a/payload_generator/full_update_generator_unittest.cc b/payload_generator/full_update_generator_unittest.cc
index 7871338..d5af9d0 100644
--- a/payload_generator/full_update_generator_unittest.cc
+++ b/payload_generator/full_update_generator_unittest.cc
@@ -83,7 +83,7 @@
                                             blob_file_.get(),
                                             &aops));
   int64_t new_part_chunks = new_part_conf.size / config_.hard_chunk_size;
-  EXPECT_EQ(new_part_chunks, aops.size());
+  EXPECT_EQ(new_part_chunks, static_cast<int64_t>(aops.size()));
   for (off_t i = 0; i < new_part_chunks; ++i) {
     EXPECT_EQ(1, aops[i].op.dst_extents_size());
     EXPECT_EQ(static_cast<uint64_t>(i * config_.hard_chunk_size / config_.block_size),