summaryrefslogtreecommitdiffstats
path: root/libdex
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2009-05-05 16:52:10 -0700
committerAndy McFadden <fadden@android.com>2009-05-05 17:05:59 -0700
commita2ee53bac4db4c77aa2bb31bad8a9d177fd09301 (patch)
tree01e36bd4bb27e2913c3bb6b2f941b9eabcc4ec8c /libdex
parent6d874d2bda563ada1034d2b3219b35d800fc6860 (diff)
downloadandroid_dalvik-a2ee53bac4db4c77aa2bb31bad8a9d177fd09301.tar.gz
android_dalvik-a2ee53bac4db4c77aa2bb31bad8a9d177fd09301.tar.bz2
android_dalvik-a2ee53bac4db4c77aa2bb31bad8a9d177fd09301.zip
Added XML output mode for dexdump.
This adds an output mode that looks similar to the "current.xml" we generate for our public APIs. There are a number of differences in content. The original ("plain") output has not been altered. I pulled in the bad checksum handling change (internal 142686) since it's small, has turned out to be useful, and might make the merge of this to master slightly easier. This also renames a buffer in the ongoing temp file variable saga.
Diffstat (limited to 'libdex')
-rw-r--r--libdex/CmdUtils.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libdex/CmdUtils.c b/libdex/CmdUtils.c
index 35ced14bc..7dfee87cc 100644
--- a/libdex/CmdUtils.c
+++ b/libdex/CmdUtils.c
@@ -104,7 +104,7 @@ UnzipToFileResult dexOpenAndMap(const char* fileName, const char* tempFileName,
{
UnzipToFileResult result = kUTFRGenericFailure;
int len = strlen(fileName);
- char tempName[32];
+ char tempNameBuf[32];
bool removeTemp = false;
int fd = -1;
@@ -125,17 +125,17 @@ UnzipToFileResult dexOpenAndMap(const char* fileName, const char* tempFileName,
* data to a temp file, the location of which varies.
*/
if (access("/tmp", W_OK) == 0)
- sprintf(tempName, "/tmp/dex-temp-%d", getpid());
+ sprintf(tempNameBuf, "/tmp/dex-temp-%d", getpid());
else
- sprintf(tempName, "/sdcard/dex-temp-%d", getpid());
+ sprintf(tempNameBuf, "/sdcard/dex-temp-%d", getpid());
- tempFileName = tempName;
+ tempFileName = tempNameBuf;
}
result = dexUnzipToFile(fileName, tempFileName, quiet);
if (result == kUTFRSuccess) {
- //printf("+++ Good unzip to '%s'\n", tempName);
+ //printf("+++ Good unzip to '%s'\n", tempFileName);
fileName = tempFileName;
removeTemp = true;
} else if (result == kUTFRNotZip) {
@@ -177,8 +177,10 @@ bail:
if (fd >= 0)
close(fd);
if (removeTemp) {
- if (unlink(tempName) != 0)
- fprintf(stderr, "Warning: unable to remove temp '%s'\n", tempName);
+ if (unlink(tempFileName) != 0) {
+ fprintf(stderr, "Warning: unable to remove temp '%s'\n",
+ tempFileName);
+ }
}
return result;
}