From 60a8549192f2a981f9625e1d0a4b41de0aa70022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Sat, 23 Mar 2013 13:29:18 +0100 Subject: [PATCH] formatting & imports --- .../decompiler/flash/SWFInputStream.java | 49 +++++++++---------- .../jpexs/decompiler/flash/action/Action.java | 4 +- .../decompiler/flash/action/ActionGraph.java | 8 ++- .../flash/action/swf3/ActionGetURL.java | 1 - .../flash/action/swf3/ActionGoToLabel.java | 1 - .../flash/action/swf3/ActionSetTarget.java | 1 - .../flash/action/swf5/ActionConstantPool.java | 1 - .../flash/action/swf5/ActionEnumerate.java | 2 +- .../flash/action/swf5/ActionSetMember.java | 2 +- .../flash/action/swf6/ActionEnumerate2.java | 2 +- .../jpexs/decompiler/flash/graph/Graph.java | 7 ++- 11 files changed, 35 insertions(+), 43 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 1582f96ae..d6c124995 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionGraphSource; -import com.jpexs.decompiler.flash.action.UnknownActionException; import com.jpexs.decompiler.flash.action.parser.ASMParser; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.special.ActionContainer; @@ -511,10 +510,10 @@ public class SWFInputStream extends InputStream { if (ins instanceof ActionConstantPool) { constantPools.add(new ConstantPool(((ActionConstantPool) ins).constantPool)); } - + //for..in return if (((ins instanceof ActionEquals) || (ins instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueTreeItem)) { - stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList())); + stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList())); } ins.translate(localData, stack, output); if (ins.isExit()) { @@ -608,13 +607,13 @@ public class SWFInputStream extends InputStream { } last = a; } - int len=retdups.size(); - for(int i=0;i 0x80) ? 2 : 0); int actual = 0; - if(a instanceof ActionContainer){ - actual=((ActionContainer)a).getHeaderBytes().length; - }else{ - actual=a.getBytes(sis.version).length; + if (a instanceof ActionContainer) { + actual = ((ActionContainer) a).getHeaderBytes().length; + } else { + actual = a.getBytes(sis.version).length; } - if(!(a instanceof ActionContainer)){ - int change=info-(rri.getPos()-ip); - if(change > 0){ - a.afterInsert=new ActionJump(change); + if (!(a instanceof ActionContainer)) { + int change = info - (rri.getPos() - ip); + if (change > 0) { + a.afterInsert = new ActionJump(change); } - }else{ - info=rri.getPos()-ip; + } else { + info = rri.getPos() - ip; } if (ip < startIp) { retv = true; @@ -828,7 +827,7 @@ public class SWFInputStream extends InputStream { ret.set(ip + i, a); } - if(a instanceof ActionEnd){ + if (a instanceof ActionEnd) { break; } if (newip > -1) { @@ -1416,11 +1415,11 @@ public class SWFInputStream extends InputStream { //skip(actionLength); } //throw new UnknownActionException(actionCode); - Action r=new ActionNop(); - r.actionCode=actionCode; + Action r = new ActionNop(); + r.actionCode = actionCode; r.actionLength = actionLength; return r; - //return new Action(actionCode, actionLength); + //return new Action(actionCode, actionLength); } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 4ec38adad..60052a091 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -860,7 +860,7 @@ public class Action implements GraphSourceItem { for (int i = 0; i < prevCount; i++) { output2.add(output.get(i)); } - output2.add(new ClassTreeItem(className, extendsOp, implementsOp, functions, vars, staticFunctions, staticVars)); + output2.add(new ClassTreeItem(className, extendsOp, implementsOp, functions, vars, staticFunctions, staticVars)); return output2; } if (parts.get(pos) instanceof StoreRegisterTreeItem) { @@ -957,7 +957,7 @@ public class Action implements GraphSourceItem { for (int i = 0; i < prevCount; i++) { output2.add(output.get(i)); } - output2.add(new ClassTreeItem(className, extendsOp, implementsOp, functions, vars, staticFunctions, staticVars)); + output2.add(new ClassTreeItem(className, extendsOp, implementsOp, functions, vars, staticFunctions, staticVars)); return output2; } } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index d4c05398d..f2d75affd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -71,21 +71,19 @@ public class ActionGraph extends Graph { } @Override - public void finalProcessStack(Stack stack,List output) { + public void finalProcessStack(Stack stack, List output) { if (stack.size() > 0) { for (int i = stack.size() - 1; i >= 0; i--) { //System.err.println(stack.get(i)); if (stack.get(i) instanceof FunctionTreeItem) { - FunctionTreeItem f=(FunctionTreeItem)stack.remove(i); - if(!output.contains(f)){ + FunctionTreeItem f = (FunctionTreeItem) stack.remove(i); + if (!output.contains(f)) { output.add(0, f); } } } } } - - @Override protected void finalProcess(List list, int level) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java index f4652be11..c2f5dc42f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GetURLTreeItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java index 8c22f7693..d8fc6e1ca 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GotoLabelTreeItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java index 33fa9ac1e..f3124a151 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.SetTargetTreeItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java index 4037b6473..b18e3bd96 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.ParsedSymbol; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java index b0f3f9e99..fba6c4ae7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java @@ -41,6 +41,6 @@ public class ActionEnumerate extends Action { public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions) { GraphTargetItem object = stack.pop(); stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList())); - stack.push(new EnumerateTreeItem(this, object)); + stack.push(new EnumerateTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java index 5eb4a57a3..3b3b35b9c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java @@ -36,7 +36,7 @@ public class ActionSetMember extends Action { @Override public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions) { - GraphTargetItem value = stack.pop(); + GraphTargetItem value = stack.pop(); GraphTargetItem objectName = stack.pop(); GraphTargetItem object = stack.pop(); output.add(new SetMemberTreeItem(this, object, objectName, value)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java index 651c213da..25e6711a1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java @@ -41,6 +41,6 @@ public class ActionEnumerate2 extends Action { public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions) { GraphTargetItem object = stack.pop(); stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList())); - stack.push(new EnumerateTreeItem(this, object)); + stack.push(new EnumerateTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index 19794bdfe..97c44574d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -292,15 +292,14 @@ public class Graph { } Stack stack = new Stack(); List ret = printGraph(localData, stack, allParts, null, heads.get(0), null, new ArrayList(), new HashMap>()); - finalProcessStack(stack,ret); + finalProcessStack(stack, ret); finalProcessAll(ret, 0); return ret; } - public void finalProcessStack(Stack stack,List output){ - + public void finalProcessStack(Stack stack, List output) { } - + private void finalProcessAll(List list, int level) { finalProcess(list, level); for (GraphTargetItem item : list) {