diff options
Diffstat (limited to 'runtime/dex_file.cc')
-rw-r--r-- | runtime/dex_file.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 35e9d5db29..85100ae49d 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -23,6 +23,7 @@ #include <string.h> #include <sys/file.h> #include <sys/stat.h> +#include <zlib.h> #include <memory> #include <sstream> @@ -67,6 +68,12 @@ const uint8_t DexFile::kDexMagicVersions[DexFile::kNumDexVersions][DexFile::kDex {'0', '3', '8', '\0'} }; +uint32_t DexFile::CalculateChecksum() const { + const uint32_t non_sum = OFFSETOF_MEMBER(DexFile::Header, signature_); + const uint8_t* non_sum_ptr = Begin() + non_sum; + return adler32(adler32(0L, Z_NULL, 0), non_sum_ptr, Size() - non_sum); +} + struct DexFile::AnnotationValue { JValue value_; uint8_t type_; |