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

Stephan Bergmann sbergman at redhat.com
Wed Feb 24 16:01:02 UTC 2016


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

New commits:
commit c684cde025e750d24de47260a2166a46428cdffc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Feb 24 16:58:44 2016 +0100

    Ah, xsqr got changed from unsigned to singed
    
    ...in 8bcc538953ceec4ef266f16cf72329bc6080d08c "WaE vs2015 literal implicit
    casting," that explains why 89fe180fbcdfcd8ee3f52955a29eccd3b9ad0f36 "Silence
    -fsanitize=shift ("left shift of negative value")" became necessary afterwards
    
    Change-Id: I1b3d09ba59d60a88e34e48cc3697a20084623817

diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index 7e54f07..cc1f3d5 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -234,8 +234,8 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
             nBits( 8 - OCTREE_BITS )
 {
     const int     nColorMax = 1 << OCTREE_BITS;
-    const long     xsqr = 1L << ( nBits << 1 );
-    const long     xsqr2 = xsqr << 1;
+    const unsigned long xsqr = 1L << ( nBits << 1 );
+    const unsigned long xsqr2 = xsqr << 1;
     const int     nColors = rPal.GetEntryCount();
     const long      x = 1L << nBits;
     const long      x2 = x >> 1L;
@@ -256,9 +256,9 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
         long bdist = cBlue - x2;
         rdist = rdist*rdist + gdist*gdist + bdist*bdist;
 
-        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;
+        const long crinc = ( xsqr - ( cRed << nBits ) ) << 1L;
+        const long cginc = ( xsqr - ( cGreen << nBits ) ) << 1L;
+        const long cbinc = ( xsqr - ( cBlue << nBits ) ) << 1L;
 
         sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer);
         sal_uInt8* crgbp = pMap;


More information about the Libreoffice-commits mailing list