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

David Ostrovsky david at ostrovsky.org
Wed Dec 3 00:02:13 PST 2014


 filter/source/graphicfilter/itiff/itiff.cxx |    4 ++--
 include/vcl/bitmap.hxx                      |    2 +-
 include/vcl/salbtype.hxx                    |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit f4aebede2b575f7572acdccbe74873ccf2c8683d
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Sun Nov 30 23:37:56 2014 +0100

    Fix "result of 32-bit shift implicitly converted to 64 bits" on WNT x64
    
    On Windows x64 long is only 32-bit (while on other x64 platforms it is
    typically 64-bit), but sal_uLong is not a typedef for unsigned long, but
    rather for sal_uIntPtr, which in turn is large enough to take recast
    pointer values (i.e., always 64-bit on 64-bit platforms).
    sal_uLong was introduced as a "temporary helper type" to ease transition
    from the old tools/solar.h types ("ULONG" etc.), but in the long run it
    should be remove from the code base, and places that now use sal_uLong
    analysed to use more appropriate types.
    
    As short term solution, cast to sal_uLong fixes it.
    
    Change-Id: I2169b7858517313616007a8fb2acc5c7d0487719
    Reviewed-on: https://gerrit.libreoffice.org/13232
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 719f51d..c778e80 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -498,7 +498,7 @@ void TIFFReader::ReadTagData( sal_uInt16 nTagType, sal_uInt32 nDataLen)
         case 0x0140: { // Color Map
             sal_uInt16 nVal;
             sal_uLong i;
-            nNumColors= ( 1UL << nBitsPerSample );
+            nNumColors= ( (sal_uLong)1 << nBitsPerSample );
             if ( nDataType == 3 && nNumColors <= 256)
             {
                 pColorMap = new sal_uLong[ 256 ];
@@ -1094,7 +1094,7 @@ void TIFFReader::MakePalCol( void )
             pColorMap = new sal_uLong[ 256 ];
         if ( nPhotometricInterpretation <= 1 )
         {
-            nNumColors = 1UL << nBitsPerSample;
+            nNumColors = (sal_uLong)1 << nBitsPerSample;
             if ( nNumColors > 256 )
                 nNumColors = 256;
             pAcc->SetPaletteEntryCount( (sal_uInt16)nNumColors );
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index accb763..6e445e3 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -914,7 +914,7 @@ inline void Bitmap::SetPrefSize( const Size& rSize )
 
 inline sal_uLong Bitmap::GetColorCount() const
 {
-    return( 1UL << (sal_uLong) GetBitCount() );
+    return( (sal_uLong)1 << (sal_uLong) GetBitCount() );
 }
 
 inline sal_uLong Bitmap::GetSizeBytes() const
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 9859aa3..5c466f0 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -732,13 +732,13 @@ inline long ColorMask::ImplCalcMaskShift( sal_uLong nMask, sal_uLong& rOr, sal_u
     sal_uLong   nLen = 0UL;
 
     // from which bit starts the mask?
-    for( nShift = 31L; ( nShift >= 0L ) && !( nMask & ( 1 << (sal_uLong) nShift ) ); nShift-- )
+    for( nShift = 31L; ( nShift >= 0L ) && !( nMask & ( (sal_uLong)1 << (sal_uLong) nShift ) ); nShift-- )
     {}
 
     nRet = nShift;
 
     // XXX determine number of bits set => walk right until null
-    while( ( nShift >= 0L ) && ( nMask & ( 1 << (sal_uLong) nShift ) ) )
+    while( ( nShift >= 0L ) && ( nMask & ( (sal_uLong)1 << (sal_uLong) nShift ) ) )
     {
         nShift--;
         nLen++;


More information about the Libreoffice-commits mailing list