[Lldb-commits] [lldb] r355708 - [lldb-vscode] Fix warning

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 8 09:36:55 PST 2019


Author: jdevlieghere
Date: Fri Mar  8 09:36:54 2019
New Revision: 355708

URL: http://llvm.org/viewvc/llvm-project?rev=355708&view=rev
Log:
[lldb-vscode] Fix warning

I changed the variable to an unsigned to get rid of a signed and
unsigned compare without realizing the value could be negative. This
fixes the assert instead.

Modified:
    lldb/trunk/tools/lldb-vscode/IOStream.cpp

Modified: lldb/trunk/tools/lldb-vscode/IOStream.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/IOStream.cpp?rev=355708&r1=355707&r2=355708&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-vscode/IOStream.cpp (original)
+++ lldb/trunk/tools/lldb-vscode/IOStream.cpp Fri Mar  8 09:36:54 2019
@@ -95,7 +95,7 @@ bool InputStream::read_full(std::ofstrea
 
   char *ptr = &data[0];
   while (length != 0) {
-    size_t bytes_read = 0;
+    int bytes_read = 0;
     if (descriptor.m_is_socket)
       bytes_read = ::recv(descriptor.m_socket, ptr, length, 0);
     else
@@ -119,7 +119,7 @@ bool InputStream::read_full(std::ofstrea
       return false;
     }
 
-    assert(bytes_read <= length);
+    assert(bytes_read >= 0 && (size_t)bytes_read <= length);
     ptr += bytes_read;
     length -= bytes_read;
   }




More information about the lldb-commits mailing list