From b728ecb9f2817c0cc82a112cd486bd9d5dda5188 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 25 Aug 2024 21:20:05 +0000 Subject: [PATCH] plug-ins: Reduce initialization warnings on Windows This patch initializes a number of variables that are used in the PSD plug-in. Otherwise, they display warnings in the Windows pipelines. --- plug-ins/file-psd/psd-export.c | 10 ++-- plug-ins/file-psd/psd-image-res-load.c | 12 ++--- plug-ins/file-psd/psd-layer-res-load.c | 64 +++++++++++++------------- plug-ins/file-psd/psd-thumb-load.c | 4 +- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/plug-ins/file-psd/psd-export.c b/plug-ins/file-psd/psd-export.c index 6602de8488..853e6e0a1a 100644 --- a/plug-ins/file-psd/psd-export.c +++ b/plug-ins/file-psd/psd-export.c @@ -791,9 +791,9 @@ save_resources (GOutputStream *output, if (gimp_drawable_has_alpha (GIMP_DRAWABLE (PSDImageData.merged_layer))) { write_gint16 (output, PSD_CS_RGB, "channel color space"); - write_gint16 (output, DOUBLE_TO_INT16 (1.0), "channel color r"); - write_gint16 (output, DOUBLE_TO_INT16 (0.0), "channel color g"); - write_gint16 (output, DOUBLE_TO_INT16 (0.0), "channel color b"); + write_gint16 (output, (gint16) DOUBLE_TO_INT16 (1.0), "channel color r"); + write_gint16 (output, (gint16) DOUBLE_TO_INT16 (0.0), "channel color g"); + write_gint16 (output, (gint16) DOUBLE_TO_INT16 (0.0), "channel color b"); write_gint16 (output, 0, "channel color padding"); write_gint16 (output, 100, "channel opacity"); write_gchar (output, 1, "channel mode"); @@ -1189,7 +1189,7 @@ save_paths (GOutputStream *output, if (tmpname && err == NULL) { - g_string_append_c (data, MIN (len, 255)); + g_string_append_c (data, (gchar) MIN (len, 255)); g_string_append_len (data, tmpname, MIN (len, 255)); g_free (tmpname); } @@ -1312,7 +1312,7 @@ save_clipping_path (GOutputStream *output, g_string_append_len (data, "\x00", 1); g_string_append_c (data, len + 6 + 1); - g_string_append_c (data, MIN (len, 255)); + g_string_append_c (data, (gchar) MIN (len, 255)); g_string_append_len (data, tmpname, MIN (len, 255)); g_free (tmpname); diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c index 65581611c8..fded06c5cc 100644 --- a/plug-ins/file-psd/psd-image-res-load.c +++ b/plug-ins/file-psd/psd-image-res-load.c @@ -823,7 +823,7 @@ load_resource_1022 (const PSDimageres *res_a, GError **error) { /* Load quick mask info */ - gboolean quick_mask_empty; /* Quick mask initially empty */ + gboolean quick_mask_empty = TRUE; /* Quick mask initially empty */ IFDBG(2) g_debug ("Process image resource block: 1022: Quick Mask"); @@ -1366,7 +1366,7 @@ load_resource_1069 (const PSDimageres *res_a, GInputStream *input, GError **error) { - guint16 layer_count; + guint16 layer_count = 0; gint i; IFDBG(2) g_debug ("Process image resource block: 1069: Layer Selection ID(s)"); @@ -1386,7 +1386,7 @@ load_resource_1069 (const PSDimageres *res_a, for (i = 0; i < layer_count; i++) { - guint32 layer_id; + guint32 layer_id = 0; if (psd_read (input, &layer_id, 4, error) < 4) { @@ -1534,7 +1534,7 @@ load_resource_2000 (const PSDimageres *res_a, gint32 x[3]; gint32 y[3]; GimpPath *path = NULL; - gint16 type; + gint16 type = 0; gint16 init_fill; gint16 num_rec; gint16 path_rec; @@ -1731,8 +1731,8 @@ load_resource_2999 (const PSDimageres *res_a, GError **error) { gchar *path_name; - gint16 path_flatness_int; - gint16 path_flatness_fixed; + gint16 path_flatness_int = 0; + gint16 path_flatness_fixed = 0; gfloat path_flatness; GimpParasite *parasite; gint32 read_len; diff --git a/plug-ins/file-psd/psd-layer-res-load.c b/plug-ins/file-psd/psd-layer-res-load.c index 4e6ab37065..f3c78bcbfd 100644 --- a/plug-ins/file-psd/psd-layer-res-load.c +++ b/plug-ins/file-psd/psd-layer-res-load.c @@ -542,17 +542,17 @@ load_resource_ltyp (const PSDlayerres *res_a, GError **error) { /* Load type tool layer */ - gint16 version; - gint16 text_desc_vers; - gint32 desc_version; + gint16 version = 0; + gint16 text_desc_vers = 0; + gint32 desc_version = 0; gint32 read_len; gint32 write_len; - guint64 t_xx; - guint64 t_xy; - guint64 t_yx; - guint64 t_yy; - guint64 t_tx; - guint64 t_ty; + guint64 t_xx = 0; + guint64 t_xy = 0; + guint64 t_yx = 0; + guint64 t_yy = 0; + guint64 t_tx = 0; + guint64 t_ty = 0; gchar *classID; IFDBG(2) g_debug ("Process layer resource block %.4s: Type tool layer", res_a->key); @@ -686,7 +686,7 @@ load_resource_lsct (const PSDlayerres *res_a, * Type 1: Open folder * Type 2: Closed folder * Type 3: End of most recent group */ - guint32 type; + guint32 type = 0; IFDBG(2) g_debug ("Process layer resource block %.4s: Section divider", res_a->key); if (psd_read (input, &type, 4, error) < 4) @@ -733,11 +733,11 @@ load_resource_lrfx (const PSDlayerres *res_a, GInputStream *input, GError **error) { - gint16 version; - gint16 count; - gchar signature[4]; - gchar effectname[4]; - gint i; + gint16 version = 0; + gint16 count = 0; + gchar signature[4]; + gchar effectname[4]; + gint i; IFDBG(2) g_debug ("Process layer resource block %.4s: Layer effects", res_a->key); @@ -826,7 +826,7 @@ load_resource_lrfx (const PSDlayerres *res_a, } else if (memcmp (effectname, "oglw", 4) == 0) { - gint32 size; + gint32 size = 0; gint32 ver; gint32 blur; gint32 intensity; @@ -870,20 +870,20 @@ load_resource_lrfx (const PSDlayerres *res_a, } else if (memcmp (effectname, "iglw", 4) == 0) { - gint32 size; - gint32 ver; - gint32 blur; - gint32 intensity; - gint32 angle; - gint32 distance; - gint16 color[5]; - gint32 blendsig; - gint32 effect; - gchar effecton; - gchar anglefx; - gchar opacity; - gchar invert; - gint16 natcolor[5]; + gint32 size = 0; + gint32 ver; + gint32 blur; + gint32 intensity; + gint32 angle; + gint32 distance; + gint16 color[5]; + gint32 blendsig; + gint32 effect; + gchar effecton; + gchar anglefx; + gchar opacity; + gchar invert; + gint16 natcolor[5]; if (psd_read (input, &size, 4, error) < 4 || psd_read (input, &ver, 4, error) < 4 || @@ -928,7 +928,7 @@ load_resource_lrfx (const PSDlayerres *res_a, } else if (memcmp (effectname, "bevl", 4) == 0) { - gint32 size; + gint32 size = 0; gint32 ver; gint32 angle; gint32 strength; @@ -1044,7 +1044,7 @@ load_resource_lyvr (const PSDlayerres *res_a, GInputStream *input, GError **error) { - gint32 version; + gint32 version = 0; IFDBG(2) g_debug ("Process layer resource block %.4s: layer version", res_a->key); diff --git a/plug-ins/file-psd/psd-thumb-load.c b/plug-ins/file-psd/psd-thumb-load.c index 27bbce38ac..3a0a3e2700 100644 --- a/plug-ins/file-psd/psd-thumb-load.c +++ b/plug-ins/file-psd/psd-thumb-load.c @@ -157,8 +157,8 @@ read_header_block (PSDimage *img_a, GInputStream *input, GError **error) { - guint16 version; - gchar sig[4] = {0}; + guint16 version = 0; + gchar sig[4] = {0}; gchar buf[6]; if (psd_read (input, sig, 4, error) < 4 ||