Implement local setting.

I've also worked out how to test CreateString and CreateObject, but
not CreateArrayObject yet.

Also stop saying "cnt".

Change-Id: I26569ff6c4fa356fb91e6c22cbf8ced95094fabd
diff --git a/src/jdwp/jdwp.h b/src/jdwp/jdwp.h
index f138880..b628e6c 100644
--- a/src/jdwp/jdwp.h
+++ b/src/jdwp/jdwp.h
@@ -213,7 +213,7 @@
   /*
    * Send up a chunk of DDM data.
    */
-  void DdmSendChunkV(uint32_t type, const iovec* iov, int iovcnt);
+  void DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count);
 
   /*
    * Process a request from the debugger.
diff --git a/src/jdwp/jdwp_adb.cc b/src/jdwp/jdwp_adb.cc
index 5570b53..f6b977e 100644
--- a/src/jdwp/jdwp_adb.cc
+++ b/src/jdwp/jdwp_adb.cc
@@ -670,7 +670,7 @@
  *
  * Returns "true" if it was sent successfully.
  */
-static bool sendBufferedRequest(JdwpState* state, const iovec* iov, int iovcnt) {
+static bool sendBufferedRequest(JdwpState* state, const iovec* iov, int iov_count) {
   JdwpNetState* netState = state->netState;
 
   if (netState->clientSock < 0) {
@@ -680,12 +680,11 @@
   }
 
   size_t expected = 0;
-  int i;
-  for (i = 0; i < iovcnt; i++) {
+  for (int i = 0; i < iov_count; i++) {
     expected += iov[i].iov_len;
   }
 
-  ssize_t actual = netState->writeBufferedPacket(iov, iovcnt);
+  ssize_t actual = netState->writeBufferedPacket(iov, iov_count);
   if ((size_t)actual != expected) {
     PLOG(ERROR) << "Failed sending b-req to debugger (" << actual << " of " << expected << ")";
     return false;
diff --git a/src/jdwp/jdwp_event.cc b/src/jdwp/jdwp_event.cc
index 9440066..15e1151 100644
--- a/src/jdwp/jdwp_event.cc
+++ b/src/jdwp/jdwp_event.cc
@@ -1091,19 +1091,20 @@
  * other debugger traffic, and can't suspend the VM, so we skip all of
  * the fun event token gymnastics.
  */
-void JdwpState::DdmSendChunkV(uint32_t type, const iovec* iov, int iovcnt) {
+void JdwpState::DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count) {
   uint8_t header[kJDWPHeaderLen + 8];
   size_t dataLen = 0;
 
   CHECK(iov != NULL);
-  CHECK(iovcnt > 0 && iovcnt < 10);
+  CHECK_GT(iov_count, 0);
+  CHECK_LT(iov_count, 10);
 
   /*
    * "Wrap" the contents of the iovec with a JDWP/DDMS header.  We do
    * this by creating a new copy of the vector with space for the header.
    */
-  iovec wrapiov[iovcnt+1];
-  for (int i = 0; i < iovcnt; i++) {
+  iovec wrapiov[iov_count+1];
+  for (int i = 0; i < iov_count; i++) {
     wrapiov[i+1].iov_base = iov[i].iov_base;
     wrapiov[i+1].iov_len = iov[i].iov_len;
     dataLen += iov[i].iov_len;
@@ -1125,7 +1126,7 @@
    * Make sure we're in VMWAIT in case the write blocks.
    */
   int old_state = Dbg::ThreadWaiting();
-  (*transport->sendBufferedRequest)(this, wrapiov, iovcnt + 1);
+  (*transport->sendBufferedRequest)(this, wrapiov, iov_count + 1);
   Dbg::ThreadContinuing(old_state);
 }
 
diff --git a/src/jdwp/jdwp_main.cc b/src/jdwp/jdwp_main.cc
index 28ea303..07ffc52 100644
--- a/src/jdwp/jdwp_main.cc
+++ b/src/jdwp/jdwp_main.cc
@@ -53,9 +53,9 @@
 /*
  * Write a buffered packet. Grabs a mutex to assure atomicity.
  */
-ssize_t JdwpNetStateBase::writeBufferedPacket(const iovec* iov, int iovcnt) {
+ssize_t JdwpNetStateBase::writeBufferedPacket(const iovec* iov, int iov_count) {
   MutexLock mu(socket_lock_);
-  return writev(clientSock, iov, iovcnt);
+  return writev(clientSock, iov, iov_count);
 }
 
 bool JdwpState::IsConnected() {
diff --git a/src/jdwp/jdwp_priv.h b/src/jdwp/jdwp_priv.h
index 45d70f8..d2c35dd 100644
--- a/src/jdwp/jdwp_priv.h
+++ b/src/jdwp/jdwp_priv.h
@@ -62,7 +62,7 @@
   bool (*awaitingHandshake)(JdwpState* state);
   bool (*processIncoming)(JdwpState* state);
   bool (*sendRequest)(JdwpState* state, ExpandBuf* pReq);
-  bool (*sendBufferedRequest)(JdwpState* state, const iovec* iov, int iovcnt);
+  bool (*sendBufferedRequest)(JdwpState* state, const iovec* iov, int iov_count);
 };
 
 const JdwpTransport* SocketTransport();
@@ -77,7 +77,7 @@
 
   JdwpNetStateBase();
   ssize_t writePacket(ExpandBuf* pReply);
-  ssize_t writeBufferedPacket(const iovec* iov, int iovcnt);
+  ssize_t writeBufferedPacket(const iovec* iov, int iov_count);
 
 private:
   Mutex socket_lock_;
diff --git a/src/jdwp/jdwp_socket.cc b/src/jdwp/jdwp_socket.cc
index aba893d..351e456 100644
--- a/src/jdwp/jdwp_socket.cc
+++ b/src/jdwp/jdwp_socket.cc
@@ -822,7 +822,7 @@
  *
  * Returns "true" if it was sent successfully.
  */
-static bool sendBufferedRequest(JdwpState* state, const iovec* iov, int iovcnt) {
+static bool sendBufferedRequest(JdwpState* state, const iovec* iov, int iov_count) {
   JdwpNetState* netState = state->netState;
 
   if (netState->clientSock < 0) {
@@ -832,11 +832,11 @@
   }
 
   size_t expected = 0;
-  for (int i = 0; i < iovcnt; i++) {
+  for (int i = 0; i < iov_count; i++) {
     expected += iov[i].iov_len;
   }
 
-  ssize_t actual = netState->writeBufferedPacket(iov, iovcnt);
+  ssize_t actual = netState->writeBufferedPacket(iov, iov_count);
 
   if ((size_t)actual != expected) {
     PLOG(ERROR) << "Failed sending b-req to debugger (" << actual << " of " << expected << ")";