From 06a0bafe79f4ba093c9f82f8096c5c5fce158c97 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Thu, 22 May 2025 02:10:08 +0000 Subject: [PATCH] plug-ins, operations: Fix warnings on Windows This patch reduces three sets of warnings when compiling on Windows: * In gimp-layer-modes.c, we move the g_return_val_if_reached () in gimp_layer_mode_get_format () to the default case in the last switch statement to prevent a warning about an unhandled switch case * In spline.c, we initialize V[] to prevent a warning about uninitialized values * In flame.c, we unconditionally call g_bytes_unref () to prevent a warning about dangling pointers. --- app/operations/layer-modes/gimp-layer-modes.c | 5 +++-- plug-ins/flame/flame.c | 11 ++++------- plug-ins/selection-to-path/spline.c | 3 +++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/operations/layer-modes/gimp-layer-modes.c b/app/operations/layer-modes/gimp-layer-modes.c index 7b85979381..e6f08d58d0 100644 --- a/app/operations/layer-modes/gimp-layer-modes.c +++ b/app/operations/layer-modes/gimp-layer-modes.c @@ -1541,9 +1541,10 @@ gimp_layer_mode_get_format (GimpLayerMode mode, case GIMP_LAYER_COLOR_SPACE_LAB: return babl_format_with_space ("CIE Lab alpha float", preferred_format); - } - g_return_val_if_reached (babl_format_with_space ("RGBA float", preferred_format)); + default: + g_return_val_if_reached (babl_format_with_space ("RGBA float", preferred_format)); + } } GimpLayerCompositeRegion diff --git a/plug-ins/flame/flame.c b/plug-ins/flame/flame.c index 1100b43ab7..c8fd60fc30 100644 --- a/plug-ins/flame/flame.c +++ b/plug-ins/flame/flame.c @@ -1034,13 +1034,10 @@ set_flame_preview (GimpProcedureConfig *proc_config) return; g_object_get (proc_config, "settings-data", &settings_bytes, NULL); - if (settings_bytes != NULL) - { - if (g_bytes_get_size (settings_bytes) == sizeof (FlameSettings)) - config = *((FlameSettings *) g_bytes_get_data (settings_bytes, NULL)); - - g_bytes_unref (settings_bytes); - } + if (settings_bytes != NULL && + g_bytes_get_size (settings_bytes) == sizeof (FlameSettings)) + config = *((FlameSettings *) g_bytes_get_data (settings_bytes, NULL)); + g_bytes_unref (settings_bytes); g_object_get (proc_config, "x", &config.cp.center[0], diff --git a/plug-ins/selection-to-path/spline.c b/plug-ins/selection-to-path/spline.c index 1e8c2e7367..92c90fb0f7 100644 --- a/plug-ins/selection-to-path/spline.c +++ b/plug-ins/selection-to-path/spline.c @@ -83,6 +83,9 @@ evaluate_spline (spline_type s, real t) real one_minus_t = 1.0 - t; polynomial_degree degree = SPLINE_DEGREE (s); + for (i = 0; i < 4; i++) + V[i] = new_spline (); + for (i = 0; i <= degree; i++) V[0].v[i] = s.v[i];