From 3265146b148b340b12c24190de36f802813b2262 Mon Sep 17 00:00:00 2001 From: sonia Date: Mon, 28 Mar 2022 23:05:47 +0200 Subject: [PATCH 1/3] fix initialized variables. --- plug-ins/file-psd/psd-image-res-load.c | 8 +++---- plug-ins/file-psd/psd-layer-res-load.c | 30 +++++++++++++------------- plug-ins/file-psd/psd-thumb-load.c | 6 +++--- plug-ins/file-tiff/file-tiff-load.c | 8 +++---- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c index 86a1f0f6602..05462671ce3 100644 --- a/plug-ins/file-psd/psd-image-res-load.c +++ b/plug-ins/file-psd/psd-image-res-load.c @@ -797,7 +797,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 = 0; /* Quick mask initially empty */ IFDBG(2) g_debug ("Process image resource block: 1022: Quick Mask"); @@ -1337,7 +1337,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)"); @@ -1357,7 +1357,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) { @@ -1494,7 +1494,7 @@ load_resource_2000 (const PSDimageres *res_a, gint32 x[3]; gint32 y[3]; GimpVectors *vectors = NULL; - gint16 type; + gint16 type = 0; gint16 init_fill; gint16 num_rec; gint16 path_rec; diff --git a/plug-ins/file-psd/psd-layer-res-load.c b/plug-ins/file-psd/psd-layer-res-load.c index 3e36c2733f0..d7eaf08b313 100644 --- a/plug-ins/file-psd/psd-layer-res-load.c +++ b/plug-ins/file-psd/psd-layer-res-load.c @@ -438,17 +438,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; static gboolean msg_flag = FALSE; @@ -589,7 +589,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) @@ -637,7 +637,7 @@ load_resource_lrfx (const PSDlayerres *res_a, GError **error) { gint16 version; - gint16 count; + gint16 count = 0; gchar signature[4]; gchar effectname[4]; gint i; @@ -729,7 +729,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; @@ -773,7 +773,7 @@ load_resource_lrfx (const PSDlayerres *res_a, } else if (memcmp (effectname, "iglw", 4) == 0) { - gint32 size; + gint32 size = 0; gint32 ver; gint32 blur; gint32 intensity; @@ -831,7 +831,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; @@ -947,7 +947,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 b6cc262dd08..742af49d68b 100644 --- a/plug-ins/file-psd/psd-thumb-load.c +++ b/plug-ins/file-psd/psd-thumb-load.c @@ -157,7 +157,7 @@ read_header_block (PSDimage *img_a, GInputStream *input, GError **error) { - guint16 version; + guint16 version = 0; gchar sig[4]; gchar buf[6]; @@ -209,7 +209,7 @@ read_color_mode_block (PSDimage *img_a, GInputStream *input, GError **error) { - guint64 block_len; + guint64 block_len = 0; guint64 block_start; guint64 block_end; @@ -237,7 +237,7 @@ read_image_resource_block (PSDimage *img_a, GInputStream *input, GError **error) { - guint64 block_len; + guint64 block_len = 0; guint64 block_end; if (psd_read (input, &block_len, 4, error) < 4) diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c index c26e7941689..9ef94ec81cb 100644 --- a/plug-ins/file-tiff/file-tiff-load.c +++ b/plug-ins/file-tiff/file-tiff-load.c @@ -1209,10 +1209,10 @@ load_image (GFile *file, /* any resolution info in the file? */ { - gfloat xres = 72.0; - gfloat yres = 72.0; - gushort read_unit; - GimpUnit unit = GIMP_UNIT_PIXEL; /* invalid unit */ + gfloat xres = 72.0; + gfloat yres = 72.0; + gushort read_unit = 0; + GimpUnit unit = GIMP_UNIT_PIXEL; /* invalid unit */ if (TIFFGetField (tif, TIFFTAG_XRESOLUTION, &xres)) { -- GitLab From 164079b93617359da7fc8da5da6a89dc36b9a575 Mon Sep 17 00:00:00 2001 From: sonia Date: Mon, 28 Mar 2022 23:33:55 +0200 Subject: [PATCH 2/3] remove extra parentheses. --- plug-ins/common/file-jp2-load.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug-ins/common/file-jp2-load.c b/plug-ins/common/file-jp2-load.c index 0e271005884..4ffe015f6e5 100644 --- a/plug-ins/common/file-jp2-load.c +++ b/plug-ins/common/file-jp2-load.c @@ -1242,7 +1242,7 @@ load_image (GFile *file, goto out; } } - else if ((image->color_space == OPJ_CLRSPC_CMYK)) + else if (image->color_space == OPJ_CLRSPC_CMYK) { if (! color_cmyk_to_rgb (image)) { -- GitLab From 25ff3a72f1812a8e6a1893368dac5917490ae268 Mon Sep 17 00:00:00 2001 From: sonia Date: Sun, 10 Apr 2022 23:16:34 +0200 Subject: [PATCH 3/3] fix typing warnings --- plug-ins/file-psd/psd-image-res-load.c | 2 +- plug-ins/file-psd/psd-load.c | 52 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c index 05462671ce3..627c4bba0d3 100644 --- a/plug-ins/file-psd/psd-image-res-load.c +++ b/plug-ins/file-psd/psd-image-res-load.c @@ -277,7 +277,7 @@ get_image_resource_header (PSDimageres *res_a, res_a->data_start = g_seekable_tell (G_SEEKABLE (input)); IFDBG(2) g_debug ("Type: %.4s, id: %d, start: %" G_GOFFSET_FORMAT ", len: %" G_GSIZE_FORMAT, - res_a->type, res_a->id, res_a->data_start, res_a->data_len); + res_a->type, res_a->id, res_a->data_start, (unsigned long)res_a->data_len); return 0; } diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c index a72fe688cef..9c678373f12 100644 --- a/plug-ins/file-psd/psd-load.c +++ b/plug-ins/file-psd/psd-load.c @@ -655,8 +655,8 @@ read_layer_info (PSDimage *img_a, GINT16_FROM_BE (lyr_a[lidx]->chn_info[cidx].channel_id); img_a->layer_data_len += lyr_a[lidx]->chn_info[cidx].data_len; IFDBG(3) g_debug ("Channel ID %d, data len %" G_GSIZE_FORMAT, - lyr_a[lidx]->chn_info[cidx].channel_id, - lyr_a[lidx]->chn_info[cidx].data_len); + lyr_a[lidx]->chn_info[cidx].channel_id, + (unsigned long)lyr_a[lidx]->chn_info[cidx].data_len); } if (psd_read (input, lyr_a[lidx]->mode_key, 4, error) < 4 || @@ -696,16 +696,16 @@ read_layer_info (PSDimage *img_a, IFDBG(2) g_debug ("\n\tLayer mode sig: %.4s\n\tBlend mode: %.4s\n\t" "Opacity: %d\n\tClipping: %d\n\tExtra data len: %" G_GSIZE_FORMAT "\n\t" "Alpha lock: %d\n\tVisible: %d\n\tIrrelevant: %d", - lyr_a[lidx]->mode_key, - lyr_a[lidx]->blend_mode, - lyr_a[lidx]->opacity, - lyr_a[lidx]->clipping, - lyr_a[lidx]->extra_len, - lyr_a[lidx]->layer_flags.trans_prot, - lyr_a[lidx]->layer_flags.visible, - lyr_a[lidx]->layer_flags.irrelevant); + lyr_a[lidx]->mode_key, + lyr_a[lidx]->blend_mode, + lyr_a[lidx]->opacity, + lyr_a[lidx]->clipping, + (unsigned long)lyr_a[lidx]->extra_len, + lyr_a[lidx]->layer_flags.trans_prot, + lyr_a[lidx]->layer_flags.visible, + lyr_a[lidx]->layer_flags.irrelevant); IFDBG(3) g_debug ("Offset: %" G_GOFFSET_FORMAT ", Remaining length %" G_GSIZE_FORMAT, - PSD_TELL(input), block_rem); + PSD_TELL(input), (unsigned long)block_rem); if (! lyr_a[lidx]->layer_flags.irrelevant) { @@ -748,20 +748,20 @@ read_layer_info (PSDimage *img_a, return NULL; } block_len = GUINT32_FROM_BE (block_len); - IFDBG(3) g_debug ("Layer mask record size %" G_GOFFSET_FORMAT, block_len); + IFDBG(3) g_debug ("Layer mask record size %" G_GOFFSET_FORMAT, (long long)block_len); if (block_len + 4 > block_rem) { g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unsupported or invalid mask info size.")); /* Translations have problems with using G_GSIZE_FORMAT, let's use g_debug. */ - g_debug ("Unsupported or invalid mask info size: %" G_GSIZE_FORMAT, block_len); + g_debug ("Unsupported or invalid mask info size: %" G_GSIZE_FORMAT, (unsigned long)block_len); free_lyr_a (lyr_a, img_a->num_layers); return NULL; } block_rem -= (block_len + 4); IFDBG(3) g_debug ("Offset: %" G_GOFFSET_FORMAT ", Remaining length %" G_GSIZE_FORMAT, - PSD_TELL(input), block_rem); + PSD_TELL(input), (unsigned long)block_rem); lyr_a[lidx]->layer_mask_extra.top = 0; lyr_a[lidx]->layer_mask_extra.left = 0; @@ -895,7 +895,7 @@ read_layer_info (PSDimage *img_a, IFDBG(1) { if (block_len > 3) - g_debug ("Skipping %" G_GOFFSET_FORMAT " bytes of unknown layer mask data", block_len); + g_debug ("Skipping %" G_GOFFSET_FORMAT " bytes of unknown layer mask data", (long long)block_len); } if (! psd_seek (input, block_len, G_SEEK_CUR, error)) @@ -968,9 +968,9 @@ read_layer_info (PSDimage *img_a, block_len = GUINT32_FROM_BE (block_len); block_rem -= (block_len + 4); IFDBG(3) g_debug ("Blending ranges size %" G_GSIZE_FORMAT - " (not imported)", block_len); + " (not imported)", (unsigned long)block_len); IFDBG(3) g_debug ("Offset: %" G_GOFFSET_FORMAT ", Remaining length %" G_GSIZE_FORMAT, - PSD_TELL(input), block_rem); + PSD_TELL(input), (unsigned long)block_rem); if (block_len > 0) { @@ -992,7 +992,7 @@ read_layer_info (PSDimage *img_a, block_rem -= read_len; IFDBG(3) g_debug ("Offset: %" G_GOFFSET_FORMAT ", Remaining length %" G_GSIZE_FORMAT, - PSD_TELL(input), block_rem); + PSD_TELL(input), (unsigned long)block_rem); /* Adjustment layer info */ /* FIXME */ @@ -1000,7 +1000,7 @@ read_layer_info (PSDimage *img_a, { gint header_size; IFDBG(3) g_debug ("Offset: %" G_GOFFSET_FORMAT ", Remaining length %" G_GSIZE_FORMAT, - PSD_TELL(input), block_rem); + PSD_TELL(input), (unsigned long)block_rem); header_size = get_layer_resource_header (&res_a, img_a->version, input, error); if (header_size < 0) { @@ -1035,7 +1035,7 @@ read_layer_info (PSDimage *img_a, return NULL; } block_rem -= res_a.data_len; - IFDBG(3) g_debug ("Remaining length in block: %" G_GSIZE_FORMAT, block_rem); + IFDBG(3) g_debug ("Remaining length in block: %" G_GSIZE_FORMAT, (unsigned long)block_rem); } if (block_rem > 0) { @@ -1058,7 +1058,7 @@ read_layer_info (PSDimage *img_a, IFDBG(1) g_debug ("Layer image data block start %" G_GOFFSET_FORMAT ", size %" G_GSIZE_FORMAT ", end: %" G_GOFFSET_FORMAT, - img_a->layer_data_start, img_a->layer_data_len, PSD_TELL(input)); + img_a->layer_data_start, (unsigned long)img_a->layer_data_len, PSD_TELL(input)); } return lyr_a; @@ -1194,7 +1194,7 @@ read_layer_block (PSDimage *img_a, /* Not fatal just skip remainder of this block. */ g_debug ("Invalid resource block length: %" G_GSIZE_FORMAT " is larger than maximum %" G_GSIZE_FORMAT, - res_a.data_len, total_len); + (unsigned long)res_a.data_len, total_len); break; } @@ -1572,9 +1572,9 @@ read_RLE_channel (PSDimage *img_a, IFDBG(4) g_debug ("RLE channel length %" G_GSIZE_FORMAT ", RLE length data: %d, " "RLE data block: %" G_GSIZE_FORMAT, - channel_data_len - 2, - rle_row_size, - (channel_data_len - 2 - rle_row_size)); + (unsigned long)channel_data_len - 2, + rle_row_size, + ((unsigned long)channel_data_len - 2 - rle_row_size)); rle_pack_len = g_malloc (lyr_chn->rows * 4); /* Always 4 since this is the data size in memory. */ for (rowi = 0; rowi < lyr_chn->rows; ++rowi) { @@ -1849,7 +1849,7 @@ add_layers (GimpImage *image, { case PSD_COMP_RAW: /* Planar raw data */ IFDBG(3) g_debug ("Raw data length: %" G_GSIZE_FORMAT, - lyr_a[lidx]->chn_info[cidx].data_len - 2); + (unsigned long)lyr_a[lidx]->chn_info[cidx].data_len - 2); if (read_channel_data (lyr_chn[cidx], img_a->bps, PSD_COMP_RAW, NULL, input, 0, error) < 1) -- GitLab