From a2ee53bac4db4c77aa2bb31bad8a9d177fd09301 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 5 May 2009 16:52:10 -0700 Subject: 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. --- libdex/CmdUtils.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'libdex') 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; } -- cgit v1.2.3