Index: tools/debugserver/source/RNBRemote.h =================================================================== --- tools/debugserver/source/RNBRemote.h +++ tools/debugserver/source/RNBRemote.h @@ -154,7 +154,7 @@ nub_thread_t GetCurrentThread () const { - if (m_thread == 0 || m_thread == -1) + if (m_thread == 0 || m_thread == static_cast(-1)) return DNBProcessGetCurrentThread (m_ctx.ProcessID()); return m_thread; } Index: tools/debugserver/source/RNBRemote.cpp =================================================================== --- tools/debugserver/source/RNBRemote.cpp +++ tools/debugserver/source/RNBRemote.cpp @@ -322,7 +322,7 @@ } else { - for (int i = 0; i != s.size(); ++i) + for (size_t i = 0; i != s.size(); ++i) cksum += s[i]; snprintf (hexbuf, sizeof hexbuf, "%02x", cksum & 0xff); sendpacket += hexbuf; @@ -398,7 +398,7 @@ int packet_checksum = 0; if (!m_noack_mode) { - for (int i = return_packet.size() - 2; i < return_packet.size(); ++i) + for (size_t i = return_packet.size() - 2; i < return_packet.size(); ++i) { char checksum_char = tolower (return_packet[i]); if (!isxdigit (checksum_char)) @@ -788,14 +788,14 @@ case rnb_success: break; - default: - case rnb_err: - DNBLogThreadedIf (LOG_RNB_REMOTE, "RNBSocket::GetCommData returned error %u", err); + case rnb_not_connected: + DNBLogThreadedIf (LOG_RNB_REMOTE, "RNBSocket::GetCommData returned not connected..."); done = true; break; - case rnb_not_connected: - DNBLogThreadedIf (LOG_RNB_REMOTE, "RNBSocket::GetCommData returned not connected..."); + case rnb_err: + default: + DNBLogThreadedIf (LOG_RNB_REMOTE, "RNBSocket::GetCommData returned error %u", err); done = true; break; } @@ -856,7 +856,7 @@ { return bytes; } - if (len == -1) + if (len == static_cast(-1)) len = strlen (str); while (len--) @@ -2214,15 +2214,14 @@ void append_hex_value (std::ostream& ostrm, const uint8_t* buf, size_t buf_size, bool swap) { - int i; if (swap) { - for (i = buf_size-1; i >= 0; i--) + for (long i = buf_size-1; i >= 0; i--) ostrm << RAWHEX8(buf[i]); } else { - for (i = 0; i < buf_size; i++) + for (size_t i = 0; i < buf_size; i++) ostrm << RAWHEX8(buf[i]); } } @@ -2353,7 +2352,7 @@ // the thread name contains special chars, send as hex bytes ostrm << std::hex << "hexname:"; uint8_t *u_thread_name = (uint8_t *)thread_name; - for (int i = 0; i < thread_name_len; i++) + for (size_t i = 0; i < thread_name_len; i++) ostrm << RAWHEX8(u_thread_name[i]); ostrm << ';'; } @@ -2421,7 +2420,7 @@ { ostrm << "metype:" << std::hex << tid_stop_info.details.exception.type << ";"; ostrm << "mecount:" << std::hex << tid_stop_info.details.exception.data_count << ";"; - for (int i = 0; i < tid_stop_info.details.exception.data_count; ++i) + for (nub_size_t i = 0; i < tid_stop_info.details.exception.data_count; ++i) ostrm << "medata:" << std::hex << tid_stop_info.details.exception.data[i] << ";"; } return SendPacket (ostrm.str ()); @@ -2645,7 +2644,7 @@ length = bytes_read; std::ostringstream ostrm; - for (int i = 0; i < length; i++) + for (uint32_t i = 0; i < length; i++) ostrm << RAWHEX8(buf[i]); return SendPacket (ostrm.str ()); } @@ -2686,7 +2685,7 @@ p += (c - p) + 1; errno = 0; - int length = strtoul (p, NULL, 16); + unsigned length = strtoul (p, NULL, 16); if (errno != 0) { return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in x packet"); @@ -2727,7 +2726,7 @@ length = buf_quoted.size(); std::ostringstream ostrm; - for (int i = 0; i < length; i++) + for (unsigned i = 0; i < length; i++) ostrm << buf_quoted[i]; return SendPacket (ostrm.str ()); @@ -3495,7 +3494,7 @@ DNBLogError("RNBRemote::HandlePacket_p(%s): unknown register number %u requested\n", p, reg); ostrm << "00000000"; } - else if (reg_entry->nub_info.reg == -1) + else if (reg_entry->nub_info.reg == static_cast(-1)) { if (reg_entry->nub_info.size > 0) { @@ -3554,7 +3553,8 @@ reg_entry = &g_reg_entries[reg]; - if (reg_entry->nub_info.set == -1 && reg_entry->nub_info.reg == -1) + if (reg_entry->nub_info.set == static_cast(-1) && + reg_entry->nub_info.reg == static_cast(-1)) { DNBLogError("RNBRemote::HandlePacket_P(%s): unknown register number %u requested\n", p, reg); return SendPacket("E48"); @@ -3911,7 +3911,7 @@ // Hardware supported stepping not supported on arm nub_thread_t tid = GetContinueThread (); - if (tid == 0 || tid == -1) + if (tid == 0 || tid == static_cast(-1)) tid = GetCurrentThread(); if (tid == INVALID_NUB_THREAD) @@ -3959,7 +3959,7 @@ } action.tid = GetContinueThread (); - if (action.tid == 0 || action.tid == -1) + if (action.tid == 0 || action.tid == static_cast(-1)) return SendPacket ("E40"); nub_state_t tstate = DNBThreadGetState (pid, action.tid);