diff options
| author | Dan Bornstein <danfuzz@android.com> | 2011-05-25 22:23:29 -0700 |
|---|---|---|
| committer | Dan Bornstein <danfuzz@android.com> | 2011-05-25 22:23:29 -0700 |
| commit | d9d1a8685a394c7fd67d87aa52e826b88c981994 (patch) | |
| tree | 6d644e09b688a50aa77ae79201d050c7954e14b3 /tools | |
| parent | e56df060df2b415c9b936ee318d75e06512e7555 (diff) | |
One more dex magic update.
I missed the dexdeps tool in my earlier change. This fixes it
to recognize both supported dex version numbers.
Change-Id: Ia6a26539f2ab6369ecbf3697b01b7d62a1e836b8
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/dexdeps/src/com/android/dexdeps/DexData.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/dexdeps/src/com/android/dexdeps/DexData.java b/tools/dexdeps/src/com/android/dexdeps/DexData.java index 7ce5d04c0..89dff182a 100644 --- a/tools/dexdeps/src/com/android/dexdeps/DexData.java +++ b/tools/dexdeps/src/com/android/dexdeps/DexData.java @@ -62,6 +62,13 @@ public class DexData { markInternalClasses(); } + /** + * Verifies the given magic number. + */ + private static boolean verifyMagic(byte[] magic) { + return Arrays.equals(magic, HeaderItem.DEX_FILE_MAGIC) || + Arrays.equals(magic, HeaderItem.DEX_FILE_MAGIC_API_13); + } /** * Parses the interesting bits out of the header. @@ -73,7 +80,7 @@ public class DexData { byte[] magic = new byte[8]; readBytes(magic); - if (!Arrays.equals(magic, HeaderItem.DEX_FILE_MAGIC)) { + if (!verifyMagic(magic)) { System.err.println("Magic number is wrong -- are you sure " + "this is a DEX file?"); throw new DexDataException(); @@ -532,6 +539,8 @@ public class DexData { /* expected magic values */ public static final byte[] DEX_FILE_MAGIC = { + 0x64, 0x65, 0x78, 0x0a, 0x30, 0x33, 0x36, 0x00 }; + public static final byte[] DEX_FILE_MAGIC_API_13 = { 0x64, 0x65, 0x78, 0x0a, 0x30, 0x33, 0x35, 0x00 }; public static final int ENDIAN_CONSTANT = 0x12345678; public static final int REVERSE_ENDIAN_CONSTANT = 0x78563412; |
