constant pool editing: escape strings

This commit is contained in:
2015-05-08 14:01:44 +02:00
parent e49296770f
commit c5a890fce7
24 changed files with 181 additions and 57 deletions
@@ -914,7 +914,7 @@ public class AVM2Code implements Cloneable {
if (info != null) {
writer.appendNoHilight("method").newLine();
writer.appendNoHilight("name ");
writer.hilightSpecial(info.name_index == 0 ? "null" : "\"" + Helper.escapeString(info.getName(constants)) + "\"", HighlightSpecialType.METHOD_NAME);
writer.hilightSpecial(info.name_index == 0 ? "null" : "\"" + Helper.escapeActionScriptString(info.getName(constants)) + "\"", HighlightSpecialType.METHOD_NAME);
writer.newLine();
if (info.flagExplicit()) {
writer.appendNoHilight("flag ");
@@ -211,7 +211,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
s.append(" null");
} else {
s.append(" \"");
s.append(Helper.escapeString(constants.getString(operands[i])));
s.append(Helper.escapeActionScriptString(constants.getString(operands[i])));
s.append("\"");
}
break;
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class StringAVM2Item extends AVM2Item {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
return writer.append("\"" + Helper.escapeString(value) + "\"");
return writer.append("\"" + Helper.escapeActionScriptString(value) + "\"");
}
@Override
@@ -191,7 +191,7 @@ public class Multiname {
break;
}
}
return constants.getNamespace(index).getKindStr() + "(" + (name == null ? "null" : "\"" + Helper.escapeString(name) + "\"") + (sub > 0 ? ",\"" + sub + "\"" : "") + ")";
return constants.getNamespace(index).getKindStr() + "(" + (name == null ? "null" : "\"" + Helper.escapeActionScriptString(name) + "\"") + (sub > 0 ? ",\"" + sub + "\"" : "") + ")";
}
private static String namespaceSetToString(AVM2ConstantPool constants, int index) {
@@ -222,16 +222,16 @@ public class Multiname {
switch (kind) {
case QNAME:
case QNAMEA:
return getKindStr() + "(" + namespaceToString(constants, namespace_index) + "," + (name_index == 0 ? "null" : "\"" + Helper.escapeString(constants.getString(name_index)) + "\"") + ")";
return getKindStr() + "(" + namespaceToString(constants, namespace_index) + "," + (name_index == 0 ? "null" : "\"" + Helper.escapeActionScriptString(constants.getString(name_index)) + "\"") + ")";
case RTQNAME:
case RTQNAMEA:
return getKindStr() + "(" + (name_index == 0 ? "null" : "\"" + Helper.escapeString(constants.getString(name_index))) + "\"" + ")";
return getKindStr() + "(" + (name_index == 0 ? "null" : "\"" + Helper.escapeActionScriptString(constants.getString(name_index))) + "\"" + ")";
case RTQNAMEL:
case RTQNAMELA:
return getKindStr() + "()";
case MULTINAME:
case MULTINAMEA:
return getKindStr() + "(" + (name_index == 0 ? "null" : "\"" + Helper.escapeString(constants.getString(name_index)) + "\"") + "," + namespaceSetToString(constants, namespace_set_index) + ")";
return getKindStr() + "(" + (name_index == 0 ? "null" : "\"" + Helper.escapeActionScriptString(constants.getString(name_index)) + "\"") + "," + namespaceSetToString(constants, namespace_set_index) + ")";
case MULTINAMEL:
case MULTINAMELA:
return getKindStr() + "(" + namespaceSetToString(constants, namespace_set_index) + ")";
@@ -137,7 +137,7 @@ public class ValueKind {
ret = "" + constants.getDecimal(value_index);
break;
case CONSTANT_Utf8:
ret = "\"" + Helper.escapeString(constants.getString(value_index)) + "\"";
ret = "\"" + Helper.escapeActionScriptString(constants.getString(value_index)) + "\"";
break;
case CONSTANT_True:
ret = "true";
@@ -179,7 +179,7 @@ public class ValueKind {
ret = "Decimal(" + constants.getDecimal(value_index) + ")";
break;
case CONSTANT_Utf8:
ret = "Utf8(\"" + Helper.escapeString(constants.getString(value_index)) + "\")";
ret = "Utf8(\"" + Helper.escapeActionScriptString(constants.getString(value_index)) + "\")";
break;
case CONSTANT_True:
ret = "True";