Kaydet (Commit) c578d1c8 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: filter

auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I39cc98d11a608d5fdad11c621b4cbde285204095
üst 1099ae1c
......@@ -88,7 +88,7 @@ void CacheItem::validateUINames(const OUString& sActLocale)
css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList()
{
sal_Int32 c = (sal_Int32)size();
sal_Int32 c = static_cast<sal_Int32>(size());
sal_Int32 i = 0;
css::uno::Sequence< css::beans::PropertyValue > lList(c);
......
......@@ -1362,7 +1362,7 @@ void FilterCache::impl_load(EFillState eRequiredState)
}
// update fill state. Note: it's a bit field, which combines different parts.
m_eFillState = (EFillState) ((sal_Int32)m_eFillState | (sal_Int32)eRequiredState);
m_eFillState = (EFillState) (static_cast<sal_Int32>(m_eFillState) | static_cast<sal_Int32>(eRequiredState));
// any data readed?
// yes! => validate it and update optimized structures.
......
......@@ -320,7 +320,7 @@ OUStringList FilterFactory::impl_queryMatchByDocumentService(const QueryTokenize
// "iflags=-1" => not allowed
// "iflags=0" => not useful
// "iflags=283648" => only filter, which has set these flag field will be addressed
sal_Int32 nCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, (sal_Int32)0);
sal_Int32 nCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, sal_Int32(0));
if (
(nIFlags > 0 ) &&
((nCheckValue & nIFlags) != nIFlags)
......@@ -379,7 +379,7 @@ class stlcomp_removeIfMatchFlags
try
{
const CacheItem aFilter = m_pCache->getItem(FilterCache::E_FILTER, sFilter);
sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, ((sal_Int32)0));
sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, (sal_Int32(0)));
bool bMatch = false;
if (m_bIFlags)
......
......@@ -76,7 +76,7 @@ void ImpSWFDialog::dispose()
Sequence< PropertyValue > ImpSWFDialog::GetFilterData()
{
sal_Int32 nCompressMode = (sal_Int32)mpNumFldQuality->GetValue();
sal_Int32 nCompressMode = static_cast<sal_Int32>(mpNumFldQuality->GetValue());
maConfigItem.WriteInt32( "CompressMode" , nCompressMode );
maConfigItem.WriteBool( "ExportAll", mpCheckExportAll->IsChecked() );
maConfigItem.WriteBool( "ExportBackgrounds", mpCheckExportBackgrounds->IsChecked() );
......
......@@ -502,7 +502,7 @@ void FlashExporter::exportShapes( const Reference< XShapes >& xShapes, bool bStr
{
OSL_ENSURE( (xShapes->getCount() <= 0xffff), "overflow in FlashExporter::exportDrawPageContents()" );
sal_uInt16 nShapeCount = (sal_uInt16)std::min( xShapes->getCount(), (sal_Int32)0xffff );
sal_uInt16 nShapeCount = static_cast<sal_uInt16>(std::min( xShapes->getCount(), sal_Int32(0xffff) ));
sal_uInt16 nShape;
Reference< XShape > xShape;
......@@ -629,7 +629,7 @@ bool FlashExporter::getMetaFile( Reference< XComponent > const &xComponent, GDIM
Sequence< PropertyValue > aFilterData(bExportAsJPEG ? 3 : 2);
aFilterData[0].Name = "Version";
aFilterData[0].Value <<= (sal_Int32)6000;
aFilterData[0].Value <<= sal_Int32(6000);
aFilterData[1].Name = "PageNumber";
aFilterData[1].Value <<= mnPageNumber;
......
......@@ -41,8 +41,8 @@ static sal_Int32 map100thmm( sal_Int32 n100thMM )
Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int32 nDocWidth, sal_Int32 nDocHeight, sal_Int32 nJPEGcompressMode )
: mnDocWidth( map100thmm(nDocWidth) ),
mnDocHeight( map100thmm(nDocHeight) ),
mnDocXScale( (double)nTWIPWidthOutput / mnDocWidth ),
mnDocYScale( (double)nTWIPHeightOutput / mnDocHeight ),
mnDocXScale( static_cast<double>(nTWIPWidthOutput) / mnDocWidth ),
mnDocYScale( static_cast<double>(nTWIPHeightOutput) / mnDocHeight ),
mpClipPolyPolygon( nullptr ),
mpTag( nullptr ),
mpSprite( nullptr ),
......@@ -60,7 +60,7 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int
mpFontsStream = maFontsTempFile.GetStream( StreamMode::WRITE|StreamMode::TRUNC );
// define an invisible button with the size of a page
tools::Rectangle aRect( 0, 0, (long)( mnDocWidth * mnDocXScale ), (long)( mnDocHeight * mnDocYScale ) );
tools::Rectangle aRect( 0, 0, static_cast<long>( mnDocWidth * mnDocXScale ), static_cast<long>( mnDocHeight * mnDocYScale ) );
tools::Polygon aPoly( aRect );
FillStyle aFill = FillStyle( Color(COL_WHITE) );
mnWhiteBackgroundShapeId = defineShape( aPoly, aFill );
......
......@@ -52,14 +52,14 @@ namespace tools
inline sal_uInt16 uInt16_( sal_Int32 nValue )
{
OSL_ENSURE( (nValue >= 0) && ((sal_uInt32)nValue <= 0xffff), "overflow while converting sal_Int32 to sal_uInt16" );
return (sal_uInt16)nValue;
OSL_ENSURE( (nValue >= 0) && (static_cast<sal_uInt32>(nValue) <= 0xffff), "overflow while converting sal_Int32 to sal_uInt16" );
return static_cast<sal_uInt16>(nValue);
}
inline sal_Int16 Int16_( sal_Int32 nValue )
{
OSL_ENSURE( (nValue >= -32768) && (nValue <= 32767), "overflow while converting sal_Int32 to sal_Int16" );
return (sal_Int16)nValue;
return static_cast<sal_Int16>(nValue);
}
class VirtualDevice;
......
......@@ -57,8 +57,8 @@ Point Writer::map( const Point& rPoint ) const
// AS: Produces a 'possible loss of data' warning that we can't fix without
// hurting code readability.
retPoint.X() = (long)( retPoint.X() * mnDocXScale );
retPoint.Y() = (long)( retPoint.Y() * mnDocYScale );
retPoint.X() = static_cast<long>( retPoint.X() * mnDocXScale );
retPoint.Y() = static_cast<long>( retPoint.Y() * mnDocYScale );
return retPoint;
}
......@@ -72,8 +72,8 @@ Size Writer::map( const Size& rSize ) const
// AS: Produces a 'possible loss of data' warning that we can't fix without
// hurting code readability.
retSize.Width() = (long)( retSize.Width() * mnDocXScale );
retSize.Height() = (long)( retSize.Height() * mnDocYScale );
retSize.Width() = static_cast<long>( retSize.Width() * mnDocXScale );
retSize.Height() = static_cast<long>( retSize.Height() * mnDocYScale );
return retSize;
}
......@@ -229,7 +229,7 @@ void Writer::Impl_addCurvedEdgeRecord( BitStream& rBits, sal_Int16 control_dx, s
std::max( getMaxBitsSigned( control_dx ),
std::max( getMaxBitsSigned( control_dy ),
std::max( getMaxBitsSigned( anchor_dx ),
std::max( getMaxBitsSigned( anchor_dy ), (sal_uInt16)3 ) ) ) ) );
std::max( getMaxBitsSigned( anchor_dy ), sal_uInt16(3) ) ) ) ) );
rBits.writeUB( nBits - 2, 4 ); // Number of bits per value
......@@ -496,7 +496,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
{
// todo: optimize me as this will generate a huge amount of duplicate polygons
tools::PolyPolygon aPolyPoygon;
mpVDev->GetTextOutline( aPolyPoygon, rText, (sal_uInt16)nLen, nWidth, pDXArray );
mpVDev->GetTextOutline( aPolyPoygon, rText, static_cast<sal_uInt16>(nLen), nWidth, pDXArray );
aPolyPoygon.Translate( rPos );
Impl_writePolyPolygon( aPolyPoygon, true, aTextColor, aTextColor );
}
......@@ -525,7 +525,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
{
const double fFactor = (double) nWidth / aNormSize.Width();
const double fFactor = static_cast<double>(nWidth) / aNormSize.Width();
for( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
pDX[ i ] = FRound( pDX[ i ] * fFactor );
......@@ -591,7 +591,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
const long n1 = aFont.GetFontSize().Width();
const long n2 = aMetric2.GetFontSize().Width();
scale = (double)n1 / (double)n2;
scale = static_cast<double>(n1) / static_cast<double>(n2);
}
basegfx::B2DHomMatrix m(basegfx::utils::createRotateB2DHomMatrix(static_cast<double>(nOrientation) * F_PI1800));
......@@ -623,7 +623,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
DBG_ASSERT( nLen <= 127, "TODO: handle text with more than 127 characters" );
// Glyph record
mpTag->addUI8( (sal_uInt8) nLen );
mpTag->addUI8( static_cast<sal_uInt8>(nLen) );
BitStream aBits;
......@@ -642,7 +642,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
}
aBits.writeUB( rFlashFont.getGlyph(rText[i],mpVDev), nGlyphBits );
aBits.writeSB( Int16_(map( Size( (long)( nAdvance / scale ), 0 ) ).Width() ), nAdvanceBits );
aBits.writeSB( Int16_(map( Size( static_cast<long>( nAdvance / scale ), 0 ) ).Width() ), nAdvanceBits );
}
mpTag->addBits( aBits );
......@@ -783,7 +783,7 @@ sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQuali
getBitmapData( bmpSource, pImageData, pAlphaData, width, height );
sal_uInt32 raw_size = width * height * 4;
uLongf compressed_size = raw_size + (sal_uInt32)(raw_size/100) + 12;
uLongf compressed_size = raw_size + static_cast<sal_uInt32>(raw_size/100) + 12;
std::unique_ptr<sal_uInt8[]> pCompressed(new sal_uInt8[ compressed_size ]);
#ifdef DBG_UTIL
......@@ -801,7 +801,7 @@ sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQuali
std::unique_ptr<sal_uInt8[]> pAlphaCompressed;
if (bmpSource.IsAlpha() || bmpSource.IsTransparent())
{
alpha_compressed_size = uLongf(width * height + (sal_uInt32)(raw_size/100) + 12);
alpha_compressed_size = uLongf(width * height + static_cast<sal_uInt32>(raw_size/100) + 12);
pAlphaCompressed.reset(new sal_uInt8[ compressed_size ]);
#ifdef DBG_UTIL
......@@ -922,7 +922,7 @@ void Writer::Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Si
double qualityScale = (pixXScale + pixYScale)/2;
nJPEGQuality = (sal_Int32)( nJPEGQuality * qualityScale );
nJPEGQuality = static_cast<sal_Int32>( nJPEGQuality * qualityScale );
if (nJPEGQuality < 10)
nJPEGQuality += 3;
......@@ -1171,9 +1171,9 @@ bool Writer::Impl_writeStroke( SvtGraphicStroke const & rStroke )
Color aColor( mpVDev->GetLineColor() );
if( 0.0 != rStroke.getTransparency() )
aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( (long int)( rStroke.getTransparency() * 0xff ), 0, 0xff ) ) );
aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( static_cast<long int>( rStroke.getTransparency() * 0xff ), 0, 0xff ) ) );
sal_uInt16 nShapeId = defineShape( aPolyPolygon, sal::static_int_cast<sal_uInt16>( mapRelative( (sal_Int32)( rStroke.getStrokeWidth() ) ) ), aColor );
sal_uInt16 nShapeId = defineShape( aPolyPolygon, sal::static_int_cast<sal_uInt16>( mapRelative( static_cast<sal_Int32>( rStroke.getStrokeWidth() ) ) ), aColor );
maShapeIds.push_back( nShapeId );
return true;
}
......@@ -1200,7 +1200,7 @@ bool Writer::Impl_writeFilling( SvtGraphicFill const & rFilling )
Color aColor( rFilling.getFillColor() );
if( 0.0 != rFilling.getTransparency() )
aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( (long int)( rFilling.getTransparency() * 0xff ) , 0, 0xff ) ) );
aColor.SetTransparency( sal::static_int_cast<sal_uInt8>( MinMax( static_cast<long int>( rFilling.getTransparency() * 0xff ) , 0, 0xff ) ) );
FillStyle aFillStyle( aColor );
......@@ -1239,8 +1239,8 @@ bool Writer::Impl_writeFilling( SvtGraphicFill const & rFilling )
aMatrix.set(2, 2, 1.0);
// scale bitmap
double XScale = aOldRect.GetWidth() ? (double)aNewRect.GetWidth()/aOldRect.GetWidth() : 1.0;
double YScale = aOldRect.GetHeight() ? (double)aNewRect.GetHeight()/aOldRect.GetHeight() : 1.0;
double XScale = aOldRect.GetWidth() ? static_cast<double>(aNewRect.GetWidth())/aOldRect.GetWidth() : 1.0;
double YScale = aOldRect.GetHeight() ? static_cast<double>(aNewRect.GetHeight())/aOldRect.GetHeight() : 1.0;
aMatrix.scale( XScale, YScale );
......@@ -1518,7 +1518,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
if( rPolyPoly.Count() )
{
// convert transparence from percent into 0x00 - 0xff
sal_uInt8 nTransparence = (sal_uInt8) MinMax( FRound( pA->GetTransparence() * 2.55 ), 0, 255 );
sal_uInt8 nTransparence = static_cast<sal_uInt8>(MinMax( FRound( pA->GetTransparence() * 2.55 ), 0, 255 ));
Impl_writePolyPolygon( rPolyPoly, true, nTransparence );
}
}
......@@ -1532,8 +1532,8 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
const Size aSrcSize( aTmpMtf.GetPrefSize() );
const Point aDestPt( pA->GetPoint() );
const Size aDestSize( pA->GetSize() );
const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
const double fScaleX = aSrcSize.Width() ? static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0;
const double fScaleY = aSrcSize.Height() ? static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0;
long nMoveX, nMoveY;
if( fScaleX != 1.0 || fScaleY != 1.0 )
......@@ -1550,10 +1550,10 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
aTmpMtf.Move( nMoveX, nMoveY );
const Gradient& rGradient = pA->GetGradient();
sal_uInt32 nLuminance = ((sal_Int32)rGradient.GetStartColor().GetLuminance() + (sal_Int32)rGradient.GetEndColor().GetLuminance() ) >> 1;
sal_uInt32 nLuminance = (static_cast<sal_Int32>(rGradient.GetStartColor().GetLuminance()) + static_cast<sal_Int32>(rGradient.GetEndColor().GetLuminance()) ) >> 1;
sal_uInt8 nOldGlobalTransparency = mnGlobalTransparency;
mnGlobalTransparency = (sal_uInt8)MinMax( nLuminance, 0, 0xff );
mnGlobalTransparency = static_cast<sal_uInt8>(MinMax( nLuminance, 0, 0xff ));
mpVDev->Push();
Impl_writeActions( aTmpMtf );
......
......@@ -315,8 +315,8 @@ void Tag::writeMatrix( SvStream& rOut, const ::basegfx::B2DHomMatrix& rMatrix )
sal_uInt8 nTranslateBits = 16;
aBits.writeUB( nTranslateBits, 5 );
aBits.writeSB( (sal_Int16)rMatrix.get(0, 2), nTranslateBits ); // Translate X
aBits.writeSB( (sal_Int16)rMatrix.get(1, 2), nTranslateBits ); // Translate Y
aBits.writeSB( static_cast<sal_Int16>(rMatrix.get(0, 2)), nTranslateBits ); // Translate X
aBits.writeSB( static_cast<sal_Int16>(rMatrix.get(1, 2)), nTranslateBits ); // Translate Y
aBits.writeTo( rOut );
}
......@@ -374,10 +374,10 @@ void Sprite::addTag( Tag* pNewTag )
sal_uInt32 swf::getFixed( double fValue )
{
sal_Int16 nUpper = (sal_Int16)floor(fValue);
sal_uInt16 nLower = (sal_uInt16)((fValue - floor(fValue))*0x10000);
sal_Int16 nUpper = static_cast<sal_Int16>(floor(fValue));
sal_uInt16 nLower = static_cast<sal_uInt16>((fValue - floor(fValue))*0x10000);
sal_uInt32 temp = ((sal_Int32)nUpper)<<16;
sal_uInt32 temp = static_cast<sal_Int32>(nUpper)<<16;
temp |= nLower;
return temp;
......@@ -563,8 +563,8 @@ void FillStyle::Impl_addGradient( Tag* pTag ) const
double tx = ( maGradient.GetOfsX() * 32768.0 ) / 100.0;
double ty = ( maGradient.GetOfsY() * 32768.0 ) / 100.0;
double scalex = (double)maBoundRect.GetWidth() / 32768.0;
double scaley = (double)maBoundRect.GetHeight() / 32768.0;
double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0;
double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0;
m.scale( 1.2, 1.2 );
......@@ -594,8 +594,8 @@ void FillStyle::Impl_addGradient( Tag* pTag ) const
aGradientRecords.emplace_back( 0x00, maGradient.GetEndColor() );
aGradientRecords.emplace_back( 0x80, maGradient.GetStartColor() );
aGradientRecords.emplace_back( 0xff, maGradient.GetEndColor() );
double scalex = (double)maBoundRect.GetWidth() / 32768.0;
double scaley = (double)maBoundRect.GetHeight() / 32768.0;
double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0;
double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0;
m.translate( 32768.0 / 2.0, 32768.0 / 2.0 );
m.scale( scalex, scaley );
}
......@@ -606,8 +606,8 @@ void FillStyle::Impl_addGradient( Tag* pTag ) const
{
aGradientRecords.emplace_back( 0x00, maGradient.GetStartColor() );
aGradientRecords.emplace_back( 0xff, maGradient.GetEndColor() );
double scalex = (double)maBoundRect.GetWidth() / 32768.0;
double scaley = (double)maBoundRect.GetHeight() / 32768.0;
double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0;
double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0;
m.scale( scalex, scaley );
......
......@@ -211,7 +211,7 @@ void GIFWriter::WriteAnimation( const Animation& rAnimation )
const double fStep = 100. / nCount;
nMinPercent = 0;
nMaxPercent = (sal_uInt32)fStep;
nMaxPercent = static_cast<sal_uInt32>(fStep);
for( sal_uInt16 i = 0; i < nCount; i++ )
{
......@@ -220,7 +220,7 @@ void GIFWriter::WriteAnimation( const Animation& rAnimation )
WriteBitmapEx( rAnimBmp.aBmpEx, rAnimBmp.aPosPix, true,
rAnimBmp.nWait, rAnimBmp.eDisposal );
nMinPercent = nMaxPercent;
nMaxPercent = (sal_uInt32)(nMaxPercent + fStep);
nMaxPercent = static_cast<sal_uInt32>(nMaxPercent + fStep);
}
}
}
......@@ -297,8 +297,8 @@ void GIFWriter::WriteGlobalHeader( const Size& rSize )
if( bStatus )
{
// 256 colors
const sal_uInt16 nWidth = (sal_uInt16) rSize.Width();
const sal_uInt16 nHeight = (sal_uInt16) rSize.Height();
const sal_uInt16 nWidth = static_cast<sal_uInt16>(rSize.Width());
const sal_uInt16 nHeight = static_cast<sal_uInt16>(rSize.Height());
const sal_uInt8 cFlags = 128 | ( 7 << 4 );
// write values
......@@ -325,7 +325,7 @@ void GIFWriter::WriteLoopExtension( const Animation& rAnimation )
{
DBG_ASSERT( rAnimation.Count() > 0, "Animation has no bitmaps!" );
sal_uInt16 nLoopCount = (sal_uInt16) rAnimation.GetLoopCount();
sal_uInt16 nLoopCount = static_cast<sal_uInt16>(rAnimation.GetLoopCount());
// if only one run should take place
// the LoopExtension won't be written
......@@ -337,8 +337,8 @@ void GIFWriter::WriteLoopExtension( const Animation& rAnimation )
if( nLoopCount )
nLoopCount--;
const sal_uInt8 cLoByte = (sal_uInt8) nLoopCount;
const sal_uInt8 cHiByte = (sal_uInt8) ( nLoopCount >> 8 );
const sal_uInt8 cLoByte = static_cast<sal_uInt8>(nLoopCount);
const sal_uInt8 cHiByte = static_cast<sal_uInt8>( nLoopCount >> 8 );
m_rGIF.WriteUChar( 0x21 );
m_rGIF.WriteUChar( 0xff );
......@@ -375,7 +375,7 @@ void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal )
{
if( bStatus )
{
const sal_uInt16 nDelay = (sal_uInt16) nTimer;
const sal_uInt16 nDelay = static_cast<sal_uInt16>(nTimer);
sal_uInt8 cFlags = 0;
// set Transparency-Flag
......@@ -406,11 +406,11 @@ void GIFWriter::WriteLocalHeader()
{
if( bStatus )
{
const sal_uInt16 nPosX = (sal_uInt16) nActX;
const sal_uInt16 nPosY = (sal_uInt16) nActY;
const sal_uInt16 nWidth = (sal_uInt16) m_pAcc->Width();
const sal_uInt16 nHeight = (sal_uInt16) m_pAcc->Height();
sal_uInt8 cFlags = (sal_uInt8) ( m_pAcc->GetBitCount() - 1 );
const sal_uInt16 nPosX = static_cast<sal_uInt16>(nActX);
const sal_uInt16 nPosY = static_cast<sal_uInt16>(nActY);
const sal_uInt16 nWidth = static_cast<sal_uInt16>(m_pAcc->Width());
const sal_uInt16 nHeight = static_cast<sal_uInt16>(m_pAcc->Height());
sal_uInt8 cFlags = static_cast<sal_uInt8>( m_pAcc->GetBitCount() - 1 );
// set Interlaced-Flag
if( nInterlaced )
......
......@@ -53,7 +53,7 @@ inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes()
if( nBlockBufSize==255 )
FlushBlockBuf();
pBlockBuf[nBlockBufSize++] = (sal_uInt8) nBitsBuf;
pBlockBuf[nBlockBufSize++] = static_cast<sal_uInt8>(nBitsBuf);
nBitsBuf >>= 8;
nBitsBufSize -= 8;
}
......@@ -65,7 +65,7 @@ inline void GIFImageDataOutputStream::WriteBits( sal_uInt16 nCode, sal_uInt16 nC
if( nBitsBufSize+nCodeLen>32 )
FlushBitsBufsFullBytes();
nBitsBuf |= (sal_uInt32)nCode << nBitsBufSize;
nBitsBuf |= static_cast<sal_uInt32>(nCode) << nBitsBufSize;
nBitsBufSize = nBitsBufSize + nCodeLen;
}
......@@ -139,13 +139,13 @@ void GIFLZWCompressor::StartCompression( SvStream& rGIF, sal_uInt16 nPixelSize )
nTableSize=nEOICode+1;
nCodeSize=nDataSize+1;
pIDOS=new GIFImageDataOutputStream(rGIF,(sal_uInt8)nDataSize);
pIDOS=new GIFImageDataOutputStream(rGIF,static_cast<sal_uInt8>(nDataSize));
pTable=new GIFLZWCTreeNode[4096];
for (i=0; i<4096; i++)
{
pTable[i].pBrother = pTable[i].pFirstChild = nullptr;
pTable[i].nValue = (sal_uInt8) ( pTable[i].nCode = i );
pTable[i].nValue = static_cast<sal_uInt8>( pTable[i].nCode = i );
}
pPrefix = nullptr;
......@@ -195,7 +195,7 @@ void GIFLZWCompressor::Compress(sal_uInt8* pSrc, sal_uInt32 nSize)
}
else
{
if(nTableSize==(sal_uInt16)(1<<nCodeSize))
if(nTableSize==static_cast<sal_uInt16>(1<<nCodeSize))
nCodeSize++;
p=pTable+(nTableSize++);
......
......@@ -576,7 +576,7 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview )
ImplWriteLine( "%%BeginPageSetup" );
ImplWriteLine( "%%EndPageSetup" );
ImplWriteLine( "pum" );
ImplScale( (double)aSizePoint.Width() / (double)pMTF->GetPrefSize().Width(), (double)aSizePoint.Height() / (double)pMTF->GetPrefSize().Height() );
ImplScale( static_cast<double>(aSizePoint.Width()) / static_cast<double>(pMTF->GetPrefSize().Width()), static_cast<double>(aSizePoint.Height()) / static_cast<double>(pMTF->GetPrefSize().Height()) );
ImplWriteDouble( 0 );
ImplWriteDouble( -pMTF->GetPrefSize().Height() );
ImplWriteLine( "t" );
......@@ -1174,8 +1174,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
const Size aSrcSize( aTmpMtf.GetPrefSize() );
const Point aDestPt( pA->GetPoint() );
const Size aDestSize( pA->GetSize() );
const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
const double fScaleX = aSrcSize.Width() ? static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0;
const double fScaleY = aSrcSize.Height() ? static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0;
long nMoveX, nMoveY;
if( fScaleX != 1.0 || fScaleY != 1.0 )
......@@ -1257,7 +1257,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
bSkipSequence = false;
if ( aStartArrow.Count() || aEndArrow.Count() )
bSkipSequence = false;
if ( (sal_uInt32)eJT > 2 )
if ( static_cast<sal_uInt32>(eJT) > 2 )
bSkipSequence = false;
if ( l_aDashArray.size() && ( fStrokeWidth != 0.0 ) )
bSkipSequence = false;
......@@ -1941,7 +1941,7 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
if ( nHeightLeft )
{
nHeightLeft++;
aSourcePos.Y() = (long) ( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg );
aSourcePos.Y() = static_cast<long>( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg );
}
}
}
......@@ -1953,9 +1953,9 @@ void PSWriter::ImplWriteCharacter( sal_Char nChar )
case '(' :
case ')' :
case '\\' :
ImplWriteByte( (sal_uInt8)'\\', PS_NONE );
ImplWriteByte( sal_uInt8('\\'), PS_NONE );
}
ImplWriteByte( (sal_uInt8)nChar, PS_NONE );
ImplWriteByte( static_cast<sal_uInt8>(nChar), PS_NONE );
}
void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & rVDev, const long* pDXArry, bool bStretch )
......@@ -2175,8 +2175,8 @@ void PSWriter::ImplGetMapMode( const MapMode& rMapMode )
{
ImplWriteLine( "tm setmatrix" );
double fMul = ImplGetScaling(rMapMode);
double fScaleX = (double)rMapMode.GetScaleX() * fMul;
double fScaleY = (double)rMapMode.GetScaleY() * fMul;
double fScaleX = static_cast<double>(rMapMode.GetScaleX()) * fMul;
double fScaleY = static_cast<double>(rMapMode.GetScaleY()) * fMul;
ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY );
ImplScale( fScaleX, fScaleY );
}
......@@ -2276,13 +2276,13 @@ void PSWriter::ImplWriteLineInfo( double fLWidth, double fMLimit,
if ( eLineCap != eLCap )
{
eLineCap = eLCap;
ImplWriteLong( (sal_Int32)eLineCap );
ImplWriteLong( static_cast<sal_Int32>(eLineCap) );
ImplWriteLine( "lc", PS_SPACE );
}
if ( eJoinType != eJoin )
{
eJoinType = eJoin;
ImplWriteLong( (sal_Int32)eJoinType );
ImplWriteLong( static_cast<sal_Int32>(eJoinType) );
ImplWriteLine( "lj", PS_SPACE );
}
if ( eJoinType == SvtGraphicStroke::joinMiter )
......@@ -2363,8 +2363,8 @@ void PSWriter::ImplWriteLong(sal_Int32 nNumber, sal_uLong nMode)
void PSWriter::ImplWriteDouble( double fNumber )
{
sal_Int32 nPTemp = (sal_Int32)fNumber;
sal_Int32 nATemp = labs( (sal_Int32)( ( fNumber - nPTemp ) * 100000 ) );
sal_Int32 nPTemp = static_cast<sal_Int32>(fNumber);
sal_Int32 nATemp = labs( static_cast<sal_Int32>( ( fNumber - nPTemp ) * 100000 ) );
if ( !nPTemp && nATemp && ( fNumber < 0.0 ) )
mpPS->WriteChar( '-' );
......@@ -2477,12 +2477,12 @@ inline void PSWriter::WriteBits( sal_uInt16 nCode, sal_uInt16 nCodeLen )
nOffset -= nCodeLen;
while ( nOffset < 24 )
{
ImplWriteHexByte( (sal_uInt8)( dwShift >> 24 ) );
ImplWriteHexByte( static_cast<sal_uInt8>( dwShift >> 24 ) );
dwShift <<= 8;
nOffset += 8;
}
if ( nCode == 257 && nOffset != 32 )
ImplWriteHexByte( (sal_uInt8)( dwShift >> 24 ) );
ImplWriteHexByte( static_cast<sal_uInt8>( dwShift >> 24 ) );
}
void PSWriter::StartCompression()
......@@ -2503,7 +2503,7 @@ void PSWriter::StartCompression()
for ( i = 0; i < 4096; i++ )
{
pTable[ i ].pBrother = pTable[ i ].pFirstChild = nullptr;
pTable[ i ].nValue = (sal_uInt8)( pTable[ i ].nCode = i );
pTable[ i ].nValue = static_cast<sal_uInt8>( pTable[ i ].nCode = i );
}
pPrefix = nullptr;
WriteBits( nClearCode, nCodeSize );
......@@ -2546,7 +2546,7 @@ void PSWriter::Compress( sal_uInt8 nCompThis )
}
else
{
if( nTableSize == (sal_uInt16)( ( 1 << nCodeSize ) - 1 ) )
if( nTableSize == static_cast<sal_uInt16>( ( 1 << nCodeSize ) - 1 ) )
nCodeSize++;
p = pTable + ( nTableSize++ );
......
......@@ -390,7 +390,7 @@ void TIFFWriter::ImplWriteBody()
if (!( nShift & 1 ))
nTemp = ( mpAcc->GetPixelIndex( y, x ) << 4 );
else
Compress( (sal_uInt8)( nTemp | ( mpAcc->GetPixelIndex( y, x ) & 0xf ) ) );
Compress( static_cast<sal_uInt8>( nTemp | ( mpAcc->GetPixelIndex( y, x ) & 0xf ) ) );
}
if ( nShift & 1 )
Compress( nTemp );
......@@ -410,13 +410,13 @@ void TIFFWriter::ImplWriteBody()
j |= ( ( ~mpAcc->GetPixelIndex( y, x ) ) & 1 );
if ( j & 0x100 )
{
Compress( (sal_uInt8)j );
Compress( static_cast<sal_uInt8>(j) );
j = 1;
}
}
if ( j != 1 )
{
Compress( (sal_uInt8)(j << ( ( ( x & 7) ^ 7 ) + 1 ) ) );
Compress( static_cast<sal_uInt8>(j << ( ( ( x & 7) ^ 7 ) + 1 ) ) );
j = 1;
}
}
......@@ -501,7 +501,7 @@ void TIFFWriter::StartCompression()
for ( i = 0; i < 4096; i++)
{
pTable[ i ].pBrother = pTable[ i ].pFirstChild = nullptr;
pTable[ i ].nValue = (sal_uInt8)( pTable[ i ].nCode = i );
pTable[ i ].nValue = static_cast<sal_uInt8>( pTable[ i ].nCode = i );
}
pPrefix = nullptr;
......@@ -546,7 +546,7 @@ void TIFFWriter::Compress( sal_uInt8 nCompThis )
}
else
{
if( nTableSize == (sal_uInt16)( ( 1 << nCodeSize ) - 1 ) )
if( nTableSize == static_cast<sal_uInt16>( ( 1 << nCodeSize ) - 1 ) )
nCodeSize++;
p = pTable + ( nTableSize++ );
......
......@@ -23,7 +23,7 @@
namespace {
constexpr BitmapColor BMCOL(sal_uInt32 _col) {
return BitmapColor( (sal_Int8)(_col >> 16 ), (sal_Int8)( _col >> 8 ), (sal_Int8)_col );
return BitmapColor( static_cast<sal_Int8>(_col >> 16 ), static_cast<sal_Int8>( _col >> 8 ), static_cast<sal_Int8>(_col) );
}
}
......@@ -66,7 +66,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
if (ImplGetDimensions(rDesc) && rDesc.mpBuf && isLegalBitsPerPixel(rDesc.mnDstBitsPerPixel))
{
rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel );
rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), static_cast<sal_uInt16>(rDesc.mnDstBitsPerPixel) );
if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != nullptr )
{
......@@ -379,7 +379,7 @@ std::unique_ptr<CGMBitmap> CGMBitmap::GetNext()
if (pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus)
{
xCGMTempBitmap.reset(new CGMBitmap(*mpCGM));
if ( ( (long)xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) &&
if ( ( static_cast<long>(xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation) == static_cast<long>(pCGMBitmapDescriptor->mnOrientation) ) &&
( ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) &&
( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) ||
( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) &&
......
......@@ -97,7 +97,7 @@ sal_uInt32 CGM::ImplGetUI16()
sal_uInt8 CGM::ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision )
{
return (sal_uInt8)( nSource >> ( ( nPrecision - 1 ) << 3 ) );
return static_cast<sal_uInt8>( nSource >> ( ( nPrecision - 1 ) << 3 ) );
};
sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision )
......@@ -110,12 +110,12 @@ sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision )
{