Fix a bunch more lint.
(If you ignore the compilers, we've got relatively little lint now. Fits on
a single screen.)
Change-Id: I51389002894d4fd8cf46f79d2bac57079322a030
diff --git a/src/jdwp/jdwp_expand_buf.cc b/src/jdwp/jdwp_expand_buf.cc
index 307167e..523c9d7 100644
--- a/src/jdwp/jdwp_expand_buf.cc
+++ b/src/jdwp/jdwp_expand_buf.cc
@@ -44,13 +44,10 @@
* Allocate a JdwpBuf and some initial storage.
*/
ExpandBuf* expandBufAlloc() {
- ExpandBuf* newBuf;
-
- newBuf = (ExpandBuf*) malloc(sizeof(*newBuf));
- newBuf->storage = (uint8_t*) malloc(kInitialStorage);
+ ExpandBuf* newBuf = new ExpandBuf;
+ newBuf->storage = reinterpret_cast<uint8_t*>(malloc(kInitialStorage));
newBuf->curLen = 0;
newBuf->maxLen = kInitialStorage;
-
return newBuf;
}
@@ -63,7 +60,7 @@
}
free(pBuf->storage);
- free(pBuf);
+ delete pBuf;
}
/*
@@ -80,7 +77,6 @@
return pBuf->curLen;
}
-
/*
* Ensure that the buffer has enough space to hold incoming data. If it
* doesn't, resize the buffer.
@@ -94,7 +90,7 @@
pBuf->maxLen *= 2;
}
- uint8_t* newPtr = (uint8_t*) realloc(pBuf->storage, pBuf->maxLen);
+ uint8_t* newPtr = reinterpret_cast<uint8_t*>(realloc(pBuf->storage, pBuf->maxLen));
if (newPtr == NULL) {
LOG(FATAL) << "realloc(" << pBuf->maxLen << ") failed";
}