mirror of
https://github.com/revanced/smali.git
synced 2025-05-09 10:54:29 +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) {
|
||||
template.setAttribute("ElementWidth", instruction.getElementWidth());
|
||||
template.setAttribute("Values", getValues());
|
||||
setValuesAttribute(template);
|
||||
}
|
||||
|
||||
private List<ByteArray> getValues() {
|
||||
List<ByteArray> values = new ArrayList<ByteArray>();
|
||||
private void setValuesAttribute(StringTemplate parentTemplate) {
|
||||
Iterator<ArrayDataPseudoInstruction.ArrayElement> iterator = instruction.getElements();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
ArrayDataPseudoInstruction.ArrayElement element = iterator.next();
|
||||
byte[] array = new byte[element.elementWidth];
|
||||
System.arraycopy(element.buffer, element.bufferIndex, array, 0, element.elementWidth);
|
||||
values.add(new ByteArray(array));
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
StringTemplate template = parentTemplate.getGroup().getInstanceOf("ArrayElement");
|
||||
|
||||
public static class ByteArray
|
||||
{
|
||||
public final byte[] ByteArray;
|
||||
public ByteArray(byte[] byteArray) {
|
||||
this.ByteArray = byteArray;
|
||||
for (int i=element.bufferIndex; i<element.bufferIndex + element.elementWidth; i++) {
|
||||
template.setAttribute("Bytes", element.buffer[i]);
|
||||
}
|
||||
|
||||
parentTemplate.setAttribute("Values", template);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,10 +258,15 @@ Format51l(Opcode, Register, Literal) ::=
|
||||
ArrayData(Opcode, ElementWidth, Values) ::=
|
||||
<<
|
||||
.array-data <ElementWidth>
|
||||
<Values: {<it.ByteArray; format="unsigned",separator=" ">}; separator="\n">
|
||||
<Values; separator="\n">
|
||||
.end array-data
|
||||
>>
|
||||
|
||||
ArrayElement(Bytes) ::=
|
||||
<<
|
||||
<Bytes; format="unsigned",separator=" ">
|
||||
>>
|
||||
|
||||
PackedSwitchData(Opcode, FirstKey, Targets) ::=
|
||||
<<
|
||||
.packed-switch <FirstKey>
|
||||
|
Loading…
x
Reference in New Issue
Block a user