diff --git a/trunk/src/com/jpexs/decompiler/flash/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/Configuration.java index 0c38d7f16..c988409d6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/Configuration.java @@ -68,10 +68,12 @@ public class Configuration { if (replacements.isEmpty()) { File rf = new File(replacementsFile); if (rf.exists()) { - rf.delete(); + if (!rf.delete()) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Cannot delete replacements file"); + } } } else { - try (PrintWriter pw = new PrintWriter(new FileWriter(replacementsFile))) { + try (PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(replacementsFile), "utf-8"))) { for (Replacement r : replacements) { pw.println(r.urlPattern); pw.println(r.targetFile); @@ -90,7 +92,7 @@ public class Configuration { return; } replacements = new ArrayList<>(); - try (BufferedReader br = new BufferedReader(new FileReader(replacementsFile))) { + try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(replacementsFile), "utf-8"))) { String s; while ((s = br.readLine()) != null) { Replacement r = new Replacement(s, br.readLine()); diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 40ef11ebd..17a20b6a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -67,7 +67,6 @@ import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag; import com.jpexs.decompiler.flash.tags.DoInitActionTag; import com.jpexs.decompiler.flash.tags.ExportAssetsTag; import com.jpexs.decompiler.flash.tags.FileAttributesTag; -import com.jpexs.decompiler.flash.tags.JPEGTablesTag; import com.jpexs.decompiler.flash.tags.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; @@ -109,6 +108,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Random; import java.util.Stack; @@ -270,7 +270,7 @@ public class SWF { public SWF(InputStream is, PercentListener listener, boolean paralelRead) throws IOException { byte hdr[] = new byte[3]; is.read(hdr); - String shdr = new String(hdr); + String shdr = new String(hdr, "utf-8"); if ((!shdr.equals("FWS")) && (!shdr.equals("CWS")) && (!shdr.equals("ZWS"))) { throw new IOException("Invalid SWF file"); } @@ -285,7 +285,7 @@ public class SWF { if (hdr[0] == 'Z') { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - long outSize = sis.readUI32(); + sis.readUI32(); //outSize int propertiesSize = 5; lzmaProperties = new byte[propertiesSize]; if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) { @@ -311,7 +311,7 @@ public class SWF { sis.setPercentMax(fileSize); displayRect = sis.readRECT(); // FIXED8 (16 bit fixed point) frameRate - int tmpFirstByetOfFrameRate = sis.readUI8(); + sis.readUI8(); //tmpFirstByetOfFrameRate frameRate = sis.readUI8(); frameCount = sis.readUI16(); tags = sis.readTagList(0, paralelRead); @@ -406,13 +406,13 @@ public class SWF { try { byte hdr[] = new byte[3]; fis.read(hdr); - String shdr = new String(hdr); + String shdr = new String(hdr, "utf-8"); if (shdr.equals("CWS")) { int version = fis.read(); SWFInputStream sis = new SWFInputStream(fis, version, 4); long fileSize = sis.readUI32(); SWFOutputStream sos = new SWFOutputStream(fos, version); - sos.write("FWS".getBytes()); + sos.write("FWS".getBytes("utf-8")); sos.writeUI8(version); sos.writeUI32(fileSize); InflaterInputStream iis = new InflaterInputStream(fis); @@ -429,7 +429,7 @@ public class SWF { long fileSize = sis.readUI32(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - long outSize = sis.readUI32(); + sis.readUI32(); //outSize int propertiesSize = 5; byte lzmaProperties[] = new byte[propertiesSize]; if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) { @@ -444,7 +444,7 @@ public class SWF { throw new IOException("LZMA:Error in data stream"); } try (SWFOutputStream sos = new SWFOutputStream(fos, version)) { - sos.write("FWS".getBytes()); + sos.write("FWS".getBytes("utf-8")); sos.write(version); sos.writeUI32(fileSize); sos.write(baos.toByteArray()); @@ -657,9 +657,9 @@ public class SWF { if (ret.get(i).tag instanceof DefineButton2Tag) { ((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; } - if (ret.get(i).tag instanceof DoInitActionTag) { - //((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } + /*if (ret.get(i).tag instanceof DoInitActionTag) { + //((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; + }*/ if (ret.get(i).tag instanceof ASMSource) { ASMSource ass = (ASMSource) ret.get(i).tag; if (ass.containsSource()) { @@ -758,11 +758,6 @@ public class SWF { boolean mp3 = true; boolean wave = true; ByteArrayOutputStream fos = new ByteArrayOutputStream(); - int id = 0; - if (t instanceof DefineSoundTag) { - id = ((DefineSoundTag) t).soundId; - } - if (t instanceof DefineSoundTag) { DefineSoundTag st = (DefineSoundTag) t; @@ -843,20 +838,20 @@ public class SWF { writeLE(subChunk1Data, bitsPerSample, 2); ByteArrayOutputStream chunks = new ByteArrayOutputStream(); - chunks.write("fmt ".getBytes()); + chunks.write("fmt ".getBytes("utf-8")); byte subChunk1DataBytes[] = subChunk1Data.toByteArray(); writeLE(chunks, subChunk1DataBytes.length, 4); chunks.write(subChunk1DataBytes); - chunks.write("data".getBytes()); + chunks.write("data".getBytes("utf-8")); writeLE(chunks, pcmData.length, 4); chunks.write(pcmData); - fos.write("RIFF".getBytes()); + fos.write("RIFF".getBytes("utf-8")); byte chunkBytes[] = chunks.toByteArray(); writeLE(fos, 4 + chunkBytes.length, 4); - fos.write("WAVE".getBytes()); + fos.write("WAVE".getBytes("utf-8")); fos.write(chunkBytes); //size1=>16bit*/ } finally { @@ -876,9 +871,10 @@ public class SWF { return ret; } if (!(new File(outdir)).exists()) { - (new File(outdir)).mkdirs(); + if (!(new File(outdir)).mkdirs()) { + throw new IOException("Cannot create directory " + outdir); + } } - List os = new ArrayList(this.tags); for (Tag t : tags) { FileOutputStream fos = null; File file = null; @@ -903,9 +899,10 @@ public class SWF { } else { file = new File(outdir + File.separator + st.getCharacterExportFileName() + ".flv"); fos = new FileOutputStream(file); - FLVOutputStream flv = new FLVOutputStream(fos); - flv.writeHeader(true, false); - flv.writeTag(new FLVTAG(0, new AUDIODATA(st.soundFormat, st.soundRate, st.soundSize, st.soundType, st.soundData))); + try (FLVOutputStream flv = new FLVOutputStream(fos)) { + flv.writeHeader(true, false); + flv.writeTag(new FLVTAG(0, new AUDIODATA(st.soundFormat, st.soundRate, st.soundSize, st.soundType, st.soundData))); + } } } if (t instanceof SoundStreamHeadTypeTag) { @@ -949,7 +946,7 @@ public class SWF { if (fos != null) { try { fos.close(); - } catch (Exception ex) { + } catch (Exception ignore) { //ignore } } @@ -968,12 +965,9 @@ public class SWF { - long fileSize = 0; - //double ms = 1000.0f / ((float) frameRate); ByteArrayOutputStream fos = new ByteArrayOutputStream(); - fos = new ByteArrayOutputStream(); //CopyOutputStream cos = new CopyOutputStream(fos, new FileInputStream("f:\\trunk\\testdata\\xfl\\xfl\\_obj\\streamvideo 7.flv")); OutputStream tos = fos; FLVOutputStream flv = new FLVOutputStream(tos); @@ -1000,19 +994,19 @@ public class SWF { } else { frameType = 2; //inter } - int qp = (int) sis.readUB(6); + sis.readUB(6); //qp int marker = (int) sis.readUB(1); if (frameMode == 0) { int version = (int) sis.readUB(5); int version2 = (int) sis.readUB(2); - boolean interlace = sis.readUB(1) == 1;//interlace + sis.readUB(1);//interlace if (marker == 1 || version2 == 0) { sis.readUI16();//offset } int dim_y = sis.readUI8(); int dim_x = sis.readUI8(); - int render_y = sis.readUI8(); - int render_x = sis.readUI8(); + sis.readUI8(); //render_y + sis.readUI8(); //render_x horizontalAdjustment = (int) (dim_x * Math.ceil(((double) videoStream.width) / (double) dim_x)) - videoStream.width; verticalAdjustment = (int) (dim_y * Math.ceil(((double) videoStream.height) / (double) dim_y)) - videoStream.height; @@ -1053,7 +1047,6 @@ public class SWF { baos.write(tag.videoData); flv.writeTag(new FLVTAG((int) Math.floor(i * 1000.0f / ((float) frameRate)), new VIDEODATA(frameType, videoStream.codecID, baos.toByteArray()))); } - fileSize = fos.toByteArray().length; return fos.toByteArray(); } @@ -1063,7 +1056,9 @@ public class SWF { return ret; } if (!(new File(outdir)).exists()) { - (new File(outdir)).mkdirs(); + if (!(new File(outdir)).mkdirs()) { + throw new IOException("Cannot create directory " + outdir); + } } for (Tag t : tags) { if (t instanceof DefineVideoStreamTag) { @@ -1083,7 +1078,9 @@ public class SWF { return ret; } if (!(new File(outdir)).exists()) { - (new File(outdir)).mkdirs(); + if (!(new File(outdir)).mkdirs()) { + throw new IOException("Cannot create directory " + outdir); + } } for (Tag t : tags) { if (t instanceof TextTag) { @@ -1111,7 +1108,9 @@ public class SWF { return ret; } if (!(new File(outdir)).exists()) { - (new File(outdir)).mkdirs(); + if (!(new File(outdir)).mkdirs()) { + throw new IOException("Cannot create directory " + outdir); + } } for (Tag t : tags) { if (t instanceof ShapeTag) { @@ -1121,7 +1120,7 @@ public class SWF { } File file = new File(outdir + File.separator + characterID + ".svg"); try (FileOutputStream fos = new FileOutputStream(file)) { - fos.write(((ShapeTag) t).toSVG().getBytes()); + fos.write(((ShapeTag) t).toSVG().getBytes("utf-8")); } ret.add(file); } @@ -1135,14 +1134,13 @@ public class SWF { return ret; } if (!(new File(outdir)).exists()) { - (new File(outdir)).mkdirs(); + if (!(new File(outdir)).mkdirs()) { + throw new IOException("Cannot create directory " + outdir); + } } for (Tag t : tags) { if (t instanceof DefineBinaryDataTag) { - int characterID = 0; - if (t instanceof CharacterTag) { - characterID = ((CharacterTag) t).getCharacterID(); - } + int characterID = ((DefineBinaryDataTag) t).getCharacterID(); File file = new File(outdir + File.separator + characterID + ".bin"); try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(((DefineBinaryDataTag) t).binaryData); @@ -1159,12 +1157,14 @@ public class SWF { return ret; } if (!(new File(outdir)).exists()) { - (new File(outdir)).mkdirs(); + if (!(new File(outdir)).mkdirs()) { + throw new IOException("Cannot create directory " + outdir); + } } for (Tag t : tags) { if (t instanceof ImageTag) { File file = new File(outdir + File.separator + ((ImageTag) t).getCharacterID() + "." + ((ImageTag) t).getImageFormat()); - ImageIO.write(((ImageTag) t).getImage(this.tags), ((ImageTag) t).getImageFormat().toUpperCase(), file); + ImageIO.write(((ImageTag) t).getImage(this.tags), ((ImageTag) t).getImageFormat().toUpperCase(Locale.ENGLISH), file); ret.add(file); } } @@ -1172,12 +1172,6 @@ public class SWF { } public void exportImages(String outdir) throws IOException { - JPEGTablesTag jtt = null; - for (Tag t : tags) { - if (t instanceof JPEGTablesTag) { - jtt = (JPEGTablesTag) t; - } - } exportImages(outdir, tags); } @@ -1232,7 +1226,7 @@ public class SWF { c = "" + fooJoinCharacters.charAt(rnd.nextInt(fooJoinCharacters.length())); } if (i == 0 && firstUppercase) { - c = c.toUpperCase(); + c = c.toUpperCase(Locale.ENGLISH); } ret += c; } @@ -1313,14 +1307,12 @@ public class SWF { return null; } - private static void getVariables(ConstantPool constantPool, List localData, Stack stack, List output, ActionGraphSource code, int ip, int lastIp, HashMap variables, List functions, HashMap strings, List visited, HashMap usageTypes) { + private static void getVariables(ConstantPool constantPool, List localData, Stack stack, List output, ActionGraphSource code, int ip, HashMap variables, List functions, HashMap strings, List visited, HashMap usageTypes) { boolean debugMode = false; while ((ip > -1) && ip < code.size()) { if (visited.contains(ip)) { break; } - - lastIp = ip; GraphSourceItem ins = code.get(ip); if (debugMode) { @@ -1447,7 +1439,7 @@ public class SWF { @SuppressWarnings("unchecked") Stack brStack = (Stack) stack.clone(); if (b >= 0) { - getVariables(constantPool, localData, brStack, output, code, b, ip, variables, functions, strings, visited, usageTypes); + getVariables(constantPool, localData, brStack, output, code, b, variables, functions, strings, visited, usageTypes); } else { if (debugMode) { System.out.println("Negative branch:" + b); @@ -1464,7 +1456,7 @@ public class SWF { private static void getVariables(HashMap variables, List functions, HashMap strings, HashMap usageType, ActionGraphSource code, int addr) { List localData = Helper.toList(new HashMap(), new HashMap(), new HashMap()); try { - getVariables(null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, variables, functions, strings, new ArrayList(), usageType); + getVariables(null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList(), usageType); } catch (Exception ex) { Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, "Getting variables error", ex); } @@ -1801,6 +1793,7 @@ public class SWF { private int width; private int height; private int type; + public static final long serialVersionUID = 1L; public CachedImage(BufferedImage img) { width = img.getWidth(); @@ -1888,9 +1881,6 @@ public class SWF { } CharacterTag character = characters.get(layer.characterId); MATRIX mat = new MATRIX(layer.matrix); - if (mat == null) { - mat = new MATRIX(); - } mat.translateX /= 20; mat.translateY /= 20; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 1985561e0..1e730c936 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -58,6 +58,7 @@ import java.io.PrintStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map.Entry; import java.util.Scanner; import java.util.Stack; import java.util.concurrent.Callable; @@ -534,7 +535,7 @@ public class SWFInputStream extends InputStream { } @SuppressWarnings("unchecked") - private static void getConstantPool(List listeners, ConstantPool cpool, List localData, Stack stack, List output, ActionGraphSource code, int ip, int lastIp, List constantPools, List visited, int version, int endIp) { + private static void getConstantPool(List listeners, ConstantPool cpool, List localData, Stack stack, List output, ActionGraphSource code, int ip, List constantPools, List visited, int version, int endIp) { boolean debugMode = false; boolean deobfuscate = (Boolean) Configuration.getConfig("autoDeobfuscate", true); while (((endIp == -1) || (endIp > ip)) && (ip > -1) && ip < code.size()) { @@ -544,7 +545,6 @@ public class SWFInputStream extends InputStream { for (int i = 0; i < listeners.size(); i++) { listeners.get(i).progress("constantpool", ip + 1, code.size()); } - lastIp = ip; GraphSourceItem ins = code.get(ip); if (ins.isIgnored()) { ip++; @@ -564,7 +564,7 @@ public class SWFInputStream extends InputStream { List localData2 = Helper.toList(new HashMap(), new HashMap(), new HashMap()); List output2 = new ArrayList<>(); output2s.add(output2); - getConstantPool(listeners, cpool, localData2, new Stack(), output2, code, code.adr2pos(endAddr), lastIp, constantPools, visited, version, code.adr2pos(endAddr + size)); + getConstantPool(listeners, cpool, localData2, new Stack(), output2, code, code.adr2pos(endAddr), constantPools, visited, version, code.adr2pos(endAddr + size)); endAddr += size; } if (deobfuscate) { @@ -666,7 +666,7 @@ public class SWFInputStream extends InputStream { } } stack.pop(); - getConstantPool(listeners, cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).getJumpOffset())) : ip + 1, ip, constantPools, visited, version, endIp); + getConstantPool(listeners, cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).getJumpOffset())) : ip + 1, constantPools, visited, version, endIp); } else { if (deobfuscate && ins instanceof ActionIf) { stack.pop(); @@ -677,7 +677,7 @@ public class SWFInputStream extends InputStream { @SuppressWarnings("unchecked") Stack brStack = (Stack) stack.clone(); if (b >= 0) { - getConstantPool(listeners, cpool, localData, brStack, output, code, b, ip, constantPools, visited, version, endIp); + getConstantPool(listeners, cpool, localData, brStack, output, code, b, constantPools, visited, version, endIp); } else { if (debugMode) { System.out.println("Negative branch:" + b); @@ -701,7 +701,7 @@ public class SWFInputStream extends InputStream { List ret = new ArrayList<>(); List localData = Helper.toList(new HashMap(), new HashMap(), new HashMap()); try { - getConstantPool(listeners, null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, ret, new ArrayList(), version, -1); + getConstantPool(listeners, null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), ret, new ArrayList(), version, -1); } catch (Exception ex) { log.log(Level.SEVERE, "Error during getting constantpool", ex); } @@ -751,7 +751,6 @@ public class SWFInputStream extends InputStream { } last = a; } - int len = retdups.size(); for (int i = 0; i < retdups.size(); i++) { Action a = retdups.get(i); if (a instanceof ActionEnd) { @@ -763,7 +762,7 @@ public class SWFInputStream extends InputStream { } } - List pools = new ArrayList<>(); + List pools; StringBuilder br = new StringBuilder(); for (int i = 0; i < ret.size(); i++) { br.append(i); @@ -810,7 +809,7 @@ public class SWFInputStream extends InputStream { rri.setPos(ip); Action a; long filePos = rri.getPos(); - Scanner sc = new Scanner(System.in); + Scanner sc = new Scanner(System.in, "utf-8"); int prevIp = ip; while (((endip == -1) || (endip > ip)) && (a = sis.readAction(rri)) != null) { for (int i = 0; i < listeners.size(); i++) { @@ -827,10 +826,10 @@ public class SWFInputStream extends InputStream { int info = a.actionLength + 1 + ((a.actionCode > 0x80) ? 2 : 0); byte b[] = a.getBytes(sis.version); int infoCorrect = info; - if (b.length != infoCorrect) { - //throw new RuntimeException("Wrong length "+a.toString()+" info:"+infoCorrect+" actual:"+b.length+" datalen:"+(infoCorrect-info)); - } - int actual = actual = a.getBytes(sis.version).length; + /*if (b.length != infoCorrect) { + throw new RuntimeException("Wrong length "+a.toString()+" info:"+infoCorrect+" actual:"+b.length+" datalen:"+(infoCorrect-info)); + }*/ + //int actual = a.getBytes(sis.version).length; if ((!(a instanceof ActionStore)) && (!(a instanceof GraphSourceItemContainer))) { int change = info - (rri.getPos() - ip); if (change > 0) { @@ -876,8 +875,8 @@ public class SWFInputStream extends InputStream { @SuppressWarnings("unchecked") HashMap vars = (HashMap) localData.get(1); System.err.print("variables: "); - for (String v : vars.keySet()) { - System.err.print("'" + v + "' = " + Highlighting.stripHilights(vars.get(v).toString(cpool)) + ", "); + for (Entry v : vars.entrySet()) { + System.err.print("'" + v + "' = " + Highlighting.stripHilights(v.getValue().toString(cpool)) + ", "); } System.err.println(); String add = ""; @@ -904,7 +903,6 @@ public class SWFInputStream extends InputStream { } cpool.setNew(((ActionConstantPool) a).constantPool); } - Action beforeInsert = null; ActionIf aif = null; boolean goaif = false; if (!a.isIgnored()) { @@ -1031,11 +1029,6 @@ public class SWFInputStream extends InputStream { a.setAddress(a.getAddress() + 1, SWF.DEFAULT_VERSION); } - if (i == 0) { - a.beforeInsert = beforeInsert; - } - } else { - a.beforeInsert = beforeInsert; } ret.set(ip + i, a); } @@ -1746,9 +1739,9 @@ public class SWFInputStream extends InputStream { case 0x2A: return new ActionThrow(); default: - if (actionLength > 0) { - //skip(actionLength); - } + /*if (actionLength > 0) { + //skip(actionLength); + }*/ //throw new UnknownActionException(actionCode); Action r = new ActionNop(); r.actionCode = actionCode; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index 4c572c927..5c7a997e8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -316,11 +316,6 @@ public class SWFOutputStream extends OutputStream { * @throws IOException */ public void writeSB(int nBits, long value) throws IOException { - long tmp = value & 0x7FFFFFFF; - - if (value < 0) { - tmp = tmp | (1L << (nBits - 1)); - } writeUB(nBits, value); } @@ -436,9 +431,9 @@ public class SWFOutputStream extends OutputStream { * @return Number of bits */ public static int getNeededBitsS(int v) { - if (v == 0) { - //return 0; - } + /*if (v == 0) { + //return 0; + }*/ int counter = 32; int mask = 0x80000000; final int val = (v < 0) ? -v : v; @@ -456,13 +451,6 @@ public class SWFOutputStream extends OutputStream { return (long) Math.floor(value); } - private static double getFloatPart(double value) { - if (value < 0) { - return value - getIntPart(value); - } - return value + getIntPart(value); - } - public static int unsignedSize(final int value) { final int val = (value < 0) ? -value - 1 : value; @@ -490,14 +478,6 @@ public class SWFOutputStream extends OutputStream { return getNeededBitsS(k) + 16; } - private int enlargeBitCountU(int currentBitCount, int value) { - int neededNew = getNeededBitsU(value); - if (neededNew > currentBitCount) { - return neededNew; - } - return currentBitCount; - } - private int enlargeBitCountS(int currentBitCount, int value) { int neededNew = getNeededBitsS(value); if (neededNew > currentBitCount) { @@ -506,14 +486,6 @@ public class SWFOutputStream extends OutputStream { return currentBitCount; } - private int enlargeBitCountF(int currentBitCount, float value) { - int neededNew = getNeededBitsF(value); - if (neededNew > currentBitCount) { - return neededNew; - } - return currentBitCount; - } - /** * Writes MATRIX value to the stream * @@ -909,31 +881,29 @@ public class SWFOutputStream extends OutputStream { */ public void writeFILTER(FILTER value) throws IOException { writeUI8(value.id); - switch (value.id) { - case 0: - writeDROPSHADOWFILTER((DROPSHADOWFILTER) value); - break; - case 1: - writeBLURFILTER((BLURFILTER) value); - break; - case 2: - writeGLOWFILTER((GLOWFILTER) value); - break; - case 3: - writeBEVELFILTER((BEVELFILTER) value); - break; - case 4: - writeGRADIENTGLOWFILTER((GRADIENTGLOWFILTER) value); - break; - case 5: - writeCONVOLUTIONFILTER((CONVOLUTIONFILTER) value); - break; - case 6: - writeCOLORMATRIXFILTER((COLORMATRIXFILTER) value); - break; - case 7: - writeGRADIENTBEVELFILTER((GRADIENTBEVELFILTER) value); - break; + if (value instanceof DROPSHADOWFILTER) { + writeDROPSHADOWFILTER((DROPSHADOWFILTER) value); + } + if (value instanceof BLURFILTER) { + writeBLURFILTER((BLURFILTER) value); + } + if (value instanceof GLOWFILTER) { + writeGLOWFILTER((GLOWFILTER) value); + } + if (value instanceof BEVELFILTER) { + writeBEVELFILTER((BEVELFILTER) value); + } + if (value instanceof GRADIENTGLOWFILTER) { + writeGRADIENTGLOWFILTER((GRADIENTGLOWFILTER) value); + } + if (value instanceof CONVOLUTIONFILTER) { + writeCONVOLUTIONFILTER((CONVOLUTIONFILTER) value); + } + if (value instanceof COLORMATRIXFILTER) { + writeCOLORMATRIXFILTER((COLORMATRIXFILTER) value); + } + if (value instanceof GRADIENTBEVELFILTER) { + writeGRADIENTBEVELFILTER((GRADIENTBEVELFILTER) value); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index bb095c930..3a1e400f4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -40,7 +40,6 @@ import com.jpexs.decompiler.flash.tags.DefineShapeTag; import com.jpexs.decompiler.flash.tags.DefineSpriteTag; import com.jpexs.decompiler.flash.tags.DefineText2Tag; import com.jpexs.decompiler.flash.tags.DefineTextTag; -import com.jpexs.decompiler.flash.tags.DoInitActionTag; import com.jpexs.decompiler.flash.tags.ExportAssetsTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.Tag; @@ -205,9 +204,9 @@ public class TagNode { if (ret.get(i).tag instanceof DefineButton2Tag) { ((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; } - if (ret.get(i).tag instanceof DoInitActionTag) { - //((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } + /*if (ret.get(i).tag instanceof DoInitActionTag) { + //((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; + }*/ if (ret.get(i).tag instanceof ASMSource) { ASMSource ass = (ASMSource) ret.get(i).tag; if (ass.containsSource()) { @@ -256,7 +255,9 @@ public class TagNode { if (node.subItems.isEmpty()) { if ((node.tag instanceof ASMSource) && (node.export)) { if (!dir.exists()) { - dir.mkdirs(); + if (!dir.mkdirs()) { + continue; + } } try { String f = outdir + name + ".as"; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index 12009e65b..8acb4a522 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -35,7 +35,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.Map.Entry; import java.util.Random; import java.util.Set; import java.util.concurrent.Callable; @@ -62,7 +64,7 @@ public class ABC { public MethodBody bodies[]; private int bodyIdxFromMethodIdx[]; public long stringOffsets[]; - public static String IDENT_STRING = " "; + public static final String IDENT_STRING = " "; public static final int MINORwithDECIMAL = 17; protected HashSet listeners = new HashSet<>(); private static Logger logger = Logger.getLogger(ABC.class.getName()); @@ -356,8 +358,7 @@ public class ABC { mb.init_scope_depth = ais.readU30(); mb.max_scope_depth = ais.readU30(); int code_length = ais.readU30(); - mb.codeBytes = new byte[code_length]; - ais.read(mb.codeBytes); + mb.codeBytes = ais.readBytes(code_length); try { mb.code = new AVM2Code(new ByteArrayInputStream(mb.codeBytes)); } catch (UnknownInstructionCode re) { @@ -473,13 +474,7 @@ public class ABC { aos.writeU30(bodies[i].max_scope_depth); byte codeBytes[] = bodies[i].code.getBytes(); aos.writeU30(codeBytes.length); - try { - aos.write(codeBytes); - } catch (NotSameException ex) { - System.out.println(bodies[i].code.toString(constants)); - System.exit(0); - return; - } + aos.write(codeBytes); aos.writeU30(bodies[i].exceptions.length); for (int j = 0; j < bodies[i].exceptions.length; j++) { aos.writeU30(bodies[i].exceptions[j].start); @@ -706,8 +701,8 @@ public class ABC { AtomicInteger cnt = new AtomicInteger(1); for (int i = 0; i < script_info.length; i++) { HashMap packs = script_info[i].getPacks(this, i); - for (ClassPath path : packs.keySet()) { - Future future = executor.submit(new ExportPackTask(cnt, script_info.length, path, packs.get(path), directory, abcList, pcode, abcStr, paralel)); + for (Entry entry : packs.entrySet()) { + Future future = executor.submit(new ExportPackTask(cnt, script_info.length, entry.getKey(), entry.getValue(), directory, abcList, pcode, abcStr, paralel)); futureResults.add(future); } } @@ -731,7 +726,13 @@ public class ABC { } public void dump(OutputStream os) { - PrintStream output = new PrintStream(os); + PrintStream output; + try { + output = new PrintStream(os, false, "utf-8"); + } catch (UnsupportedEncodingException ex) { + Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, ex); + return; + } constants.dump(output); for (int i = 0; i < method_info.length; i++) { output.println("MethodInfo[" + i + "]:" + method_info[i].toString(constants, new ArrayList())); @@ -798,7 +799,7 @@ public class ABC { c = "" + fooJoinCharacters.charAt(rnd.nextInt(fooJoinCharacters.length())); } if (i == 0 && firstUppercase) { - c = c.toUpperCase(); + c = c.toUpperCase(Locale.ENGLISH); } ret += c; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index 03c65aab9..868cf2162 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -31,7 +31,7 @@ public class ABCInputStream extends InputStream { private InputStream is; private long bytesRead = 0; private ByteArrayOutputStream bufferOs = null; - public static boolean DEBUG_READ = false; + public static final boolean DEBUG_READ = false; public void startBuffer() { bufferOs = new ByteArrayOutputStream(); @@ -225,8 +225,7 @@ public class ABCInputStream extends InputStream { params.add(readU30()); //multiname indices! } } else { - System.err.println("Unknown kind of Multiname:0x" + Integer.toHexString(kind)); - System.exit(1); + throw new IOException("Unknown kind of Multiname:0x" + Integer.toHexString(kind)); } return new Multiname(kind, name_index, namespace_index, namespace_set_index, qname_index, params); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index e4c698ffc..92a96e4ef 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -101,7 +101,9 @@ public class ScriptPack { String packageName = getPathPackage(); File outDir = new File(directory + File.separatorChar + makeDirPath(packageName)); if (!outDir.exists()) { - outDir.mkdirs(); + if (!outDir.mkdirs()) { + throw new IOException("cannot create directory " + outDir); + } } String fileName = outDir.toString() + File.separator + Helper.makeFileName(scriptName) + ".as"; File file = new File(fileName); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index d54ae07dc..83718f559 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -26,7 +26,12 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.*; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.*; -import com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion.*; +import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.EqualsIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterEqualsIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterThanIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessEqualsIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessThanIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.*; import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugFileIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugIns; @@ -63,6 +68,7 @@ import java.util.logging.Logger; public class AVM2Code implements Serializable { + public static final long serialVersionUID = 1L; private static final boolean DEBUG_MODE = false; public static int toSourceLimit = -1; public ArrayList code = new ArrayList<>(); @@ -669,32 +675,25 @@ public class AVM2Code implements Serializable { @Override public String toString() { - String s = ""; + StringBuilder s = new StringBuilder(); for (AVM2Instruction instruction : code) { - s += instruction.toString() + "\r\n"; + s.append(instruction.toString()); + s.append("\r\n"); } - return s; + return s.toString(); } public String toString(ConstantPool constants) { - String s = ""; + StringBuilder s = new StringBuilder(); int i = 0; for (AVM2Instruction instruction : code) { - s += Helper.formatAddress(i) + " " + instruction.toString(constants, new ArrayList()) + "\r\n"; + s.append(Helper.formatAddress(i)); + s.append(" "); + s.append(instruction.toString(constants, new ArrayList())); + s.append("\r\n"); i++; } - return s; - } - - private static String popStack(Stack stack) { - for (int i = stack.size() - 1; i >= 0; i--) { - String s = stack.get(i); - if (!s.startsWith("//")) { - stack.remove(i); - return s; - } - } - return null; + return s.toString(); } public String toASMSource(ConstantPool constants, MethodBody body, boolean hex) { @@ -829,130 +828,8 @@ public class AVM2Code implements Serializable { public void invalidateCache() { cacheActual = false; } - - private static String innerStackToString(List stack) { - String ret = ""; - for (int d = 0; d < stack.size(); d++) { - Object o = stack.get(d); - ret += o.toString(); - if (d < stack.size() - 1) { - if (!ret.endsWith("\r\n")) { - ret += "\r\n"; - } - } - } - return ret; - } - - private class Loop { - - public int loopContinue; - public int loopBreak; - public int continueCount = 0; - public int breakCount = 0; - - public Loop(int loopContinue, int loopBreak) { - this.loopContinue = loopContinue; - this.loopBreak = loopBreak; - } - } - private List loopList; private List unknownJumps; - private List finallyJumps; - private List parsedExceptions; private List ignoredIns; - - private String stripBrackets(String s) { - if (s.startsWith("(") && (s.endsWith(")"))) { - s = s.substring(1, s.length() - 1); - } - return s; - } - - private int checkCatches(ABC abc, ConstantPool constants, MethodInfo method_info[], Stack stack, Stack scopeStack, List output, MethodBody body, int ip) throws ConvertException { - /*int newip = ip; - loope: - for (int e = 0; e < body.exceptions.length; e++) { - if (pos2adr(ip) == body.exceptions[e].end) { - for (int f = 0; f < e; f++) { - if (body.exceptions[e].startServer == body.exceptions[f].startServer) { - if (body.exceptions[e].end == body.exceptions[f].end) { - continue loope; - } - } - } - output.add("}"); - if (!(code.get(ip).definition instanceof JumpIns)) { - throw new ConvertException("No jump to skip catches"); - } - int addrAfterCatches = pos2adr(ip + 1) + code.get(ip).operands[0]; - int posAfterCatches = adr2pos(addrAfterCatches); - for (int g = 0; g < body.exceptions.length; g++) { - if (body.exceptions[e].startServer == body.exceptions[g].startServer) { - if (body.exceptions[e].end == body.exceptions[g].end) { - if (body.exceptions[g].isFinally()) { - output.add("finally"); - } else { - output.add("catch(" + body.exceptions[g].getVarName(constants) + ":" + body.exceptions[g].getTypeName(constants) + ")"); - } - output.add("{"); - - if (body.exceptions[g].isFinally()) { - int jumppos = adr2pos(body.exceptions[g].target) - 1; - AVM2Instruction jumpIns = code.get(jumppos); - if (!(jumpIns.definition instanceof JumpIns)) { - throw new ConvertException("No jump in finally block"); - } - int nextAddr = pos2adr(jumppos + 1) + jumpIns.operands[0]; - int nextins = adr2pos(nextAddr); - int pos = nextins; - Integer uj = new Integer(nextins); - if (unknownJumps.contains(uj)) { - unknownJumps.remove(uj); - } - int endpos = 0; - do { - if (code.get(pos).definition instanceof LookupSwitchIns) { - if (code.get(pos).operands[0] == 0) { - if (adr2pos(pos2adr(pos) + code.get(pos).operands[2]) < pos) { - endpos = pos - 1; - newip = endpos + 1; - break; - } - } - } - pos++; - } while (pos < code.size()); - output.addAll(toSource(stack, scopeStack, abc, constants, method_info, body, nextins, endpos).output); - } else { - - int pos = adr2pos(body.exceptions[g].target); - int endpos = posAfterCatches - 1; - for (int p = pos; p < posAfterCatches; p++) { - if (code.get(p).definition instanceof JumpIns) { - int nextAddr = pos2adr(p + 1) + code.get(p).operands[0]; - int nextPos = adr2pos(nextAddr); - if (nextPos == posAfterCatches) { - endpos = p - 1; - break; - } - } - } - Stack cstack = new Stack(); - cstack.push("catched " + body.exceptions[g].getVarName(constants)); - List outcatch = toSource(cstack, new Stack(), abc, constants, method_info, body, pos, endpos).output; - output.addAll(outcatch); - newip = endpos + 1; - } - output.add("}"); - } - } - } - } - } - return newip;*/ - return ip; - } boolean isCatched = false; public boolean isKilled(int regName, int start, int end) { @@ -967,32 +844,6 @@ public class AVM2Code implements Serializable { } private int toSourceCount = 0; - private int ipOfType(int from, boolean up, Class search, Class skipped, int start, int end) { - if (up) { - for (int i = from; i >= start; i--) { - if (search.isInstance(code.get(i).definition)) { - return i; - } else if ((skipped != null) && skipped.isInstance(code.get(i).definition)) { - //skipped - } else { - return -1; - } - } - } else { - for (int i = from; i <= end; i++) { - if (search.isInstance(code.get(i).definition)) { - return i; - } else if ((skipped != null) && skipped.isInstance(code.get(i).definition)) { - //skipped - } else { - return -1; - } - } - - } - return -1; - } - public HashMap getLocalRegNamesFromDebug(ABC abc) { HashMap localRegNames = new HashMap<>(); for (AVM2Instruction ins : code) { @@ -1052,7 +903,7 @@ public class AVM2Code implements Serializable { String ret = ""; int ip = start; try { - int addr; + //int addr; iploop: while (ip <= end) { @@ -1061,9 +912,9 @@ public class AVM2Code implements Serializable { continue; } boolean processTry = processJumps; - addr = pos2adr(ip); + //addr = pos2adr(ip); int ipfix = fixIPAfterDebugLine(ip); - int addrfix = pos2adr(ipfix); + //int addrfix = pos2adr(ipfix); int maxend = -1; if (ip > end) { @@ -1071,7 +922,7 @@ public class AVM2Code implements Serializable { } if (unknownJumps.contains(ip)) { - unknownJumps.remove(new Integer(ip)); + unknownJumps.remove(Integer.valueOf(ip)); throw new UnknownJumpException(stack, ip, output); } if (visited[ip]) { @@ -1159,7 +1010,7 @@ public class AVM2Code implements Serializable { } if (insAfter.definition instanceof ConvertBIns) { //SWF compiled with debug contain convert_b ip++; - addr = pos2adr(ip); + //addr = pos2adr(ip); insAfter = code.get(ip + 1); } @@ -1220,7 +1071,7 @@ public class AVM2Code implements Serializable { } while (ins.definition instanceof DupIns); } else if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) { ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames); - ip = end + 1; + //ip = end + 1; break; } else if (ins.definition instanceof NewFunctionIns) { String functionName = ""; @@ -1263,7 +1114,7 @@ public class AVM2Code implements Serializable { ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames); ip++; - addr = pos2adr(ip); + //addr = pos2adr(ip); } } @@ -1280,11 +1131,11 @@ public class AVM2Code implements Serializable { } public String tabString(int len) { - String ret = ""; + StringBuilder ret = new StringBuilder(); for (int i = 0; i < len; i++) { - ret += ABC.IDENT_STRING; + ret.append(ABC.IDENT_STRING); } - return ret; + return ret.toString(); } public String toSource(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) { @@ -1354,10 +1205,7 @@ public class AVM2Code implements Serializable { public void initToSource() { toSourceCount = 0; - loopList = new ArrayList<>(); unknownJumps = new ArrayList<>(); - finallyJumps = new ArrayList<>(); - parsedExceptions = new ArrayList<>(); ignoredIns = new ArrayList<>(); } @@ -1368,14 +1216,6 @@ public class AVM2Code implements Serializable { HashMap localRegs = new HashMap<>(); int regCount = getRegisterCount(); - int paramCount; - if (body.method_info != -1) { - MethodInfo mi = method_info[body.method_info]; - paramCount = mi.param_types.length; - if (mi.flagNeed_rest()) { - paramCount++; - } - } //try { @@ -1893,24 +1733,6 @@ public class AVM2Code implements Serializable { return ret; } - private int visitCodeTrap(MethodBody body, int visited[]) { - int ret = 0; - for (int i = 0; i < visited.length; i++) { - visited[i] = 0; - } - ret += visitCodeTrap(0, visited, null, null); - for (ABCException e : body.exceptions) { - try { - ret += visitCodeTrap(adr2pos(e.start), visited, null, null); - ret += visitCodeTrap(adr2pos(e.target), visited, null, null); - ret += visitCodeTrap(adr2pos(e.end), visited, null, null); - } catch (ConvertException ex) { - Logger.getLogger(AVM2Code.class.getName()).log(Level.FINE, null, ex); - } - } - return ret; - } - private static class ControlFlowTag { public String name; @@ -1926,7 +1748,6 @@ public class AVM2Code implements Serializable { List buf = new ArrayList<>(); boolean cont = false; int continueip = 0; - AVM2Instruction prev = null; for (; ip < code.size(); ip++) { AVM2Instruction ins = code.get(ip); @@ -2009,7 +1830,6 @@ public class AVM2Code implements Serializable { } else if (cont) { buf.add(ip); } - prev = ins; } } @@ -2162,7 +1982,7 @@ public class AVM2Code implements Serializable { } @SuppressWarnings("unchecked") - private static int removeTraps(boolean secondPass, boolean useVisited, List localData, Stack stack, List output, AVM2GraphSource code, int ip, int lastIp, HashMap visited, HashMap> visitedStates, HashMap decisions) { + private static int removeTraps(boolean secondPass, boolean useVisited, List localData, Stack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions) { boolean debugMode = false; int ret = 0; iploop: @@ -2189,7 +2009,6 @@ public class AVM2Code implements Serializable { visitedStates.put(ip, (HashMap) currentState.clone()); } - lastIp = ip; GraphSourceItem ins = code.get(ip); if (ins.isIgnored()) { ip++; @@ -2198,60 +2017,6 @@ public class AVM2Code implements Serializable { if (debugMode) { System.out.println((useVisited ? "useV " : "") + (secondPass ? "secondPass " : "") + "Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString())); } - AVM2Instruction ains = (AVM2Instruction) ins; - /*if (ains.definition instanceof DupIns) { - do { - AVM2Instruction insAfter = (AVM2Instruction) code.get(ip + 1); - if (insAfter.definition instanceof ConvertBIns) { //SWF compiled with debug contain convert_b - ip++; - insAfter = (AVM2Instruction) code.get(ip + 1); - } - - if (insAfter.definition instanceof SetLocalTypeIns) { - //chained assignments - int reg = (((SetLocalTypeIns) insAfter.definition).getRegisterId(insAfter)); - for (int t = ip + 1; t < code.size(); t++) { - if (((AVM2Instruction) code.get(t)).definition instanceof KillIns) { - if (((AVM2Instruction) code.get(t)).operands[0] == reg) { - break; - } - } - if (((AVM2Instruction) code.get(t)).definition instanceof GetLocalTypeIns) { - if (((GetLocalTypeIns) ((AVM2Instruction) code.get(t)).definition).getRegisterId((AVM2Instruction) code.get(t)) == reg) { - if (((AVM2Instruction) code.get(t + 1)).definition instanceof KillIns) { - if (((AVM2Instruction) code.get(t + 1)).operands[0] == reg) { - code.getCode().initToSource(); - ConvertOutput assignment = code.getCode().toSourceOutput(false, (Boolean) localData.get(0), (Integer) localData.get(13), (Integer) localData.get(1), (HashMap) localData.get(2), stack, (Stack) localData.get(3), (ABC) localData.get(7), (ConstantPool) localData.get(4), (MethodInfo[]) localData.get(5), (MethodBody) localData.get(6), ip + 2, t - 1, (HashMap) localData.get(8), (List) localData.get(9), null); - stack.push(assignment.output.remove(assignment.output.size() - 1)); - ip = t + 2; - continue iploop; - } - } - } - } - } - if (!code.getCode().isKilled(reg, 0, code.size() - 1)) { - for (int i = ip; i >= 0; i--) { - if (((AVM2Instruction) code.get(i)).definition instanceof DupIns) { - GraphTargetItem v = stack.pop(); - stack.push(new LocalRegTreeItem((AVM2Instruction) ins, reg, v)); - stack.push(v); - } else { - break; - } - } - } else { - break; - } - ip++; - continue iploop; - //} - - } else { - break; - } - } while (((AVM2Instruction) ins).definition instanceof DupIns); - }*/ if ((ins instanceof AVM2Instruction) && (((AVM2Instruction) ins).definition instanceof NewFunctionIns)) { stack.push(new BooleanTreeItem(null, true)); } else { @@ -2303,7 +2068,6 @@ public class AVM2Code implements Serializable { } } ip = condition ? branches.get(0) : branches.get(1); - lastIp = ip; continue; //ret += removeTraps(secondPass, useVisited, localData, stack, output, code, condition ? branches.get(0) : branches.get(1), ip, visited, visitedStates, decisions); } else { @@ -2323,7 +2087,7 @@ public class AVM2Code implements Serializable { for (int b : branches) { Stack brStack = (Stack) stack.clone(); if (b >= 0) { - ret += removeTraps(secondPass, useVisited || (!ins.isJump()), localData, brStack, output, code, b, ip, visited, visitedStates, decisions); + ret += removeTraps(secondPass, useVisited || (!ins.isJump()), localData, brStack, output, code, b, visited, visitedStates, decisions); } else { if (debugMode) { System.out.println("Negative branch:" + b); @@ -2343,8 +2107,8 @@ public class AVM2Code implements Serializable { public static int removeTraps(List localData, AVM2GraphSource code, int addr) { HashMap decisions = new HashMap<>(); - removeTraps(false, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, new HashMap(), new HashMap>(), decisions); + removeTraps(false, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), new HashMap(), new HashMap>(), decisions); localData.set(2, new HashMap()); - return removeTraps(true, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, new HashMap(), new HashMap>(), decisions); + return removeTraps(true, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), new HashMap(), new HashMap>(), decisions); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java index 48f166021..8d8c685d7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java @@ -22,8 +22,11 @@ import com.jpexs.decompiler.flash.abc.types.Namespace; import com.jpexs.decompiler.flash.abc.types.NamespaceSet; import java.io.OutputStream; import java.io.PrintStream; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; public class ConstantPool { @@ -81,7 +84,7 @@ public class ConstantPool { public int getDoubleId(double value) { for (int i = 1; i < constant_double.length; i++) { - if (constant_double[i] == value) { + if (Double.compare(constant_double[i], value) == 0) { return i; } } @@ -130,7 +133,13 @@ public class ConstantPool { } public void dump(OutputStream os) { - PrintStream output = new PrintStream(os); + PrintStream output; + try { + output = new PrintStream(os, false, "utf-8"); + } catch (UnsupportedEncodingException ex) { + Logger.getLogger(ConstantPool.class.getName()).log(Level.SEVERE, null, ex); + return; + } String s = ""; for (int i = 1; i < constant_int.length; i++) { output.println("INT[" + i + "]=" + constant_int[i]); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 94150b518..d6c081fbf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -207,9 +207,9 @@ public class AVM2Graph extends Graph { } } if (catchedExceptions.size() > 0) { - if (currentLoop != null) { - //currentLoop.phase=0; - } + /*if (currentLoop != null) { + //currentLoop.phase=0; + }*/ parsedExceptions.addAll(catchedExceptions); int endpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end)); int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end); @@ -580,7 +580,7 @@ public class AVM2Graph extends Graph { if ((!w.expression.isEmpty()) && (w.expression.get(w.expression.size() - 1) instanceof HasNextTreeItem)) { if (((HasNextTreeItem) w.expression.get(w.expression.size() - 1)).collection.getNotCoerced().getThroughRegister() instanceof FilteredCheckTreeItem) { - GraphTargetItem gti = ((HasNextTreeItem) ((HasNextTreeItem) w.expression.get(w.expression.size() - 1))).collection.getNotCoerced().getThroughRegister(); + //GraphTargetItem gti = ((HasNextTreeItem) ((HasNextTreeItem) w.expression.get(w.expression.size() - 1))).collection.getNotCoerced().getThroughRegister(); if (w.commands.size() >= 3) { //((w.commands.size() == 3) || (w.commands.size() == 4)) { int pos = 0; while (w.commands.get(pos) instanceof SetLocalTreeItem) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 091a8491a..e988d280b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -41,6 +41,7 @@ import java.util.Stack; public class AVM2Instruction implements Serializable, GraphSourceItem { + public static final long serialVersionUID = 1L; public InstructionDefinition definition; public int operands[]; public long offset; @@ -95,11 +96,13 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { @Override public String toString() { - String s = definition.instructionName; + StringBuffer s = new StringBuffer(); + s.append(definition.instructionName); for (int i = 0; i < operands.length; i++) { - s += " " + operands[i]; + s.append(" "); + s.append(operands[i]); } - return s; + return s.toString(); } public List getOffsets() { @@ -135,13 +138,13 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { s.add(constants.constant_string[operands[i]]); break; case AVM2Code.DAT_INT_INDEX: - s.add(new Long(constants.constant_int[operands[i]])); + s.add(Long.valueOf(constants.constant_int[operands[i]])); break; case AVM2Code.DAT_UINT_INDEX: s.add(new Long(constants.constant_uint[operands[i]])); break; case AVM2Code.DAT_DOUBLE_INDEX: - s.add(new Double(constants.constant_double[operands[i]])); + s.add(Double.valueOf(constants.constant_double[operands[i]])); break; case AVM2Code.DAT_OFFSET: s.add(new Long(offset + operands[i] + getBytes().length)); @@ -164,54 +167,59 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { } public String getParams(ConstantPool constants, List fullyQualifiedNames) { - String s = ""; + StringBuilder s = new StringBuilder(); for (int i = 0; i < definition.operands.length; i++) { switch (definition.operands[i]) { case AVM2Code.DAT_MULTINAME_INDEX: - s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants, fullyQualifiedNames)) + "\""; + s.append(" m["); + s.append(operands[i]); + s.append("]\""); + s.append(Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants, fullyQualifiedNames))); + s.append("\""); break; case AVM2Code.DAT_STRING_INDEX: - s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\""; + s.append(" \""); + s.append(Helper.escapeString(constants.constant_string[operands[i]])); + s.append("\""); break; case AVM2Code.DAT_INT_INDEX: - s += " " + constants.constant_int[operands[i]] + ""; + s.append(" "); + s.append(constants.constant_int[operands[i]]); break; case AVM2Code.DAT_UINT_INDEX: - s += " " + constants.constant_uint[operands[i]] + ""; + s.append(" "); + s.append(constants.constant_uint[operands[i]]); break; case AVM2Code.DAT_DOUBLE_INDEX: - s += " " + constants.constant_double[operands[i]] + ""; + s.append(" "); + s.append(constants.constant_double[operands[i]]); break; case AVM2Code.DAT_OFFSET: - s += " "; - if (operands[i] > 0) { - //s += "+"; - }//operands[i] - s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + ""; + s.append(" "); + s.append("ofs"); + s.append(Helper.formatAddress(offset + operands[i] + getBytes().length)); break; case AVM2Code.DAT_CASE_BASEOFFSET: - s += " "; - if (operands[i] > 0) { - //s += "+"; - }//operands[i] - s += "ofs" + Helper.formatAddress(offset + operands[i]) + ""; + s.append(" "); + s.append("ofs"); + s.append(Helper.formatAddress(offset + operands[i])); break; case AVM2Code.OPT_CASE_OFFSETS: - s += " " + operands[i]; + s.append(" "); + s.append(operands[i]); for (int j = i + 1; j < operands.length; j++) { - s += " "; - if (operands[j] > 0) { - //s += "+"; - }//operands[j] - s += "ofs" + Helper.formatAddress(offset + operands[j]) + ""; + s.append(" "); + s.append("ofs"); + s.append(Helper.formatAddress(offset + operands[j])); } break; default: - s += " " + operands[i]; + s.append(" "); + s.append(operands[i]); } } - return s; + return s.toString(); } public String getComment() { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java index 42eb40861..10278bf25 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java @@ -32,6 +32,8 @@ import java.util.Stack; public class InstructionDefinition implements Serializable { + public static final long serialVersionUID = 1L; + protected String hilighOffset(String text, long offset) { return Highlighting.hilighOffset(text, offset); } @@ -47,25 +49,26 @@ public class InstructionDefinition implements Serializable { @Override public String toString() { - String s = instructionName; + StringBuilder s = new StringBuilder(); + s.append(instructionName); for (int i = 0; i < operands.length; i++) { if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) { - s += " U30"; + s.append(" U30"); } if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) { - s += " U8"; + s.append(" U8"); } if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) { - s += " BYTE"; + s.append(" BYTE"); } if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) { - s += " S24"; + s.append(" S24"); } if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) { - s += " U30 S24,[S24]..."; + s.append(" U30 S24,[S24]..."); } } - return s; + return s.toString(); } public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/TagInstruction.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/TagInstruction.java index d6942ac6a..0f52e83a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/TagInstruction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/TagInstruction.java @@ -22,6 +22,8 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions; */ public class TagInstruction extends InstructionDefinition { + public static final long serialVersionUID = 1L; + public TagInstruction(String tagName) { super(-1, tagName, new int[0]); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java index 3f1c3258b..68f95bd18 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java @@ -39,10 +39,10 @@ public class AddIns extends InstructionDefinition { Object o1 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue()); + Long ret = Long.valueOf(((Long) o1).longValue() + ((Long) o2).longValue()); lda.operandStack.push(ret); } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue()); + Double ret = Double.valueOf(((Double) o1).doubleValue() + ((Double) o2).doubleValue()); lda.operandStack.push(ret); } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java index 702d0ab10..0630850f1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java @@ -39,10 +39,10 @@ public class DivideIns extends InstructionDefinition { Object o2 = lda.operandStack.pop(); Object o1 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue()); + Long ret = Long.valueOf(((Long) o1).longValue() / ((Long) o2).longValue()); lda.operandStack.push(ret); } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue()); + Double ret = Double.valueOf(((Double) o1).doubleValue() / ((Double) o2).doubleValue()); lda.operandStack.push(ret); } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java index 7eba2c645..23a3ab9fa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java @@ -40,7 +40,7 @@ public class ModuloIns extends InstructionDefinition { Object o2 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = new Long(((Long) o2).longValue() % ((Long) o1).longValue()); + Long ret = Long.valueOf(((Long) o2).longValue() % ((Long) o1).longValue()); lda.operandStack.push(ret); } else { throw new RuntimeException("Cannot modulo"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java index 55d1dd0f2..d17af1a3a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java @@ -39,10 +39,10 @@ public class MultiplyIns extends InstructionDefinition { Object o1 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = new Long(((Long) o1).longValue() * ((Long) o2).longValue()); + Long ret = Long.valueOf(((Long) o1).longValue() * ((Long) o2).longValue()); lda.operandStack.push(ret); } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = new Double(((Double) o1).doubleValue() * ((Double) o2).doubleValue()); + Double ret = Double.valueOf(((Double) o1).doubleValue() * ((Double) o2).doubleValue()); lda.operandStack.push(ret); } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { Double ret = new Double(((Long) o1).longValue() * ((Double) o2).doubleValue()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java index 384345bba..f08defc61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java @@ -37,7 +37,7 @@ public class BitNotIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { Long value = (Long) lda.operandStack.pop(); - Long ret = new Long(-value.longValue()); + Long ret = Long.valueOf(-value.longValue()); lda.operandStack.push(ret); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java similarity index 95% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java rename to trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java index 63e74c19f..81adb428f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion; +package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/GreaterEqualsIns.java similarity index 94% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java rename to trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/GreaterEqualsIns.java index 4c9c954de..27776098e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/GreaterEqualsIns.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion; +package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/GreaterThanIns.java similarity index 94% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java rename to trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/GreaterThanIns.java index 298a05134..7b6cba9d0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/GreaterThanIns.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion; +package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/LessEqualsIns.java similarity index 94% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java rename to trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/LessEqualsIns.java index cef94a5fc..0cc18e335 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/LessEqualsIns.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion; +package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/LessThanIns.java similarity index 94% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java rename to trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/LessThanIns.java index fe0d48714..3e8e38de1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/LessThanIns.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion; +package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/StrictEqualsIns.java similarity index 94% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java rename to trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/StrictEqualsIns.java index 635fb62d3..030c8a6a6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/StrictEqualsIns.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion; +package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java index 87961d61c..5c556e779 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java @@ -35,8 +35,8 @@ public class LookupSwitchIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - int defaultOffset = ins.operands[0]; - int caseCount = ins.operands[1]; + //int defaultOffset = ins.operands[0]; + //int caseCount = ins.operands[1]; //stack.push("switch(...)"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java index 317da109a..0378988ac 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java @@ -61,7 +61,7 @@ public class DecLocalIIns extends InstructionDefinition { int regIndex = ins.operands[0]; output.add(new DecLocalTreeItem(ins, regIndex)); if (localRegs.containsKey(regIndex)) { - localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))))); + localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1))))); } else { //localRegs.put(regIndex, new SubtractTreeItem(ins, new IntegerValueTreeItem(ins, new Long(0)), new IntegerValueTreeItem(ins, new Long(1)))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java index 5626389fc..5a7dbbc65 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java @@ -61,7 +61,7 @@ public class DecLocalIns extends InstructionDefinition { int regIndex = ins.operands[0]; output.add(new DecLocalTreeItem(ins, regIndex)); if (localRegs.containsKey(regIndex)) { - localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))))); + localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1))))); } else { //localRegs.put(regIndex, new SubtractTreeItem(ins, new IntegerValueTreeItem(ins, new Long(0)), new IntegerValueTreeItem(ins, new Long(1)))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java index ca08953d9..68300db3f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java @@ -41,7 +41,7 @@ public class IncLocalIIns extends InstructionDefinition { int regIndex = ins.operands[0]; output.add(new IncLocalTreeItem(ins, regIndex)); if (localRegs.containsKey(regIndex)) { - localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))))); + localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1))))); } else { //localRegs.put(regIndex, new AddTreeItem(ins, null, new IntegerValueTreeItem(ins, new Long(1)))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java index 7d0988392..8db74bb77 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java @@ -41,7 +41,7 @@ public class IncLocalIns extends InstructionDefinition { int regIndex = ins.operands[0]; output.add(new IncLocalTreeItem(ins, regIndex)); if (localRegs.containsKey(regIndex)) { - localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))))); + localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1))))); } else { //localRegs.put(regIndex, new AddTreeItem(ins, null, new IntegerValueTreeItem(ins, new Long(1)))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java index 7ae29ed5f..94fede47d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java @@ -39,11 +39,11 @@ public class DeletePropertyIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - Object obj = lda.operandStack.pop(); - //push true if removed + /*int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + Object obj = lda.operandStack.pop(); + //push true if removed*/ throw new RuntimeException("Cannot remove property"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java index 5efd97e93..4542e5535 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java @@ -38,7 +38,7 @@ public class FindPropertyIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //int multiIndex = (int) ((Long) arguments.get(0)).longValue(); //if is runtime //pop(name), pop(ns) throw new RuntimeException("Cannot find property"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java index b3e15a0e5..9858f2527 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java @@ -38,7 +38,7 @@ public class FindPropertyStrictIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //int multiIndex = (int) ((Long) arguments.get(0)).longValue(); //if is runtime //pop(name), pop(ns) throw new RuntimeException("Cannot find property"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java index 9e43c0cca..4e766e634 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java @@ -38,10 +38,10 @@ public class GetDescendantsIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); - //if is runtime - //pop(name), pop(ns) - Object obj = lda.operandStack.pop(); + /*int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //if is runtime + //pop(name), pop(ns) + Object obj = lda.operandStack.pop();*/ throw new RuntimeException("getdescentants not working"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java index d9317413e..be5413f0b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java @@ -42,7 +42,7 @@ public class PushByteIns extends InstructionDefinition implements PushIntegerTyp @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); + stack.push(new IntegerValueTreeItem(ins, Long.valueOf(ins.operands[0]))); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java index 84ad8ee13..c6bc249ec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java @@ -42,7 +42,7 @@ public class PushShortIns extends InstructionDefinition implements PushIntegerTy @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); + stack.push(new IntegerValueTreeItem(ins, Long.valueOf(ins.operands[0]))); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java index f90543e33..0ec2709ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java @@ -38,7 +38,7 @@ public class AsTypeIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Long typeIndex = (Long) arguments.get(0); + //Long typeIndex = (Long) arguments.get(0); Object obj = lda.operandStack.pop(); //if multiname[typeIndex]==obj lda.operandStack.push(obj); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java index fb5d94d81..fe8649d1a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java @@ -36,7 +36,7 @@ public class AsTypeLateIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object objClass = lda.operandStack.pop(); + //Object objClass = lda.operandStack.pop(); Object obj = lda.operandStack.pop(); //if obj.class=objClass lda.operandStack.push(obj); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java index 101f6b441..3afebd85f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java @@ -37,7 +37,7 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + //int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); //push and pop coerced value to specified type } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java index d9d91de48..4ebb1291e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java @@ -55,7 +55,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver } else { ret = 1; //must call toPrimitive } - lda.operandStack.push(new Double(ret)); + lda.operandStack.push(Double.valueOf(ret)); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java index ec2b4cd37..fe28f9f06 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java @@ -53,7 +53,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver } else { ret = 1; //must call toPrimitive } - lda.operandStack.push(new Long(ret)); + lda.operandStack.push(Long.valueOf(ret)); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java index 46277c98e..6c4a9ea86 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java @@ -27,6 +27,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public class ASM3Parser { @@ -124,7 +125,7 @@ public class ASM3Parser { continue; } if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) { - if (((String) symb.value).toLowerCase().equals("exception")) { + if (((String) symb.value).toLowerCase(Locale.ENGLISH).equals("exception")) { ParsedSymbol exIndex = lexer.yylex(); if (exIndex.type != ParsedSymbol.TYPE_INTEGER) { throw new ParseException("Index expected", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java index aed998e2f..2d0c884b6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java @@ -36,22 +36,23 @@ public class ApplyTypeTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret = object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); + StringBuilder ret = new StringBuilder(); + ret.append(object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames))); if (!params.isEmpty()) { - ret += hilight(".<"); + ret.append(hilight(".<")); for (int i = 0; i < params.size(); i++) { if (i > 0) { - ret += hilight(","); + ret.append(hilight(",")); } GraphTargetItem p = params.get(i); if (p instanceof NullTreeItem) { - ret += "*"; + ret.append("*"); } else { - ret += p.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); + ret.append(p.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames))); } } - ret += hilight(">"); + ret.append(">"); } - return ret; + return ret.toString(); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 4cd5b3ff9..b5c6c8a55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.abc.types.traits; -import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java index 26ce951e0..ee189d0dc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.abc.types.traits; -import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.graph.GraphTargetItem; diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index 97ce729f2..c0dfacda3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.graph; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.helpers.Highlighting; -import java.awt.GradientPaint; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java index 034a418b4..bccc0cbce 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java @@ -20,7 +20,6 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; -import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.SwingConstants; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java index dbdd00c6c..f6e1279ad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java @@ -7,7 +7,6 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JComboBox; -import javax.swing.JDialog; import javax.swing.JLabel; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java index a1a988d2e..b2e9f222d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java @@ -19,17 +19,11 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.graph.Graph; import com.jpexs.decompiler.flash.graph.GraphPart; import java.awt.*; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.event.WindowAdapter; import java.awt.geom.AffineTransform; import java.awt.geom.Line2D; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GraphTreeFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/GraphTreeFrame.java index 350ad2394..c6ca0cd23 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GraphTreeFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GraphTreeFrame.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph; import com.jpexs.decompiler.flash.graph.GraphPart; import java.awt.BorderLayout; import java.awt.Container; -import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index fa496deb7..ee573fb97 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.PercentListener; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.Version; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.gui.jna.platform.win32.Advapi32Util; import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32; import com.jpexs.decompiler.flash.gui.jna.platform.win32.SHELLEXECUTEINFO; @@ -59,7 +60,6 @@ import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.SwingWorker; import javax.swing.filechooser.FileFilter; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * Main executable class @@ -984,7 +984,7 @@ public class Main { } public static boolean isAssociated() { - if(!Platform.isWindows()){ + if (!Platform.isWindows()) { return false; } if (!Advapi32Util.registryKeyExists(WinReg.HKEY_CLASSES_ROOT, ".swf")) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 71cb49c89..43efcd5cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -25,15 +25,15 @@ import com.jpexs.decompiler.flash.TagNode; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.RenameType; import com.jpexs.decompiler.flash.abc.ScriptPack; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; +import static com.jpexs.decompiler.flash.gui.Main.isAssociated; import com.jpexs.decompiler.flash.gui.abc.ABCPanel; import com.jpexs.decompiler.flash.gui.abc.ClassesListTreeModel; import com.jpexs.decompiler.flash.gui.abc.DeobfuscationDialog; import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane; import com.jpexs.decompiler.flash.gui.abc.TreeElement; -import com.jpexs.decompiler.flash.abc.types.traits.Trait; -import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; import com.jpexs.decompiler.flash.gui.action.ActionPanel; -import static com.jpexs.decompiler.flash.gui.Main.isAssociated; import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.tags.ABCContainerTag; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java index b6bc3a380..b8d12ddd4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java @@ -23,7 +23,6 @@ import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.JLabel; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java index cf31f6e90..13d205d53 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java @@ -25,7 +25,6 @@ import java.awt.event.ActionListener; import java.util.List; import javax.swing.BoxLayout; import javax.swing.JButton; -import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java index 6c8e37981..3b7fb853b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.SWF; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import java.awt.BorderLayout; import java.awt.image.BufferedImage; import java.util.ArrayList; @@ -27,7 +28,6 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.BevelBorder; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java index ba4a4fa68..bb68dae5d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java @@ -22,13 +22,10 @@ import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.InputStream; import java.util.Locale; -import java.util.Properties; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; -import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 5d20583f5..f46f0eaf6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -16,21 +16,22 @@ */ package com.jpexs.decompiler.flash.gui.abc; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.UIntTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.DoubleTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.IntTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceSetTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.MultinameTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.DecimalTableModel; -import com.jpexs.decompiler.flash.gui.abc.tablemodels.StringTableModel; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ClassPath; import com.jpexs.decompiler.flash.abc.ScriptPack; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.gui.TagTreeModel; import com.jpexs.decompiler.flash.gui.View; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.DecimalTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.DoubleTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.IntTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.MultinameTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceSetTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.StringTableModel; +import com.jpexs.decompiler.flash.gui.abc.tablemodels.UIntTableModel; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import java.awt.BorderLayout; import java.awt.Component; @@ -43,7 +44,6 @@ import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -55,7 +55,6 @@ import javax.swing.table.*; import javax.swing.tree.TreePath; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.actions.DocumentSearchData; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; public class ABCPanel extends JPanel implements ItemListener, ActionListener { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java index ddbe5d850..e8e49d329 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -20,12 +20,11 @@ import com.jpexs.decompiler.flash.abc.ClassPath; import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; -import com.jpexs.decompiler.flash.gui.MainFrame; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import java.util.HashMap; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; class ClassIndexVisitor implements TreeVisitor { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 0b8002930..7a1f635a0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.types.ScriptInfo; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.helpers.Cache; import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.ABCContainerTag; @@ -33,7 +34,6 @@ import java.util.Timer; import java.util.TimerTask; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretListener { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java index fdea644a3..357211a36 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java @@ -26,7 +26,6 @@ import java.awt.event.ActionListener; import java.util.Hashtable; import javax.swing.JButton; import javax.swing.JCheckBox; -import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JSlider; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java index b3d17c561..57d538bc2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.gui.View; import com.jpexs.decompiler.flash.helpers.Helper; import java.awt.BorderLayout; @@ -29,7 +30,6 @@ import java.util.ArrayList; import java.util.HashMap; import javax.swing.*; import javax.swing.border.BevelBorder; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java index 48c44896a..531c3cd6c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.avm2.parser.MissingSymbolHandler; -import javax.swing.JOptionPane; import static com.jpexs.decompiler.flash.gui.AppStrings.translate; +import javax.swing.JOptionPane; public class DialogMissingSymbolHandler implements MissingSymbolHandler { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodBodyParamsPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodBodyParamsPanel.java index 3488ba993..f60d37c62 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodBodyParamsPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodBodyParamsPanel.java @@ -17,13 +17,13 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.types.MethodBody; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import java.awt.Color; import java.awt.Dimension; import java.text.NumberFormat; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java index 694370810..bd252b1da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.gui.View; import java.awt.BorderLayout; @@ -30,7 +31,6 @@ import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JToggleButton; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodInfoPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodInfoPanel.java index dfe26e9c2..48ecd701a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodInfoPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodInfoPanel.java @@ -21,13 +21,13 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParser; import com.jpexs.decompiler.flash.abc.methodinfo_parser.ParseException; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.helpers.Helper; import java.awt.Dimension; import java.awt.Font; import java.util.ArrayList; import javax.swing.*; import jsyntaxpane.syntaxkits.Flasm3MethodInfoSyntaxKit; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java index 232681fd3..69b7ad542 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java @@ -16,9 +16,9 @@ */ package com.jpexs.decompiler.flash.gui.abc; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java index 191bcfc11..b51dc6d0e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java @@ -21,12 +21,12 @@ import com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParser; import com.jpexs.decompiler.flash.abc.methodinfo_parser.ParseException; import com.jpexs.decompiler.flash.abc.types.ValueKind; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.helpers.Helper; import java.awt.BorderLayout; import java.util.ArrayList; import javax.swing.*; import jsyntaxpane.syntaxkits.Flasm3MethodInfoSyntaxKit; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java index bfd8ffeb2..23ded9c47 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java @@ -4,10 +4,10 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import java.util.ArrayList; import java.util.List; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 04c1455cc..babf8b457 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.TagNode; -import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionGraph; import com.jpexs.decompiler.flash.action.parser.ParseException; @@ -29,10 +28,12 @@ import com.jpexs.decompiler.flash.action.parser.script.ActionScriptParser; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf4.ConstantIndex; import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import static com.jpexs.decompiler.flash.gui.AppStrings.translate; import com.jpexs.decompiler.flash.gui.GraphFrame; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.gui.TagTreeModel; import com.jpexs.decompiler.flash.gui.View; +import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane; import com.jpexs.decompiler.flash.helpers.Cache; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; @@ -51,9 +52,6 @@ import java.io.StringReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.TimerTask; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Pattern; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -71,7 +69,6 @@ import javax.swing.event.CaretListener; import javax.swing.tree.TreePath; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.actions.DocumentSearchData; -import static com.jpexs.decompiler.flash.gui.AppStrings.translate; public class ActionPanel extends JPanel implements ActionListener { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index fa704b09b..6c1cac4bb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; -import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ALPHABITMAPDATA.java b/trunk/src/com/jpexs/decompiler/flash/types/ALPHABITMAPDATA.java index d1f391bdc..0808d14d4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ALPHABITMAPDATA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ALPHABITMAPDATA.java @@ -23,5 +23,5 @@ package com.jpexs.decompiler.flash.types; */ public class ALPHABITMAPDATA { - public ARGB bitmapPixelData[]; + public ARGB bitmapPixelData[] = new ARGB[0]; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BITMAPDATA.java b/trunk/src/com/jpexs/decompiler/flash/types/BITMAPDATA.java index 9d44f0f89..e641d01d1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BITMAPDATA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BITMAPDATA.java @@ -23,6 +23,6 @@ package com.jpexs.decompiler.flash.types; */ public class BITMAPDATA { - public PIX15 bitmapPixelDataPix15[]; - public PIX24 bitmapPixelDataPix24[]; + public PIX15 bitmapPixelDataPix15[] = new PIX15[0]; + public PIX24 bitmapPixelDataPix24[] = new PIX24[0]; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java index 110a83449..2e7405c71 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import java.util.ArrayList; import java.util.List; /** @@ -32,5 +33,5 @@ public class CLIPACTIONS { /** * Individual event handlers */ - public List clipActionRecords; + public List clipActionRecords = new ArrayList<>(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java b/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java index a01eb7fd4..d4c2d4e4c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java @@ -24,6 +24,6 @@ public class FOCALGRADIENT { public int spreadMode; public int interPolationMode; - public GRADRECORD gradientRecords[]; + public GRADRECORD gradientRecords[] = new GRADRECORD[0]; public float focalPoint; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLEARRAY.java b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLEARRAY.java index c872181b7..4a805035a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLEARRAY.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLEARRAY.java @@ -22,6 +22,6 @@ package com.jpexs.decompiler.flash.types; */ public class LINESTYLEARRAY { - public LINESTYLE lineStyles[]; - public LINESTYLE2 lineStyles2[]; + public LINESTYLE lineStyles[] = new LINESTYLE[0]; + public LINESTYLE2 lineStyles2[] = new LINESTYLE2[0]; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java index 78deb1fba..3f3910960 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java @@ -31,5 +31,5 @@ public class SOUNDINFO { public long inPoint; public long outPoint; public int loopCount; - public SOUNDENVELOPE envelopeRecords[]; + public SOUNDENVELOPE envelopeRecords[] = new SOUNDENVELOPE[0]; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java index 373e2279e..6c501cccb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java @@ -23,7 +23,7 @@ package com.jpexs.decompiler.flash.types; */ public class ZONERECORD { - public ZONEDATA zonedata[]; + public ZONEDATA zonedata[] = new ZONEDATA[0]; public boolean zoneMaskX; public boolean zoneMaskY; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java index 4e036ba42..090a9f147 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java @@ -45,7 +45,7 @@ public class CONVOLUTIONFILTER extends FILTER { /** * Matrix values */ - public float matrix[][]; + public float matrix[][] = new float[0][0]; /** * Default color for pixels outside the image */ diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java index ac3586d4c..5c849efb8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java @@ -32,11 +32,11 @@ public class GRADIENTBEVELFILTER extends FILTER { /** * Gradient colors */ - public RGBA gradientColors[]; + public RGBA gradientColors[] = new RGBA[0]; /** * Gradient ratios */ - public int gradientRatio[]; + public int gradientRatio[] = new int[0]; /** * Horizontal blur amount */ diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java index de8ff3384..6ab5635de 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java @@ -32,7 +32,7 @@ public class GRADIENTGLOWFILTER extends FILTER { /** * Gradient colors */ - public RGBA gradientColors[]; + public RGBA gradientColors[] = new RGBA[0]; /** * Gradient ratios */