diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index c0e35e6af..6190744c1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -409,14 +409,14 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { public static final int LIBRARY_AIR = 0; public static final int LIBRARY_FLASH = 1; - + public static AbcIndexing getPlayerGlobalAbcIndex() { return playerGlobalAbcIndex; } public static AbcIndexing getAirGlobalAbcIndex() { return airGlobalAbcIndex; - } + } public AbcIndexing getAbcIndex() { if (abcIndex != null) { @@ -428,21 +428,20 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { if (conf.getCustomData(CustomConfigurationKeys.KEY_LIBRARY, "" + LIBRARY_FLASH).equals("" + LIBRARY_AIR)) { air = true; } - } + } try { SWF.initPlayer(); } catch (IOException | InterruptedException ex) { Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, null, ex); } abcIndex = new AbcIndexing(air ? SWF.getAirGlobalAbcIndex() : SWF.getPlayerGlobalAbcIndex()); - for (Tag tag:tags) { - if (tag instanceof ABCContainerTag) { - abcIndex.addAbc(((ABCContainerTag)tag).getABC()); + for (Tag tag : tags) { + if (tag instanceof ABCContainerTag) { + abcIndex.addAbc(((ABCContainerTag) tag).getABC()); } } return abcIndex; } - public static void initPlayer() throws IOException, InterruptedException { if (playerGlobalAbcIndex == null) { @@ -1609,6 +1608,9 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { if (fileTitle != null) { return fileTitle; } + if (file == null) { + return "_"; + } return new File(file).getName(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java index 582dc99a1..63d79c2e8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java @@ -118,10 +118,10 @@ public abstract class AVM2Item extends GraphTargetItem { data.namespaceIndex = namespaceIndex;*/ if (((FullMultinameAVM2Item) propertyName).name != null) { - /*if (((FullMultinameAVM2Item) propertyName).namespace != null) { - writer.hilightSpecial(".", HighlightSpecialType.PROPERTY_PARENT_TYPE, 0, data); - }*/ - writer.append("."); + if (((FullMultinameAVM2Item) propertyName).namespace != null) { + writer.append("."); + //writer.hilightSpecial(".", HighlightSpecialType.PROPERTY_PARENT_TYPE, 0, data); + } return propertyName.toString(writer, localData); } else { //writer.hilightSpecial(".", HighlightSpecialType.PROPERTY_PARENT_TYPE, 0, data); diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java index e6a8fdc2a..23f1466e2 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java @@ -76,7 +76,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile + "var extraLine:Boolean = false;\r\n" + "var r:int = 7;\r\n" + "var t:int = 0;\r\n" - + "t = int(this.getInt());\r\n" + + "t = this.getInt();\r\n" + "if(t + 1 < g.length)\r\n" + "{\r\n" + "t++;\r\n" @@ -218,7 +218,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile public void testConvert() { decompileMethod("classic_air", "testConvert", "var s:String = \"a\";\r\n" + "var i:int = int(s);\r\n" - + "var j:int = int(n);\r\n" + + "var j:int = n;\r\n" + "s = String(j);\r\n" + "s = ns;\r\n", false); @@ -280,7 +280,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile @Test public void testDeobfuscation() { - decompileMethod("classic_air", "testDeobfuscation", "var r:int = int(Math.random());\r\n" + decompileMethod("classic_air", "testDeobfuscation", "var r:int = Math.random();\r\n" + "if(r > 5)\r\n" + "{\r\n" + "trace(\"A\");\r\n" @@ -909,7 +909,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile @Test public void testIfFinally() { - decompileMethod("classic_air", "testIfFinally", "var a:int = int(Math.random());\r\n" + decompileMethod("classic_air", "testIfFinally", "var a:int = Math.random();\r\n" + "if(a == 5)\r\n" + "{\r\n" + "try\r\n" @@ -979,7 +979,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile @Test public void testIgnoreAndOr() { - decompileMethod("classic_air", "testIgnoreAndOr", "var k:int = int(Math.random());\r\n" + decompileMethod("classic_air", "testIgnoreAndOr", "var k:int = Math.random();\r\n" + "if(k > 5)\r\n" + "{\r\n" + "trace(\"A\");\r\n" @@ -1244,7 +1244,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile + "var a:* = ns::unnamespacedFunc();\r\n" + "var b:* = ns::[name];\r\n" + "trace(b.c);\r\n" - + "var c:* = myInternal::neco;\r\n", + + "var c:int = myInternal::neco;\r\n", false); } @@ -1472,7 +1472,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile @Test public void testTryIf() { - decompileMethod("classic_air", "testTryIf", "var a:int = int(Math.random());\r\n" + decompileMethod("classic_air", "testTryIf", "var a:int = Math.random();\r\n" + "try\r\n" + "{\r\n" + "if(a > 5 && a < 50)\r\n" diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java index d3602caac..9f5c00d2f 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java @@ -76,7 +76,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes + "var extraLine:Boolean = false;\r\n" + "var r:int = 7;\r\n" + "var t:int = 0;\r\n" - + "t = int(this.getInt());\r\n" + + "t = this.getInt();\r\n" + "if(t + 1 < g.length)\r\n" + "{\r\n" + "t++;\r\n" @@ -217,7 +217,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes public void testConvert() { decompileMethod("classic", "testConvert", "var s:String = \"a\";\r\n" + "var i:int = int(s);\r\n" - + "var j:int = int(this.n);\r\n" + + "var j:int = this.n;\r\n" + "s = String(j);\r\n" + "s = this.ns;\r\n", false); @@ -279,7 +279,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes @Test public void testDeobfuscation() { - decompileMethod("classic", "testDeobfuscation", "var r:int = int(Math.random());\r\n" + decompileMethod("classic", "testDeobfuscation", "var r:int = Math.random();\r\n" + "if(r > 5)\r\n" + "{\r\n" + "trace(\"A\");\r\n" @@ -974,7 +974,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes @Test public void testIgnoreAndOr() { - decompileMethod("classic", "testIgnoreAndOr", "var k:int = int(Math.random());\r\n" + decompileMethod("classic", "testIgnoreAndOr", "var k:int = Math.random();\r\n" + "if(k > 5)\r\n" + "{\r\n" + "trace(\"A\");\r\n" diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileDecompileTest.java index 3839c4c2d..9c30f4d83 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileDecompileTest.java @@ -79,7 +79,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi @Test(dataProvider = "swfNamesProvider") public void testTryCatchInIf(String swfUsed) { - decompileMethod(swfUsed, "testTryCatchInIf", "var a:int = int(Math.random());\r\n" + decompileMethod(swfUsed, "testTryCatchInIf", "var a:int = Math.random();\r\n" + "if(a > 10)\r\n" + "{\r\n" + "try\r\n" @@ -96,7 +96,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi @Test(dataProvider = "swfNamesProvider") public void testTryCatchInIf2(String swfUsed) { - decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int = int(Math.random());\r\n" + decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int = Math.random();\r\n" + "if(a > 10)\r\n" + "{\r\n" + "try\r\n" @@ -744,7 +744,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi @Test(dataProvider = "swfNamesProvider") public void testTryFinallyReturnNested(String swfUsed) { - decompileMethod(swfUsed, "testTryFinallyReturnNested", "var a:int = int(Math.random() * 5);\r\n" + decompileMethod(swfUsed, "testTryFinallyReturnNested", "var a:int = Math.random() * 5;\r\n" + "try\r\n" + "{\r\n" + "trace(\"before try2\");\r\n" @@ -776,7 +776,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi @Test(dataProvider = "swfNamesProvider") public void testTryFinallyReturnNested2(String swfUsed) { - decompileMethod(swfUsed, "testTryFinallyReturnNested2", "var a:int = int(Math.random() * 5);\r\n" + decompileMethod(swfUsed, "testTryFinallyReturnNested2", "var a:int = Math.random() * 5;\r\n" + "try\r\n" + "{\r\n" + "try\r\n" @@ -828,7 +828,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi @Test(dataProvider = "swfNamesProvider") public void testTryFinallyReturnVoid(String swfUsed) { - decompileMethod(swfUsed, "testTryFinallyReturnVoid", "var a:int = int(Math.random() * 5);\r\n" + decompileMethod(swfUsed, "testTryFinallyReturnVoid", "var a:int = Math.random() * 5;\r\n" + "trace(\"before try\");\r\n" + "try\r\n" + "{\r\n" diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileSwfToolsDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileSwfToolsDecompileTest.java index 04b345181..8da71e1d2 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileSwfToolsDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3CrossCompileSwfToolsDecompileTest.java @@ -70,7 +70,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript @Test public void testTryCatchInIf() { - decompileMethod("swftools", "testTryCatchInIf", "var _loc1_:int = int(Math.random());\r\n" + decompileMethod("swftools", "testTryCatchInIf", "var _loc1_:int = Math.random();\r\n" + "if(_loc1_ > 10)\r\n" + "{\r\n" + "try\r\n" @@ -87,7 +87,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript @Test public void testTryCatchInIf2() { - decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:* = int(Math.random());\r\n" + decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:int = Math.random();\r\n" + "if(_loc1_ > 10)\r\n" + "{\r\n" + "try\r\n" @@ -762,7 +762,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript @Test public void testTryFinallyReturnNested() { - decompileMethod("swftools", "testTryFinallyReturnNested", "var _loc1_:* = int(Math.random() * 5);\r\n" + decompileMethod("swftools", "testTryFinallyReturnNested", "var _loc1_:int = Math.random() * 5;\r\n" + "try\r\n" + "{\r\n" + "trace(\"before try2\");\r\n" @@ -803,7 +803,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript @Test public void testTryFinallyReturnNested2() { - decompileMethod("swftools", "testTryFinallyReturnNested2", "var _loc1_:* = int(Math.random() * 5);\r\n" + decompileMethod("swftools", "testTryFinallyReturnNested2", "var _loc1_:int = Math.random() * 5;\r\n" + "try\r\n" + "{\r\n" + "try\r\n" @@ -870,7 +870,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript @Test public void testTryFinallyReturnVoid() { - decompileMethod("swftools", "testTryFinallyReturnVoid", "var _loc1_:* = int(Math.random() * 5);\r\n" + decompileMethod("swftools", "testTryFinallyReturnVoid", "var _loc1_:int = Math.random() * 5;\r\n" + "trace(\"before try\");\r\n" + "try\r\n" + "{\r\n" diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.air.swf b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.air.swf index cdf76a132..1c38ff305 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.air.swf and b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.air.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex.swf b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex.swf index faca62b3b..f0f0cf96f 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex.swf and b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex_apache.swf b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex_apache.swf index c0cc273f0..b1c82e0c4 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex_apache.swf and b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.flex_apache.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.swftools.swf b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.swftools.swf index 716519d73..48a7fc4ea 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.swftools.swf and b/libsrc/ffdec_lib/testdata/as3_cross_compile/bin/as3_cross_compile.swftools.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf2.as b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf2.as index 29adb20ae..e15618c4d 100644 --- a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf2.as +++ b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf2.as @@ -10,7 +10,7 @@ package tests public function run():void { - var a:int = int(Math.random()); + var a:int = Math.random(); if (a > 10) { diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested.as b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested.as index eb35a6f4d..baf378ca0 100644 --- a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested.as +++ b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested.as @@ -9,7 +9,7 @@ package tests public function run() : String { - var a:int = int(Math.random() * 5); + var a:int = Math.random() * 5; try { trace("before try2"); diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested2.as b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested2.as index 24805ba00..27c44ea9c 100644 --- a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested2.as +++ b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnNested2.as @@ -10,7 +10,7 @@ package tests public function run() : String { - var a:int = int(Math.random() * 5); + var a:int = Math.random() * 5; try { try diff --git a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnVoid.as b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnVoid.as index 1fc103c61..b5f57ccb9 100644 --- a/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnVoid.as +++ b/libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryFinallyReturnVoid.as @@ -9,7 +9,7 @@ package tests public function run() : void { - var a:int = int(Math.random() * 5); + var a:int = Math.random() * 5; trace("before try"); try {