diff options
author | Brian Carlstrom <bdc@google.com> | 2013-07-19 11:24:52 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-07-19 11:24:52 -0700 |
commit | d35311bcf4da508aefda65e6328cd18b878cb094 (patch) | |
tree | 5ea26227a61f1ce4a5d9d4dfda4da31fee012906 /runtime/jdwp | |
parent | d0e4e9eea233a55856df726c98ecc7aaca7f826c (diff) | |
parent | f52935278fca8c7aa220543eef4544e3d1105d91 (diff) | |
download | art-d35311bcf4da508aefda65e6328cd18b878cb094.zip art-d35311bcf4da508aefda65e6328cd18b878cb094.tar.gz art-d35311bcf4da508aefda65e6328cd18b878cb094.tar.bz2 |
am f5293527: Move JDWP to std::vector<iovec> to remove runtime/arrays warning
* commit 'f52935278fca8c7aa220543eef4544e3d1105d91':
Move JDWP to std::vector<iovec> to remove runtime/arrays warning
Diffstat (limited to 'runtime/jdwp')
-rw-r--r-- | runtime/jdwp/jdwp.h | 2 | ||||
-rw-r--r-- | runtime/jdwp/jdwp_event.cc | 10 | ||||
-rw-r--r-- | runtime/jdwp/jdwp_main.cc | 10 | ||||
-rw-r--r-- | runtime/jdwp/jdwp_priv.h | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h index 40ec431..ca118a2 100644 --- a/runtime/jdwp/jdwp.h +++ b/runtime/jdwp/jdwp.h @@ -289,7 +289,7 @@ struct JdwpState { void UnregisterEvent(JdwpEvent* pEvent) EXCLUSIVE_LOCKS_REQUIRED(event_list_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SendBufferedRequest(uint32_t type, const iovec* iov, int iov_count); + void SendBufferedRequest(uint32_t type, const std::vector<iovec>& iov); public: // TODO: fix privacy const JdwpOptions* options_; diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc index 546c637..ef5a7d3 100644 --- a/runtime/jdwp/jdwp_event.cc +++ b/runtime/jdwp/jdwp_event.cc @@ -1046,10 +1046,10 @@ void JdwpState::DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count) { * "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[iov_count+1]; // NOLINT(runtime/arrays) iov_count < 10 + std::vector<iovec> wrapiov; + wrapiov.push_back(iovec()); 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; + wrapiov.push_back(iov[i]); dataLen += iov[i].iov_len; } @@ -1080,11 +1080,11 @@ void JdwpState::DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count) { if (safe_to_release_mutator_lock_over_send) { // Change state to waiting to allow GC, ... while we're sending. self->TransitionFromRunnableToSuspended(kWaitingForDebuggerSend); - SendBufferedRequest(type, wrapiov, iov_count + 1); + SendBufferedRequest(type, wrapiov); self->TransitionFromSuspendedToRunnable(); } else { // Send and possibly block GC... - SendBufferedRequest(type, wrapiov, iov_count + 1); + SendBufferedRequest(type, wrapiov); } } diff --git a/runtime/jdwp/jdwp_main.cc b/runtime/jdwp/jdwp_main.cc index 8e61d23..93deee5 100644 --- a/runtime/jdwp/jdwp_main.cc +++ b/runtime/jdwp/jdwp_main.cc @@ -132,16 +132,16 @@ ssize_t JdwpNetStateBase::WritePacket(ExpandBuf* pReply) { /* * Write a buffered packet. Grabs a mutex to assure atomicity. */ -ssize_t JdwpNetStateBase::WriteBufferedPacket(const iovec* iov, int iov_count) { +ssize_t JdwpNetStateBase::WriteBufferedPacket(const std::vector<iovec>& iov) { MutexLock mu(Thread::Current(), socket_lock_); - return TEMP_FAILURE_RETRY(writev(clientSock, iov, iov_count)); + return TEMP_FAILURE_RETRY(writev(clientSock, &iov[0], iov.size())); } bool JdwpState::IsConnected() { return netState != NULL && netState->IsConnected(); } -void JdwpState::SendBufferedRequest(uint32_t type, const iovec* iov, int iov_count) { +void JdwpState::SendBufferedRequest(uint32_t type, const std::vector<iovec>& iov) { if (netState->clientSock < 0) { // Can happen with some DDMS events. VLOG(jdwp) << "Not sending JDWP packet: no debugger attached!"; @@ -149,12 +149,12 @@ void JdwpState::SendBufferedRequest(uint32_t type, const iovec* iov, int iov_cou } size_t expected = 0; - for (int i = 0; i < iov_count; ++i) { + for (size_t i = 0; i < iov.size(); ++i) { expected += iov[i].iov_len; } errno = 0; - ssize_t actual = netState->WriteBufferedPacket(iov, iov_count); + ssize_t actual = netState->WriteBufferedPacket(iov); if (static_cast<size_t>(actual) != expected) { PLOG(ERROR) << StringPrintf("Failed to send JDWP packet %c%c%c%c to debugger (%d of %d)", static_cast<uint8_t>(type >> 24), diff --git a/runtime/jdwp/jdwp_priv.h b/runtime/jdwp/jdwp_priv.h index 557632c..f919f97 100644 --- a/runtime/jdwp/jdwp_priv.h +++ b/runtime/jdwp/jdwp_priv.h @@ -70,7 +70,7 @@ class JdwpNetStateBase { void Close(); ssize_t WritePacket(ExpandBuf* pReply); - ssize_t WriteBufferedPacket(const iovec* iov, int iov_count); + ssize_t WriteBufferedPacket(const std::vector<iovec>& iov); int clientSock; // Active connection to debugger. |