[poppler] poppler/JPEG2000Stream.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 22 19:58:46 UTC 2021


 poppler/JPEG2000Stream.cc |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 7d7e09cf815c94bb3e50e6ef957dc81a14964f2f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Feb 20 23:11:29 2021 +0100

    JPEG2000Stream.cc: Remove useless two if (priv->image)
    
    We're already inside an if (priv->image) check

diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index 2a3cc4c6..6223e427 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -4,7 +4,7 @@
 //
 // A JPX stream decoder using OpenJPEG
 //
-// Copyright 2008-2010, 2012, 2017-2020 Albert Astals Cid <aacid at kde.org>
+// Copyright 2008-2010, 2012, 2017-2021 Albert Astals Cid <aacid at kde.org>
 // Copyright 2011 Daniel Glöckner <daniel-gl at gmx.net>
 // Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
@@ -267,24 +267,22 @@ void JPXStream::init()
     gfree(buf);
 
     if (priv->image) {
-        int numComps = (priv->image) ? priv->image->numcomps : 1;
+        int numComps = priv->image->numcomps;
         int alpha = 0;
-        if (priv->image) {
-            if (priv->image->color_space == OPJ_CLRSPC_SRGB && numComps == 4) {
-                numComps = 3;
-                alpha = 1;
-            } else if (priv->image->color_space == OPJ_CLRSPC_SYCC && numComps == 4) {
-                numComps = 3;
-                alpha = 1;
-            } else if (numComps == 2) {
-                numComps = 1;
-                alpha = 1;
-            } else if (numComps > 4) {
-                numComps = 4;
-                alpha = 1;
-            } else {
-                alpha = 0;
-            }
+        if (priv->image->color_space == OPJ_CLRSPC_SRGB && numComps == 4) {
+            numComps = 3;
+            alpha = 1;
+        } else if (priv->image->color_space == OPJ_CLRSPC_SYCC && numComps == 4) {
+            numComps = 3;
+            alpha = 1;
+        } else if (numComps == 2) {
+            numComps = 1;
+            alpha = 1;
+        } else if (numComps > 4) {
+            numComps = 4;
+            alpha = 1;
+        } else {
+            alpha = 0;
         }
         priv->npixels = priv->image->comps[0].w * priv->image->comps[0].h;
         priv->ncomps = priv->image->numcomps;


More information about the poppler mailing list