Kaydet (Commit) f4aebede authored tarafından David Ostrovsky's avatar David Ostrovsky Kaydeden (comit) Stephan Bergmann

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/13232Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Tested-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 5f1de30c
......@@ -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 );
......
......@@ -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
......
......@@ -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++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment