diff --git a/src/com/jpexs/decompiler/flash/SWFInputStream.java b/src/com/jpexs/decompiler/flash/SWFInputStream.java index 71d3b5ec2..f97bca26f 100644 --- a/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -1048,7 +1048,7 @@ public class SWFInputStream implements AutoCloseable { } else { switch (tag.getId()) { case FileAttributesTag.ID: //FileAttributes - faPos = tagCnt-1; //should be 0, as it is first tag, but anyway + faPos = tagCnt - 1; //should be 0, as it is first tag, but anyway if (tag instanceof TagStub) { tag = resolveTag((TagStub) tag, level, parallel, skipUnusualTags); } @@ -1117,8 +1117,8 @@ public class SWFInputStream implements AutoCloseable { executor.shutdown(); } //Workaround to not reading fileattributes twice. TODO:Handle this better - if(parallel && fileAttributes!=null){ - tags.add(faPos,fileAttributes); + if (parallel && fileAttributes != null) { + tags.add(faPos, fileAttributes); } return tags; } @@ -1460,7 +1460,7 @@ public class SWFInputStream implements AutoCloseable { DumpInfo di = dumpInfo; try { ret = resolveTag(tagStub, level, parallel, skipUnusualTags); - } catch (EndOfStreamException ex) { + } catch (Exception ex) { tagDataStream.endDumpLevelUntil(di); logger.log(Level.SEVERE, "Problem in " + timelined.toString(), ex); } diff --git a/src/com/jpexs/decompiler/flash/action/Deobfuscation.java b/src/com/jpexs/decompiler/flash/action/Deobfuscation.java index 9e93af5ce..e45a564c5 100644 --- a/src/com/jpexs/decompiler/flash/action/Deobfuscation.java +++ b/src/com/jpexs/decompiler/flash/action/Deobfuscation.java @@ -175,7 +175,7 @@ public class Deobfuscation { return null; } - public static boolean isValidName(String s){ + public static boolean isValidName(String s) { boolean isValid = true; if (Action.isReservedWord(s)) { isValid = false; @@ -198,7 +198,7 @@ public class Deobfuscation { } return isValid; } - + public String deobfuscateName(String s, boolean firstUppercase, String usageType, HashMap namesMap, RenameType renameType, Map selected) { boolean isValid = true; if (usageType == null) { diff --git a/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index 06b865d2e..8fc0bcf09 100644 --- a/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -83,18 +83,18 @@ public class FunctionActionItem extends ActionItem { if (calculatedFunctionName != null) { writer.append(" "); String fname = calculatedFunctionName.toStringNoQuotes(localData); - if(!Deobfuscation.isValidName(fname)){ + if (!Deobfuscation.isValidName(fname)) { calculatedFunctionName.appendTo(writer, localData); //Use quotes - }else{ + } else { calculatedFunctionName.appendToNoQuotes(writer, localData); } } else if (!functionName.isEmpty()) { writer.append(" "); - if(!Deobfuscation.isValidName(functionName)){ + if (!Deobfuscation.isValidName(functionName)) { writer.append("\""); writer.append(Helper.escapeString(functionName)); writer.append("\""); - }else{ + } else { writer.append(functionName); } } @@ -109,7 +109,7 @@ public class FunctionActionItem extends ActionItem { if (pname == null || pname.isEmpty()) { pname = new RegisterNumber(regStart + p).translate(); } - if(!Deobfuscation.isValidName(pname)){ + if (!Deobfuscation.isValidName(pname)) { writer.append("\""); writer.append(Helper.escapeString(pname)); writer.append("\""); diff --git a/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java b/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java index b6ee10f05..121eed3e3 100644 --- a/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java +++ b/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java @@ -50,10 +50,10 @@ public class GetMemberActionItem extends ActionItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { object.toString(writer, localData); - if((!(memberName instanceof DirectValueActionItem)) || (!((DirectValueActionItem)memberName).isString()) ||(!Deobfuscation.isValidName(((DirectValueActionItem)memberName).toStringNoQuotes(localData)))){ + if ((!(memberName instanceof DirectValueActionItem)) || (!((DirectValueActionItem) memberName).isString()) || (!Deobfuscation.isValidName(((DirectValueActionItem) memberName).toStringNoQuotes(localData)))) { writer.append("["); memberName.toString(writer, localData); - return writer.append("]"); + return writer.append("]"); } writer.append("."); return stripQuotes(memberName, localData, writer); diff --git a/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java b/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java index 5b43f70fd..bf4ee59d2 100644 --- a/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java +++ b/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java @@ -53,13 +53,13 @@ public class GetVariableActionItem extends ActionItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { - if((!(name instanceof DirectValueActionItem)) || (!((DirectValueActionItem)name).isString()) ||(!Deobfuscation.isValidName(((DirectValueActionItem)name).toStringNoQuotes(localData)))){ - if((!((DirectValueActionItem)name).toStringNoQuotes(localData).equals("this"))&&(!((DirectValueActionItem)name).toStringNoQuotes(localData).equals("super"))){ + if ((!(name instanceof DirectValueActionItem)) || (!((DirectValueActionItem) name).isString()) || (!Deobfuscation.isValidName(((DirectValueActionItem) name).toStringNoQuotes(localData)))) { + if ((!((DirectValueActionItem) name).toStringNoQuotes(localData).equals("this")) && (!((DirectValueActionItem) name).toStringNoQuotes(localData).equals("super"))) { writer.append("eval("); name.appendTo(writer, localData); return writer.append(")"); } - } + } return stripQuotes(name, localData, writer); } diff --git a/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java b/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java index 11fffecd5..53a8acb8e 100644 --- a/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java +++ b/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java @@ -84,12 +84,12 @@ public class SetMemberActionItem extends ActionItem implements SetTypeActionItem @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { object.toString(writer, localData); - - if((!(objectName instanceof DirectValueActionItem)) || (!((DirectValueActionItem)objectName).isString()) ||(!Deobfuscation.isValidName(((DirectValueActionItem)objectName).toStringNoQuotes(localData)))){ + + if ((!(objectName instanceof DirectValueActionItem)) || (!((DirectValueActionItem) objectName).isString()) || (!Deobfuscation.isValidName(((DirectValueActionItem) objectName).toStringNoQuotes(localData)))) { writer.append("["); objectName.toString(writer, localData); writer.append("]"); - }else{ + } else { writer.append("."); stripQuotes(objectName, localData, writer); } diff --git a/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java b/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java index 3d201e5fd..f9c9e2bd7 100644 --- a/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java +++ b/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java @@ -74,7 +74,7 @@ public class SetVariableActionItem extends ActionItem implements SetTypeActionIt @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { - if (((name instanceof DirectValueActionItem)&&((DirectValueActionItem)name).isString() && Deobfuscation.isValidName(((DirectValueActionItem)name).toStringNoQuotes(localData))) || name instanceof VariableActionItem) { + if (((name instanceof DirectValueActionItem) && ((DirectValueActionItem) name).isString() && Deobfuscation.isValidName(((DirectValueActionItem) name).toStringNoQuotes(localData))) || name instanceof VariableActionItem) { stripQuotes(name, localData, writer); writer.append(" = "); return value.toString(writer, localData); diff --git a/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java b/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java index aadc78bb3..c4a47524a 100644 --- a/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java +++ b/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java @@ -41,7 +41,7 @@ public class ActionGetProperty extends Action { GraphTargetItem target = stack.pop(); int indexInt = 0; if (index instanceof DirectValueActionItem) { - Object value = ((DirectValueActionItem) index).value; + Object value = ((DirectValueActionItem) index).value; if (value instanceof Long) { indexInt = (int) (long) (Long) value; } else if (value instanceof Double) { diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index 59c2e05cc..07270e79e 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -277,7 +277,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { } private List getEmptyResizePolicies(JRibbonBand ribbonBand) { - List resizePolicies = new ArrayList<>(); + List resizePolicies = new ArrayList<>(); resizePolicies.add(new BaseRibbonBandResizePolicy(ribbonBand.getControlPanel()) { @Override public int getPreferredWidth(int i, int i1) { diff --git a/src/com/jpexs/decompiler/flash/types/gfx/FontType.java b/src/com/jpexs/decompiler/flash/types/gfx/FontType.java index f9fd3e050..da02fb68c 100644 --- a/src/com/jpexs/decompiler/flash/types/gfx/FontType.java +++ b/src/com/jpexs/decompiler/flash/types/gfx/FontType.java @@ -63,11 +63,15 @@ public class FontType implements Serializable { kerning.add(new KerningPairType(sis)); } + long pos = sis.getPos(); + glyphs = new ArrayList<>(); for (int i = 0; i < glyphInfo.size(); i++) { sis.setPos(glyphInfo.get(i).globalOffset); glyphs.add(new GlyphType(sis)); } + + sis.setPos(pos); } public List getGlyphShapes() { diff --git a/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java b/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java index b59b7f57e..15f574feb 100644 --- a/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java +++ b/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java @@ -167,7 +167,6 @@ public class GFxInputStream { /** * Reads one string value from the stream * - * @param name * @return String value * @throws IOException */