diff --git a/src/com/jpexs/decompiler/flash/SWFInputStream.java b/src/com/jpexs/decompiler/flash/SWFInputStream.java index 7e78d9730..b8f3d664a 100644 --- a/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -1443,7 +1443,7 @@ public class SWFInputStream implements AutoCloseable { if (tagDataStream.dumpInfo == null && dumpInfo != null) { dumpInfo.tagToResolve = tagStub; } - + if (resolve) { DumpInfo di = dumpInfo; try { diff --git a/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/src/com/jpexs/decompiler/flash/SWFOutputStream.java index 951e620ae..51a990026 100644 --- a/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -129,7 +129,7 @@ public class SWFOutputStream extends OutputStream { os.write(b); pos += b.length; } - + private void alignByte() throws IOException { if (bitPos > 0) { bitPos = 0; diff --git a/src/com/jpexs/decompiler/flash/action/Action.java b/src/com/jpexs/decompiler/flash/action/Action.java index 29c62a6ea..c6004ad93 100644 --- a/src/com/jpexs/decompiler/flash/action/Action.java +++ b/src/com/jpexs/decompiler/flash/action/Action.java @@ -49,7 +49,6 @@ import com.jpexs.decompiler.flash.action.special.ActionEnd; import com.jpexs.decompiler.flash.action.special.ActionStore; import com.jpexs.decompiler.flash.action.swf4.ActionEquals; import com.jpexs.decompiler.flash.action.swf4.ActionIf; -import com.jpexs.decompiler.flash.action.swf4.ActionJump; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; @@ -183,6 +182,7 @@ public class Action implements GraphSourceItem { /** * Gets all addresses which are referenced from this action and/or * subactions + * * @param refs list of addresses */ public void getRef(List refs) { @@ -494,13 +494,13 @@ public class Action implements GraphSourceItem { String add = ""; // honfika: commented out the following lines, because it makes no sense /*if (a instanceof ActionIf) { - add = " change: " + ((ActionIf) a).getJumpOffset(); - } - if (a instanceof ActionJump) { - add = " change: " + ((ActionJump) a).getJumpOffset(); - } - add = "; ofs" + Helper.formatAddress(offset) + add; - add = "";*/ + add = " change: " + ((ActionIf) a).getJumpOffset(); + } + if (a instanceof ActionJump) { + add = " change: " + ((ActionJump) a).getJumpOffset(); + } + add = "; ofs" + Helper.formatAddress(offset) + add; + add = "";*/ if ((a instanceof ActionPush) && lastPush) { writer.appendNoHilight(" "); ((ActionPush) a).paramsToStringReplaced(list, importantOffsets, constantPool, version, exportMode, writer); diff --git a/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 77e1610e6..7fd11f270 100644 --- a/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -128,7 +128,7 @@ public class ActionListReader { // Map of the actions. Use TreeMap to sort the keys in ascending order Map actionMap = new TreeMap<>(); - Map nextOffsets = new HashMap<>(); + Map nextOffsets = new HashMap<>(); Action entryAction = readActionListAtPos(listeners, cpool, sis, actionMap, nextOffsets, ip, 0, endIp, path, false, new ArrayList()); @@ -137,7 +137,7 @@ public class ActionListReader { if (actionMap.isEmpty()) { return actions; } - + Map> containerLastActions = new HashMap<>(); List addresses = new ArrayList<>(actionMap.keySet()); getContainerLastActions(actionMap, addresses, containerLastActions); @@ -211,7 +211,7 @@ public class ActionListReader { // Map of the actions. Use TreeMap to sort the keys in ascending order Map actionMap = new TreeMap<>(); - Map nextOffsets = new HashMap<>(); + Map nextOffsets = new HashMap<>(); readActionListAtPos(new ArrayList(), cpool, sis, actionMap, nextOffsets, startIp, startIp, endIp, "", false, new ArrayList()); @@ -296,23 +296,24 @@ public class ActionListReader { private static long getNearAddress(List addresses, long address, boolean next) { int min = 0; int max = addresses.size() - 1; - + while (max >= min) { int mid = (min + max) / 2; long midValue = addresses.get(mid); - if(midValue == address) - return address; - else if (midValue < address) + if (midValue == address) { + return address; + } else if (midValue < address) { min = mid + 1; - else + } else { max = mid - 1; + } } - - return next + + return next ? (min < addresses.size() ? addresses.get(min) : -1) : (max > 0 ? addresses.get(max) : -1); } - + private static Map actionListToMap(List actions) { Map map = new HashMap<>(actions.size()); for (Action a : actions) { @@ -600,7 +601,7 @@ public class ActionListReader { if (ip < startIp) { continue; } - + while (endIp == -1 || endIp > ip) { sis.seek((int) ip); diff --git a/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index 9d0590d3c..c9b0be458 100644 --- a/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -487,7 +487,7 @@ public class ASMParser { } } } - + if (!found) { if (throwOnError) { throw new ParseException("TARGET NOT FOUND - identifier:" + identifier + " addr: ofs" + Helper.formatAddress(link.getAddress()), -1); diff --git a/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index 8ff3ce344..5e34c9a1c 100644 --- a/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -1675,7 +1675,7 @@ public class ActionScriptParser { GetMemberActionItem mem = (GetMemberActionItem) newvar; ret = new NewMethodActionItem(null, mem.object, mem.memberName, call(registerVars, inFunction, inMethod, variables)); } else if (newvar instanceof VariableActionItem) { - ret = new NewObjectActionItem(null, new DirectValueActionItem(((VariableActionItem)newvar).getVariableName()), call(registerVars, inFunction, inMethod, variables)); + ret = new NewObjectActionItem(null, new DirectValueActionItem(((VariableActionItem) newvar).getVariableName()), call(registerVars, inFunction, inMethod, variables)); } else { throw new ParseException("Invalid new item", lexer.yyline()); } diff --git a/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java b/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java index eb8ac775e..379890ce1 100644 --- a/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java +++ b/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java @@ -88,7 +88,7 @@ public class DumpInfo { } return end - 1; } - + @Override public String toString() { String value = previewValue == null ? "" : previewValue.toString(); diff --git a/src/com/jpexs/decompiler/flash/exporters/TextExporter.java b/src/com/jpexs/decompiler/flash/exporters/TextExporter.java index 225518c83..ade7811fd 100644 --- a/src/com/jpexs/decompiler/flash/exporters/TextExporter.java +++ b/src/com/jpexs/decompiler/flash/exporters/TextExporter.java @@ -65,7 +65,7 @@ public class TextExporter { for (Tag t : tags) { if (t instanceof TextTag) { final TextTag textTag = (TextTag) t; - final File file = new File(outdir + File.separator + Helper.makeFileName(textTag.getCharacterExportFileName()+ ".svg")); + final File file = new File(outdir + File.separator + Helper.makeFileName(textTag.getCharacterExportFileName() + ".svg")); new RetryTask(new RunnableIOEx() { @Override public void run() throws IOException { diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index fde069389..3f4dad94e 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -69,9 +69,7 @@ import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Map.Entry; -import java.util.TreeMap; import java.util.logging.ConsoleHandler; import java.util.logging.FileHandler; import java.util.logging.Formatter; diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java index 50e2175b9..d45d3eeb4 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java @@ -156,7 +156,7 @@ public class DumpTree extends JTree implements ActionListener { if (treeNode instanceof DumpInfoSwfNode) { closeSelectionMenuItem.setVisible(true); } - + if (treeNode.getEndByte() - treeNode.startByte > 3) { saveToFileMenuItem.setVisible(true); } @@ -164,7 +164,7 @@ public class DumpTree extends JTree implements ActionListener { if (treeNode.name.equals("actionBytes") && treeNode.getChildCount() == 0) { parseActionsMenuItem.setVisible(true); } - + TreeModel model = getModel(); expandRecursiveMenuItem.setVisible(model.getChildCount(treeNode) > 0); } diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java index 096ca172d..ece7e4f7f 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java @@ -93,7 +93,7 @@ public class DumpTreeModel implements TreeModel { @Override public int getChildCount(Object o) { - DumpInfo di = (DumpInfo) o; + DumpInfo di = (DumpInfo) o; if (di.tagToResolve != null) { TagStub tagStub = di.tagToResolve; try { @@ -111,7 +111,7 @@ public class DumpTreeModel implements TreeModel { @Override public boolean isLeaf(Object o) { - DumpInfo di = (DumpInfo) o; + DumpInfo di = (DumpInfo) o; return (di.tagToResolve == null) && di.getChildCount() == 0; }