mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 12:20:11 +02:00
Rename the printLongAsHex and printIntAsHex methods in IndentingWriter for clarity
This commit is contained in:
parent
f119fc6db5
commit
74c14ffcca
@ -50,7 +50,7 @@ public abstract class DebugMethodItem extends MethodItem {
|
|||||||
|
|
||||||
protected static void writeLine(IndentingWriter writer, int line) throws IOException {
|
protected static void writeLine(IndentingWriter writer, int line) throws IOException {
|
||||||
writer.write(".line ");
|
writer.write(".line ");
|
||||||
writer.printIntAsDec(line);
|
writer.printSignedIntAsDec(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void writeEndPrologue(IndentingWriter writer) throws IOException {
|
protected static void writeEndPrologue(IndentingWriter writer) throws IOException {
|
||||||
|
@ -43,7 +43,7 @@ public class ArrayDataMethodItem extends InstructionMethodItem<ArrayDataPseudoIn
|
|||||||
|
|
||||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||||
writer.write(".array-data 0x");
|
writer.write(".array-data 0x");
|
||||||
writer.printLongAsHex(instruction.getElementWidth());
|
writer.printUnsignedLongAsHex(instruction.getElementWidth());
|
||||||
writer.write('\n');
|
writer.write('\n');
|
||||||
|
|
||||||
writer.indent(4);
|
writer.indent(4);
|
||||||
|
@ -293,12 +293,12 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
|||||||
|
|
||||||
protected void writeFieldOffset(IndentingWriter writer) throws IOException {
|
protected void writeFieldOffset(IndentingWriter writer) throws IOException {
|
||||||
writer.write("field@0x");
|
writer.write("field@0x");
|
||||||
writer.printLongAsHex(((OdexedFieldAccess)instruction).getFieldOffset());
|
writer.printUnsignedLongAsHex(((OdexedFieldAccess) instruction).getFieldOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeVtableIndex(IndentingWriter writer) throws IOException {
|
protected void writeVtableIndex(IndentingWriter writer) throws IOException {
|
||||||
writer.write("vtable@0x");
|
writer.write("vtable@0x");
|
||||||
writer.printLongAsHex(((OdexedInvokeVirtual)instruction).getMethodIndex());
|
writer.printUnsignedLongAsHex(((OdexedInvokeVirtual) instruction).getMethodIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeReference(IndentingWriter writer) throws IOException {
|
protected void writeReference(IndentingWriter writer) throws IOException {
|
||||||
|
@ -74,9 +74,9 @@ public class LabelMethodItem extends MethodItem {
|
|||||||
writer.write(':');
|
writer.write(':');
|
||||||
writer.write(labelPrefix);
|
writer.write(labelPrefix);
|
||||||
if (baksmali.useSequentialLabels) {
|
if (baksmali.useSequentialLabels) {
|
||||||
writer.printLongAsHex(labelSequence);
|
writer.printUnsignedLongAsHex(labelSequence);
|
||||||
} else {
|
} else {
|
||||||
writer.printLongAsHex(this.getLabelAddress());
|
writer.printUnsignedLongAsHex(this.getLabelAddress());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class MethodDefinition {
|
|||||||
} else {
|
} else {
|
||||||
writer.write(".registers ");
|
writer.write(".registers ");
|
||||||
}
|
}
|
||||||
writer.printIntAsDec(getRegisterCount(encodedMethod));
|
writer.printSignedIntAsDec(getRegisterCount(encodedMethod));
|
||||||
writer.write('\n');
|
writer.write('\n');
|
||||||
writeParameters(writer, codeItem, parameterAnnotations);
|
writeParameters(writer, codeItem, parameterAnnotations);
|
||||||
if (annotationSet != null) {
|
if (annotationSet != null) {
|
||||||
@ -339,7 +339,7 @@ public class MethodDefinition {
|
|||||||
@Override
|
@Override
|
||||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||||
writer.write("#@");
|
writer.write("#@");
|
||||||
writer.printLongAsHex(codeAddress & 0xFFFFFFFF);
|
writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -417,7 +417,7 @@ public class MethodDefinition {
|
|||||||
@Override
|
@Override
|
||||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||||
writer.write("#@");
|
writer.write("#@");
|
||||||
writer.printLongAsHex(codeAddress & 0xFFFFFFFF);
|
writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -219,7 +219,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
|||||||
writer.write("Start:");
|
writer.write("Start:");
|
||||||
} else {
|
} else {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
|
writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
|
||||||
writer.write(':');
|
writer.write(':');
|
||||||
}
|
}
|
||||||
predecessorRegisterType.writeTo(writer);
|
predecessorRegisterType.writeTo(writer);
|
||||||
|
@ -63,17 +63,17 @@ public class RegisterFormatter {
|
|||||||
|
|
||||||
if (startRegister >= registerCount - parameterRegisterCount) {
|
if (startRegister >= registerCount - parameterRegisterCount) {
|
||||||
writer.write("{p");
|
writer.write("{p");
|
||||||
writer.printIntAsDec(startRegister - (registerCount - parameterRegisterCount));
|
writer.printSignedIntAsDec(startRegister - (registerCount - parameterRegisterCount));
|
||||||
writer.write(" .. p");
|
writer.write(" .. p");
|
||||||
writer.printIntAsDec(lastRegister - (registerCount - parameterRegisterCount));
|
writer.printSignedIntAsDec(lastRegister - (registerCount - parameterRegisterCount));
|
||||||
writer.write('}');
|
writer.write('}');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writer.write("{v");
|
writer.write("{v");
|
||||||
writer.printIntAsDec(startRegister);
|
writer.printSignedIntAsDec(startRegister);
|
||||||
writer.write(" .. v");
|
writer.write(" .. v");
|
||||||
writer.printIntAsDec(lastRegister);
|
writer.printSignedIntAsDec(lastRegister);
|
||||||
writer.write('}');
|
writer.write('}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +93,11 @@ public class RegisterFormatter {
|
|||||||
int registerCount = codeItem.getRegisterCount();
|
int registerCount = codeItem.getRegisterCount();
|
||||||
if (register >= registerCount - parameterRegisterCount) {
|
if (register >= registerCount - parameterRegisterCount) {
|
||||||
writer.write('p');
|
writer.write('p');
|
||||||
writer.printIntAsDec((register - (registerCount - parameterRegisterCount)));
|
writer.printSignedIntAsDec((register - (registerCount - parameterRegisterCount)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writer.write('v');
|
writer.write('v');
|
||||||
writer.printIntAsDec(register);
|
writer.printSignedIntAsDec(register);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,18 +36,18 @@ public class ByteRenderer {
|
|||||||
public static void writeTo(IndentingWriter writer, byte val) throws IOException {
|
public static void writeTo(IndentingWriter writer, byte val) throws IOException {
|
||||||
if (val<0) {
|
if (val<0) {
|
||||||
writer.write("-0x");
|
writer.write("-0x");
|
||||||
writer.printLongAsHex(-val);
|
writer.printUnsignedLongAsHex(-val);
|
||||||
writer.write('t');
|
writer.write('t');
|
||||||
} else {
|
} else {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val);
|
writer.printUnsignedLongAsHex(val);
|
||||||
writer.write('t');
|
writer.write('t');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeUnsignedTo(IndentingWriter writer, byte val) throws IOException {
|
public static void writeUnsignedTo(IndentingWriter writer, byte val) throws IOException {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val & 0xFF);
|
writer.printUnsignedLongAsHex(val & 0xFF);
|
||||||
writer.write('t');
|
writer.write('t');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,15 +36,15 @@ public class IntegerRenderer {
|
|||||||
public static void writeTo(IndentingWriter writer, int val) throws IOException {
|
public static void writeTo(IndentingWriter writer, int val) throws IOException {
|
||||||
if (val<0) {
|
if (val<0) {
|
||||||
writer.write("-0x");
|
writer.write("-0x");
|
||||||
writer.printLongAsHex(-((long)val));
|
writer.printUnsignedLongAsHex(-((long) val));
|
||||||
} else {
|
} else {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val);
|
writer.printUnsignedLongAsHex(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeUnsignedTo(IndentingWriter writer, int val) throws IOException {
|
public static void writeUnsignedTo(IndentingWriter writer, int val) throws IOException {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val & 0xFFFFFFFF);
|
writer.printUnsignedLongAsHex(val & 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ public class LongRenderer {
|
|||||||
public static void writeTo(IndentingWriter writer, long val) throws IOException {
|
public static void writeTo(IndentingWriter writer, long val) throws IOException {
|
||||||
if (val<0) {
|
if (val<0) {
|
||||||
writer.write("-0x");
|
writer.write("-0x");
|
||||||
writer.printLongAsHex(-val);
|
writer.printUnsignedLongAsHex(-val);
|
||||||
writer.write('L');
|
writer.write('L');
|
||||||
} else {
|
} else {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val);
|
writer.printUnsignedLongAsHex(val);
|
||||||
writer.write('L');
|
writer.write('L');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,13 +48,13 @@ public class LongRenderer {
|
|||||||
public static void writeSignedIntOrLongTo(IndentingWriter writer, long val) throws IOException {
|
public static void writeSignedIntOrLongTo(IndentingWriter writer, long val) throws IOException {
|
||||||
if (val<0) {
|
if (val<0) {
|
||||||
writer.write("-0x");
|
writer.write("-0x");
|
||||||
writer.printLongAsHex(-val);
|
writer.printUnsignedLongAsHex(-val);
|
||||||
if (val < Integer.MIN_VALUE) {
|
if (val < Integer.MIN_VALUE) {
|
||||||
writer.write('L');
|
writer.write('L');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val);
|
writer.printUnsignedLongAsHex(val);
|
||||||
if (val > Integer.MAX_VALUE) {
|
if (val > Integer.MAX_VALUE) {
|
||||||
writer.write('L');
|
writer.write('L');
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ public class ShortRenderer {
|
|||||||
public static void writeTo(IndentingWriter writer, short val) throws IOException {
|
public static void writeTo(IndentingWriter writer, short val) throws IOException {
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
writer.write("-0x");
|
writer.write("-0x");
|
||||||
writer.printLongAsHex(-val);
|
writer.printUnsignedLongAsHex(-val);
|
||||||
writer.write('s');
|
writer.write('s');
|
||||||
} else {
|
} else {
|
||||||
writer.write("0x");
|
writer.write("0x");
|
||||||
writer.printLongAsHex(val);
|
writer.printUnsignedLongAsHex(val);
|
||||||
writer.write('s');
|
writer.write('s');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
int bufferIndex = 0;
|
||||||
do {
|
do {
|
||||||
int digit = (int)(value & 15);
|
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;
|
int bufferIndex = 0;
|
||||||
|
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user