[Lldb-commits] [lldb] r228909 - Cast EOF to get a proper comparison.

Justin Hibbits jrh29 at ALUMNI.cwru.edu
Wed Feb 11 21:31:46 PST 2015


Author: jhibbits
Date: Wed Feb 11 23:31:46 2015
New Revision: 228909

URL: http://llvm.org/viewvc/llvm-project?rev=228909&view=rev
Log:
Cast EOF to get a proper comparison.

On PowerPC, and maybe some other architectures, 'char' is unsigned.  Comparing
an unsigned char with a signed int (-1) is always false.  To fix this, down-cast
EOF to a char.

Modified:
    lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=228909&r1=228908&r2=228909&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Wed Feb 11 23:31:46 2015
@@ -594,7 +594,7 @@ Editline::GetCharacter (EditLineCharType
                 return 1;
 #else
             *c = ch;
-            if(*c != EOF) 
+            if(ch != (char)EOF) 
                 return 1;
 #endif
         }





More information about the lldb-commits mailing list