stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
diff --git a/runtime/dex_file_verifier.cc b/runtime/dex_file_verifier.cc
index 9eba92f..0597253 100644
--- a/runtime/dex_file_verifier.cc
+++ b/runtime/dex_file_verifier.cc
@@ -124,7 +124,7 @@
     error_stmt;                                             \
   }
 
-bool DexFileVerifier::Verify(const DexFile* dex_file, const byte* begin, size_t size,
+bool DexFileVerifier::Verify(const DexFile* dex_file, const uint8_t* begin, size_t size,
                              const char* location, std::string* error_msg) {
   std::unique_ptr<DexFileVerifier> verifier(new DexFileVerifier(dex_file, begin, size, location));
   if (!verifier->Verify()) {
@@ -175,8 +175,8 @@
   // Check that size is not 0.
   CHECK_NE(elem_size, 0U);
 
-  const byte* range_start = reinterpret_cast<const byte*>(start);
-  const byte* file_start = reinterpret_cast<const byte*>(begin_);
+  const uint8_t* range_start = reinterpret_cast<const uint8_t*>(start);
+  const uint8_t* file_start = reinterpret_cast<const uint8_t*>(begin_);
 
   // Check for overflow.
   uintptr_t max = 0 - 1;
@@ -189,8 +189,8 @@
     return false;
   }
 
-  const byte* range_end = range_start + count * elem_size;
-  const byte* file_end = file_start + size_;
+  const uint8_t* range_end = range_start + count * elem_size;
+  const uint8_t* file_end = file_start + size_;
   if (UNLIKELY((range_start < file_start) || (range_end > file_end))) {
     // Note: these two tests are enough as we make sure above that there's no overflow.
     ErrorStringPrintf("Bad range for %s: %zx to %zx", label,
@@ -201,7 +201,7 @@
   return true;
 }
 
-bool DexFileVerifier::CheckList(size_t element_size, const char* label, const byte* *ptr) {
+bool DexFileVerifier::CheckList(size_t element_size, const char* label, const uint8_t* *ptr) {
   // Check that the list is available. The first 4B are the count.
   if (!CheckListSize(*ptr, 1, 4U, label)) {
     return false;
@@ -251,7 +251,7 @@
   // Compute and verify the checksum in the header.
   uint32_t adler_checksum = adler32(0L, Z_NULL, 0);
   const uint32_t non_sum = sizeof(header_->magic_) + sizeof(header_->checksum_);
-  const byte* non_sum_ptr = reinterpret_cast<const byte*>(header_) + non_sum;
+  const uint8_t* non_sum_ptr = reinterpret_cast<const uint8_t*>(header_) + non_sum;
   adler_checksum = adler32(adler_checksum, non_sum_ptr, expected_size - non_sum);
   if (adler_checksum != header_->checksum_) {
     ErrorStringPrintf("Bad checksum (%08x, expected %08x)", adler_checksum, header_->checksum_);
@@ -388,7 +388,7 @@
 
 uint32_t DexFileVerifier::ReadUnsignedLittleEndian(uint32_t size) {
   uint32_t result = 0;
-  if (LIKELY(CheckListSize(ptr_, size, sizeof(byte), "encoded_value"))) {
+  if (LIKELY(CheckListSize(ptr_, size, sizeof(uint8_t), "encoded_value"))) {
     for (uint32_t i = 0; i < size; i++) {
       result |= ((uint32_t) *(ptr_++)) << (i * 8);
     }
@@ -398,7 +398,7 @@
 
 bool DexFileVerifier::CheckAndGetHandlerOffsets(const DexFile::CodeItem* code_item,
                                                 uint32_t* handler_offsets, uint32_t handlers_size) {
-  const byte* handlers_base = DexFile::GetCatchHandlerData(*code_item, 0);
+  const uint8_t* handlers_base = DexFile::GetCatchHandlerData(*code_item, 0);
 
   for (uint32_t i = 0; i < handlers_size; i++) {
     bool catch_all;
@@ -503,7 +503,7 @@
 
 bool DexFileVerifier::CheckPadding(size_t offset, uint32_t aligned_offset) {
   if (offset < aligned_offset) {
-    if (!CheckListSize(begin_ + offset, aligned_offset - offset, sizeof(byte), "section")) {
+    if (!CheckListSize(begin_ + offset, aligned_offset - offset, sizeof(uint8_t), "section")) {
       return false;
     }
     while (offset < aligned_offset) {
@@ -519,7 +519,7 @@
 }
 
 bool DexFileVerifier::CheckEncodedValue() {
-  if (!CheckListSize(ptr_, 1, sizeof(byte), "encoded_value header")) {
+  if (!CheckListSize(ptr_, 1, sizeof(uint8_t), "encoded_value header")) {
     return false;
   }
 
@@ -746,7 +746,7 @@
   // Grab the end of the insns if there are no try_items.
   uint32_t try_items_size = code_item->tries_size_;
   if (try_items_size == 0) {
-    ptr_ = reinterpret_cast<const byte*>(&insns[insns_size]);
+    ptr_ = reinterpret_cast<const uint8_t*>(&insns[insns_size]);
     return true;
   }
 
@@ -812,7 +812,7 @@
 
 bool DexFileVerifier::CheckIntraStringDataItem() {
   uint32_t size = DecodeUnsignedLeb128(&ptr_);
-  const byte* file_end = begin_ + size_;
+  const uint8_t* file_end = begin_ + size_;
 
   for (uint32_t i = 0; i < size; i++) {
     CHECK_LT(i, size);  // b/15014252 Prevents hitting the impossible case below
@@ -1003,7 +1003,7 @@
 }
 
 bool DexFileVerifier::CheckIntraAnnotationItem() {
-  if (!CheckListSize(ptr_, 1, sizeof(byte), "annotation visibility")) {
+  if (!CheckListSize(ptr_, 1, sizeof(uint8_t), "annotation visibility")) {
     return false;
   }
 
@@ -1090,7 +1090,7 @@
   }
 
   // Return a pointer to the end of the annotations.
-  ptr_ = reinterpret_cast<const byte*>(parameter_item);
+  ptr_ = reinterpret_cast<const uint8_t*>(parameter_item);
   return true;
 }
 
@@ -1416,7 +1416,7 @@
   return true;
 }
 
-uint16_t DexFileVerifier::FindFirstClassDataDefiner(const byte* ptr, bool* success) {
+uint16_t DexFileVerifier::FindFirstClassDataDefiner(const uint8_t* ptr, bool* success) {
   ClassDataItemIterator it(*dex_file_, ptr);
   *success = true;
 
@@ -1435,7 +1435,7 @@
   return DexFile::kDexNoIndex16;
 }
 
-uint16_t DexFileVerifier::FindFirstAnnotationsDirectoryDefiner(const byte* ptr, bool* success) {
+uint16_t DexFileVerifier::FindFirstAnnotationsDirectoryDefiner(const uint8_t* ptr, bool* success) {
   const DexFile::AnnotationsDirectoryItem* item =
       reinterpret_cast<const DexFile::AnnotationsDirectoryItem*>(ptr);
   *success = true;
@@ -1759,7 +1759,7 @@
 
   // Check that references in class_data_item are to the right class.
   if (item->class_data_off_ != 0) {
-    const byte* data = begin_ + item->class_data_off_;
+    const uint8_t* data = begin_ + item->class_data_off_;
     bool success;
     uint16_t data_definer = FindFirstClassDataDefiner(data, &success);
     if (!success) {
@@ -1773,7 +1773,7 @@
 
   // Check that references in annotations_directory_item are to right class.
   if (item->annotations_off_ != 0) {
-    const byte* data = begin_ + item->annotations_off_;
+    const uint8_t* data = begin_ + item->annotations_off_;
     bool success;
     uint16_t annotations_definer = FindFirstAnnotationsDirectoryDefiner(data, &success);
     if (!success) {
@@ -1804,7 +1804,7 @@
     item++;
   }
 
-  ptr_ = reinterpret_cast<const byte*>(item);
+  ptr_ = reinterpret_cast<const uint8_t*>(item);
   return true;
 }
 
@@ -1834,7 +1834,7 @@
     offsets++;
   }
 
-  ptr_ = reinterpret_cast<const byte*>(offsets);
+  ptr_ = reinterpret_cast<const uint8_t*>(offsets);
   return true;
 }
 
@@ -1935,7 +1935,7 @@
     parameter_item++;
   }
 
-  ptr_ = reinterpret_cast<const byte*>(parameter_item);
+  ptr_ = reinterpret_cast<const uint8_t*>(parameter_item);
   return true;
 }
 
@@ -1956,7 +1956,7 @@
   for (uint32_t i = 0; i < count; i++) {
     uint32_t new_offset = (offset + alignment_mask) & ~alignment_mask;
     ptr_ = begin_ + new_offset;
-    const byte* prev_ptr = ptr_;
+    const uint8_t* prev_ptr = ptr_;
 
     // Check depending on the section type.
     switch (type) {