diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-29 20:04:58 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-29 20:31:10 +0200 |
commit | 4cc067434059858762276d44e4e91b1e0ffaf7c7 (patch) | |
tree | ce106afa53a76cf0db90db571fbebd82f9214fa2 /vcl/quartz | |
parent | c75a575752dd53d4333dd8b937de774a85d00806 (diff) |
loplugin:cstylecast
Change-Id: I999ec56219a7d9a9dc8c1e9310cc74dccd0ac099
Diffstat (limited to 'vcl/quartz')
-rw-r--r-- | vcl/quartz/CTRunData.cxx | 12 | ||||
-rw-r--r-- | vcl/quartz/ctfonts.cxx | 26 | ||||
-rw-r--r-- | vcl/quartz/ctlayout.cxx | 14 | ||||
-rw-r--r-- | vcl/quartz/salgdicommon.cxx | 2 | ||||
-rw-r--r-- | vcl/quartz/salvd.cxx | 4 |
5 files changed, 29 insertions, 29 deletions
diff --git a/vcl/quartz/CTRunData.cxx b/vcl/quartz/CTRunData.cxx index 2bb5ed3b97ff..930f6d17fb88 100644 --- a/vcl/quartz/CTRunData.cxx +++ b/vcl/quartz/CTRunData.cxx @@ -22,7 +22,7 @@ CTRunData::CTRunData( CTRunRef pRun, int start) assert(pRun); CFDictionaryRef pRunAttributes = CTRunGetAttributes( m_pRun ); - m_pFont = (CTFontRef)CFDictionaryGetValue( pRunAttributes, kCTFontAttributeName ); + m_pFont = static_cast<CTFontRef>(CFDictionaryGetValue( pRunAttributes, kCTFontAttributeName )); m_nGlyphs = CTRunGetGlyphCount(m_pRun); m_EndPos = m_StartPos + m_nGlyphs; @@ -33,7 +33,7 @@ CTRunData::CTRunData( CTRunRef pRun, int start) { m_pAdvances = new CGSize[m_nGlyphs]; ownership_flags |= CTRUNDATA_F_OWN_ADVANCES; - CTRunGetAdvances( pRun, aAll, (CGSize*)m_pAdvances ); + CTRunGetAdvances( pRun, aAll, const_cast<CGSize*>(m_pAdvances) ); } m_pGlyphs = CTRunGetGlyphsPtr( m_pRun ); @@ -41,7 +41,7 @@ CTRunData::CTRunData( CTRunRef pRun, int start) { m_pGlyphs = new CGGlyph[m_nGlyphs]; ownership_flags |= CTRUNDATA_F_OWN_GLYPHS; - CTRunGetGlyphs( pRun, aAll, (CGGlyph*)m_pGlyphs); + CTRunGetGlyphs( pRun, aAll, const_cast<CGGlyph*>(m_pGlyphs)); } m_pStringIndices = CTRunGetStringIndicesPtr( pRun ); @@ -49,15 +49,15 @@ CTRunData::CTRunData( CTRunRef pRun, int start) { m_pStringIndices = new CFIndex[m_nGlyphs]; ownership_flags |= CTRUNDATA_F_OWN_INDICES; - CTRunGetStringIndices( pRun, aAll, (CFIndex*)m_pStringIndices ); + CTRunGetStringIndices( pRun, aAll, const_cast<CFIndex*>(m_pStringIndices) ); } - m_pPositions = (CGPoint*)CTRunGetPositionsPtr( pRun ); + m_pPositions = CTRunGetPositionsPtr( pRun ); if( !m_pPositions ) { m_pPositions = new CGPoint[m_nGlyphs]; ownership_flags |= CTRUNDATA_F_OWN_POSITIONS; - CTRunGetPositions( pRun, aAll, (CGPoint*)m_pPositions ); + CTRunGetPositions( pRun, aAll, const_cast<CGPoint*>(m_pPositions) ); } for(int i = 0; i < m_nGlyphs; i++) { diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index fd4231568fe0..7b47cfc0f857 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -45,7 +45,7 @@ inline double toRadian(int nDegree) } CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD ) -: mpFontData( const_cast<CoreTextFontData*>(static_cast<CoreTextFontData const *>(rFSD.mpFontData)) ) +: mpFontData( static_cast<CoreTextFontData const *>(rFSD.mpFontData) ) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) , mpStyleDict( NULL ) @@ -119,7 +119,7 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricData& rMetric ) const { // get the matching CoreText font handle // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here? - CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ); + CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); const CGFloat fAscent = CTFontGetAscent( aCTFontRef ); const CGFloat fCapHeight = CTFontGetCapHeight( aCTFontRef ); @@ -142,7 +142,7 @@ bool CoreTextStyle::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) { CGGlyph nCGGlyph = aGlyphId & GF_IDXMASK; // XXX: this is broken if the glyph came from fallback font - CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ); + CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); const CTFontOrientation aFontOrientation = kCTFontDefaultOrientation; // TODO: horz/vert const CGRect aCGRect = CTFontGetBoundingRectsForGlyphs( aCTFontRef, aFontOrientation, &nCGGlyph, NULL, 1 ); @@ -200,7 +200,7 @@ bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolyg CGGlyph nCGGlyph = aGlyphId & GF_IDXMASK; // XXX: this is broken if the glyph came from fallback font - CTFontRef pCTFont = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ); + CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); CGPathRef xPath = CTFontCreatePathForGlyph( pCTFont, nCGGlyph, NULL ); if (!xPath) { return false; @@ -287,14 +287,14 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool const OUString aUILang = Application::GetSettings().GetUILanguageTag().getLanguage(); CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault, aUILang.getStr(), aUILang.getLength() ); CFStringRef pLang = NULL; - CFStringRef pFamilyName = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, &pLang ); + CFStringRef pFamilyName = static_cast<CFStringRef>(CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, &pLang )); if ( !pLang || ( CFStringCompare( pUILang, pLang, 0 ) != kCFCompareEqualTo )) { if(pFamilyName) { CFRelease( pFamilyName ); } - pFamilyName = (CFStringRef)CTFontDescriptorCopyAttribute( pFD, kCTFontFamilyNameAttribute ); + pFamilyName = static_cast<CFStringRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontFamilyNameAttribute )); } #else // No "Application" on iOS. And it is unclear whether this code @@ -306,19 +306,19 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool rDFA.SetFamilyName( GetOUString( pFamilyName ) ); // get font style - CFStringRef pStyleName = (CFStringRef)CTFontDescriptorCopyAttribute( pFD, kCTFontStyleNameAttribute ); + CFStringRef pStyleName = static_cast<CFStringRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontStyleNameAttribute )); rDFA.SetStyleName( GetOUString( pStyleName ) ); // get font-enabled status if( bFontEnabled ) { int bEnabled = TRUE; // by default (and when we're on OS X < 10.6) it's "enabled" - CFNumberRef pEnabled = (CFNumberRef)CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute ); + CFNumberRef pEnabled = static_cast<CFNumberRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute )); CFNumberGetValue( pEnabled, kCFNumberIntType, &bEnabled ); *bFontEnabled = bEnabled; } // get font attributes - CFDictionaryRef pAttrDict = (CFDictionaryRef)CTFontDescriptorCopyAttribute( pFD, kCTFontTraitsAttribute ); + CFDictionaryRef pAttrDict = static_cast<CFDictionaryRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontTraitsAttribute )); // get symbolic trait // TODO: use other traits such as MonoSpace/Condensed/Expanded or Vertical too @@ -331,7 +331,7 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool // get the font weight double fWeight = 0; - CFNumberRef pWeightNum = (CFNumberRef)CFDictionaryGetValue( pAttrDict, kCTFontWeightTrait ); + CFNumberRef pWeightNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWeightTrait )); CFNumberGetValue( pWeightNum, kCFNumberDoubleType, &fWeight ); int nInt = WEIGHT_NORMAL; if( fWeight > 0 ) { @@ -347,14 +347,14 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool // get the font slant double fSlant = 0; - CFNumberRef pSlantNum = (CFNumberRef)CFDictionaryGetValue( pAttrDict, kCTFontSlantTrait ); + CFNumberRef pSlantNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontSlantTrait )); CFNumberGetValue( pSlantNum, kCFNumberDoubleType, &fSlant ); if( fSlant >= 0.035 ) rDFA.SetItalic( ITALIC_NORMAL ); // get width trait double fWidth = 0; - CFNumberRef pWidthNum = (CFNumberRef)CFDictionaryGetValue( pAttrDict, kCTFontWidthTrait ); + CFNumberRef pWidthNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWidthTrait )); CFNumberGetValue( pWidthNum, kCFNumberDoubleType, &fWidth ); nInt = WIDTH_NORMAL; if( fWidth > 0 ) { @@ -388,7 +388,7 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext ) { const sal_IntPtr nFontId = reinterpret_cast<sal_IntPtr>(pValue); CoreTextFontData* pFontData = new CoreTextFontData( rDFA, nFontId ); - SystemFontList* pFontList = (SystemFontList*)pContext; + SystemFontList* pFontList = static_cast<SystemFontList*>(pContext); pFontList->AddFont( pFontData ); } } diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index b70f436ecfad..d9c823def393 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -517,7 +517,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons for (CFIndex runIndex = 0; runIndex < runCount; runIndex++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runArray, runIndex); + CTRunRef run = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, runIndex)); CFIndex runGlyphCount = CTRunGetGlyphCount(run); CGPoint position; CGSize advance; @@ -534,8 +534,8 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons CGFloat ascent; CGFloat descent; CGFloat leading; - CTFontRef runFont = (CTFontRef)CFDictionaryGetValue(CTRunGetAttributes(run), - kCTFontAttributeName); + CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(CTRunGetAttributes(run), + kCTFontAttributeName)); CGFloat baseSize = CTFontGetSize(runFont); CTRunGetTypographicBounds ( run, glyphRange, &ascent, &descent, &leading); @@ -600,7 +600,7 @@ bool CTLayout::CacheGlyphLayout(void) const // eew! for( int i = 0; i < nRun; ++i ) { - CTRunRef pRun = (CTRunRef)CFArrayGetValueAtIndex( aRuns, i ); + CTRunRef pRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex( aRuns, i )); CTRunData* pRunData = new CTRunData(pRun, nPos); m_vRunData.push_back(pRunData); nPos += pRunData->m_nGlyphs; @@ -645,7 +645,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i { if( pFallbackFonts ) { - pFont = (CTFontRef)CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName ); + pFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName )); pFontDesc = CTFontCopyFontDescriptor( iter->m_pFont ); rDevFontAttr = DevFontFromCTFontDescriptor( pFontDesc, NULL ); } @@ -694,7 +694,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i } if( pFallbackFonts ) { - pFont = (CTFontRef)CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName ); + pFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName )); pFontDesc = CTFontCopyFontDescriptor( iter->m_pFont ); rDevFontAttr = DevFontFromCTFontDescriptor( pFontDesc, NULL ); } @@ -749,7 +749,7 @@ DeviceCoordinate CTLayout::FillDXArray( DeviceCoordinate* pDXArray ) const for( int nRunIndex = 0; nRunIndex < nRunCount; ++nRunIndex ) { - CTRunRef pGlyphRun = (CTRunRef)CFArrayGetValueAtIndex( aGlyphRuns, nRunIndex ); + CTRunRef pGlyphRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex( aGlyphRuns, nRunIndex )); const CFIndex nGlyphCount = CTRunGetGlyphCount( pGlyphRun ); const CFRange aFullRange = CFRangeMake( 0, nGlyphCount ); diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index f193122f6243..8cbbf657708c 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -2193,7 +2193,7 @@ void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth, // a bitmap context will be needed for manual XORing // create one unless the target context is a bitmap context if( nTargetDepth ) - m_pTempBuffer = (sal_uLong*)CGBitmapContextGetData( m_xTargetContext ); + m_pTempBuffer = static_cast<sal_uLong*>(CGBitmapContextGetData( m_xTargetContext )); if( !m_pTempBuffer ) { // create a bitmap context matching to the target context diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index 4a8878d3a95e..6a6426ceb86c 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -200,7 +200,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); #ifdef DBG_UTIL for (ssize_t i = 0; i < nBytesPerRow * nDY; i++) - ((sal_uInt8*)pRawData)[i] = (i & 0xFF); + static_cast<sal_uInt8*>(pRawData)[i] = (i & 0xFF); #endif mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY, mnBitmapDepth, nBytesPerRow, GetSalData()->mxGraySpace, kCGImageAlphaNone ); @@ -247,7 +247,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); #ifdef DBG_UTIL for (ssize_t i = 0; i < nBytesPerRow * nDY; i++) - ((sal_uInt8*)pRawData)[i] = (i & 0xFF); + static_cast<sal_uInt8*>(pRawData)[i] = (i & 0xFF); #endif mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY, 8, nBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst ); |