ASDec: Small changes to eliminate notices

This commit is contained in:
Jindra Pet��k
2012-12-28 12:17:33 +01:00
parent 1223dd8aad
commit dbe3dc2905
63 changed files with 116 additions and 104 deletions
+3 -4
View File
@@ -350,7 +350,7 @@ public class Action {
*/
public static String actionsToString(List<Action> list, List<Long> importantOffsets, List<String> constantPool, int version) {
String ret = "";
long offset = 0;
long offset;
if (importantOffsets == null) {
setActionsAddresses(list, 0, version);
importantOffsets = getActionsAllRefs(list, version);
@@ -437,7 +437,7 @@ public class Action {
*/
public static long ip2adr(List<Action> actions, int ip, int version) {
if (ip >= actions.size()) {
if (actions.size() == 0) {
if (actions.isEmpty()) {
return 0;
}
return actions.get(actions.size() - 1).getAddress() + actions.get(actions.size() - 1).getBytes(version).length;
@@ -715,7 +715,6 @@ public class Action {
if (!unknownJumps.contains(((ActionJump) action).getRef(version))) {
unknownJumps.add(((ActionJump) action).getRef(version));
}
ip = ip + 1;
break;
} else if (action instanceof ActionIf) {
@@ -776,7 +775,7 @@ public class Action {
try {
onTrue = actionsToTree(registerNames, unknownJumps, loopList, jumpsOrIfs, trueStack, constants, actions, ip + 1, jumpIp - 1 - (hasElse || isWhile || isForIn ? 1 : 0), version);
if (onTrue.size() == 0 && trueStack.size() > 0) {
if (onTrue.isEmpty() && trueStack.size() > 0) {
isTernar = true;
}
} catch (UnknownJumpException uje) {
@@ -104,7 +104,7 @@ public class TagNode {
continue;
}
}
if (ret.get(i).subItems.size() == 0) {
if (ret.get(i).subItems.isEmpty()) {
ret.remove(i);
}
}
@@ -43,6 +43,7 @@ public class ActionStrictMode extends Action {
mode = (int) lexLong(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -50,6 +50,7 @@ public class ActionGetURL extends Action {
targetString = lexString(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -47,6 +47,7 @@ public class ActionGoToLabel extends Action {
return "GoToLabel \"" + Helper.escapeString(label) + "\"";
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -43,6 +43,7 @@ public class ActionGotoFrame extends Action {
return "GotoFrame " + frame;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -47,6 +47,7 @@ public class ActionSetTarget extends Action {
return "SetTarget \"" + Helper.escapeString(targetName) + "\"";
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -45,6 +45,7 @@ public class ActionWaitForFrame extends Action {
return "WaitForFrame " + frame + " " + skipCount;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -50,6 +50,7 @@ public class ActionGetURL2 extends Action {
return "GetURL2 " + sendVarsMethod + " " + loadTargetFlag + " " + loadVariablesFlag;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -45,6 +45,7 @@ public class ActionGotoFrame2 extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -48,6 +48,7 @@ public class ActionIf extends Action {
return getAddress() + getBytes(version).length + offset;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -48,6 +48,7 @@ public class ActionJump extends Action {
return getAddress() + getBytes(version).length + offset;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -61,7 +61,7 @@ public class ActionPush extends Action {
values.add(new RegisterNumber(sis.readUI8()));
break;
case 5:
values.add(new Boolean(sis.readUI8() == 1));
values.add((Boolean)(sis.readUI8() == 1));
break;
case 6:
values.add(sis.readDOUBLE());
@@ -79,6 +79,7 @@ public class ActionPush extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -142,7 +143,7 @@ public class ActionPush extends Action {
switch (symb.type) {
case ParsedSymbol.TYPE_STRING:
count++;
if (constantPool.contains(symb.value)) {
if (constantPool.contains((String)symb.value)) {
values.add(new ConstantIndex(constantPool.indexOf(symb.value), constantPool));
} else {
values.add(symb.value);
@@ -43,6 +43,7 @@ public class ActionWaitForFrame2 extends Action {
skipCount = (int) lexLong(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -58,6 +58,7 @@ public class ActionConstantPool extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -62,6 +62,7 @@ public class ActionDefineFunction extends Action {
code = ASMParser.parse(labels, address + getPreLen(version), lexer, constantPool, version);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -44,6 +44,7 @@ public class ActionStoreRegister extends Action {
registerNumber = (int) lexLong(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -52,6 +52,7 @@ public class ActionWith extends Action {
Action.setActionsAddresses(actions, address + 5, version);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -92,6 +92,7 @@ public class ActionTry extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -48,6 +48,7 @@ public abstract class TreeItem {
public abstract String toString(ConstantPool constants);
@Override
public String toString() {
return toString(null);
}
@@ -38,8 +38,8 @@ public class IfTreeItem extends TreeItem implements Block {
@Override
public String toString(ConstantPool constants) {
String ret = "";
ret = hilight("if(") + expression.toString(constants) + hilight(")\r\n{\r\n");
String ret;
ret = hilight("if(") + expression.toString(constants) + hilight(")")+"\r\n{\r\n";
for (TreeItem ti : onTrue) {
ret += ti.toString(constants) + "\r\n";
}
@@ -41,7 +41,7 @@ public class WithTreeItem extends TreeItem {
@Override
public String toString(ConstantPool constants) {
String ret = "";
String ret;
ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n");
for (TreeItem ti : items) {
ret += ti.toString(constants) + "\r\n";