[gimp] app: always return a profile from gimp_drawable_transform_buffer_*()



commit d3de67a9de835a816d61cd8839083769e3eecb40
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 6 20:25:11 2016 +0200

    app: always return a profile from gimp_drawable_transform_buffer_*()
    
    Assign the buffer_profile return value early, so it doesn't stay
    uninitialized when we bail out half way through the functions.

 app/core/gimpdrawable-transform.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index 9f97f2d..a4baa00 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -90,10 +90,14 @@ gimp_drawable_transform_buffer_affine (GimpDrawable           *drawable,
   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
   g_return_val_if_fail (GEGL_IS_BUFFER (orig_buffer), NULL);
   g_return_val_if_fail (matrix != NULL, NULL);
+  g_return_val_if_fail (buffer_profile != NULL, NULL);
   g_return_val_if_fail (new_offset_x != NULL, NULL);
   g_return_val_if_fail (new_offset_y != NULL, NULL);
   g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
 
+  *buffer_profile =
+    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
+
   m = *matrix;
 
   if (direction == GIMP_TRANSFORM_BACKWARD)
@@ -131,9 +135,6 @@ gimp_drawable_transform_buffer_affine (GimpDrawable           *drawable,
                              interpolation_type,
                              &gegl_matrix);
 
-  *buffer_profile =
-    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
-
   *new_offset_x = x1;
   *new_offset_y = y1;
 
@@ -166,6 +167,12 @@ gimp_drawable_transform_buffer_flip (GimpDrawable        *drawable,
   g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
   g_return_val_if_fail (GEGL_IS_BUFFER (orig_buffer), NULL);
+  g_return_val_if_fail (buffer_profile != NULL, NULL);
+  g_return_val_if_fail (new_offset_x != NULL, NULL);
+  g_return_val_if_fail (new_offset_y != NULL, NULL);
+
+  *buffer_profile =
+    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
 
   orig_x      = orig_offset_x;
   orig_y      = orig_offset_y;
@@ -298,9 +305,6 @@ gimp_drawable_transform_buffer_flip (GimpDrawable        *drawable,
       break;
     }
 
-  *buffer_profile =
-    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
-
   return new_buffer;
 }
 
@@ -365,6 +369,12 @@ gimp_drawable_transform_buffer_rotate (GimpDrawable      *drawable,
   g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
   g_return_val_if_fail (GEGL_IS_BUFFER (orig_buffer), NULL);
+  g_return_val_if_fail (buffer_profile != NULL, NULL);
+  g_return_val_if_fail (new_offset_x != NULL, NULL);
+  g_return_val_if_fail (new_offset_y != NULL, NULL);
+
+  *buffer_profile =
+    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
 
   orig_x      = orig_offset_x;
   orig_y      = orig_offset_y;
@@ -625,9 +635,6 @@ gimp_drawable_transform_buffer_rotate (GimpDrawable      *drawable,
       break;
     }
 
-  *buffer_profile =
-    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
-
   return new_buffer;
 }
 


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