mirror of
https://github.com/revanced/smali.git
synced 2025-05-09 19:04:32 +02:00
Set the Bytes attribute multiple times, instead of using an array of bytes
git-svn-id: https://smali.googlecode.com/svn/trunk@373 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
fdf48625bb
commit
149225a27f
@ -45,28 +45,21 @@ public class ArrayDataMethodItem extends InstructionFormatMethodItem<ArrayDataPs
|
|||||||
|
|
||||||
protected void setAttributes(StringTemplate template) {
|
protected void setAttributes(StringTemplate template) {
|
||||||
template.setAttribute("ElementWidth", instruction.getElementWidth());
|
template.setAttribute("ElementWidth", instruction.getElementWidth());
|
||||||
template.setAttribute("Values", getValues());
|
setValuesAttribute(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ByteArray> getValues() {
|
private void setValuesAttribute(StringTemplate parentTemplate) {
|
||||||
List<ByteArray> values = new ArrayList<ByteArray>();
|
|
||||||
Iterator<ArrayDataPseudoInstruction.ArrayElement> iterator = instruction.getElements();
|
Iterator<ArrayDataPseudoInstruction.ArrayElement> iterator = instruction.getElements();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ArrayDataPseudoInstruction.ArrayElement element = iterator.next();
|
ArrayDataPseudoInstruction.ArrayElement element = iterator.next();
|
||||||
byte[] array = new byte[element.elementWidth];
|
|
||||||
System.arraycopy(element.buffer, element.bufferIndex, array, 0, element.elementWidth);
|
StringTemplate template = parentTemplate.getGroup().getInstanceOf("ArrayElement");
|
||||||
values.add(new ByteArray(array));
|
|
||||||
|
for (int i=element.bufferIndex; i<element.bufferIndex + element.elementWidth; i++) {
|
||||||
|
template.setAttribute("Bytes", element.buffer[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
parentTemplate.setAttribute("Values", template);
|
||||||
}
|
|
||||||
|
|
||||||
public static class ByteArray
|
|
||||||
{
|
|
||||||
public final byte[] ByteArray;
|
|
||||||
public ByteArray(byte[] byteArray) {
|
|
||||||
this.ByteArray = byteArray;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,10 +258,15 @@ Format51l(Opcode, Register, Literal) ::=
|
|||||||
ArrayData(Opcode, ElementWidth, Values) ::=
|
ArrayData(Opcode, ElementWidth, Values) ::=
|
||||||
<<
|
<<
|
||||||
.array-data <ElementWidth>
|
.array-data <ElementWidth>
|
||||||
<Values: {<it.ByteArray; format="unsigned",separator=" ">}; separator="\n">
|
<Values; separator="\n">
|
||||||
.end array-data
|
.end array-data
|
||||||
>>
|
>>
|
||||||
|
|
||||||
|
ArrayElement(Bytes) ::=
|
||||||
|
<<
|
||||||
|
<Bytes; format="unsigned",separator=" ">
|
||||||
|
>>
|
||||||
|
|
||||||
PackedSwitchData(Opcode, FirstKey, Targets) ::=
|
PackedSwitchData(Opcode, FirstKey, Targets) ::=
|
||||||
<<
|
<<
|
||||||
.packed-switch <FirstKey>
|
.packed-switch <FirstKey>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user