[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Mon Feb 22 14:53:23 UTC 2016


 vcl/source/gdi/octree.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 89fe180fbcdfcd8ee3f52955a29eccd3b9ad0f36
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Feb 22 15:52:51 2016 +0100

    Silence -fsanitize=shift ("left shift of negative value")
    
    Change-Id: Ifa70183b86819c85611feda671fe76d4a2bf86d9

diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index 81ba003..7e54f07 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -256,9 +256,9 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
         long bdist = cBlue - x2;
         rdist = rdist*rdist + gdist*gdist + bdist*bdist;
 
-        const long crinc = ( xsqr - ( cRed << nBits ) ) << 1L;
-        const long cginc = ( xsqr - ( cGreen << nBits ) ) << 1L;
-        const long cbinc = ( xsqr - ( cBlue << nBits ) ) << 1L;
+        const long crinc = static_cast<unsigned long>( xsqr - ( cRed << nBits ) ) << 1L;
+        const long cginc = static_cast<unsigned long>( xsqr - ( cGreen << nBits ) ) << 1L;
+        const long cbinc = static_cast<unsigned long>( xsqr - ( cBlue << nBits ) ) << 1L;
 
         sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer);
         sal_uInt8* crgbp = pMap;


More information about the Libreoffice-commits mailing list