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

New commits:
commit 7d7e09cf815c94bb3e50e6ef957dc81a14964f2f
Author: Albert Astals Cid <[email protected]>
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 <[email protected]>
+// Copyright 2008-2010, 2012, 2017-2021 Albert Astals Cid <[email protected]>
 // Copyright 2011 Daniel Glöckner <[email protected]>
 // Copyright 2014, 2016 Thomas Freitag <[email protected]>
 // Copyright 2013, 2014 Adrian Johnson <[email protected]>
@@ -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;
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to