[gimp/wip/Jehan/Issue-5863-Gexiv2-GError-variants] Issue #5863: do not raise WARNINGs on Exiv2 unsupported tags on loading.




commit d164c9922801631631ba8f275b0b2ce91c71d6df
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.
    
    WIP. Waiting for GExiv2 to merge a patch I submitted:
    https://gitlab.gnome.org/GNOME/gexiv2/-/merge_requests/20
    
    We will have to bump GExiv2 dependency as well (so master only fix).

 libgimpbase/gimpmetadata.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c
index 2170d4a4f4..ef312be670 100644
--- a/libgimpbase/gimpmetadata.c
+++ b/libgimpbase/gimpmetadata.c
@@ -644,12 +644,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);
 
@@ -1597,9 +1605,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;
+
+  values = gexiv2_metadata_try_get_tag_multiple (src, tag, &error);
 
-  if (values)
+  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]