organize imports & code formatting

This commit is contained in:
honfika
2014-08-15 15:42:37 +02:00
parent 35386fb241
commit f84e4d7336
11 changed files with 31 additions and 32 deletions
@@ -1443,7 +1443,7 @@ public class SWFInputStream implements AutoCloseable {
if (tagDataStream.dumpInfo == null && dumpInfo != null) {
dumpInfo.tagToResolve = tagStub;
}
if (resolve) {
DumpInfo di = dumpInfo;
try {
@@ -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;
@@ -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<Long> 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);
@@ -128,7 +128,7 @@ public class ActionListReader {
// Map of the actions. Use TreeMap to sort the keys in ascending order
Map<Long, Action> actionMap = new TreeMap<>();
Map<Long,Long> nextOffsets = new HashMap<>();
Map<Long, Long> nextOffsets = new HashMap<>();
Action entryAction = readActionListAtPos(listeners, cpool,
sis, actionMap, nextOffsets,
ip, 0, endIp, path, false, new ArrayList<Long>());
@@ -137,7 +137,7 @@ public class ActionListReader {
if (actionMap.isEmpty()) {
return actions;
}
Map<Action, List<Action>> containerLastActions = new HashMap<>();
List<Long> 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<Long, Action> actionMap = new TreeMap<>();
Map<Long,Long> nextOffsets = new HashMap<>();
Map<Long, Long> nextOffsets = new HashMap<>();
readActionListAtPos(new ArrayList<DisassemblyListener>(), cpool,
sis, actionMap, nextOffsets,
startIp, startIp, endIp, "", false, new ArrayList<Long>());
@@ -296,23 +296,24 @@ public class ActionListReader {
private static long getNearAddress(List<Long> 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<Long, Action> actionListToMap(List<Action> actions) {
Map<Long, Action> 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);
@@ -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);
@@ -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());
}
@@ -88,7 +88,7 @@ public class DumpInfo {
}
return end - 1;
}
@Override
public String toString() {
String value = previewValue == null ? "" : previewValue.toString();
@@ -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 {
@@ -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;
@@ -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);
}
@@ -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;
}