summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2014-11-30 23:37:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-03 08:01:46 +0000
commitf4aebede2b575f7572acdccbe74873ccf2c8683d (patch)
treeed0ad5c043d05420bdcd4a67f639e9edfc8d8a55
parent5f1de30c6373ae41480aad13e49876bfac8a2156 (diff)
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@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx4
-rw-r--r--include/vcl/bitmap.hxx2
-rw-r--r--include/vcl/salbtype.hxx4
3 files changed, 5 insertions, 5 deletions
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 719f51d997c2..c778e807d736 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 accb763c5faa..6e445e37a865 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 9859aa3f1b83..5c466f08cde3 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++;