1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Bug 303629 unsigned char should never appear negative in the Variables view.

This commit is contained in:
James Blackburn 2010-02-23 15:26:13 +00:00
parent 2dc9a8c1d3
commit 79ece8daa2

View file

@ -288,11 +288,13 @@ public class CValue extends AbstractCValue {
case '\r': case '\r':
return "'\\r'"; //$NON-NLS-1$ return "'\\r'"; //$NON-NLS-1$
} }
if (Character.isISOControl(byteValue) || byteValue < 0) if (Character.isISOControl(byteValue))
return Byte.toString(byteValue); return Byte.toString(byteValue);
else if (byteValue < 0)
return new String( new byte[]{ '\'', byteValue, '\'' } ); //$NON-NLS-1$ return isUnsigned() ? Short.toString(value.shortValue()) : Byte.toString(byteValue);
return new String( new byte[]{ '\'', byteValue, '\'' } );
} }
else if ( CVariableFormat.DECIMAL.equals( format ) ) { else if ( CVariableFormat.DECIMAL.equals( format ) ) {
return (isUnsigned()) ? Integer.toString( value.shortValue() ) : Integer.toString( (byte)value.byteValue() ); return (isUnsigned()) ? Integer.toString( value.shortValue() ) : Integer.toString( (byte)value.byteValue() );