stdint types all the way!
Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
diff --git a/runtime/dex_file_verifier_test.cc b/runtime/dex_file_verifier_test.cc
index d475d42..addd948 100644
--- a/runtime/dex_file_verifier_test.cc
+++ b/runtime/dex_file_verifier_test.cc
@@ -30,7 +30,7 @@
class DexFileVerifierTest : public CommonRuntimeTest {};
-static const byte kBase64Map[256] = {
+static const uint8_t kBase64Map[256] = {
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
@@ -55,12 +55,12 @@
255, 255, 255, 255
};
-static inline byte* DecodeBase64(const char* src, size_t* dst_size) {
- std::vector<byte> tmp;
+static inline uint8_t* DecodeBase64(const char* src, size_t* dst_size) {
+ std::vector<uint8_t> tmp;
uint32_t t = 0, y = 0;
int g = 3;
for (size_t i = 0; src[i] != '\0'; ++i) {
- byte c = kBase64Map[src[i] & 0xFF];
+ uint8_t c = kBase64Map[src[i] & 0xFF];
if (c == 255) continue;
// the final = symbols are read and used to trim the remaining bytes
if (c == 254) {
@@ -91,7 +91,7 @@
*dst_size = 0;
return nullptr;
}
- std::unique_ptr<byte[]> dst(new byte[tmp.size()]);
+ std::unique_ptr<uint8_t[]> dst(new uint8_t[tmp.size()]);
if (dst_size != nullptr) {
*dst_size = tmp.size();
} else {
@@ -106,7 +106,7 @@
// decode base64
CHECK(base64 != NULL);
size_t length;
- std::unique_ptr<byte[]> dex_bytes(DecodeBase64(base64, &length));
+ std::unique_ptr<uint8_t[]> dex_bytes(DecodeBase64(base64, &length));
CHECK(dex_bytes.get() != NULL);
// write to provided file
@@ -153,17 +153,17 @@
ASSERT_TRUE(raw.get() != nullptr) << error_msg;
}
-static void FixUpChecksum(byte* dex_file) {
+static void FixUpChecksum(uint8_t* dex_file) {
DexFile::Header* header = reinterpret_cast<DexFile::Header*>(dex_file);
uint32_t expected_size = header->file_size_;
uint32_t adler_checksum = adler32(0L, Z_NULL, 0);
const uint32_t non_sum = sizeof(DexFile::Header::magic_) + sizeof(DexFile::Header::checksum_);
- const byte* non_sum_ptr = dex_file + non_sum;
+ const uint8_t* non_sum_ptr = dex_file + non_sum;
adler_checksum = adler32(adler_checksum, non_sum_ptr, expected_size - non_sum);
header->checksum_ = adler_checksum;
}
-static const DexFile* FixChecksumAndOpen(byte* bytes, size_t length, const char* location,
+static const DexFile* FixChecksumAndOpen(uint8_t* bytes, size_t length, const char* location,
std::string* error_msg) {
// Check data.
CHECK(bytes != nullptr);
@@ -196,7 +196,7 @@
std::string* error_msg) {
// Decode base64.
size_t length;
- std::unique_ptr<byte[]> dex_bytes(DecodeBase64(kGoodTestDex, &length));
+ std::unique_ptr<uint8_t[]> dex_bytes(DecodeBase64(kGoodTestDex, &length));
CHECK(dex_bytes.get() != NULL);
// Make modifications.