Newer
Older
minerva / Ports / libjxl / patches / 0001-Explicitly-cast-to-boolean.patch
@minerva minerva on 13 Jul 1 KB Initial commit
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lucas CHOLLET <lucas.chollet@free.fr>
Date: Sun, 17 Sep 2023 23:18:14 +0200
Subject: [PATCH] Explicitly cast to boolean

This patch remove two warnings that stop the compilation.
---
 lib/extras/dec/jpg.cc | 2 +-
 lib/extras/enc/jpg.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/extras/dec/jpg.cc b/lib/extras/dec/jpg.cc
index 3c8a4bccfec5cf9ef6610bfcd3f621fe893b357c..8e7eed85b746922549e6abf9c982e46294ee70ab 100644
--- a/lib/extras/dec/jpg.cc
+++ b/lib/extras/dec/jpg.cc
@@ -278,7 +278,7 @@ Status DecodeImageJPG(const Span<const uint8_t> bytes,
     if (dparams && dparams->num_colors > 0) {
       cinfo.quantize_colors = TRUE;
       cinfo.desired_number_of_colors = dparams->num_colors;
-      cinfo.two_pass_quantize = dparams->two_pass_quant;
+      cinfo.two_pass_quantize = static_cast<boolean>(dparams->two_pass_quant);
       cinfo.dither_mode = (J_DITHER_MODE)dparams->dither_mode;
     }
 
diff --git a/lib/extras/enc/jpg.cc b/lib/extras/enc/jpg.cc
index f1355bbcb7975882f37ccd7b8e5fb4b195b3f250..410a6425c521314a62fb122f3b9848df8c44c51a 100644
--- a/lib/extras/enc/jpg.cc
+++ b/lib/extras/enc/jpg.cc
@@ -292,7 +292,7 @@ Status EncodeWithLibJpeg(const PackedImage& image, const JxlBasicInfo& info,
   cinfo.input_components = info.num_color_channels;
   cinfo.in_color_space = info.num_color_channels == 1 ? JCS_GRAYSCALE : JCS_RGB;
   jpeg_set_defaults(&cinfo);
-  cinfo.optimize_coding = params.optimize_coding;
+  cinfo.optimize_coding = static_cast<boolean>(params.optimize_coding);
   if (cinfo.input_components == 3) {
     JXL_RETURN_IF_ERROR(
         SetChromaSubsampling(params.chroma_subsampling, &cinfo));