summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-02 10:27:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-02 11:11:41 +0200
commite347a6bbb58a20e29e691a194c1cd3193d2c5a23 (patch)
tree0a8f29fedc860452957efa6a6e25998659f19234 /vcl
parentc386f07ce195c2167f1b56d23cfd95292634e2de (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/bitmap/BitmapPopArtFilter.cxx17
-rw-r--r--vcl/source/gdi/impvect.cxx15
2 files changed, 4 insertions, 28 deletions
diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx b/vcl/source/bitmap/BitmapPopArtFilter.cxx
index 621f95fe9c46..a335f04fb824 100644
--- a/vcl/source/bitmap/BitmapPopArtFilter.cxx
+++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx
@@ -54,22 +54,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 52174a012c19..5ecfb6aedbd1 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -109,24 +109,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