vcl/source/bitmap/BitmapPopArtFilter.cxx |   17 +----------------
 vcl/source/gdi/impvect.cxx               |   15 +++------------
 2 files changed, 4 insertions(+), 28 deletions(-)

New commits:
commit 7fc057876e21c857cd033502a5cc02a07c462a58
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Oct 2 10:27:10 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Oct 2 13:54:35 2019 +0200

    tdf#127913 crash applying popart filter to an image
    
    regression from
        commit 1cd32bcf1b92bd53320717626601135623dadd55
        Date:   Mon Dec 10 11:28:59 2018 +0200
        loplugin:useuniqueptr in vcl
    
    where I failed to note that sort needs a different kind of comparator to
    qsort.
    Also fix another similar issue I introduced in that commit
    
    Change-Id: I5a93bd0567cd5dd4344b9cf2c362ebff60fa0027
    Reviewed-on: https://gerrit.libreoffice.org/80007
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit e347a6bbb58a20e29e691a194c1cd3193d2c5a23)
    Reviewed-on: https://gerrit.libreoffice.org/80012

diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx 
b/vcl/source/bitmap/BitmapPopArtFilter.cxx
index 6f83ad47c566..5d67d815bbe4 100644
--- a/vcl/source/bitmap/BitmapPopArtFilter.cxx
+++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx
@@ -57,22 +57,7 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
             // sort table
             std::sort(aPopArtTable.begin(), aPopArtTable.end(),
                       [](const PopArtEntry& lhs, const PopArtEntry& rhs) {
-                          int nRet;
-
-                          if (lhs.mnCount < rhs.mnCount)
-                          {
-                              nRet = 1;
-                          }
-                          else if (lhs.mnCount == rhs.mnCount)
-                          {
-                              nRet = 0;
-                          }
-                          else
-                          {
-                              nRet = -1;
-                          }
-
-                          return nRet;
+                          return lhs.mnCount < rhs.mnCount;
                       });
 
             // get last used entry
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index a27094c02f9a..bf5d2fc4fcb7 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -112,24 +112,15 @@ struct ImplColorSet
     bool        mbSet = false;
 };
 
-static int ImplColorSetCmpFnc( const ImplColorSet& lhs, const ImplColorSet& 
rhs)
+static bool ImplColorSetCmpFnc( const ImplColorSet& lhs, const ImplColorSet& 
rhs)
 {
-    int             nRet;
-
     if( lhs.mbSet && rhs.mbSet )
     {
         const sal_uInt8 cLum1 = lhs.maColor.GetLuminance();
         const sal_uInt8 cLum2 = rhs.maColor.GetLuminance();
-        nRet = ( cLum1 > cLum2 ) ? -1 : ( ( cLum1 == cLum2 ) ? 0 : 1 );
+        return cLum1 < cLum2;
     }
-    else if( lhs.mbSet )
-        nRet = -1;
-    else if( rhs.mbSet )
-        nRet = 1;
-    else
-        nRet = 0;
-
-    return nRet;
+    return lhs.mbSet < rhs.mbSet;
 }
 
 class ImplPointArray
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to