From f2bf2b7fe301e15e416a3880624e9e1abdfd7d35 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Wed, 25 Oct 2023 16:15:04 +0000 Subject: [PATCH] app: Fix initialization warnings Initialized values in gimpruler.c and gimptoolrectangle.c to remove warnings about uninitialized variables. --- app/display/gimptoolrectangle.c | 26 ++++++++++++++++++++------ libgimpwidgets/gimpruler.c | 12 +++++++----- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/display/gimptoolrectangle.c b/app/display/gimptoolrectangle.c index 743db0b7dd..5af2ba1157 100644 --- a/app/display/gimptoolrectangle.c +++ b/app/display/gimptoolrectangle.c @@ -2022,8 +2022,10 @@ static void gimp_tool_rectangle_update_options (GimpToolRectangle *rectangle) { GimpToolRectanglePrivate *private = rectangle->private; - gdouble x1, y1; - gdouble x2, y2; + gdouble x1 = 0; + gdouble y1 = 0; + gdouble x2 = 0; + gdouble y2 = 0; gimp_tool_rectangle_get_public_rect (rectangle, &x1, &y1, &x2, &y2); @@ -2158,7 +2160,10 @@ static void gimp_tool_rectangle_update_status (GimpToolRectangle *rectangle) { GimpToolRectanglePrivate *private = rectangle->private; - gdouble x1, y1, x2, y2; + gdouble x1 = 0; + gdouble y1 = 0; + gdouble x2 = 0; + gdouble y2 = 0; gimp_tool_rectangle_get_public_rect (rectangle, &x1, &y1, &x2, &y2); @@ -2432,7 +2437,10 @@ gimp_tool_rectangle_coord_on_handle (GimpToolRectangle *rectangle, { GimpToolRectanglePrivate *private = rectangle->private; GimpDisplayShell *shell; - gdouble x1, y1, x2, y2; + gdouble x1 = 0; + gdouble y1 = 0; + gdouble x2 = 0; + gdouble y2 = 0; gdouble rect_w, rect_h; gdouble handle_x = 0; gdouble handle_y = 0; @@ -2834,7 +2842,10 @@ gimp_tool_rectangle_setup_snap_offsets (GimpToolRectangle *rectangle, { GimpToolWidget *widget = GIMP_TOOL_WIDGET (rectangle); GimpToolRectanglePrivate *private = rectangle->private; - gdouble x1, y1, x2, y2; + gdouble x1 = 0; + gdouble y1 = 0; + gdouble x2 = 0; + gdouble y2 = 0; gdouble coord_x, coord_y; gimp_tool_rectangle_get_public_rect (rectangle, &x1, &y1, &x2, &y2); @@ -4181,7 +4192,10 @@ gimp_tool_rectangle_point_in_rectangle (GimpToolRectangle *rectangle, gdouble x, gdouble y) { - gdouble x1, y1, x2, y2; + gdouble x1 = 0; + gdouble y1 = 0; + gdouble x2 = 0; + gdouble y2 = 0; g_return_val_if_fail (GIMP_IS_TOOL_RECTANGLE (rectangle), FALSE); diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c index 27e9063951..157944322b 100644 --- a/libgimpwidgets/gimpruler.c +++ b/libgimpwidgets/gimpruler.c @@ -390,10 +390,10 @@ gimp_ruler_update_position (GimpRuler *ruler, gdouble x, gdouble y) { - GimpRulerPrivate *priv = GET_PRIVATE (ruler); + GimpRulerPrivate *priv = GET_PRIVATE (ruler); GtkAllocation allocation; - gdouble lower; - gdouble upper; + gdouble lower = 0; + gdouble upper = 0; gtk_widget_get_allocation (GTK_WIDGET (ruler), &allocation); gimp_ruler_get_range (ruler, &lower, &upper, NULL); @@ -1005,7 +1005,8 @@ gimp_ruler_draw_ticks (GimpRuler *ruler) gint i; gint width, height; gint length, ideal_length; - gdouble lower, upper; /* Upper and lower limits, in ruler units */ + gdouble lower = 0; /* Upper and lower limits, in ruler units */ + gdouble upper = 0; gdouble increment; /* Number of pixels per unit */ gint scale; /* Number of units per major unit */ gdouble start, end, cur; @@ -1209,7 +1210,8 @@ gimp_ruler_get_pos_rect (GimpRuler *ruler, GtkAllocation allocation; GtkBorder border; gint width, height; - gdouble upper, lower; + gdouble upper = 0; + gdouble lower = 0; gdouble increment; GdkRectangle rect = { 0, };