Rename the printLongAsHex and printIntAsHex methods in IndentingWriter for clarity

This commit is contained in:
Ben Gruver 2011-07-15 13:29:16 -04:00
parent f119fc6db5
commit 74c14ffcca
12 changed files with 30 additions and 30 deletions

View File

@ -50,7 +50,7 @@ public abstract class DebugMethodItem extends MethodItem {
protected static void writeLine(IndentingWriter writer, int line) throws IOException {
writer.write(".line ");
writer.printIntAsDec(line);
writer.printSignedIntAsDec(line);
}
protected static void writeEndPrologue(IndentingWriter writer) throws IOException {

View File

@ -43,7 +43,7 @@ public class ArrayDataMethodItem extends InstructionMethodItem<ArrayDataPseudoIn
public boolean writeTo(IndentingWriter writer) throws IOException {
writer.write(".array-data 0x");
writer.printLongAsHex(instruction.getElementWidth());
writer.printUnsignedLongAsHex(instruction.getElementWidth());
writer.write('\n');
writer.indent(4);

View File

@ -293,12 +293,12 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
protected void writeFieldOffset(IndentingWriter writer) throws IOException {
writer.write("field@0x");
writer.printLongAsHex(((OdexedFieldAccess)instruction).getFieldOffset());
writer.printUnsignedLongAsHex(((OdexedFieldAccess) instruction).getFieldOffset());
}
protected void writeVtableIndex(IndentingWriter writer) throws IOException {
writer.write("vtable@0x");
writer.printLongAsHex(((OdexedInvokeVirtual)instruction).getMethodIndex());
writer.printUnsignedLongAsHex(((OdexedInvokeVirtual) instruction).getMethodIndex());
}
protected void writeReference(IndentingWriter writer) throws IOException {

View File

@ -74,9 +74,9 @@ public class LabelMethodItem extends MethodItem {
writer.write(':');
writer.write(labelPrefix);
if (baksmali.useSequentialLabels) {
writer.printLongAsHex(labelSequence);
writer.printUnsignedLongAsHex(labelSequence);
} else {
writer.printLongAsHex(this.getLabelAddress());
writer.printUnsignedLongAsHex(this.getLabelAddress());
}
return true;
}

View File

@ -120,7 +120,7 @@ public class MethodDefinition {
} else {
writer.write(".registers ");
}
writer.printIntAsDec(getRegisterCount(encodedMethod));
writer.printSignedIntAsDec(getRegisterCount(encodedMethod));
writer.write('\n');
writeParameters(writer, codeItem, parameterAnnotations);
if (annotationSet != null) {
@ -339,7 +339,7 @@ public class MethodDefinition {
@Override
public boolean writeTo(IndentingWriter writer) throws IOException {
writer.write("#@");
writer.printLongAsHex(codeAddress & 0xFFFFFFFF);
writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFF);
return true;
}
});
@ -417,7 +417,7 @@ public class MethodDefinition {
@Override
public boolean writeTo(IndentingWriter writer) throws IOException {
writer.write("#@");
writer.printLongAsHex(codeAddress & 0xFFFFFFFF);
writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFF);
return true;
}
});

View File

@ -219,7 +219,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
writer.write("Start:");
} else {
writer.write("0x");
writer.printLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
writer.write(':');
}
predecessorRegisterType.writeTo(writer);

View File

@ -63,17 +63,17 @@ public class RegisterFormatter {
if (startRegister >= registerCount - parameterRegisterCount) {
writer.write("{p");
writer.printIntAsDec(startRegister - (registerCount - parameterRegisterCount));
writer.printSignedIntAsDec(startRegister - (registerCount - parameterRegisterCount));
writer.write(" .. p");
writer.printIntAsDec(lastRegister - (registerCount - parameterRegisterCount));
writer.printSignedIntAsDec(lastRegister - (registerCount - parameterRegisterCount));
writer.write('}');
return;
}
}
writer.write("{v");
writer.printIntAsDec(startRegister);
writer.printSignedIntAsDec(startRegister);
writer.write(" .. v");
writer.printIntAsDec(lastRegister);
writer.printSignedIntAsDec(lastRegister);
writer.write('}');
}
@ -93,11 +93,11 @@ public class RegisterFormatter {
int registerCount = codeItem.getRegisterCount();
if (register >= registerCount - parameterRegisterCount) {
writer.write('p');
writer.printIntAsDec((register - (registerCount - parameterRegisterCount)));
writer.printSignedIntAsDec((register - (registerCount - parameterRegisterCount)));
return;
}
}
writer.write('v');
writer.printIntAsDec(register);
writer.printSignedIntAsDec(register);
}
}

View File

@ -36,18 +36,18 @@ public class ByteRenderer {
public static void writeTo(IndentingWriter writer, byte val) throws IOException {
if (val<0) {
writer.write("-0x");
writer.printLongAsHex(-val);
writer.printUnsignedLongAsHex(-val);
writer.write('t');
} else {
writer.write("0x");
writer.printLongAsHex(val);
writer.printUnsignedLongAsHex(val);
writer.write('t');
}
}
public static void writeUnsignedTo(IndentingWriter writer, byte val) throws IOException {
writer.write("0x");
writer.printLongAsHex(val & 0xFF);
writer.printUnsignedLongAsHex(val & 0xFF);
writer.write('t');
}
}

View File

@ -36,15 +36,15 @@ public class IntegerRenderer {
public static void writeTo(IndentingWriter writer, int val) throws IOException {
if (val<0) {
writer.write("-0x");
writer.printLongAsHex(-((long)val));
writer.printUnsignedLongAsHex(-((long) val));
} else {
writer.write("0x");
writer.printLongAsHex(val);
writer.printUnsignedLongAsHex(val);
}
}
public static void writeUnsignedTo(IndentingWriter writer, int val) throws IOException {
writer.write("0x");
writer.printLongAsHex(val & 0xFFFFFFFF);
writer.printUnsignedLongAsHex(val & 0xFFFFFFFF);
}
}

View File

@ -36,11 +36,11 @@ public class LongRenderer {
public static void writeTo(IndentingWriter writer, long val) throws IOException {
if (val<0) {
writer.write("-0x");
writer.printLongAsHex(-val);
writer.printUnsignedLongAsHex(-val);
writer.write('L');
} else {
writer.write("0x");
writer.printLongAsHex(val);
writer.printUnsignedLongAsHex(val);
writer.write('L');
}
}
@ -48,13 +48,13 @@ public class LongRenderer {
public static void writeSignedIntOrLongTo(IndentingWriter writer, long val) throws IOException {
if (val<0) {
writer.write("-0x");
writer.printLongAsHex(-val);
writer.printUnsignedLongAsHex(-val);
if (val < Integer.MIN_VALUE) {
writer.write('L');
}
} else {
writer.write("0x");
writer.printLongAsHex(val);
writer.printUnsignedLongAsHex(val);
if (val > Integer.MAX_VALUE) {
writer.write('L');
}

View File

@ -36,11 +36,11 @@ public class ShortRenderer {
public static void writeTo(IndentingWriter writer, short val) throws IOException {
if (val < 0) {
writer.write("-0x");
writer.printLongAsHex(-val);
writer.printUnsignedLongAsHex(-val);
writer.write('s');
} else {
writer.write("0x");
writer.printLongAsHex(val);
writer.printUnsignedLongAsHex(val);
writer.write('s');
}
}

View File

@ -148,7 +148,7 @@ public class IndentingWriter extends Writer {
//}
}
public void printLongAsHex(long value) throws IOException {
public void printUnsignedLongAsHex(long value) throws IOException {
int bufferIndex = 0;
do {
int digit = (int)(value & 15);
@ -166,7 +166,7 @@ public class IndentingWriter extends Writer {
}
}
public void printIntAsDec(int value) throws IOException {
public void printSignedIntAsDec(int value) throws IOException {
int bufferIndex = 0;
if (value < 0) {