mirror of
https://github.com/revanced/smali.git
synced 2025-05-10 03:14:31 +02:00
Add support for empty packed switch data instructions
This commit is contained in:
parent
4879652a47
commit
c89097680e
@ -345,6 +345,9 @@ public class CodeItem {
|
|||||||
out.indent();
|
out.indent();
|
||||||
|
|
||||||
out.annotate(2, "size = %d", elements.size());
|
out.annotate(2, "size = %d", elements.size());
|
||||||
|
if (elements.size() == 0) {
|
||||||
|
out.annotate(4, "first_key");
|
||||||
|
} else {
|
||||||
out.annotate(4, "first_key = %d", elements.get(0).getKey());
|
out.annotate(4, "first_key = %d", elements.get(0).getKey());
|
||||||
out.annotate(0, "targets:");
|
out.annotate(0, "targets:");
|
||||||
out.indent();
|
out.indent();
|
||||||
@ -352,6 +355,7 @@ public class CodeItem {
|
|||||||
out.annotate(4, "target[%d] = %d", i, elements.get(i).getOffset());
|
out.annotate(4, "target[%d] = %d", i, elements.get(i).getOffset());
|
||||||
}
|
}
|
||||||
out.deindent();
|
out.deindent();
|
||||||
|
}
|
||||||
out.deindent();
|
out.deindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +525,8 @@ public class CodeItemPool {
|
|||||||
|
|
||||||
public void writeSparseSwitchPayload(@Nonnull DexWriter writer, @Nonnull SparseSwitchPayload instruction)
|
public void writeSparseSwitchPayload(@Nonnull DexWriter writer, @Nonnull SparseSwitchPayload instruction)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
writer.writeUshort(instruction.getOpcode().value);
|
writer.writeUbyte(0);
|
||||||
|
writer.writeUbyte(instruction.getOpcode().value >> 8);
|
||||||
List<? extends SwitchElement> elements = instruction.getSwitchElements();
|
List<? extends SwitchElement> elements = instruction.getSwitchElements();
|
||||||
writer.writeUshort(elements.size());
|
writer.writeUshort(elements.size());
|
||||||
for (SwitchElement element: elements) {
|
for (SwitchElement element: elements) {
|
||||||
@ -538,12 +539,17 @@ public class CodeItemPool {
|
|||||||
|
|
||||||
public void writePackedSwitchPayload(@Nonnull DexWriter writer, @Nonnull PackedSwitchPayload instruction)
|
public void writePackedSwitchPayload(@Nonnull DexWriter writer, @Nonnull PackedSwitchPayload instruction)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
writer.writeUshort(instruction.getOpcode().value);
|
writer.writeUbyte(0);
|
||||||
|
writer.writeUbyte(instruction.getOpcode().value >> 8);
|
||||||
List<? extends SwitchElement> elements = instruction.getSwitchElements();
|
List<? extends SwitchElement> elements = instruction.getSwitchElements();
|
||||||
writer.writeUshort(elements.size());
|
writer.writeUshort(elements.size());
|
||||||
|
if (elements.size() == 0) {
|
||||||
|
writer.writeInt(0);
|
||||||
|
} else {
|
||||||
writer.writeInt(elements.get(0).getKey());
|
writer.writeInt(elements.get(0).getKey());
|
||||||
for (SwitchElement element: elements) {
|
for (SwitchElement element: elements) {
|
||||||
writer.writeInt(element.getOffset());
|
writer.writeInt(element.getOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user