[gimp] Issue #5863: do not raise WARNINGs on Exiv2 unsupported tags on loading.



commit 454d1daf1aa5b603a8b254baaa1053fa494971b0
Author: Jehan <jehan girinstud io>
Date:   Sun Nov 8 18:54:53 2020 +0100

    Issue #5863: do not raise WARNINGs on Exiv2 unsupported tags on loading.
    
    I was waiting for GExiv2 to merge a patch I submitted:
    https://gitlab.gnome.org/GNOME/gexiv2/-/merge_requests/20
    
    Then we waited for it to land in a released version then for this
    version to be in Debian testing. It's all done now and we bumped the
    GExiv2 dependency in the previous commit (which makes it a master-only
    fix). So all good.

 libgimpbase/gimpmetadata.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c
index 573127a456..130333d799 100644
--- a/libgimpbase/gimpmetadata.c
+++ b/libgimpbase/gimpmetadata.c
@@ -655,12 +655,20 @@ gimp_metadata_deserialize_text (GMarkupParseContext  *context,
       if (value)
         {
           GExiv2Metadata  *g2_metadata = GEXIV2_METADATA (parse_data->metadata);
+          GError          *error       = NULL;
           gchar          **values;
 
-          values = gexiv2_metadata_get_tag_multiple (g2_metadata,
-                                                     parse_data->name);
+          values = gexiv2_metadata_try_get_tag_multiple (g2_metadata,
+                                                         parse_data->name,
+                                                         &error);
 
-          if (values)
+          if (error)
+            {
+              g_printerr ("%s: %s\n", G_STRFUNC, error->message);
+              g_clear_error (&error);
+              g_strfreev (values);
+            }
+          else if (values)
             {
               guint length = g_strv_length (values);
 
@@ -1643,9 +1651,18 @@ gimp_metadata_copy_tag (GExiv2Metadata *src,
                         GExiv2Metadata *dest,
                         const gchar    *tag)
 {
-  gchar **values = gexiv2_metadata_get_tag_multiple (src, tag);
+  gchar  **values;
+  GError  *error = NULL;
 
-  if (values)
+  values = gexiv2_metadata_try_get_tag_multiple (src, tag, &error);
+
+  if (error)
+    {
+      g_printerr ("%s: %s\n", G_STRFUNC, error->message);
+      g_clear_error (&error);
+      g_strfreev (values);
+    }
+  else if (values)
     {
       gexiv2_metadata_set_tag_multiple (dest, tag, (const gchar **) values);
       g_strfreev (values);


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