Fixed size calculation in placeItem

git-svn-id: https://smali.googlecode.com/svn/trunk@380 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-10 06:59:19 +00:00
parent 14f02f4884
commit d269393753

View File

@ -169,14 +169,15 @@ public class CodeItem extends Item<CodeItem> {
protected int placeItem(int offset) {
offset += 16 + encodedInstructions.length;
if (tries != null && tries.length > 0) {
if (encodedInstructions.length % 2 == 1) {
offset++;
if (encodedInstructions.length % 4 != 0) {
offset+=2;
}
offset += tries.length * 8;
int encodedCatchHandlerBaseOffset = offset;
offset += Leb128Utils.unsignedLeb128Size(encodedCatchHandlers.length);
for (EncodedCatchHandler encodedCatchHandler: encodedCatchHandlers) {
offset += encodedCatchHandler.place(offset, encodedCatchHandlerBaseOffset);
offset = encodedCatchHandler.place(offset, encodedCatchHandlerBaseOffset);
}
}
return offset;