2nd tag saving problem fixed

This commit is contained in:
honfika
2014-06-28 08:04:27 +02:00
parent 5a47eb1c01
commit 73585ba076
2 changed files with 11 additions and 1 deletions
+1
View File
@@ -451,6 +451,7 @@ public final class SWF implements TreeItem, Timelined {
public void clearModified() {
for (Tag tag : tags) {
if (tag.isModified()) {
tag.createOriginalData();
tag.setModified(false);
}
}
+10 -1
View File
@@ -68,7 +68,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
* Original tag data
*/
@Internal
private final ByteArrayRange originalData;
private ByteArrayRange originalData;
public String getTagName() {
return tagName;
@@ -394,6 +394,15 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
modified = value;
}
public void createOriginalData() {
byte[] data = getData();
byte[] headerData = getHeader(data);
byte[] tagData = new byte[data.length + headerData.length];
System.arraycopy(headerData, 0, tagData, 0, headerData.length);
System.arraycopy(data, 0, tagData, headerData.length, data.length);
originalData = new ByteArrayRange(tagData, 0, tagData.length);
}
public boolean isModified() {
return modified;
}