Fix implicit conversions, rename reserved works, enable -Wc++-compat.
Change-Id: I06292964a6882ea2d0c17c5c962db95e46b01543
diff --git a/vm/hprof/Hprof.c b/vm/hprof/Hprof.c
index e42bd10..44547a1 100644
--- a/vm/hprof/Hprof.c
+++ b/vm/hprof/Hprof.c
@@ -45,7 +45,7 @@
hprofStartup_Stack();
#endif
- hprof_context_t *ctx = malloc(sizeof(*ctx));
+ hprof_context_t *ctx = (hprof_context_t *)malloc(sizeof(*ctx));
if (ctx == NULL) {
LOGE("hprof: can't allocate context.\n");
return NULL;
@@ -72,7 +72,7 @@
* Create a new context struct for the start of the file. We
* heap-allocate it so we can share the "free" function.
*/
- hprof_context_t *headCtx = malloc(sizeof(*headCtx));
+ hprof_context_t *headCtx = (hprof_context_t *)malloc(sizeof(*headCtx));
if (headCtx == NULL) {
LOGE("hprof: can't allocate context.\n");
hprofFreeContext(tailCtx);
@@ -212,10 +212,10 @@
assert(arg != NULL);
assert(type < NELEM(xlate));
- ctx = arg;
+ ctx = (hprof_context_t *)arg;
ctx->gcScanState = xlate[type];
ctx->gcThreadSerialNumber = threadId;
- hprofMarkRootObject(ctx, addr, 0);
+ hprofMarkRootObject(ctx, (Object *)addr, 0);
ctx->gcScanState = 0;
ctx->gcThreadSerialNumber = 0;
}
@@ -230,8 +230,8 @@
assert(ptr != NULL);
assert(arg != NULL);
- obj = ptr;
- ctx = arg;
+ obj = (Object *)ptr;
+ ctx = (hprof_context_t *)arg;
hprofDumpHeapObject(ctx, obj);
}
diff --git a/vm/hprof/HprofOutput.c b/vm/hprof/HprofOutput.c
index 25512b2..b84b298 100644
--- a/vm/hprof/HprofOutput.c
+++ b/vm/hprof/HprofOutput.c
@@ -85,7 +85,7 @@
ctx->fd = fd;
ctx->curRec.allocLen = 128;
- ctx->curRec.body = malloc(ctx->curRec.allocLen);
+ ctx->curRec.body = (unsigned char *)malloc(ctx->curRec.allocLen);
//xxx check for/return an error
if (writeHeader) {
@@ -194,7 +194,7 @@
if (newAllocLen < minSize) {
newAllocLen = rec->allocLen + nmore + nmore/2;
}
- newBody = realloc(rec->body, newAllocLen);
+ newBody = (unsigned char *)realloc(rec->body, newAllocLen);
if (newBody != NULL) {
rec->body = newBody;
rec->allocLen = newAllocLen;