Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java72
1 files changed, 36 insertions, 36 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java
index 25dde336f..f15fb6cf4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -33,14 +33,14 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
{
String ret;
long result = 0;
-
+
if (columnSize == 1)
{
result = byteArray[0];
result &= 0xff;
}
else if (columnSize == 2)
- {
+ {
result = RenderingsUtil.convertByteArrayToInt(byteArray, endianess);
}
else if (columnSize == 4)
@@ -50,7 +50,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
else if (columnSize == 8)
{
BigInteger value = RenderingsUtil.convertByteArrayToUnsignedLong(byteArray, endianess);
- return value.toString();
+ return value.toString();
}
else if (columnSize == 16)
{
@@ -60,14 +60,14 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
else
{
BigInteger bigRet = RenderingsUtil.convertByteArrayToUnsignedBigInt(byteArray, endianess, columnSize);
- return bigRet.toString();
+ return bigRet.toString();
}
ret = new Long(result).toString();
-
+
return ret;
- }
-
+ }
+
private byte[] convertToBytes(int colSize, String newValue, int endianess)
{
try {
@@ -80,25 +80,25 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
}
// unsigned integer
else if (colSize == 2)
- {
+ {
int i = Integer.parseInt(newValue);
bytes = RenderingsUtil.convertIntToByteArray(i, endianess);
bytes = extractBytes(bytes, endianess, colSize);
}
else if (colSize == 4)
- {
+ {
long i = Long.parseLong(newValue);
bytes = RenderingsUtil.convertLongToByteArray(i, endianess);
bytes = extractBytes(bytes, endianess, colSize);
}
else if (colSize == 8)
- {
+ {
BigInteger i = new BigInteger(newValue);
bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess);
bytes = extractBytes(bytes, endianess, colSize);
}
else if (colSize == 16)
- {
+ {
BigInteger i = new BigInteger(newValue);
bytes = RenderingsUtil.convertUnsignedBigIntegerToByteArray(i, endianess);
bytes = extractBytes(bytes, endianess, colSize);
@@ -110,9 +110,9 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
BigInteger i = new BigInteger(newValue);
bytes = RenderingsUtil.convertUnsignedBigIntToByteArray(i, endianess, colSize);
bytes = extractBytes(bytes, endianess, colSize);
- return bytes;
+ return bytes;
}
-
+
return bytes;
} catch (NumberFormatException e) {
throw e;
@@ -124,7 +124,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
*/
@Override
public String getString(String dataType, BigInteger address, MemoryByte[] data) {
-
+
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
boolean invalid = false;
for (int i=0; i<data.length; i++)
@@ -135,7 +135,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
break;
}
}
-
+
if (invalid)
{
StringBuffer strBuf = new StringBuffer();
@@ -145,19 +145,19 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
}
return strBuf.toString();
}
-
+
int columnSize = getBytesPerColumn();
int endianess = getDisplayEndianess();
if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN)
endianess = getBytesEndianess(data);
-
+
byte[] byteArray = new byte[data.length];
for (int i=0; i<byteArray.length;i ++)
{
byteArray[i] = data[i].getValue();
}
-
- // if endianess is unknown, do not render, just return padded string
+
+ // if endianess is unknown, do not render, just return padded string
if (RenderingsUtil.ENDIANESS_UNKNOWN == endianess)
{
StringBuffer strBuf = new StringBuffer();
@@ -167,7 +167,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
}
return strBuf.toString();
}
-
+
return convertToString(byteArray, columnSize, endianess);
}
@@ -176,12 +176,12 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
*/
@Override
public byte[] getBytes(String dataType, BigInteger address, MemoryByte[] currentValues, String data) {
-
+
int columnSize = getBytesPerColumn();
int endianess = getDisplayEndianess();
if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN)
endianess = getBytesEndianess(currentValues);
-
+
// if endianess is unknown, do not try to render new data to bytes
if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN)
{
@@ -190,19 +190,19 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
retBytes[i] = currentValues[i].getValue();
return retBytes;
}
-
+
return convertToBytes(columnSize, data, endianess);
}
-
+
private byte[] extractBytes(byte[] bytes, int endianess, int colSize) {
-
+
if (colSize > bytes.length)
throw new NumberFormatException();
-
+
// take the least significant 'colSize' bytes out of the bytes array
// if it's big endian, it's the last 'colSize' bytes
if (endianess == RenderingsUtil.BIG_ENDIAN)
- {
+ {
// check most significan bytes... if data has to be represented
// using more than 'colSize' number of bytes, this
// number is invalid, throw number format exception
@@ -211,11 +211,11 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
if (bytes[i] != 0)
throw new NumberFormatException();
}
-
+
byte[] copy = new byte[colSize];
for (int j=0, k=bytes.length-colSize; j<copy.length && k<bytes.length; j++, k++)
- {
- copy[j] = bytes[k];
+ {
+ copy[j] = bytes[k];
}
bytes = copy;
}
@@ -230,14 +230,14 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
if (bytes[i] != 0)
throw new NumberFormatException();
}
-
+
byte[] copy = new byte[colSize];
for (int j=0; j<copy.length; j++)
- {
- copy[j] = bytes[j];
+ {
+ copy[j] = bytes[j];
}
- bytes = copy;
+ bytes = copy;
}
return bytes;
- }
+ }
}

Back to the top