Cast EOF to get a proper comparison.
authorJustin Hibbits <jrh29@alumni.cwru.edu>
Thu, 12 Feb 2015 05:31:46 +0000 (05:31 +0000)
committerJustin Hibbits <jrh29@alumni.cwru.edu>
Thu, 12 Feb 2015 05:31:46 +0000 (05:31 +0000)
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.

llvm-svn: 228909

lldb/source/Host/common/Editline.cpp

index a127d58..dd2e2db 100644 (file)
@@ -594,7 +594,7 @@ Editline::GetCharacter (EditLineCharType * c)
                 return 1;
 #else
             *c = ch;
-            if(*c != EOF) 
+            if(ch != (char)EOF) 
                 return 1;
 #endif
         }