[Libreoffice-commits] core.git: basic/source compilerplugins/clang forms/source idlc/source include/vcl pyuno/source sot/source stoc/source sw/source xmloff/source

Stephan Bergmann sbergman at redhat.com
Sun Mar 29 00:18:16 PDT 2015


 basic/source/classes/sbunoobj.cxx       |    2 +-
 compilerplugins/clang/cstylecast.cxx    |    3 ---
 forms/source/component/DatabaseForm.cxx |    4 ++--
 idlc/source/astdump.cxx                 |    6 +++---
 idlc/source/astenum.cxx                 |    2 +-
 idlc/source/astinterface.cxx            |    2 +-
 idlc/source/aststruct.cxx               |    2 +-
 include/vcl/cmdevt.hxx                  |    2 +-
 include/vcl/event.hxx                   |    4 ++--
 pyuno/source/module/pyuno.cxx           |    4 ++--
 pyuno/source/module/pyuno_runtime.cxx   |    4 ++--
 sot/source/sdstor/stgstrms.cxx          |    2 +-
 stoc/source/corereflection/base.hxx     |    2 +-
 stoc/source/corereflection/criface.cxx  |    8 ++++----
 sw/source/core/txtnode/fntcache.cxx     |    2 +-
 sw/source/core/txtnode/swfntcch.cxx     |    2 +-
 xmloff/source/style/impastpl.cxx        |    2 +-
 17 files changed, 25 insertions(+), 28 deletions(-)

New commits:
commit 0bd502af47b53bc4340df7874bd726361e3bbad9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Mar 29 09:17:00 2015 +0200

    Clean up remaining C-style casts among void pointers
    
    Change-Id: I1b49c020d597b569e330482f4dbf20c15ccdae3f

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 7a73a45..2e527d4 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4799,7 +4799,7 @@ bool StructRefInfo::setValue( const Any& rValue )
 {
     return uno_type_assignData( getInst(),
        maType.getTypeLibType(),
-       (void*)rValue.getValue(),
+       const_cast<void*>(rValue.getValue()),
        rValue.getValueTypeRef(),
        reinterpret_cast< uno_QueryInterfaceFunc >(cpp_queryInterface),
        reinterpret_cast< uno_AcquireFunc >(cpp_acquire),
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index fcc1fc82..47e8d17 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -95,9 +95,6 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
         if (t1->isPointerType() && t2->isPointerType()) {
             t1 = t1->getAs<PointerType>()->getPointeeType();
             t2 = t2->getAs<PointerType>()->getPointeeType();
-            if (t2->isVoidType()) {
-                return true;
-            }
         } else if (t1->isLValueReferenceType() && t2->isLValueReferenceType()) {
             t1 = t1->getAs<LValueReferenceType>()->getPointeeType();
             t2 = t2->getAs<LValueReferenceType>()->getPointeeType();
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 82a6d78..672e7c4 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -569,11 +569,11 @@ Sequence<sal_Int8> ODatabaseForm::GetDataMultiPartEncoded(const Reference<XContr
 
     aMemStream.Flush();
     aMemStream.Seek( 0 );
-    void* pData = (void*)aMemStream.GetData();
+    void const * pData = aMemStream.GetData();
     sal_Int32 nLen = aMemStream.Seek(STREAM_SEEK_TO_END);
 
     rContentType = aParent.GetContentType();
-    return Sequence<sal_Int8>(static_cast<sal_Int8*>(pData), nLen);
+    return Sequence<sal_Int8>(static_cast<sal_Int8 const *>(pData), nLen);
 }
 
 
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index e0f786b..5b6938c 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -87,7 +87,7 @@ bool AstModule::dump(RegistryKey& rKey)
         void const * pBlob = aBlob.getBlob(&aBlobSize);
 
         if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
-                                (RegValue)pBlob, aBlobSize))
+                                const_cast<RegValue>(pBlob), aBlobSize))
         {
             fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
                     idlc()->getOptions()->getProgramName().getStr(),
@@ -112,7 +112,7 @@ bool AstModule::dump(RegistryKey& rKey)
         if ( getNodeType() != NT_root )
         {
             if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
-                                    (RegValue)pBlob, aBlobSize))
+                                    const_cast<RegValue>(pBlob), aBlobSize))
             {
                 fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
                         idlc()->getOptions()->getProgramName().getStr(),
@@ -152,7 +152,7 @@ bool AstTypeDef::dump(RegistryKey& rKey)
     sal_uInt32 aBlobSize;
     void const * pBlob = aBlob.getBlob(&aBlobSize);
 
-    if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY, (RegValue)pBlob, aBlobSize))
+    if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY, const_cast<RegValue>(pBlob), aBlobSize))
     {
         fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
                 idlc()->getOptions()->getProgramName().getStr(),
diff --git a/idlc/source/astenum.cxx b/idlc/source/astenum.cxx
index 32f8138..51a48f0 100644
--- a/idlc/source/astenum.cxx
+++ b/idlc/source/astenum.cxx
@@ -92,7 +92,7 @@ bool AstEnum::dump(RegistryKey& rKey)
         void const * pBlob = aBlob.getBlob(&aBlobSize);
 
         if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
-                                (RegValue)pBlob, aBlobSize))
+                                const_cast<RegValue>(pBlob), aBlobSize))
         {
             fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
                     idlc()->getOptions()->getProgramName().getStr(),
diff --git a/idlc/source/astinterface.cxx b/idlc/source/astinterface.cxx
index f6b9eef..7a28e21 100644
--- a/idlc/source/astinterface.cxx
+++ b/idlc/source/astinterface.cxx
@@ -244,7 +244,7 @@ bool AstInterface::dump(RegistryKey& rKey)
     sal_uInt32 aBlobSize;
     void const * pBlob = aBlob.getBlob(&aBlobSize);
 
-    if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY, (RegValue)pBlob, aBlobSize))
+    if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY, const_cast<RegValue>(pBlob), aBlobSize))
     {
         fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
                 idlc()->getOptions()->getProgramName().getStr(),
diff --git a/idlc/source/aststruct.cxx b/idlc/source/aststruct.cxx
index 0a85a12..5df066c 100644
--- a/idlc/source/aststruct.cxx
+++ b/idlc/source/aststruct.cxx
@@ -162,7 +162,7 @@ bool AstStruct::dump(RegistryKey& rKey)
     void const * pBlob = aBlob.getBlob(&aBlobSize);
 
     if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
-                            (RegValue)pBlob, aBlobSize))
+                            const_cast<RegValue>(pBlob), aBlobSize))
     {
         fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
                 idlc()->getOptions()->getProgramName().getStr(),
diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx
index ad6a9dc..942d45b 100644
--- a/include/vcl/cmdevt.hxx
+++ b/include/vcl/cmdevt.hxx
@@ -439,7 +439,7 @@ inline CommandEvent::CommandEvent( const Point& rMousePos,
                                    sal_uInt16 nCmd, bool bMEvt, const void* pCmdData ) :
             maPos( rMousePos )
 {
-    mpData          = (void*)pCmdData;
+    mpData          = const_cast<void*>(pCmdData);
     mnCommand       = nCmd;
     mbMouseEvent    = bMEvt;
 }
diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index 8ad67fb..05a54dc 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -447,7 +447,7 @@ inline NotifyEvent::NotifyEvent( MouseNotifyEvent nEventType, vcl::Window* pWind
                                  const void* pEvent, long nRet )
 {
     mpWindow    = pWindow;
-    mpData      = (void*)pEvent;
+    mpData      = const_cast<void*>(pEvent);
     mnEventType  = nEventType;
     mnRetValue  = nRet;
 }
@@ -521,7 +521,7 @@ inline DataChangedEvent::DataChangedEvent( DataChangedEventType nType,
                                            const void* pData,
                                            AllSettingsFlags nChangeFlags )
 {
-    mpData  = (void*)pData;
+    mpData  = const_cast<void*>(pData);
     mnFlags = nChangeFlags;
     mnType  = nType;
 }
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 1d990d0..3ec1316 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -408,7 +408,7 @@ PyObject *PyUNO_str( PyObject * self )
         {
             PyThreadDetach antiguard;
             Any a = rHolder->getMaterial();
-            OUString s = val2str( (void*) a.getValue(), a.getValueType().getTypeLibType() );
+            OUString s = val2str( a.getValue(), a.getValueType().getTypeLibType() );
             buf.append( OUStringToOString(s,RTL_TEXTENCODING_ASCII_US) );
         }
     }
@@ -418,7 +418,7 @@ PyObject *PyUNO_str( PyObject * self )
         PyThreadDetach antiguard;
         buf.append( "pyuno object " );
 
-        OUString s = val2str( (void*)me->members->wrappedObject.getValue(),
+        OUString s = val2str( me->members->wrappedObject.getValue(),
                               me->members->wrappedObject.getValueType().getTypeLibType() );
         buf.append( OUStringToOString(s,RTL_TEXTENCODING_ASCII_US) );
     }
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index c58682c..a7793da 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -499,8 +499,8 @@ PyRef Runtime::any2PyObject (const Any &a ) const
             PyRef args( PyTuple_New( 1 ), SAL_NO_ACQUIRE, NOT_NULL );
 
             // assuming that the Message is always the first member, wuuuu
-            void *pData = (void*)a.getValue();
-            OUString message = *static_cast<OUString *>(pData);
+            void const *pData = a.getValue();
+            OUString message = *static_cast<OUString const *>(pData);
             PyRef pymsg = ustring2PyString( message );
             PyTuple_SetItem( args.get(), 0 , pymsg.getAcquired() );
             // the exception base functions want to have an "args" tuple,
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index ca7f087..e90e823 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -984,7 +984,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
                 }
                 else
                     // do a direct (unbuffered) write
-                    nRes = (short) rIo.Write( nPage, (void*) p, 1 ) * nPageSize;
+                    nRes = (short) rIo.Write( nPage, const_cast<void*>(p), 1 ) * nPageSize;
             }
             else
             {
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx
index 7c83960..d81cf76 100644
--- a/stoc/source/corereflection/base.hxx
+++ b/stoc/source/corereflection/base.hxx
@@ -425,7 +425,7 @@ inline bool coerce_assign(
     {
         return uno_type_assignData(
             pDest, pTD->pWeakRef,
-            (void *)rSource.getValue(), rSource.getValueTypeRef(),
+            const_cast<void *>(rSource.getValue()), rSource.getValueTypeRef(),
             reinterpret_cast< uno_QueryInterfaceFunc >(css::uno::cpp_queryInterface),
             reinterpret_cast< uno_AcquireFunc >(css::uno::cpp_acquire),
             reinterpret_cast< uno_ReleaseFunc >(css::uno::cpp_release) );
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index a3b72bc..560d632 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -258,7 +258,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
             // construct temp uno val to do proper assignment: todo opt
             void * pTemp = alloca( pValueTD->nSize );
             uno_copyAndConvertData(
-                pTemp, (void *)rValue.getValue(), pValueTD, getReflection()->getCpp2Uno().get() );
+                pTemp, const_cast<void *>(rValue.getValue()), pValueTD, getReflection()->getCpp2Uno().get() );
             uno_constructData(
                 pArg, pTD );
             // assignment does simple conversion
@@ -636,14 +636,14 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
                         pCppArgs[nPos].getValueTypeRef(), pTD->pWeakRef ))
                 {
                     uno_type_copyAndConvertData(
-                        ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
+                        ppUnoArgs[nPos], const_cast<void *>(pCppArgs[nPos].getValue()),
                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
                     bAssign = true;
                 }
                 else if (pTD->eTypeClass == typelib_TypeClass_ANY)
                 {
                     uno_type_any_constructAndConvert(
-                        static_cast<uno_Any *>(ppUnoArgs[nPos]), (void *)pCppArgs[nPos].getValue(),
+                        static_cast<uno_Any *>(ppUnoArgs[nPos]), const_cast<void *>(pCppArgs[nPos].getValue()),
                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
                     bAssign = true;
                 }
@@ -666,7 +666,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
                     // construct temp uno val to do proper assignment: todo opt
                     void * pTemp = alloca( pValueTD->nSize );
                     uno_copyAndConvertData(
-                        pTemp, (void *)pCppArgs[nPos].getValue(), pValueTD,
+                        pTemp, const_cast<void *>(pCppArgs[nPos].getValue()), pValueTD,
                         getReflection()->getCpp2Uno().get() );
                     uno_constructData(
                         ppUnoArgs[nPos], pTD );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 225e637..9c34419 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -104,7 +104,7 @@ void SwFntCache::Flush( )
 }
 
 SwFntObj::SwFntObj(const SwSubFont &rFont, const void *pOwn, SwViewShell const *pSh)
-    : SwCacheObj((void*)pOwn)
+    : SwCacheObj(pOwn)
     , aFont(rFont)
     , pScrFont(NULL)
     , pPrtFont(&aFont)
diff --git a/sw/source/core/txtnode/swfntcch.cxx b/sw/source/core/txtnode/swfntcch.cxx
index 058b071..109ce7a 100644
--- a/sw/source/core/txtnode/swfntcch.cxx
+++ b/sw/source/core/txtnode/swfntcch.cxx
@@ -30,7 +30,7 @@ extern const sal_uInt8 StackPos[];
 SwFontCache *pSwFontCache = NULL;
 
 SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) :
-    SwCacheObj( (void*)pOwn ),
+    SwCacheObj( pOwn ),
     aSwFont( &static_cast<SwTxtFmtColl const *>(pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 )
 {
     aSwFont.GoMagic( pSh, aSwFont.GetActual() );
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx
index b6e1b2a..a35f51b 100644
--- a/xmloff/source/style/impastpl.cxx
+++ b/xmloff/source/style/impastpl.cxx
@@ -165,7 +165,7 @@ data2string(void *data,
 static OUString
 any2string(uno::Any any)
 {
-    return data2string((void*)any.getValue(), any.pType);
+    return data2string(const_cast<void*>(any.getValue()), any.pType);
 }
 
 // Class SvXMLAutoStylePoolProperties_Impl


More information about the Libreoffice-commits mailing list