[gimp/gimp-2-10] plug-ins: some cleaning in HEIF plug-in.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: some cleaning in HEIF plug-in.
- Date: Tue, 2 Jul 2019 15:37:03 +0000 (UTC)
commit 262d2023fa24d5d7642205834769e56f2ff8cd20
Author: Jehan <jehan girinstud io>
Date: Mon Jul 1 19:14:28 2019 +0200
plug-ins: some cleaning in HEIF plug-in.
heif_chroma_interleaved_24|32bit are deprecated values replaced by
heif_chroma_interleaved_RGB(A).
Also we allocated a HEIF context twice (i.e. leaking it).
Finally it's better to initialize heif_image and heif_encoder variables
to NULL because these may not be set if creation functions fail (and
it's better to fail with NULL than with garbled unset contents).
(cherry picked from commit f4af95ab9530b8fb4bd551080bb6b520f4b0f346)
plug-ins/common/file-heif.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c
index ab1b80fbd8..5d69079c76 100644
--- a/plug-ins/common/file-heif.c
+++ b/plug-ins/common/file-heif.c
@@ -350,8 +350,8 @@ load_image (GFile *file,
gsize bytes_read;
struct heif_context *ctx;
struct heif_error err;
- struct heif_image_handle *handle = NULL;
- struct heif_image *img = NULL;
+ struct heif_image_handle *handle = NULL;
+ struct heif_image *img = NULL;
GimpColorProfile *profile = NULL;
gint n_images;
heif_item_id primary;
@@ -480,8 +480,8 @@ load_image (GFile *file,
err = heif_decode_image (handle,
&img,
heif_colorspace_RGB,
- has_alpha ? heif_chroma_interleaved_32bit :
- heif_chroma_interleaved_24bit,
+ has_alpha ? heif_chroma_interleaved_RGBA :
+ heif_chroma_interleaved_RGB,
NULL);
if (err.code)
{
@@ -683,8 +683,8 @@ save_image (GFile *file,
{
struct heif_image *image = NULL;
struct heif_context *context = heif_context_alloc ();
- struct heif_encoder *encoder;
- struct heif_image_handle *handle;
+ struct heif_encoder *encoder = NULL;
+ struct heif_image_handle *handle = NULL;
struct heif_writer writer;
struct heif_error err;
GOutputStream *output;
@@ -795,8 +795,6 @@ save_image (GFile *file,
/* encode to HEIF file */
- context = heif_context_alloc ();
-
err = heif_context_get_encoder_for_format (context,
heif_compression_HEVC,
&encoder);
@@ -896,14 +894,14 @@ load_thumbnails (struct heif_context *heif,
for (i = 0; i < n_images; i++)
{
- struct heif_image_handle *handle;
+ struct heif_image_handle *handle = NULL;
struct heif_error err;
gint width;
gint height;
- struct heif_image_handle *thumbnail_handle;
+ struct heif_image_handle *thumbnail_handle = NULL;
heif_item_id thumbnail_ID;
gint n_thumbnails;
- struct heif_image *thumbnail_img;
+ struct heif_image *thumbnail_img = NULL;
gint thumbnail_width;
gint thumbnail_height;
@@ -971,7 +969,7 @@ load_thumbnails (struct heif_context *heif,
err = heif_decode_image (thumbnail_handle,
&thumbnail_img,
heif_colorspace_RGB,
- heif_chroma_interleaved_24bit,
+ heif_chroma_interleaved_RGB,
NULL);
if (err.code)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]