[gimp] plug-ins: always set an error domain.



commit 9926c900551e2dba20cc646c60171530ececcf91
Author: Jehan <jehan girinstud io>
Date:   Thu Mar 24 14:18:57 2022 +0100

    plug-ins: always set an error domain.
    
    The code can be 0, but not the domain. Let's use G_FILE_ERROR as all
    these errors are about problematic file contents.
    
    Fixing these warnings:
    
    > g_error_new_valist: runtime check failed: (domain != 0)

 plug-ins/common/file-png.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 11b094c484..d92c926981 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -619,7 +619,7 @@ load_image (GFile        *file,
       /* this could happen if the compile time and run-time libpng
          versions do not match. */
 
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Error creating PNG read struct while loading '%s'."),
                    gimp_file_get_utf8_name (file));
       return NULL;
@@ -628,7 +628,7 @@ load_image (GFile        *file,
   info = png_create_info_struct (pp);
   if (! info)
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Error while reading '%s'. Could not create PNG header info structure."),
                    gimp_file_get_utf8_name (file));
       return NULL;
@@ -899,7 +899,7 @@ load_image (GFile        *file,
       break;
 
     default:
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Unknown color model in PNG file '%s'."),
                    gimp_file_get_utf8_name (file));
       return NULL;
@@ -912,7 +912,7 @@ load_image (GFile        *file,
                                          image_type, image_precision);
   if (! image)
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Could not create new image for '%s': %s"),
                    gimp_file_get_utf8_name (file),
                    gimp_pdb_get_last_error (gimp_get_pdb ()));
@@ -1456,7 +1456,7 @@ save_image (GFile        *file,
       /* this could happen if the compile time and run-time libpng
        * versions do not match.
        */
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Error creating PNG write struct while exporting '%s'."),
                    gimp_file_get_utf8_name (file));
       return FALSE;
@@ -1465,7 +1465,7 @@ save_image (GFile        *file,
   info = png_create_info_struct (pp);
   if (! info)
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Error while exporting '%s'. Could not create PNG header info structure."),
                    gimp_file_get_utf8_name (file));
       return FALSE;
@@ -1473,7 +1473,7 @@ save_image (GFile        *file,
 
   if (setjmp (png_jmpbuf (pp)))
     {
-      g_set_error (error, 0, 0,
+      g_set_error (error, G_FILE_ERROR, 0,
                    _("Error while exporting '%s'. Could not export image."),
                    gimp_file_get_utf8_name (file));
       return FALSE;
@@ -1619,7 +1619,7 @@ save_image (GFile        *file,
         break;
 
       default:
-        g_set_error (error, 0, 0, "Image type can't be exported as PNG");
+        g_set_error (error, G_FILE_ERROR, 0, "Image type can't be exported as PNG");
         return FALSE;
       }
     }


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