[Libreoffice-commits] core.git: 2 commits - vcl/osx vcl/qa vcl/quartz vcl/source
Stephan Bergmann
sbergman at redhat.com
Sun Mar 29 11:31:43 PDT 2015
vcl/osx/salframe.cxx | 4 ++--
vcl/qa/cppunit/BitmapTest.cxx | 5 +++++
vcl/quartz/CTRunData.cxx | 12 ++++++------
vcl/quartz/ctfonts.cxx | 26 +++++++++++++-------------
vcl/quartz/ctlayout.cxx | 14 +++++++-------
vcl/quartz/salgdicommon.cxx | 2 +-
vcl/quartz/salvd.cxx | 4 ++--
vcl/source/outdev/text.cxx | 4 ++--
8 files changed, 38 insertions(+), 33 deletions(-)
New commits:
commit fec207b77aadd6fa8f8411c5918c99af95dea786
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sun Mar 29 20:30:53 2015 +0200
Fix test on non-Linux
Change-Id: I0852c732d580d85ebad629ca26c28ede1576b957
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index dc2070d..74e7e89 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -57,9 +57,14 @@ void BitmapTest::testConvert()
CPPUNIT_ASSERT_EQUAL(sal_uInt16(24), aBitmap.GetBitCount());
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+#if defined LINUX
// 24 bit Bitmap on SVP backend uses 32bit BGRX format
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(32), pReadAccess->GetBitCount());
CPPUNIT_ASSERT_EQUAL(sal_uLong(40), pReadAccess->GetScanlineSize());
+#else
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), pReadAccess->GetBitCount());
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(30), pReadAccess->GetScanlineSize());
+#endif
CPPUNIT_ASSERT(!pReadAccess->HasPalette());
Color aColor = pReadAccess->GetPixel(0, 0);
CPPUNIT_ASSERT_EQUAL(sal_Int32(204), sal_Int32(aColor.GetRed()));
commit 4cc067434059858762276d44e4e91b1e0ffaf7c7
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sun Mar 29 20:04:58 2015 +0200
loplugin:cstylecast
Change-Id: I999ec56219a7d9a9dc8c1e9310cc74dccd0ac099
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 226f539..d177aa2 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1033,7 +1033,7 @@ static void getAppleScrollBarVariant(StyleSettings &rSettings)
CFStringRef AppleScrollBarType = CFSTR("AppleScrollBarVariant");
if( AppleScrollBarType )
{
- CFStringRef ScrollBarVariant = ((CFStringRef)CFPreferencesCopyAppValue( AppleScrollBarType, kCFPreferencesCurrentApplication ));
+ CFStringRef ScrollBarVariant = static_cast<CFStringRef>(CFPreferencesCopyAppValue( AppleScrollBarType, kCFPreferencesCurrentApplication ));
if( ScrollBarVariant )
{
if( CFGetTypeID( ScrollBarVariant ) == CFStringGetTypeID() )
@@ -1059,7 +1059,7 @@ static void getAppleScrollBarVariant(StyleSettings &rSettings)
CFStringRef jumpScroll = CFSTR("AppleScrollerPagingBehavior");
if( jumpScroll )
{
- CFBooleanRef jumpStr = ((CFBooleanRef)CFPreferencesCopyAppValue( jumpScroll, kCFPreferencesCurrentApplication ));
+ CFBooleanRef jumpStr = static_cast<CFBooleanRef>(CFPreferencesCopyAppValue( jumpScroll, kCFPreferencesCurrentApplication ));
if( jumpStr )
{
if( CFGetTypeID( jumpStr ) == CFBooleanGetTypeID() )
diff --git a/vcl/quartz/CTRunData.cxx b/vcl/quartz/CTRunData.cxx
index 2bb5ed3..930f6d17 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 fd42315..7b47cfc 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 b70f436..d9c823d 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 f193122..8cbbf65 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 4a8878d..6a6426c 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 );
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index d273d5b..06e0b40 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1016,7 +1016,7 @@ long OutputDevice::GetTextArray( const OUString& rStr, long* pDXAry,
DeviceCoordinate* pDXPixelArray = NULL;
if(pDXAry)
{
- pDXPixelArray = (DeviceCoordinate*)alloca(nLen * sizeof(DeviceCoordinate));
+ pDXPixelArray = static_cast<DeviceCoordinate*>(alloca(nLen * sizeof(DeviceCoordinate)));
}
DeviceCoordinate nWidth = pSalLayout->FillDXArray( pDXPixelArray );
int nWidthFactor = pSalLayout->GetUnitsPerPixel();
@@ -1357,7 +1357,7 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
else
{
#if VCL_FLOAT_DEVICE_PIXEL
- pDXPixelArray = (DeviceCoordinate*)alloca( nLen * sizeof(DeviceCoordinate) );
+ pDXPixelArray = static_cast<DeviceCoordinate*>(alloca( nLen * sizeof(DeviceCoordinate) ));
for( int i = 0; i < nLen; ++i )
{
pDXPixelArray[i] = pDXArray[i];
More information about the Libreoffice-commits
mailing list