Add art_defaults to dexlayout

The build rule defaults for dexlayout targets didn't include defaults
from the ART project.  Because of this ART_TARGET_* weren't defined,
among other problems

Bug: 35800981
Test: make -j 40 test-art-host
Change-Id: Ic528bfc6b622fa9b4f5c0ddf883f15912641b720
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index e26d051..4b65c52 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -14,6 +14,7 @@
 
 art_cc_defaults {
     name: "libart-dexlayout-defaults",
+    defaults: ["art_defaults"],
     host_supported: true,
     srcs: [
         "dexlayout.cc",
diff --git a/dexlayout/dex_ir.cc b/dexlayout/dex_ir.cc
index 4905b5c..6bd9da8 100644
--- a/dexlayout/dex_ir.cc
+++ b/dexlayout/dex_ir.cc
@@ -496,8 +496,8 @@
       dex_file.GetClassAnnotationSet(disk_annotations_item);
   AnnotationSetItem* class_annotation = nullptr;
   if (class_set_item != nullptr) {
-    uint32_t offset = disk_annotations_item->class_annotations_off_;
-    class_annotation = CreateAnnotationSetItem(dex_file, class_set_item, offset);
+    uint32_t item_offset = disk_annotations_item->class_annotations_off_;
+    class_annotation = CreateAnnotationSetItem(dex_file, class_set_item, item_offset);
   }
   const DexFile::FieldAnnotationsItem* fields =
       dex_file.GetFieldAnnotations(disk_annotations_item);
@@ -784,7 +784,7 @@
   std::function<uint32_t(const dex_ir::Collections&)> offset_fn;
 };
 
-static const std::vector<FileSectionDescriptor> kFileSectionDescriptors = {
+static const FileSectionDescriptor kFileSectionDescriptors[] = {
   {
     "Header",
     DexFile::kDexTypeHeaderItem,
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index 0e0d66b..344d735 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -393,6 +393,7 @@
       index = dec_insn->VRegB();
       secondary_index = dec_insn->VRegH();
       width = 4;
+      break;
     default:
       break;
   }  // switch
@@ -1820,7 +1821,11 @@
       LOG(ERROR) << "Could not create dex writer output file: " << output_location;
       return;
     }
-    ftruncate(new_file->Fd(), header_->FileSize());
+    if (ftruncate(new_file->Fd(), header_->FileSize()) != 0) {
+      LOG(ERROR) << "Could not grow dex writer output file: " << output_location;;
+      new_file->Erase();
+      return;
+    }
     mem_map_.reset(MemMap::MapFile(header_->FileSize(), PROT_READ | PROT_WRITE, MAP_SHARED,
         new_file->Fd(), 0, /*low_4gb*/ false, output_location.c_str(), &error_msg));
   } else {