OSDN Git Service

Fix oat_writer to use WriteData which updates checksum.
authorJeff Hao <jeffhao@google.com>
Mon, 23 May 2016 21:30:44 +0000 (14:30 -0700)
committerJeff Hao <jeffhao@google.com>
Wed, 25 May 2016 18:05:08 +0000 (11:05 -0700)
OatWriter was using WriteFully in some places instead.

Bug: 28874264

(cherry-picked from commit 5e7cbde3100b0bfb58277accc9d71a94636ea727)

Change-Id: I7dac3ad0597c210ba6e12e0cc1670277d7a28fc7

compiler/oat_writer.cc

index 140db0c..1aa2609 100644 (file)
@@ -2013,7 +2013,7 @@ bool OatWriter::WriteDexFile(OutputStream* rodata,
   DCHECK(ValidateDexFileHeader(dex_file, oat_dex_file->GetLocation()));
   const UnalignedDexFileHeader* header = AsUnalignedDexFileHeader(dex_file);
 
-  if (!rodata->WriteFully(dex_file, header->file_size_)) {
+  if (!WriteData(rodata, dex_file, header->file_size_)) {
     PLOG(ERROR) << "Failed to write dex file " << oat_dex_file->GetLocation()
                 << " to " << rodata->GetLocation();
     return false;
@@ -2193,7 +2193,7 @@ bool OatWriter::WriteCodeAlignment(OutputStream* out, uint32_t aligned_code_delt
       0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u
   };
   DCHECK_LE(aligned_code_delta, sizeof(kPadding));
-  if (UNLIKELY(!out->WriteFully(kPadding, aligned_code_delta))) {
+  if (UNLIKELY(!WriteData(out, kPadding, aligned_code_delta))) {
     return false;
   }
   size_code_alignment_ += aligned_code_delta;