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

Tor Lillqvist tml at collabora.com
Thu Mar 19 11:36:12 PDT 2015


 include/vcl/salbtype.hxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a25fa1cb0266bb8461323b5d856c3c979d538114
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Mar 19 20:24:39 2015 +0200

    MSVC and gcc are wrong, Clang was right, apparently
    
    The 'unsigned int(expression)' syntax is *not* correct, says
    http://en.cppreference.com/w/cpp/language/explicit_cast, but
    apparently MSVC and gcc don't mind. Clang doesn't like it, though.
    Re-introduce kendy's change but use static_cast instead of functional
    cast.
    
    This reverts commit 33d2475d9f2f01308ba4675ac99aaabb43870e0f
    
    Change-Id: I799cce13e9bebf1a375243c294c4fa8788502ec6

diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 40dfd8f..d5bbc73 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -406,7 +406,7 @@ inline BitmapColor& BitmapColor::Invert()
 inline sal_uInt8 BitmapColor::GetLuminance() const
 {
     DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
-    return( (sal_uInt8) ( ( mcBlueOrIndex * 28UL + mcGreen * 151UL + mcRed * 77UL ) >> 8UL ) );
+    return (static_cast<unsigned long>(mcBlueOrIndex) * 28UL + static_cast<unsigned long>(mcGreen) * 151UL + static_cast<unsigned long>(mcRed) * 77UL) >> 8;
 }
 
 inline BitmapColor& BitmapColor::IncreaseLuminance( sal_uInt8 cGreyInc )


More information about the Libreoffice-commits mailing list