[gimp] libgimp: use the new macros in all non-generated files



commit 6ed2d03c73e2c3774d94678324645d6249a3748f
Author: Michael Natterer <mitch gimp org>
Date:   Tue Aug 20 01:21:32 2019 +0200

    libgimp: use the new macros in all non-generated files

 libgimp/gimpbrushselect.c        | 16 ++++++++--------
 libgimp/gimpfontselect.c         |  4 ++--
 libgimp/gimpgpcompat.c           | 12 ++++++------
 libgimp/gimpgradientselect.c     |  8 ++++----
 libgimp/gimpimageprocedure.c     |  6 +++---
 libgimp/gimploadprocedure.c      |  6 +++---
 libgimp/gimppaletteselect.c      |  6 +++---
 libgimp/gimppatternselect.c      | 12 ++++++------
 libgimp/gimppdb.c                |  3 +--
 libgimp/gimpprogress.c           |  8 ++++----
 libgimp/gimpsaveprocedure.c      | 10 +++++-----
 libgimp/gimpthumbnailprocedure.c |  4 ++--
 12 files changed, 47 insertions(+), 48 deletions(-)
---
diff --git a/libgimp/gimpbrushselect.c b/libgimp/gimpbrushselect.c
index be8f490ace..e0ccfc2800 100644
--- a/libgimp/gimpbrushselect.c
+++ b/libgimp/gimpbrushselect.c
@@ -200,14 +200,14 @@ gimp_temp_brush_run (GimpProcedure        *procedure,
   g_free (data->brush_name);
   g_free (data->brush_mask_data);
 
-  data->brush_name      = g_value_dup_string (gimp_value_array_index (args, 0));
-  data->opacity         = g_value_get_double (gimp_value_array_index (args, 1));
-  data->spacing         = g_value_get_int    (gimp_value_array_index (args, 2));
-  data->paint_mode      = g_value_get_enum   (gimp_value_array_index (args, 3));
-  data->width           = g_value_get_int    (gimp_value_array_index (args, 4));
-  data->height          = g_value_get_int    (gimp_value_array_index (args, 5));
-  data->brush_mask_data = gimp_value_dup_uint8_array (gimp_value_array_index (args, 7));
-  data->closing         = g_value_get_boolean (gimp_value_array_index (args, 8));
+  data->brush_name      = GIMP_VALUES_DUP_STRING      (args, 0);
+  data->opacity         = GIMP_VALUES_GET_DOUBLE      (args, 1);
+  data->spacing         = GIMP_VALUES_GET_INT         (args, 2);
+  data->paint_mode      = GIMP_VALUES_GET_ENUM        (args, 3);
+  data->width           = GIMP_VALUES_GET_INT         (args, 4);
+  data->height          = GIMP_VALUES_GET_INT         (args, 5);
+  data->brush_mask_data = GIMP_VALUES_DUP_UINT8_ARRAY (args, 7);
+  data->closing         = GIMP_VALUES_GET_BOOLEAN     (args, 8);
 
   if (! data->idle_id)
     data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_brush_idle, data);
diff --git a/libgimp/gimpfontselect.c b/libgimp/gimpfontselect.c
index 325b25a409..5c87cc4511 100644
--- a/libgimp/gimpfontselect.c
+++ b/libgimp/gimpfontselect.c
@@ -146,8 +146,8 @@ gimp_temp_font_run (GimpProcedure        *procedure,
 
   g_free (data->font_name);
 
-  data->font_name = g_value_dup_string  (gimp_value_array_index (args, 0));
-  data->closing   = g_value_get_boolean (gimp_value_array_index (args, 1));
+  data->font_name = GIMP_VALUES_DUP_STRING  (args, 0);
+  data->closing   = GIMP_VALUES_GET_BOOLEAN (args, 1);
 
   if (! data->idle_id)
     data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_font_idle,
diff --git a/libgimp/gimpgpcompat.c b/libgimp/gimpgpcompat.c
index 294bc40e9f..6528272325 100644
--- a/libgimp/gimpgpcompat.c
+++ b/libgimp/gimpgpcompat.c
@@ -393,7 +393,7 @@ _gimp_params_to_value_array (const GimpParam  *params,
           break;
 
         case GIMP_PDB_INT32ARRAY:
-          count = g_value_get_int (gimp_value_array_index (args, i - 1));
+          count = GIMP_VALUES_GET_INT (args, i - 1);
           if (full_copy)
             gimp_value_set_int32_array (&value,
                                         params[i].data.d_int32array,
@@ -405,7 +405,7 @@ _gimp_params_to_value_array (const GimpParam  *params,
           break;
 
         case GIMP_PDB_INT16ARRAY:
-          count = g_value_get_int (gimp_value_array_index (args, i - 1));
+          count = GIMP_VALUES_GET_INT (args, i - 1);
           if (full_copy)
             gimp_value_set_int16_array (&value,
                                         params[i].data.d_int16array,
@@ -417,7 +417,7 @@ _gimp_params_to_value_array (const GimpParam  *params,
           break;
 
         case GIMP_PDB_INT8ARRAY:
-          count = g_value_get_int (gimp_value_array_index (args, i - 1));
+          count = GIMP_VALUES_GET_INT (args, i - 1);
           if (full_copy)
             gimp_value_set_uint8_array (&value,
                                         params[i].data.d_int8array,
@@ -429,7 +429,7 @@ _gimp_params_to_value_array (const GimpParam  *params,
           break;
 
         case GIMP_PDB_FLOATARRAY:
-          count = g_value_get_int (gimp_value_array_index (args, i - 1));
+          count = GIMP_VALUES_GET_INT (args, i - 1);
           if (full_copy)
             gimp_value_set_float_array (&value,
                                         params[i].data.d_floatarray,
@@ -441,7 +441,7 @@ _gimp_params_to_value_array (const GimpParam  *params,
           break;
 
         case GIMP_PDB_STRINGARRAY:
-          count = g_value_get_int (gimp_value_array_index (args, i - 1));
+          count = GIMP_VALUES_GET_INT (args, i - 1);
           if (full_copy)
             gimp_value_set_string_array (&value,
                                         (const gchar **) params[i].data.d_stringarray,
@@ -485,7 +485,7 @@ _gimp_params_to_value_array (const GimpParam  *params,
           break;
 
         case GIMP_PDB_COLORARRAY:
-          count = g_value_get_int (gimp_value_array_index (args, i - 1));
+          count = GIMP_VALUES_GET_INT (args, i - 1);
           if (full_copy)
             gimp_value_set_rgb_array (&value,
                                       params[i].data.d_colorarray,
diff --git a/libgimp/gimpgradientselect.c b/libgimp/gimpgradientselect.c
index f043a9b75a..207b552b96 100644
--- a/libgimp/gimpgradientselect.c
+++ b/libgimp/gimpgradientselect.c
@@ -163,10 +163,10 @@ gimp_temp_gradient_run (GimpProcedure        *procedure,
   g_free (data->gradient_name);
   g_free (data->gradient_data);
 
-  data->gradient_name = g_value_dup_string  (gimp_value_array_index (args, 0));
-  data->width         = g_value_get_int     (gimp_value_array_index (args, 1));
-  data->gradient_data = gimp_value_dup_float_array (gimp_value_array_index (args, 2));
-  data->closing       = g_value_get_boolean (gimp_value_array_index (args, 3));
+  data->gradient_name = GIMP_VALUES_DUP_STRING      (args, 0);
+  data->width         = GIMP_VALUES_GET_INT         (args, 1);
+  data->gradient_data = GIMP_VALUES_DUP_FLOAT_ARRAY (args, 2);
+  data->closing       = GIMP_VALUES_GET_BOOLEAN     (args, 3);
 
   if (! data->idle_id)
     data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_gradient_idle, data);
diff --git a/libgimp/gimpimageprocedure.c b/libgimp/gimpimageprocedure.c
index 382dbc6300..ea0a8d4e29 100644
--- a/libgimp/gimpimageprocedure.c
+++ b/libgimp/gimpimageprocedure.c
@@ -117,9 +117,9 @@ gimp_image_procedure_run (GimpProcedure        *procedure,
   gint32              drawable_id;
   gint                i;
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_id    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-  drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
+  run_mode    = GIMP_VALUES_GET_ENUM     (args, 0);
+  image_id    = GIMP_VALUES_GET_IMAGE    (args, 1);
+  drawable_id = GIMP_VALUES_GET_DRAWABLE (args, 2);
 
   remaining = gimp_value_array_new (gimp_value_array_length (args) - 3);
 
diff --git a/libgimp/gimploadprocedure.c b/libgimp/gimploadprocedure.c
index 1139170029..636669d29b 100644
--- a/libgimp/gimploadprocedure.c
+++ b/libgimp/gimploadprocedure.c
@@ -168,9 +168,9 @@ gimp_load_procedure_run (GimpProcedure        *procedure,
   GFile             *file;
   gint               i;
 
-  run_mode   = g_value_get_enum   (gimp_value_array_index (args, 0));
-  uri        = g_value_get_string (gimp_value_array_index (args, 1));
-  /* raw_uri = g_value_get_string (gimp_value_array_index (args, 2)); */
+  run_mode   = GIMP_VALUES_GET_ENUM   (args, 0);
+  uri        = GIMP_VALUES_GET_STRING (args, 1);
+  /* raw_uri = GIMP_VALUES_GET_STRING (args, 2); */
 
   file = g_file_new_for_uri (uri);
 
diff --git a/libgimp/gimppaletteselect.c b/libgimp/gimppaletteselect.c
index 4153f8d0bd..8d296de105 100644
--- a/libgimp/gimppaletteselect.c
+++ b/libgimp/gimppaletteselect.c
@@ -153,9 +153,9 @@ gimp_temp_palette_run (GimpProcedure        *procedure,
 
   g_free (data->palette_name);
 
-  data->palette_name = g_value_dup_string  (gimp_value_array_index (args, 0));
-  data->num_colors   = g_value_get_int     (gimp_value_array_index (args, 1));
-  data->closing      = g_value_get_boolean (gimp_value_array_index (args, 2));
+  data->palette_name = GIMP_VALUES_DUP_STRING  (args, 0);
+  data->num_colors   = GIMP_VALUES_GET_INT     (args, 1);
+  data->closing      = GIMP_VALUES_GET_BOOLEAN (args, 2);
 
   if (! data->idle_id)
     data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_palette_idle,
diff --git a/libgimp/gimppatternselect.c b/libgimp/gimppatternselect.c
index 5b30b38bd2..ec3528ecab 100644
--- a/libgimp/gimppatternselect.c
+++ b/libgimp/gimppatternselect.c
@@ -181,12 +181,12 @@ gimp_temp_pattern_run (GimpProcedure        *procedure,
   g_free (data->pattern_name);
   g_free (data->pattern_mask_data);
 
-  data->pattern_name      = g_value_dup_string (gimp_value_array_index (args, 0));
-  data->width             = g_value_get_int    (gimp_value_array_index (args, 1));
-  data->height            = g_value_get_int    (gimp_value_array_index (args, 2));
-  data->bytes             = g_value_get_int    (gimp_value_array_index (args, 3));
-  data->pattern_mask_data = gimp_value_dup_uint8_array (gimp_value_array_index (args, 5));
-  data->closing           = g_value_get_boolean (gimp_value_array_index (args, 6));
+  data->pattern_name      = GIMP_VALUES_DUP_STRING      (args, 0);
+  data->width             = GIMP_VALUES_GET_INT         (args, 1);
+  data->height            = GIMP_VALUES_GET_INT         (args, 2);
+  data->bytes             = GIMP_VALUES_GET_INT         (args, 3);
+  data->pattern_mask_data = GIMP_VALUES_DUP_UINT8_ARRAY (args, 5);
+  data->closing           = GIMP_VALUES_GET_BOOLEAN     (args, 6);
 
   if (! data->idle_id)
     data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_pattern_idle, data);
diff --git a/libgimp/gimppdb.c b/libgimp/gimppdb.c
index 890af4310d..09e62f9c96 100644
--- a/libgimp/gimppdb.c
+++ b/libgimp/gimppdb.c
@@ -602,8 +602,7 @@ gimp_pdb_set_error (GimpPDB        *pdb,
 
   if (gimp_value_array_length (return_values) > 0)
     {
-      pdb->priv->error_status =
-        g_value_get_enum (gimp_value_array_index (return_values, 0));
+      pdb->priv->error_status = GIMP_VALUES_GET_ENUM (return_values, 0);
 
       switch (pdb->priv->error_status)
         {
diff --git a/libgimp/gimpprogress.c b/libgimp/gimpprogress.c
index cfa7a119ce..c9a3a6ded2 100644
--- a/libgimp/gimpprogress.c
+++ b/libgimp/gimpprogress.c
@@ -338,9 +338,9 @@ gimp_temp_progress_run (GimpProcedure        *procedure,
   const gchar         *text;
   gdouble              value;
 
-  command = g_value_get_enum   (gimp_value_array_index (args, 0));
-  text    = g_value_get_string (gimp_value_array_index (args, 1));
-  value   = g_value_get_double (gimp_value_array_index (args, 2));
+  command = GIMP_VALUES_GET_ENUM   (args, 0);
+  text    = GIMP_VALUES_GET_STRING (args, 1);
+  value   = GIMP_VALUES_GET_DOUBLE (args, 2);
 
   switch (command)
     {
@@ -379,7 +379,7 @@ gimp_temp_progress_run (GimpProcedure        *procedure,
         return_vals = gimp_procedure_new_return_values (procedure,
                                                         GIMP_PDB_SUCCESS,
                                                         NULL);
-        g_value_set_double (gimp_value_array_index (return_vals, 1), window_id);
+        GIMP_VALUES_SET_DOUBLE (return_vals, 1, window_id);
 
         return return_vals;
       }
diff --git a/libgimp/gimpsaveprocedure.c b/libgimp/gimpsaveprocedure.c
index 21367a00ed..e68f1748e7 100644
--- a/libgimp/gimpsaveprocedure.c
+++ b/libgimp/gimpsaveprocedure.c
@@ -153,11 +153,11 @@ gimp_save_procedure_run (GimpProcedure        *procedure,
   GFile             *file;
   gint               i;
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_id    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-  drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
-  uri         = g_value_get_string         (gimp_value_array_index (args, 3));
-  /* raw_uri  = g_value_get_string         (gimp_value_array_index (args, 4)); */
+  run_mode    = GIMP_VALUES_GET_ENUM     (args, 0);
+  image_id    = GIMP_VALUES_GET_IMAGE    (args, 1);
+  drawable_id = GIMP_VALUES_GET_DRAWABLE (args, 2);
+  uri         = GIMP_VALUES_GET_STRING   (args, 3);
+  /* raw_uri  = GIMP_VALUES_GET_STRING   (args, 4); */
 
   file = g_file_new_for_uri (uri);
 
diff --git a/libgimp/gimpthumbnailprocedure.c b/libgimp/gimpthumbnailprocedure.c
index 1b4273ac4e..181b0a96e2 100644
--- a/libgimp/gimpthumbnailprocedure.c
+++ b/libgimp/gimpthumbnailprocedure.c
@@ -141,8 +141,8 @@ gimp_thumbnail_procedure_run (GimpProcedure        *procedure,
   gint                    size;
   gint                    i;
 
-  uri  = g_value_get_string (gimp_value_array_index (args, 0));
-  size = g_value_get_int    (gimp_value_array_index (args, 1));
+  uri  = GIMP_VALUES_GET_STRING (args, 0);
+  size = GIMP_VALUES_GET_INT    (args, 1);
 
   file = g_file_new_for_uri (uri);
 


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