[gimp/metadata-browser: 42/45] Workaround for EXIF data import which crashes the plug-in.



commit 607a6581ca78139433a121be1c0c49691f3e0ffb
Author: Roman Joost <roman bromeco de>
Date:   Fri Dec 2 11:05:56 2011 +1000

    Workaround for EXIF data import which crashes the plug-in.
    
    This workaround allows to run the plug-in when opening a JPEG. The
    import/merge of EXIF data is currently not working. All data is set as a
    scalar property. This is invalid data by the XMP metadata
    standard.  A proper fix will need more code for the import in
    exif-decode.c

 plug-ins/metadata/tests/Makefile.am |    1 +
 plug-ins/metadata/xmp-encode.c      |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/metadata/tests/Makefile.am b/plug-ins/metadata/tests/Makefile.am
index 27f1b48..15bd343 100644
--- a/plug-ins/metadata/tests/Makefile.am
+++ b/plug-ins/metadata/tests/Makefile.am
@@ -18,6 +18,7 @@ LDADD = \
        $(libgimpconfig)        \
        $(libgimpcolor)         \
        $(libgimpbase)          \
+       $(GTK_LIBS)             \
        $(GLIB_LIBS)            \
        ../base64.o             \
        ../xmp-parse.o          \
diff --git a/plug-ins/metadata/xmp-encode.c b/plug-ins/metadata/xmp-encode.c
index 23a2e05..16ca4ec 100644
--- a/plug-ins/metadata/xmp-encode.c
+++ b/plug-ins/metadata/xmp-encode.c
@@ -251,8 +251,9 @@ gen_property (GString            *buffer,
     case XMP_TYPE_DEVICE_SETTINGS:
     case XMP_TYPE_CONTACT_INFO:
     case XMP_TYPE_GENERIC_STRUCTURE:
-      if (value_array[0] && value_array[1]
-          && !! strcmp (value_array[1], schema->uri))
+      if ((value_array != NULL)
+        && (value_array[0] && value_array[1]
+            && !! strcmp (value_array[1], schema->uri)))
         {
           g_string_append_printf (buffer,
                                   "  <%s:%s rdf:parseType='Resource'\n"
@@ -268,13 +269,21 @@ gen_property (GString            *buffer,
                                   schema->prefix, property->name);
           ns_prefix = schema->prefix;
         }
-      if (value_array[0] && value_array[1])
+      if (value_array != NULL && value_array[0] && value_array[1])
+       {
         for (i = 2; value_array[i] != NULL; i += 2)
           {
             gen_element (buffer, 3,
                          ns_prefix, value_array[i], value_array[i + 1],
                          NULL);
           }
+       }
+      else
+       {
+        gen_element (buffer, 3,
+                     ns_prefix, property->name, value,
+                     NULL);
+       }
       g_string_append_printf (buffer, "  </%s:%s>\n",
                               schema->prefix, property->name);
       break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]