Use uintptr_t for cast pointer to integer.

On 64bit host, sizeof pointer is not equal to sizeof int.
	Need for host tools.

Change-Id: I848ceb878b873e6764a077e8a4ee31e756f30017
This commit is contained in:
SangWook Han
2012-07-15 22:51:02 +09:00
parent 43eb9a78c3
commit ac8ed5e089

View File

@@ -7,6 +7,7 @@
#include "Common.h" #include "Common.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
@@ -35,7 +36,7 @@ void printHexDumpEx(FILE* fp, const void* vaddr, size_t length,
{ {
const unsigned char* addr = reinterpret_cast<const unsigned char*>(vaddr); const unsigned char* addr = reinterpret_cast<const unsigned char*>(vaddr);
char out[77]; /* exact fit */ char out[77]; /* exact fit */
unsigned int offset; /* offset to show while printing */ uintptr_t offset; /* offset to show while printing */
char* hex; char* hex;
char* asc; char* asc;
int gap; int gap;
@@ -43,7 +44,7 @@ void printHexDumpEx(FILE* fp, const void* vaddr, size_t length,
if (mode == kHexDumpLocal) if (mode == kHexDumpLocal)
offset = 0; offset = 0;
else else
offset = (int) addr; offset = (uintptr_t) addr;
memset(out, ' ', sizeof(out)-1); memset(out, ' ', sizeof(out)-1);
out[8] = ':'; out[8] = ':';