xmpedit

GTK+ editor for XMP metadata embedded in images
git clone https://code.djc.id.au/git/xmpedit/
commit e535b24fd92978a09668e09dfc4d9eac13a35d0b
parent d0bdabb8a88fd7f18d7e06640df4b95d1a1169ca
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sat, 18 Sep 2010 19:23:57 +1000

forgot about trailing xpacket PI

Diffstat:
Msrc/ImageMetadata.vala | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/ImageMetadata.vala b/src/ImageMetadata.vala
@@ -231,7 +231,8 @@ public class ImageMetadata : Object, Gtk.TreeModel {
         xml.append("<?xpacket begin=\"\xef\xbb\xbf\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>" +
                 """<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="xmpedit 0.0-dev">""");
         xml.append(graph.to_xml(subject));
-        var new_size = xml.str.size() + 12; // plus </x:xmpmeta>
+        xml.append("</x:xmpmeta>");
+        var new_size = xml.str.size() + 19; // plus trailing PI
         size_t padding;
         if (new_size <= xmp_packet_size)
             padding = xmp_packet_size - new_size;
@@ -239,7 +240,7 @@ public class ImageMetadata : Object, Gtk.TreeModel {
             padding = new_size + 1024;
         for (size_t i = 0; i < padding; i ++)
             xml.append_c(' ');
-        xml.append("""</x:xmpmeta>""");
+        xml.append("""<?xpacket end="w"?>""");
 #if DEBUG
         stderr.puts("=== Serialized XMP packet:\n");
         stderr.puts(xml.str);