diff options
author | Carl Shapiro <cshapiro@google.com> | 2011-04-27 14:16:08 -0700 |
---|---|---|
committer | Carl Shapiro <cshapiro@google.com> | 2011-04-27 14:16:08 -0700 |
commit | bfc9799b1a53fd6f6136d07e6278d4538cf70f13 (patch) | |
tree | 40bf278711a479bd9dab3eb789ed6128424218a0 /dexdump | |
parent | 093bba7fc67305c514dec0fefab3e988efa05df9 (diff) | |
download | android_dalvik-bfc9799b1a53fd6f6136d07e6278d4538cf70f13.tar.gz android_dalvik-bfc9799b1a53fd6f6136d07e6278d4538cf70f13.tar.bz2 android_dalvik-bfc9799b1a53fd6f6136d07e6278d4538cf70f13.zip |
Make libdex structures tool friendly.
Previously, the struct name and its typedef name were identical. This
confuses emacs and etags. This change eliminates the typedef names and
removes the extern "C" wrapping the libdex header files. To support
this change the transitive C dependencies have been made to compile as
C++ instead.
Change-Id: I7065f32d61d776f9b09c7b461adf2502268d852f
Diffstat (limited to 'dexdump')
-rw-r--r-- | dexdump/Android.mk | 2 | ||||
-rw-r--r-- | dexdump/DexDump.cpp (renamed from dexdump/DexDump.c) | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/dexdump/Android.mk b/dexdump/Android.mk index 58fa13720..e47acfa5c 100644 --- a/dexdump/Android.mk +++ b/dexdump/Android.mk @@ -18,7 +18,7 @@ LOCAL_PATH:= $(call my-dir) dexdump_src_files := \ - DexDump.c + DexDump.cpp dexdump_c_includes := \ dalvik \ diff --git a/dexdump/DexDump.c b/dexdump/DexDump.cpp index 93534714f..7d1175281 100644 --- a/dexdump/DexDump.c +++ b/dexdump/DexDump.cpp @@ -52,13 +52,13 @@ static const char* gProgName = "dexdump"; -typedef enum OutputFormat { +enum OutputFormat { OUTPUT_PLAIN = 0, /* default */ OUTPUT_XML, /* fancy */ -} OutputFormat; +}; /* command-line options */ -struct { +struct Options { bool checksumOnly; bool disassemble; bool showFileHeaders; @@ -69,14 +69,16 @@ struct { const char* tempFileName; bool exportsOnly; bool verbose; -} gOptions; +}; + +struct Options gOptions; /* basic info about a field or method */ -typedef struct FieldMethodInfo { +struct FieldMethodInfo { const char* classDescriptor; const char* name; const char* signature; -} FieldMethodInfo; +}; /* * Get 2 little-endian bytes. @@ -150,7 +152,7 @@ static char* descriptorToDot(const char* str) } } - newStr = malloc(targetLen + arrayDepth * 2 +1); + newStr = (char*)malloc(targetLen + arrayDepth * 2 +1); /* copy class name over */ int i; @@ -825,7 +827,7 @@ static char* indexString(DexFile* pDexFile, * size, so we add explicit space for it here. */ outSize++; - buf = malloc(outSize); + buf = (char*)malloc(outSize); if (buf == NULL) { return NULL; } @@ -1647,7 +1649,7 @@ bail: */ void dumpRegisterMaps(DexFile* pDexFile) { - const u1* pClassPool = pDexFile->pRegisterMapPool; + const u1* pClassPool = (const u1*)pDexFile->pRegisterMapPool; const u4* classOffsets; const u1* ptr; u4 numClasses; @@ -1781,15 +1783,16 @@ int process(const char* fileName) if (gOptions.verbose) printf("Processing '%s'...\n", fileName); - if (dexOpenAndMap(fileName, gOptions.tempFileName, &map, false) != 0) - goto bail; + if (dexOpenAndMap(fileName, gOptions.tempFileName, &map, false) != 0) { + return result; + } mapped = true; int flags = kDexParseVerifyChecksum; if (gOptions.ignoreBadChecksum) flags |= kDexParseContinueOnError; - pDexFile = dexFileParse(map.addr, map.length, flags); + pDexFile = dexFileParse((u1*)map.addr, map.length, flags); if (pDexFile == NULL) { fprintf(stderr, "ERROR: DEX parse failed\n"); goto bail; |