[Libreoffice-commits] core.git: vcl/inc vcl/osx vcl/quartz

Stephan Bergmann sbergman at redhat.com
Wed Dec 3 23:48:14 PST 2014


 vcl/inc/osx/saldata.hxx              |    2 +-
 vcl/osx/DragSource.cxx               |    2 +-
 vcl/osx/DropTarget.cxx               |    2 +-
 vcl/osx/a11ytextattributeswrapper.mm |    2 +-
 vcl/osx/saldata.cxx                  |    4 ++--
 vcl/osx/salframe.cxx                 |    2 +-
 vcl/osx/salframeview.mm              |    6 +++---
 vcl/osx/salmenu.cxx                  |    8 ++++----
 vcl/osx/salnativewidgets.cxx         |    6 +++---
 vcl/quartz/ctfonts.cxx               |    7 +++----
 vcl/quartz/ctlayout.cxx              |    4 ++--
 11 files changed, 22 insertions(+), 23 deletions(-)

New commits:
commit 083f517ca3c037a1d36e6f5ea830366f24659f22
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 4 08:47:31 2014 +0100

    vcl (Mac): loplugin:cstylecast
    
    Change-Id: Ic46623380f026a8dfcc74c895db35a06bcea1ead

diff --git a/vcl/inc/osx/saldata.hxx b/vcl/inc/osx/saldata.hxx
index 413754b..86667ac 100644
--- a/vcl/inc/osx/saldata.hxx
+++ b/vcl/inc/osx/saldata.hxx
@@ -59,7 +59,7 @@ struct FrameHash : public boost::hash<sal_IntPtr>
     { return boost::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); }
 };
 
-#define INVALID_CURSOR_PTR (NSCursor*)0xdeadbeef
+#define INVALID_CURSOR_PTR reinterpret_cast<NSCursor*>(0xdeadbeef)
 
 // Singleton, instantiated from Application::Application() in
 // vcl/source/app/svapp.cxx through InitSalData().
diff --git a/vcl/osx/DragSource.cxx b/vcl/osx/DragSource.cxx
index 593bf8b..5601d25 100644
--- a/vcl/osx/DragSource.cxx
+++ b/vcl/osx/DragSource.cxx
@@ -172,7 +172,7 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
   Any pNSView = aArguments[1];
   sal_uInt64 tmp = 0;
   pNSView >>= tmp;
-  mView = (NSView*)tmp;
+  mView = reinterpret_cast<NSView*>(tmp);
 
   /* All SalFrameView the base class for all VCL system views inherits from
      NSView in order to get mouse and other events. This is the only way to
diff --git a/vcl/osx/DropTarget.cxx b/vcl/osx/DropTarget.cxx
index 7ee0f5b..a6721a6 100644
--- a/vcl/osx/DropTarget.cxx
+++ b/vcl/osx/DropTarget.cxx
@@ -352,7 +352,7 @@ void SAL_CALL DropTarget::initialize(const Sequence< Any >& aArguments)
     Any pNSView = aArguments[0];
     sal_uInt64 tmp = 0;
     pNSView >>= tmp;
-    mView = (id)tmp;
+    mView = reinterpret_cast<id>(tmp);
     mpFrame = [(SalFrameView*)mView getSalFrame];
 
     mDropTargetHelper = [[DropTargetHelper alloc] initWithDropTarget: this];
diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm
index 4b18234..3ac368e 100644
--- a/vcl/osx/a11ytextattributeswrapper.mm
+++ b/vcl/osx/a11ytextattributeswrapper.mm
@@ -178,7 +178,7 @@ using namespace ::com::sun::star::uno;
         return;
     const RGBAColor aRGBAColor( nSalColor);
     CGColorRef aColorRef = CGColorCreate ( CGColorSpaceCreateWithName ( kCGColorSpaceGenericRGB ), aRGBAColor.AsArray() );
-    [ string addAttribute: attribute value: (id) aColorRef range: range ];
+    [ string addAttribute: attribute value: reinterpret_cast<id>(aColorRef) range: range ];
     CGColorRelease( aColorRef );
 }
 
diff --git a/vcl/osx/saldata.cxx b/vcl/osx/saldata.cxx
index f4dc179..a2a8b85 100644
--- a/vcl/osx/saldata.cxx
+++ b/vcl/osx/saldata.cxx
@@ -30,7 +30,7 @@ oslThreadKey SalData::s_aAutoReleaseKey = 0;
 static void SAL_CALL releasePool( void* pPool )
 {
     if( pPool )
-        [(NSAutoreleasePool*)pPool release];
+        [static_cast<NSAutoreleasePool*>(pPool) release];
 }
 
 SalData::SalData()
@@ -230,7 +230,7 @@ NSCursor* SalData::getCursor( PointerStyle i_eStyle )
             CFURLRef hURL = CFBundleCopyResourceURL( hMain, pCursorName, CFSTR("png"), CFSTR("cursors") );
             if( hURL )
             {
-                pCurs = [[NSCursor alloc] initWithImage: [[NSImage alloc] initWithContentsOfURL: (NSURL*)hURL] hotSpot: aHotSpot];
+                pCurs = [[NSCursor alloc] initWithImage: [[NSImage alloc] initWithContentsOfURL: const_cast<NSURL*>(static_cast<NSURL const *>(hURL))] hotSpot: aHotSpot];
                 CFRelease( hURL );
             }
             CFRelease( pCursorName );
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 0f266db..7591c69 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1497,7 +1497,7 @@ void AquaSalFrame::SetParent( SalFrame* pNewParent )
     bool bShown = mbShown;
     // remove from child list
     Show( FALSE );
-    mpParent = (AquaSalFrame*)pNewParent;
+    mpParent = static_cast<AquaSalFrame*>(pNewParent);
     // insert to correct parent and paint
     Show( bShown );
 }
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index add9891..248c8eb 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -189,13 +189,13 @@ static AquaSalFrame* getMouseContainerFrame()
     if( bAllowFullScreen && [pNSWindow respondsToSelector: setCollectionBehavior])
     {
         const int bMode= (bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary);
-        [pNSWindow performSelector:setCollectionBehavior withObject:(id)(intptr_t)bMode];
+        [pNSWindow performSelector:setCollectionBehavior withObject:reinterpret_cast<id>(static_cast<intptr_t>(bMode))];
     }
 
     // disable OSX>=10.7 window restoration until we support it directly
     const SEL setRestorable = @selector(setRestorable:);
     if( [pNSWindow respondsToSelector: setRestorable]) {
-        [pNSWindow performSelector:setRestorable withObject:(id)NO];
+        [pNSWindow performSelector:setRestorable withObject:reinterpret_cast<id>(NO)];
     }
 
     return (SalFrameWindow *)pNSWindow;
@@ -1674,7 +1674,7 @@ private:
 
 - (NSInteger)conversationIdentifier
 {
-    return (long)self;
+    return reinterpret_cast<long>(self);
 }
 
 - (void)doCommandBySelector:(SEL)aSelector
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index 6d13eed..6d2c6d8 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -341,10 +341,10 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rR
     const float offset = 9.0;
 
     // get the pointers
-    AquaSalFrame * pParentAquaSalFrame = (AquaSalFrame *) pWin->ImplGetWindowImpl()->mpRealParent->ImplGetFrame();
+    AquaSalFrame * pParentAquaSalFrame = static_cast<AquaSalFrame *>(pWin->ImplGetWindowImpl()->mpRealParent->ImplGetFrame());
     NSWindow* pParentNSWindow = pParentAquaSalFrame->mpNSWindow;
     NSView* pParentNSView = [pParentNSWindow contentView];
-    NSView* pPopupNSView = ((AquaSalFrame *) pWin->ImplGetWindow()->ImplGetFrame())->mpNSView;
+    NSView* pPopupNSView = static_cast<AquaSalFrame *>(pWin->ImplGetWindow()->ImplGetFrame())->mpNSView;
     NSRect popupFrame = [pPopupNSView frame];
 
     // since we manipulate the menu below (removing entries)
@@ -658,7 +658,7 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem,
     if (!i_pSalMenuItem)
         return;
 
-    AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) i_pSalMenuItem;
+    AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(i_pSalMenuItem);
 
     // Delete mnemonics
     OUString aText( comphelper::string::remove(i_rText, '~') );
@@ -763,7 +763,7 @@ void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem,
     if(nModifier & KEY_MOD3)
         nItemModifier |= NSControlKeyMask;
 
-    AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) pSalMenuItem;
+    AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(pSalMenuItem);
     NSString* pString = CreateNSString( OUString( &nCommandKey, 1 ) );
     [pAquaSalMenuItem->mpMenuItem setKeyEquivalent: pString];
     [pAquaSalMenuItem->mpMenuItem setKeyEquivalentModifierMask: nItemModifier];
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index ce3ab41..6b35c02 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -662,7 +662,7 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType,
             // no animation
             aPushInfo.animation.time.start = 0;
             aPushInfo.animation.time.current = 0;
-            PushButtonValue* pPBVal = aValue.getType() == CTRL_PUSHBUTTON ? (PushButtonValue*)&aValue : NULL;
+            PushButtonValue const * pPBVal = aValue.getType() == CTRL_PUSHBUTTON ? static_cast<PushButtonValue const *>(&aValue) : NULL;
             int nPaintHeight = static_cast<int>(rc.size.height);
 
             if( pPBVal && pPBVal->mbBevelButton )
@@ -831,7 +831,7 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType,
 
     case CTRL_SLIDER:
         {
-            SliderValue* pSLVal = (SliderValue*)&aValue;
+            SliderValue const * pSLVal = static_cast<SliderValue const *>(&aValue);
 
             HIThemeTrackDrawInfo aTrackDraw;
             aTrackDraw.kind = kThemeSliderMedium;
@@ -955,7 +955,7 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType,
             //first, last or middle tab
             aTabItemDrawInfo.position=kHIThemeTabPositionMiddle;
 
-            TabitemValue* pTabValue = (TabitemValue *) &aValue;
+            TabitemValue const * pTabValue = static_cast<TabitemValue const *>(&aValue);
             unsigned int nAlignment = pTabValue->mnAlignment;
             //TABITEM_LEFTALIGNED (and TABITEM_RIGHTALIGNED) for the leftmost (or rightmost) tab
             //when there are several lines of tabs because there is only one first tab and one
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index a11453c..80253ab 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -47,12 +47,11 @@ inline double toRadian(int nDegree)
 }
 
 CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
-:   mpFontData( (CoreTextFontData*)rFSD.mpFontData )
+:   mpFontData( const_cast<CoreTextFontData*>(static_cast<CoreTextFontData const *>(rFSD.mpFontData)) )
 ,   mfFontStretch( 1.0 )
 ,   mfFontRotation( 0.0 )
 ,   mpStyleDict( NULL )
 {
-    mpFontData = (CoreTextFontData*)rFSD.mpFontData;
     const FontSelectPattern* const pReqFont = &rFSD;
 
     double fScaledFontHeight = pReqFont->mfExactHeight;
@@ -95,7 +94,7 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
         aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, toRadian(120), 1, 0, 0));
     }
 
-    CTFontDescriptorRef pFontDesc = (CTFontDescriptorRef)mpFontData->GetFontId();
+    CTFontDescriptorRef pFontDesc = reinterpret_cast<CTFontDescriptorRef>(mpFontData->GetFontId());
     CTFontRef pNewCTFont = CTFontCreateWithFontDescriptor( pFontDesc, fScaledFontHeight, &aMatrix );
     CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont );
     CFRelease( pNewCTFont);
@@ -389,7 +388,7 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext )
 
     if( bFontEnabled)
     {
-        const sal_IntPtr nFontId = (sal_IntPtr)pValue;
+        const sal_IntPtr nFontId = reinterpret_cast<sal_IntPtr>(pValue);
         CoreTextFontData* pFontData = new CoreTextFontData( rDFA, nFontId );
         SystemFontList* pFontList = (SystemFontList*)pContext;
         pFontList->AddFont( pFontData );
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 5803976..fe294cb 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -176,7 +176,7 @@ void CTLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
         delete[] iter->m_pAdjPositions;
         iter->m_pAdjPositions = new CGPoint[iter->m_nGlyphs];
 
-        SAL_INFO( "vcl.ct", "Apply DXArray Run status:"<< (void*)(uintptr_t)status);
+        SAL_INFO( "vcl.ct", "Apply DXArray Run status:"<< status);
 
         if(!(status & kCTRunStatusNonMonotonic))
         {
@@ -669,7 +669,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
         {
             if ( !CFEqual( iter->m_pFont,  pFont ) )
             {
-                pFallbackFont = new CoreTextFontData( rDevFontAttr, (sal_IntPtr)pFontDesc );
+                pFallbackFont = new CoreTextFontData( rDevFontAttr, reinterpret_cast<sal_IntPtr>(pFontDesc) );
                 *(pFallbackFonts++) = pFallbackFont;
             }
             else


More information about the Libreoffice-commits mailing list