[Libreoffice-commits] core.git: 39 commits - basctl/source basic/source bridges/source chart2/source comphelper/source compilerplugins/clang connectivity/source cppu/source desktop/source extensions/source filter/source formula/source hwpfilter/source i18npool/qa i18npool/source include/editeng include/sfx2 include/svx io/source jvmfwk/source lingucomponent/source oox/source opencl/source qadevOOo/tests rsc/source sal/osl sal/qa sal/textenc sc/source sdext/source sd/source sfx2/source shell/source sot/source svl/source svtools/source svx/source sw/source toolkit/source tools/source unoxml/source vcl/generic vcl/headless vcl/inc vcl/quartz vcl/source vcl/unx xmloff/source xmlsecurity/source

Stephan Bergmann sbergman at redhat.com
Tue Jun 2 02:30:00 PDT 2015


 basctl/source/dlged/dlgedobj.cxx                                 |    2 
 basic/source/runtime/methods1.cxx                                |    4 
 bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx             |    2 
 bridges/source/jni_uno/jni_helper.h                              |    4 
 chart2/source/view/main/3DChartObjects.cxx                       |    2 
 comphelper/source/property/propertysethelper.cxx                 |   12 -
 compilerplugins/clang/cstylecast.cxx                             |  117 ++++++++--
 connectivity/source/drivers/dbase/DTable.cxx                     |    4 
 connectivity/source/drivers/evoab2/NResultSet.cxx                |    2 
 connectivity/source/drivers/hsqldb/HStorageAccess.cxx            |    4 
 connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx  |    2 
 connectivity/source/drivers/kab/KDatabaseMetaData.cxx            |    6 
 connectivity/source/drivers/kab/KResultSet.cxx                   |    6 
 connectivity/source/drivers/kab/KResultSetMetaData.cxx           |    2 
 connectivity/source/drivers/kab/kcondition.cxx                   |    6 
 connectivity/source/drivers/kab/kfields.cxx                      |    4 
 connectivity/source/drivers/macab/MacabRecords.cxx               |    6 
 connectivity/source/drivers/odbc/OResultSet.cxx                  |    2 
 connectivity/source/drivers/odbc/OStatement.cxx                  |    2 
 cppu/source/typelib/typelib.cxx                                  |    6 
 desktop/source/lib/init.cxx                                      |    8 
 extensions/source/bibliography/toolbar.cxx                       |    4 
 extensions/source/plugin/base/xplugin.cxx                        |    4 
 extensions/source/propctrlr/taborder.cxx                         |    2 
 extensions/source/scanner/sane.cxx                               |    4 
 filter/source/graphicfilter/eos2met/eos2met.cxx                  |    2 
 filter/source/graphicfilter/ios2met/ios2met.cxx                  |    4 
 filter/source/t602/t602filter.cxx                                |    2 
 formula/source/core/api/token.cxx                                |    2 
 hwpfilter/source/mzstring.h                                      |    2 
 i18npool/qa/cppunit/test_textsearch.cxx                          |    8 
 i18npool/source/breakiterator/gendict.cxx                        |    2 
 i18npool/source/collator/gencoll_rule.cxx                        |    2 
 i18npool/source/indexentry/genindex_data.cxx                     |    2 
 i18npool/source/search/textsearch.cxx                            |    6 
 i18npool/source/textconversion/genconv_dict.cxx                  |    6 
 include/editeng/svxrtf.hxx                                       |    2 
 include/sfx2/styfitem.hxx                                        |    2 
 include/svx/svdlayer.hxx                                         |    2 
 io/source/stm/odata.cxx                                          |    2 
 jvmfwk/source/framework.cxx                                      |    2 
 lingucomponent/source/languageguessing/guesslang.cxx             |    2 
 lingucomponent/source/spellcheck/spell/sspellimp.cxx             |    2 
 oox/source/export/drawingml.cxx                                  |    2 
 opencl/source/openclwrapper.cxx                                  |    2 
 qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java |   10 
 rsc/source/parser/rscdb.cxx                                      |    2 
 sal/osl/unx/module.cxx                                           |    4 
 sal/osl/unx/mutex.cxx                                            |    2 
 sal/osl/unx/process.cxx                                          |    2 
 sal/osl/unx/socket.cxx                                           |    4 
 sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx          |    8 
 sal/qa/rtl/strings/test_ostring_concat.cxx                       |    4 
 sal/qa/rtl/strings/test_ostring_stringliterals.cxx               |   32 +-
 sal/qa/rtl/strings/test_oustring_concat.cxx                      |    4 
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx              |    2 
 sal/textenc/tencinfo.cxx                                         |    6 
 sal/textenc/textcvt.cxx                                          |    4 
 sc/source/core/tool/addinlis.cxx                                 |    2 
 sc/source/core/tool/callform.cxx                                 |   16 -
 sc/source/ui/condformat/condformatdlg.cxx                        |    4 
 sc/source/ui/unoobj/cellsuno.cxx                                 |    2 
 sd/source/filter/eppt/epptso.cxx                                 |    2 
 sd/source/filter/html/htmlex.cxx                                 |    2 
 sd/source/ui/remotecontrol/BluetoothServer.cxx                   |    2 
 sd/source/ui/view/drviews2.cxx                                   |   28 +-
 sd/source/ui/view/drviews9.cxx                                   |    2 
 sd/source/ui/view/drviewse.cxx                                   |   10 
 sdext/source/pdfimport/pdfparse/pdfentries.cxx                   |    4 
 sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx                 |    2 
 sfx2/source/doc/sfxbasemodel.cxx                                 |    2 
 shell/source/backends/kde4be/kde4access.cxx                      |   14 -
 shell/source/backends/kdebe/kdeaccess.cxx                        |   14 -
 shell/source/backends/macbe/macbackend.mm                        |    2 
 sot/source/sdstor/stgole.cxx                                     |    2 
 sot/source/sdstor/storinfo.cxx                                   |    2 
 svl/source/items/poolio.cxx                                      |    4 
 svtools/source/contnr/svimpbox.cxx                               |    2 
 svtools/source/control/ctrltool.cxx                              |    4 
 svx/source/fmcomp/fmgridcl.cxx                                   |    2 
 svx/source/fmcomp/gridcell.cxx                                   |    2 
 svx/source/form/fmexpl.cxx                                       |    4 
 svx/source/form/fmundo.cxx                                       |    2 
 svx/source/form/fmvwimp.cxx                                      |    4 
 svx/source/form/formcontroller.cxx                               |    6 
 svx/source/svdraw/svdlayer.cxx                                   |    2 
 svx/source/toolbars/extrusionbar.cxx                             |    6 
 svx/source/toolbars/fontworkbar.cxx                              |    2 
 sw/source/core/crsr/crsrsh.cxx                                   |    2 
 sw/source/core/crsr/crstrvl.cxx                                  |    2 
 sw/source/core/doc/docedt.cxx                                    |    2 
 sw/source/core/doc/docnum.cxx                                    |    4 
 sw/source/core/doc/docsort.cxx                                   |    4 
 sw/source/core/doc/tblcpy.cxx                                    |    4 
 sw/source/core/docnode/ndtbl.cxx                                 |    2 
 sw/source/core/docnode/nodes.cxx                                 |    6 
 sw/source/core/fields/fldlst.cxx                                 |    4 
 sw/source/core/frmedt/tblsel.cxx                                 |   18 -
 sw/source/core/layout/movedfwdfrmsbyobjpos.cxx                   |    2 
 sw/source/core/text/txtfly.cxx                                   |    8 
 sw/source/filter/ww8/rtfattributeoutput.cxx                      |    2 
 sw/source/filter/ww8/wrtw8num.cxx                                |    2 
 sw/source/uibase/app/mainwn.cxx                                  |    2 
 sw/source/uibase/shells/grfsh.cxx                                |    4 
 sw/source/uibase/utlui/gloslst.cxx                               |    2 
 toolkit/source/awt/vclxtoolkit.cxx                               |    2 
 toolkit/source/controls/controlmodelcontainerbase.cxx            |    2 
 toolkit/source/controls/dialogcontrol.cxx                        |    2 
 toolkit/source/controls/stdtabcontroller.cxx                     |    4 
 tools/source/stream/stream.cxx                                   |    2 
 unoxml/source/dom/node.cxx                                       |    2 
 vcl/generic/fontmanager/fontconfig.cxx                           |    2 
 vcl/generic/fontmanager/fontmanager.cxx                          |    2 
 vcl/generic/print/genpspgraphics.cxx                             |    2 
 vcl/headless/svpbmp.cxx                                          |    2 
 vcl/inc/ilstbox.hxx                                              |    2 
 vcl/quartz/ctfonts.cxx                                           |    2 
 vcl/source/filter/jpeg/JpegReader.cxx                            |    6 
 vcl/source/filter/jpeg/jpegc.cxx                                 |    4 
 vcl/source/gdi/bmpacc.cxx                                        |    4 
 vcl/source/gdi/dibtools.cxx                                      |    6 
 vcl/source/gdi/pdfwriter_impl.cxx                                |    2 
 vcl/source/gdi/salgdilayout.cxx                                  |    4 
 vcl/source/outdev/polygon.cxx                                    |    2 
 vcl/source/window/window.cxx                                     |    2 
 vcl/unx/gtk/window/gtksalmenu.cxx                                |    4 
 xmloff/source/draw/ximp3dscene.cxx                               |    2 
 xmlsecurity/source/framework/buffernode.cxx                      |    8 
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx    |    2 
 xmlsecurity/source/xmlsec/xmlstreamio.cxx                        |    2 
 130 files changed, 373 insertions(+), 280 deletions(-)

New commits:
commit acd4ecc38fc3aa486b7eaf8d5effa4a5ea034ccd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:29:13 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Ice7bbdea1d0df0a92f2e1b38f033adaff2fb8b07

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index afbcacd..dadba42 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -18,6 +18,63 @@
 
 namespace {
 
+bool areSimilar(QualType type1, QualType type2) {
+    auto t1 = type1.getCanonicalType().getTypePtr();
+    auto t2 = type2.getCanonicalType().getTypePtr();
+    for (;;) {
+        if (t1->isPointerType()) {
+            if (!t2->isPointerType()) {
+                return false;
+            }
+            auto t1a = t1->getAs<PointerType>();
+            auto t2a = t2->getAs<PointerType>();
+            t1 = t1a->getPointeeType().getTypePtr();
+            t2 = t2a->getPointeeType().getTypePtr();
+        } else if (t1->isMemberPointerType()) {
+            if (!t2->isMemberPointerType()) {
+                return false;
+            }
+            auto t1a = t1->getAs<MemberPointerType>();
+            auto t2a = t2->getAs<MemberPointerType>();
+            if (t1a->getClass()->getCanonicalTypeInternal()
+                != t2a->getClass()->getCanonicalTypeInternal())
+            {
+                return false;
+            }
+            t1 = t1a->getPointeeType().getTypePtr();
+            t2 = t2a->getPointeeType().getTypePtr();
+        } else if (t1->isConstantArrayType()) {
+            if (!t2->isConstantArrayType()) {
+                return false;
+            }
+            auto t1a = static_cast<ConstantArrayType const *>(
+                t1->getAsArrayTypeUnsafe());
+            auto t2a = static_cast<ConstantArrayType const *>(
+                t2->getAsArrayTypeUnsafe());
+            if (t1a->getSize() != t2a->getSize()) {
+                return false;
+            }
+            t1 = t1a->getElementType().getTypePtr();
+            t2 = t2a->getElementType().getTypePtr();
+        } else if (t1->isIncompleteArrayType()) {
+            if (!t2->isIncompleteArrayType()) {
+                return false;
+            }
+            auto t1a = static_cast<IncompleteArrayType const *>(
+                t1->getAsArrayTypeUnsafe());
+            auto t2a = static_cast<IncompleteArrayType const *>(
+                t2->getAsArrayTypeUnsafe());
+            t1 = t1a->getElementType().getTypePtr();
+            t2 = t2a->getElementType().getTypePtr();
+        } else {
+            return false;
+        }
+        if (t1 == t2) {
+            return true;
+        }
+    }
+}
+
 bool hasCLanguageLinkageType(FunctionDecl const * decl) {
     return decl->isExternC() || compat::isInExternCContext(*decl);
 }
@@ -48,6 +105,8 @@ public:
     bool VisitCStyleCastExpr(const CStyleCastExpr * expr);
 
 private:
+    bool isConstCast(QualType from, QualType to);
+
     bool externCFunction;
 };
 
@@ -56,7 +115,7 @@ static const char * recommendedFix(clang::CastKind ck) {
         case CK_IntegralToPointer: return "reinterpret_cast";
         case CK_PointerToIntegral: return "reinterpret_cast";
         case CK_BaseToDerived: return "static_cast";
-        default: return "???";
+        default: return nullptr;
     }
 }
 
@@ -88,6 +147,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
     if( expr->getCastKind() == CK_IntegralCast ) {
         return true;
     }
+    char const * perf = nullptr;
     if( expr->getCastKind() == CK_NoOp ) {
         QualType t1 = expr->getSubExpr()->getType();
         QualType t2 = expr->getType();
@@ -100,11 +160,17 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
         } else {
             return true;
         }
-        if (expr->getSubExprAsWritten()->getType() != expr->getType()
-            && (!t1.isMoreQualifiedThan(t2)
-                || (t1.getUnqualifiedType().getCanonicalType().getTypePtr()
-                    != (t2.getUnqualifiedType().getCanonicalType()
-                        .getTypePtr()))))
+        if (isConstCast(
+                expr->getSubExprAsWritten()->getType(),
+                expr->getTypeAsWritten()))
+        {
+            perf = "const_cast";
+        } else if (expr->getSubExprAsWritten()->getType() != expr->getType()
+                   && (!t1.isMoreQualifiedThan(t2)
+                       || ((t1.getUnqualifiedType().getCanonicalType()
+                            .getTypePtr())
+                           != (t2.getUnqualifiedType().getCanonicalType()
+                               .getTypePtr()))))
         {
             return true;
         }
@@ -130,18 +196,43 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
             return true;
         }
     }
+    if (perf == nullptr) {
+        perf = recommendedFix(expr->getCastKind());
+    }
+    std::string performs;
+    if (perf != nullptr) {
+        performs = std::string(" (performs: ") + perf + ")";
+    }
     report(
-        DiagnosticsEngine::Warning,
-        "c-style cast, type=%0, from=%1%2, to=%3%4, recommendedFix=%5",
+        DiagnosticsEngine::Warning, "%0 C-style cast from %1%2 to %3%4%5",
         expr->getSourceRange().getBegin())
-      << expr->getCastKind()
-      << incompFrom << expr->getSubExprAsWritten()->getType()
-      << incompTo << expr->getType()
-      << recommendedFix(expr->getCastKind())
-      << expr->getSourceRange();
+      << expr->getCastKindName() << incompFrom
+      << expr->getSubExprAsWritten()->getType() << incompTo << expr->getType()
+      << performs << expr->getSourceRange();
     return true;
 }
 
+bool CStyleCast::isConstCast(QualType from, QualType to) {
+    if (to->isReferenceType()
+        && to->getAs<ReferenceType>()->getPointeeType()->isObjectType())
+    {
+        if (!from->isObjectType()) {
+            return false;
+        }
+        from = compiler.getASTContext().getPointerType(from);
+        to = compiler.getASTContext().getPointerType(
+            to->getAs<ReferenceType>()->getPointeeType());
+    } else {
+        if (from->isArrayType()) {
+            from = compiler.getASTContext().getPointerType(
+                from->getAsArrayTypeUnsafe()->getElementType());
+        } else if (from->isFunctionType()) {
+            compiler.getASTContext().getPointerType(from);
+        }
+    }
+    return areSimilar(from, to);
+}
+
 loplugin::Plugin::Registration< CStyleCast > X("cstylecast");
 
 }
commit 3f846cb7a40ea6226c68ff22981d6090da66e6aa
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:29:00 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I7128d99926bddf5ffd0a87099c7fa3ce3a1e08e0

diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx
index cbe27e7..13bec53 100644
--- a/xmlsecurity/source/framework/buffernode.cxx
+++ b/xmlsecurity/source/framework/buffernode.cxx
@@ -367,7 +367,7 @@ const BufferNode* BufferNode::getFirstChild() const
         rc = const_cast<BufferNode*>(m_vChildren.front());
     }
 
-    return (const BufferNode*)rc;
+    return rc;
 }
 
 void BufferNode::addChild(const BufferNode* pChild, sal_Int32 nPosition)
@@ -557,7 +557,7 @@ const BufferNode* BufferNode::getNextSibling() const
         rc = const_cast<BufferNode*>(m_pParent->getNextChild(this));
     }
 
-    return (const BufferNode*)rc;
+    return rc;
 }
 
 const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const
@@ -609,7 +609,7 @@ const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const
         }
     }
 
-    return (const BufferNode*)rc;
+    return rc;
 }
 
 bool BufferNode::isPrevious(const BufferNode* pFollowing) const
@@ -1065,7 +1065,7 @@ const BufferNode* BufferNode::getNextChild(const BufferNode* pChild) const
         }
     }
 
-    return (const BufferNode*)rc;
+    return rc;
 }
 
 
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index ceb6289..7d26171 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -561,7 +561,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAs
 {
     OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ;
     xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), ( int )oscert.getLength() ) ;
-    int certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ;
+    int certSize = xmlSecBase64Decode( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ) ) ;
     if (certSize > 0)
     {
         Sequence< sal_Int8 > rawCert(certSize) ;
diff --git a/xmlsecurity/source/xmlsec/xmlstreamio.cxx b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
index 032ee47..29fd957 100644
--- a/xmlsecurity/source/xmlsec/xmlstreamio.cxx
+++ b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
@@ -121,7 +121,7 @@ int xmlStreamRead( void* context, char* buffer, int len )
                 return 0 ;
 
             numbers = xInputStream->readBytes( outSeqs, len ) ;
-            const sal_Int8* readBytes = ( const sal_Int8* )outSeqs.getArray() ;
+            const sal_Int8* readBytes = outSeqs.getArray() ;
             for( int i = 0 ; i < numbers ; i ++ )
                 *( buffer + i ) = *( readBytes + i ) ;
         }
commit 0fded753c787c9e0e374bf65fe5c53538adda206
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:56 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Idd4f5a66667e2c13d2cb691960cfd1f568310674

diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx
index ad3ac71..72055e9 100644
--- a/xmloff/source/draw/ximp3dscene.cxx
+++ b/xmloff/source/draw/ximp3dscene.cxx
@@ -379,7 +379,7 @@ void SdXML3DSceneAttributesHelper::setSceneAttributes( const com::sun::star::uno
         // set lights
         for( size_t a = 0; a < maList.size(); a++)
         {
-            SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList[ a ];
+            SdXML3DLightContext* pCtx = maList[ a ];
 
             // set anys
             aAny <<= pCtx->GetDiffuseColor();
commit c56a8863cde2ccd96dc6b75ad2c7d208c8190414
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:51 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I1a9aa868d3724a7d14c181e45d956cdf2423e40c

diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 7561736..59ed6ae 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -671,7 +671,7 @@ bool PrintFontManager::addFontconfigDir( const OString& rDirName )
     const int nVersion = FcGetVersion();
     if( nVersion <= 20400 )
         return false;
-    const char* pDirName = (const char*)rDirName.getStr();
+    const char* pDirName = rDirName.getStr();
     bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), reinterpret_cast<FcChar8 const *>(pDirName) ) == FcTrue);
 
 #if OSL_DEBUG_LEVEL > 1
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index b90abdc..2f4b49a 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -2190,7 +2190,7 @@ std::list< OString > PrintFontManager::getAdobeNameFromUnicode( sal_Unicode aCha
     if( aRet.begin() == aRet.end() && aChar != 0 )
     {
         sal_Char aBuf[8];
-        sal_Int32 nChars = snprintf( (char*)aBuf, sizeof( aBuf ), "uni%.4hX", aChar );
+        sal_Int32 nChars = snprintf( aBuf, sizeof( aBuf ), "uni%.4hX", aChar );
         aRet.push_back( OString( aBuf, nChars ) );
     }
 
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 0a1bedc..e6df236 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -479,7 +479,7 @@ bool GenPspGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly,
                                              const sal_uInt8* const* pFlgAry )
 {
     // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx
-    m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, reinterpret_cast<Point const * const *>(pPtAry), (sal_uInt8**)pFlgAry);
+    m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, reinterpret_cast<Point const * const *>(pPtAry), pFlgAry);
     return true;
 }
 
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 901526e..a63a5fe 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -245,7 +245,7 @@ BitmapBuffer* SvpSalBitmap::AcquireBuffer( BitmapAccessMode )
         pBuf->mnHeight          = aSize.getY();
         pBuf->mnScanlineSize    = m_aBitmap->getScanlineStride();
         pBuf->mnBitCount        = nBitCount;
-        pBuf->mpBits            = (sal_uInt8*)m_aBitmap->getBuffer().get();
+        pBuf->mpBits            = m_aBitmap->getBuffer().get();
         if( nBitCount <= 8 )
         {
             if( m_aBitmap->getScanlineFormat() == FORMAT_EIGHT_BIT_GREY ||
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 363483e..39746dc 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -112,7 +112,7 @@ public:
 
     sal_Int32               InsertEntry( sal_Int32  nPos, ImplEntryType* pNewEntry, bool bSort );
     void                    RemoveEntry( sal_Int32  nPos );
-    const ImplEntryType*    GetEntryPtr( sal_Int32  nPos ) const { return (const ImplEntryType*) GetEntry( nPos ); }
+    const ImplEntryType*    GetEntryPtr( sal_Int32  nPos ) const { return GetEntry( nPos ); }
     ImplEntryType*          GetMutableEntryPtr( sal_Int32  nPos ) const { return GetEntry( nPos ); }
     void                    Clear();
 
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 16cde93..607fbd9 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -249,7 +249,7 @@ int CoreTextFontData::GetFontTable( const char pTagName[5], unsigned char* pResu
     if( pResultBuf && (nByteLength > 0))
     {
         const CFRange aFullRange = CFRangeMake( 0, nByteLength);
-        CFDataGetBytes( pDataRef, aFullRange, (UInt8*)pResultBuf);
+        CFDataGetBytes( pDataRef, aFullRange, reinterpret_cast<UInt8*>(pResultBuf));
     }
 
     CFRelease( pDataRef);
diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx
index 5785224..24b2626 100644
--- a/vcl/source/filter/jpeg/JpegReader.cxx
+++ b/vcl/source/filter/jpeg/JpegReader.cxx
@@ -327,7 +327,7 @@ void JPEGReader::FillBitmap()
 
             for( long nY = 0L; nY < nHeight; nY++ )
             {
-                pTmp = (sal_uInt8*) mpBuffer + nY * nAlignedWidth;
+                pTmp = mpBuffer + nY * nAlignedWidth;
 
                 for( long nX = 0L; nX < nWidth; nX++ )
                 {
@@ -351,7 +351,7 @@ void JPEGReader::FillBitmap()
                     // then CopyScanline can use a memcpy to do the data transport. CopyScanline can also
                     // do the needed conversion from BMP_FORMAT_24BIT_TC_RGB (and it works well), but this
                     // is not faster that the old loop below using SetPixel.
-                    sal_uInt8* aSource((sal_uInt8*)mpBuffer + nY * nAlignedWidth);
+                    sal_uInt8* aSource(mpBuffer + nY * nAlignedWidth);
                     sal_uInt8* aEnd(aSource + (nWidth * 3));
 
                     for(sal_uInt8* aTmp(aSource); aTmp < aEnd; aTmp += 3)
@@ -364,7 +364,7 @@ void JPEGReader::FillBitmap()
                 else
                 {
                     // old version: WritePixel
-                    pTmp = (sal_uInt8*) mpBuffer + nY * nAlignedWidth;
+                    pTmp = mpBuffer + nY * nAlignedWidth;
 
                     for( long nX = 0L; nX < nWidth; nX++ )
                     {
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index 9762e5a..45c69ad 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -184,7 +184,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
                 int i;
                 int j;
                 unsigned char *pSLB = pScanLineBuffer.get();
-                jpeg_read_scanlines( &cinfo, (JSAMPARRAY) &pSLB, 1 );
+                jpeg_read_scanlines( &cinfo, reinterpret_cast<JSAMPARRAY>(&pSLB), 1 );
                 // convert CMYK to RGB
                 for( i=0, j=0; i < nScanLineBufferComponents; i+=4, j+=3 )
                 {
@@ -199,7 +199,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
             }
             else
             {
-                jpeg_read_scanlines( &cinfo, (JSAMPARRAY) &pTmp, 1 );
+                jpeg_read_scanlines( &cinfo, reinterpret_cast<JSAMPARRAY>(&pTmp), 1 );
             }
 
             /* PENDING ??? */
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index 2e7982f..ef2983c 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -361,7 +361,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits()
                 else
                     nMask = static_cast<sal_uInt8>(0xffU >> (nLeftOverBits & 3UL));
 
-                sal_uInt8* pLastBytes = (sal_uInt8*)GetBuffer() + ( nScanSize - nBytes );
+                sal_uInt8* pLastBytes = reinterpret_cast<sal_uInt8*>(GetBuffer()) + ( nScanSize - nBytes );
                 for( sal_uInt32 i = 0; i < nHeight; i++, pLastBytes += nScanSize )
                 {
                     *pLastBytes &= nMask;
@@ -373,7 +373,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits()
         else if( nBits & 0x1f )
         {
             sal_uInt32  nMask = 0xffffffff << ( ( nScanSize << 3 ) - nBits );
-            sal_uInt8*      pLast4Bytes = (sal_uInt8*) GetBuffer() + ( nScanSize - 4 );
+            sal_uInt8*      pLast4Bytes = reinterpret_cast<sal_uInt8*>(GetBuffer()) + ( nScanSize - 4 );
 
 #ifdef OSL_LITENDIAN
             nMask = OSL_SWAPDWORD( nMask );
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 4267cce..85fe8e8 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -1047,13 +1047,13 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess*
         SVBT32              aVal32;
 
         UInt32ToSVBT32( rMask.GetRedMask(), aVal32 );
-        rOStm.Write( (sal_uInt8*) aVal32, 4UL );
+        rOStm.Write( aVal32, 4UL );
 
         UInt32ToSVBT32( rMask.GetGreenMask(), aVal32 );
-        rOStm.Write( (sal_uInt8*) aVal32, 4UL );
+        rOStm.Write( aVal32, 4UL );
 
         UInt32ToSVBT32( rMask.GetBlueMask(), aVal32 );
-        rOStm.Write( (sal_uInt8*) aVal32, 4UL );
+        rOStm.Write( aVal32, 4UL );
 
         rImageSize = rOStm.Tell();
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index fe1b833..e750d3a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2112,7 +2112,7 @@ void PDFWriterImpl::emitComment( const char* pComment )
 {
     OStringBuffer aLine( 64 );
     aLine.append( "% " );
-    aLine.append( (const sal_Char*)pComment );
+    aLine.append( pComment );
     aLine.append( "\n" );
     writeBuffer( aLine.getStr(), aLine.getLength() );
 }
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index f25b956..9a30c33 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -435,7 +435,7 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints,
             mirror( nPoints, pPtAry[i], pPtAry2[i], pOutDev );
         }
 
-        drawPolyPolygon( nPoly, pPoints, (PCONSTSALPOINT*)pPtAry2 );
+        drawPolyPolygon( nPoly, pPoints, const_cast<PCONSTSALPOINT*>(pPtAry2) );
 
         for(i=0; i<nPoly; i++)
             delete [] pPtAry2[i];
@@ -502,7 +502,7 @@ bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i
             mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_pOutDev );
         }
 
-        bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, (PCONSTSALPOINT*)pPtAry2, i_pFlgAry );
+        bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<PCONSTSALPOINT const *>(pPtAry2), i_pFlgAry );
 
         for(i=0; i<i_nPoly; i++)
             delete [] pPtAry2[i];
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 9b703a0..208906d 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -347,7 +347,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolyg
     {
         pPointAry       = aStackAry1;
         pPointAryAry    = aStackAry2;
-        pFlagAryAry     = (const sal_uInt8**)aStackAry3;
+        pFlagAryAry     = const_cast<const sal_uInt8**>(aStackAry3);
     }
 
     do
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c9129b6..72433b0 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -835,7 +835,7 @@ void Window::ReleaseGraphics( bool bRelease )
 
     ImplSVData* pSVData = ImplGetSVData();
 
-    vcl::Window* pWindow = (vcl::Window*)this;
+    vcl::Window* pWindow = this;
 
     if ( bRelease )
         pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics );
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 94668ff..4cd6622 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -804,7 +804,7 @@ bool GtkSalMenu::IsItemVisible( unsigned nPos )
     bool bVisible = false;
 
     if ( nPos < maItems.size() )
-        bVisible = ( ( GtkSalMenuItem* ) maItems[ nPos ])->mbVisible;
+        bVisible = maItems[ nPos ]->mbVisible;
 
     return bVisible;
 }
@@ -821,7 +821,7 @@ void GtkSalMenu::ShowItem( unsigned nPos, bool bShow )
 {
     SolarMutexGuard aGuard;
     if ( nPos < maItems.size() )
-        ( ( GtkSalMenuItem* ) maItems[ nPos ] )->mbVisible = bShow;
+        maItems[ nPos ]->mbVisible = bShow;
 }
 
 void GtkSalMenu::SetItemText( unsigned, SalMenuItem*, const OUString& )
commit 132e8ca43e4f28c2b4b9842ce2b977e0f25b0730
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:47 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Ic50468d68c92779a589894963ab4099eefb8adf4

diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 4fbba7c..4501b7a 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -116,7 +116,7 @@ namespace DOM
                        strlen(reinterpret_cast<const char*>(pPrefix)));
 
         OSL_TRACE("getTokenWithPrefix(): prefix %s, name %s",
-                  (const char*)pPrefix, (const char*)pName);
+                  pPrefix, pName);
 
         Context::NamespaceVectorType::value_type::const_iterator aIter;
         if( (aIter=std::find_if(rContext.maNamespaces.back().begin(),
commit 194c960ce9991418d72ab7ca181d412255d13020
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:42 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Ia5b84ed835215fe8e6a00a92cb3ac66f5fe0d973

diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 45d2769..2e98799 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1163,7 +1163,7 @@ SvStream& SvStream::WriteUChar( unsigned char v )
 //SDO
     if(bIoWrite && sizeof(char) <= nBufFree )
     {
-        *(unsigned char*)pBufPos = v;
+        *reinterpret_cast<unsigned char*>(pBufPos) = v;
         pBufPos++; // = sizeof(char);
         nBufActualPos++; // = sizeof(char);
         if( nBufActualPos > nBufActualLen )  // Append ?
commit 64b33886ef0ba179abafa50e1bfc6f3386488a5b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:38 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Ie7129c66f236b93f505dad9ea672ab777cb380d1

diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index b148173..8745157 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1064,7 +1064,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
 
                                 rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(processID) );
 
-                                ::com::sun::star::uno::Sequence<sal_Int8> processIdSeq((sal_Int8*)processID, 16);
+                                ::com::sun::star::uno::Sequence<sal_Int8> processIdSeq(processID, 16);
 
                                 ::com::sun::star::uno::Any anyHandle = xSystemDepParent->getWindowHandle(processIdSeq, SYSTEM_DEPENDENT_TYPE);
 
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 98b953c..5457d16 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -1684,7 +1684,7 @@ void ControlContainerBase::ImplModelPropertiesChanged( const Sequence< PropertyC
         {
             const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
             Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
-            bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+            bool bOwnModel = xModel.get() == getModel().get();
             if ( ( rEvt.PropertyName == s1 ) ||
                  ( rEvt.PropertyName == s2 ) ||
                  ( rEvt.PropertyName == s3 ) ||
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 39404aa..f194f3d 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -659,7 +659,7 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang
     {
         const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
         Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
-        bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+        bool bOwnModel = xModel.get() == getModel().get();
         if ( bOwnModel && rEvt.PropertyName == "ImageURL" )
         {
             OUString aImageURL;
diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx
index 3134587..bb606ae 100644
--- a/toolkit/source/controls/stdtabcontroller.cxx
+++ b/toolkit/source/controls/stdtabcontroller.cxx
@@ -258,7 +258,7 @@ void StdTabController::autoTabOrder(  ) throw(RuntimeException, std::exception)
     size_t n;
     for ( n = 0; n < nCtrls; n++ )
     {
-        XWindow* pC = (XWindow*)pComponents[n].get();
+        XWindow* pC = pComponents[n].get();
         ComponentEntry* pE = new ComponentEntry;
         pE->pComponent = pC;
         awt::Rectangle aPosSize = pC->getPosSize();
@@ -396,7 +396,7 @@ Reference< XControl >  StdTabController::FindControl( Sequence< Reference< XCont
     for ( sal_Int32 n = 0; n < nCtrls; n++ )
     {
         Reference< XControlModel >  xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : Reference< XControlModel > ());
-        if ( (XControlModel*)xModel.get() == (XControlModel*)rxCtrlModel.get() )
+        if ( xModel.get() == rxCtrlModel.get() )
         {
             Reference< XControl >  xCtrl( pCtrls[n] );
             ::comphelper::removeElementAt( rCtrls, n );
commit 0686fcdb667f1dce67185656d2d011e84638eff3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:35 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Icb8f62a167cc450bd156f0e3611f30c4d2a57c16

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index de3193e..30781fb 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -193,7 +193,7 @@ SwPaM* SwCrsrShell::GetCrsr( bool bMakeTableCrsr ) const
                 0 != ( pCNd = m_pTableCrsr->GetContentNode() ) && pCNd->getLayoutFrm( GetLayout() ) &&
                 0 != ( pCNd = m_pTableCrsr->GetContentNode(false) ) && pCNd->getLayoutFrm( GetLayout() ) )
             {
-                SwShellTableCrsr* pTC = (SwShellTableCrsr*)m_pTableCrsr;
+                SwShellTableCrsr* pTC = m_pTableCrsr;
                 GetLayout()->MakeTableCrsrs( *pTC );
             }
         }
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 99c8a56..de64caf 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1867,7 +1867,7 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
             {
                 SwNodeIndex aEnd( aPos.nNode, 1 );
                 while( aEnd.GetNode().IsEndNode() &&
-                        (const SwNode*)&aEnd.GetNode() !=
+                        &aEnd.GetNode() !=
                         pSectNd->EndOfSectionNode() )
                     ++aEnd;
 
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 8bc9e08..257b73c 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -127,7 +127,7 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
 
     for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
     {
-        pFormat = (SwFrameFormat*)rFormats[n];
+        pFormat = rFormats[n];
         pAnchor = &pFormat->GetAnchor();
         const SwPosition* pAPos = pAnchor->GetContentAnchor();
         if (pAPos &&
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 011714b..54822e8 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -182,8 +182,8 @@ bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
 
     // calculate the range
     const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds();
-    const SwNodePtr pSttNd = (SwNodePtr)&rPam.Start()->nNode.GetNode();
-    const SwNodePtr pEndNd = (SwNodePtr)&rPam.End()->nNode.GetNode();
+    const SwNodePtr pSttNd = &rPam.Start()->nNode.GetNode();
+    const SwNodePtr pEndNd = &rPam.End()->nNode.GetNode();
     sal_uInt16 nSttPos, nEndPos;
 
     if( !rOutlNds.Seek_Entry( pSttNd, &nSttPos ) &&
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index de772cd..c74eed9 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -758,7 +758,7 @@ FlatFndBox::FlatFndBox(SwDoc* pDocPtr, const _FndBox& rBox) :
         // Create linear array
         size_t nCount = static_cast<size_t>(nRows) * nCols;
         pArr = new const _FndBox*[nCount];
-        _FndBox** ppTmp = (_FndBox**)pArr;
+        _FndBox** ppTmp = const_cast<_FndBox**>(pArr);
         memset(ppTmp, 0, sizeof(const _FndBox*) * nCount);
 
         FillFlat( rBoxRef );
@@ -767,7 +767,7 @@ FlatFndBox::FlatFndBox(SwDoc* pDocPtr, const _FndBox& rBox) :
 
 FlatFndBox::~FlatFndBox()
 {
-    _FndBox** ppTmp = (_FndBox**)pArr;
+    _FndBox** ppTmp = const_cast<_FndBox**>(pArr);
     delete [] ppTmp;
 
     if( ppItemSets )
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 91f5f16..62ae12c 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -815,7 +815,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes,
 
     SwTableNumFormatMerge aTNFM( *pCpyDoc, *pDoc );
 
-    SwTableBox *pSttBox = (SwTableBox*)rSelBoxes[0];
+    SwTableBox *pSttBox = rSelBoxes[0];
 
     _FndLine *pFLine, *pInsFLine = 0;
     _FndBox aFndBox( 0, 0 );
@@ -998,7 +998,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes,
         for (size_t n = 0; n < rSelBoxes.size(); ++n)
         {
             lcl_CpyBox( rCpyTable, pTmpBx, *this,
-                        (SwTableBox*)rSelBoxes[n], true, pUndo );
+                        rSelBoxes[n], true, pUndo );
         }
     }
     else
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index edb6758..16041a2 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1671,7 +1671,7 @@ bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh,
     const SwFrameFormats& rFlyArr = *GetDoc()->GetSpzFrameFormats();
     for( auto pFly : rFlyArr )
     {
-        SwFrameFormat *const pFormat = (SwFrameFormat*)pFly;
+        SwFrameFormat *const pFormat = pFly;
         const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
         SwPosition const*const pAPos = rAnchor.GetContentAnchor();
         if (pAPos &&
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 83b58b4..71704fc 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -156,7 +156,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
 
                 if (pTextNode->IsOutline())
                 {
-                    const SwNodePtr pSrch = (SwNodePtr)&rNd;
+                    const SwNodePtr pSrch = &rNd;
                     pOutlineNds->erase( pSrch );
                 }
             }
@@ -171,7 +171,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
 
                 if (bInsOutlineIdx && rTextNd.IsOutline())
                 {
-                    const SwNodePtr pSrch = (SwNodePtr)&rNd;
+                    const SwNodePtr pSrch = &rNd;
                     pOutlineNds->insert( pSrch );
                 }
                 rTextNd.InvalidateNumRule();
@@ -349,7 +349,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
         rNds.GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 );
 
     if( bNewFrms )
-        bNewFrms = &GetDoc()->GetNodes() == (const SwNodes*)&rNds &&
+        bNewFrms = &GetDoc()->GetNodes() == &rNds &&
                     GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
 
     if( bNewFrms )
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index 13339c5..449c7c6 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -44,7 +44,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst )
     // iterate over all types
     for(size_t i=0; i < nSize; ++i)
     {
-        SwFieldType* pFieldType = (SwFieldType*)rFieldTypes[ i ];
+        SwFieldType* pFieldType = rFieldTypes[ i ];
         const sal_uInt16 nType = pFieldType->Which();
 
         if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType || RES_DROPDOWN == nType )
@@ -132,7 +132,7 @@ bool SwInputFieldList::BuildSortLst()
     // iterate over all types
     for( size_t i = 0; i < nSize; ++i )
     {
-        SwFieldType* pFieldType = (SwFieldType*)rFieldTypes[ i ];
+        SwFieldType* pFieldType = rFieldTypes[ i ];
         const sal_uInt16 nType = pFieldType->Which();
 
         if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType )
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index a5d3e8a..93f8378 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2099,7 +2099,7 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable )
         while ( pLine->GetUpper() )
             pLine = pLine->GetUpper()->GetUpper();
         const sal_uInt16 nPos = rTable.GetTabLines().GetPos(
-                    (const SwTableLine*&)pLine ) + 1;
+                    const_cast<const SwTableLine*&>(pLine) ) + 1;
 
         OSL_ENSURE( nPos != USHRT_MAX, "TableLine not found." );
 
@@ -2161,7 +2161,7 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose )
     if ( pLineBefore )
     {
         nStPos = rTable.GetTabLines().GetPos(
-                        (const SwTableLine*&)pLineBefore );
+                        const_cast<const SwTableLine*&>(pLineBefore) );
         OSL_ENSURE( nStPos != USHRT_MAX, "The fox stole the line!" );
         ++nStPos;
     }
@@ -2170,7 +2170,7 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose )
     if ( pLineBehind )
     {
         nEndPos = rTable.GetTabLines().GetPos(
-                        (const SwTableLine*&)pLineBehind );
+                        const_cast<const SwTableLine*&>(pLineBehind) );
         OSL_ENSURE( nEndPos != USHRT_MAX, "The fox stole the line!" );
         if (nEndPos != 0)
             --nEndPos;
@@ -2320,7 +2320,7 @@ void _FndBox::MakeFrms( SwTable &rTable )
     if ( pLineBefore )
     {
         nStPos = rTable.GetTabLines().GetPos(
-                        (const SwTableLine*&)pLineBefore );
+                        const_cast<const SwTableLine*&>(pLineBefore) );
         OSL_ENSURE( nStPos != USHRT_MAX, "Fox stole the line!" );
         ++nStPos;
 
@@ -2328,7 +2328,7 @@ void _FndBox::MakeFrms( SwTable &rTable )
     if ( pLineBehind )
     {
         nEndPos = rTable.GetTabLines().GetPos(
-                        (const SwTableLine*&)pLineBehind );
+                        const_cast<const SwTableLine*&>(pLineBehind) );
         OSL_ENSURE( nEndPos != USHRT_MAX, "Fox stole the line!" );
         --nEndPos;
     }
@@ -2391,10 +2391,10 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber,
     // bBehind == true:  before  pLineBehind
     //         == false: after   pLineBefore
     const sal_uInt16 nBfPos = pLineBefore ?
-        rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBefore ) :
+        rTable.GetTabLines().GetPos( const_cast<const SwTableLine*&>(pLineBefore) ) :
         USHRT_MAX;
     const sal_uInt16 nBhPos = pLineBehind ?
-        rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBehind ) :
+        rTable.GetTabLines().GetPos( const_cast<const SwTableLine*&>(pLineBehind) ) :
         USHRT_MAX;
 
     //nNumber: how often did we insert
@@ -2534,7 +2534,7 @@ bool _FndBox::AreLinesToRestore( const SwTable &rTable ) const
     sal_uInt16 nBfPos;
     if(pLineBefore)
     {
-        const SwTableLine* rLBefore = (const SwTableLine*)pLineBefore;
+        const SwTableLine* rLBefore = const_cast<const SwTableLine*>(pLineBefore);
         nBfPos = rTable.GetTabLines().GetPos( rLBefore );
     }
     else
@@ -2543,7 +2543,7 @@ bool _FndBox::AreLinesToRestore( const SwTable &rTable ) const
     sal_uInt16 nBhPos;
     if(pLineBehind)
     {
-        const SwTableLine* rLBehind = (const SwTableLine*)pLineBehind;
+        const SwTableLine* rLBehind = const_cast<const SwTableLine*>(pLineBehind);
         nBhPos = rTable.GetTabLines().GetPos( rLBehind );
     }
     else
diff --git a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx
index 233c379..a7c2bf8 100644
--- a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx
+++ b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx
@@ -75,7 +75,7 @@ bool SwMovedFwdFrmsByObjPos::DoesRowContainMovedFwdFrm( const SwRowFrm& _rRowFrm
         if ( rEntry.second >= nPageNumOfRow )
         {
             SwIterator<SwTextFrm,SwTextNode> aFrmIter( *rEntry.first );
-            for( SwTextFrm* pTextFrm = aFrmIter.First(); pTextFrm; pTextFrm = (SwTextFrm*)aFrmIter.Next() )
+            for( SwTextFrm* pTextFrm = aFrmIter.First(); pTextFrm; pTextFrm = aFrmIter.Next() )
             {
                 // #115759# - assure that found text frame
                 // is the first one.
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 94068d4..002af69 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -124,7 +124,7 @@ namespace
 SwContourCache::SwContourCache() :
     nPntCnt( 0 ), nObjCnt( 0 )
 {
-    memset( (SdrObject**)pSdrObj, 0, sizeof(pSdrObj) );
+    memset( pSdrObj, 0, sizeof(pSdrObj) );
     memset( pTextRanger, 0, sizeof(pTextRanger) );
 }
 
@@ -140,7 +140,7 @@ void SwContourCache::ClrObject( sal_uInt16 nPos )
     nPntCnt -= pTextRanger[ nPos ]->GetPointCount();
     delete pTextRanger[ nPos ];
     --nObjCnt;
-    memmove( (SdrObject**)pSdrObj + nPos, pSdrObj + nPos + 1,
+    memmove( const_cast<SdrObject**>(pSdrObj) + nPos, pSdrObj + nPos + 1,
              ( nObjCnt - nPos ) * sizeof( SdrObject* ) );
     memmove( pTextRanger + nPos, pTextRanger + nPos + 1,
              ( nObjCnt - nPos ) * sizeof( TextRanger* ) );
@@ -245,7 +245,7 @@ const SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
         const SvxLRSpaceItem &rLRSpace = pFormat->GetLRSpace();
         const SvxULSpaceItem &rULSpace = pFormat->GetULSpace();
         memmove( pTextRanger + 1, pTextRanger, nObjCnt * sizeof( TextRanger* ) );
-        memmove( (SdrObject**)pSdrObj + 1, pSdrObj, nObjCnt++ * sizeof( SdrObject* ) );
+        memmove( const_cast<SdrObject**>(pSdrObj) + 1, pSdrObj, nObjCnt++ * sizeof( SdrObject* ) );
         pSdrObj[ 0 ] = pObj; // due to #37347 the Object must be entered only
                              // after GetContour()
         pTextRanger[ 0 ] = new TextRanger( aPolyPolygon, pPolyPolygon, 20,
@@ -267,7 +267,7 @@ const SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
     {
         const SdrObject* pTmpObj = pSdrObj[ nPos ];
         TextRanger* pTmpRanger = pTextRanger[ nPos ];
-        memmove( (SdrObject**)pSdrObj + 1, pSdrObj, nPos * sizeof( SdrObject* ) );
+        memmove( const_cast<SdrObject**>(pSdrObj) + 1, pSdrObj, nPos * sizeof( SdrObject* ) );
         memmove( pTextRanger + 1, pTextRanger, nPos * sizeof( TextRanger* ) );
         pSdrObj[ 0 ] = pTmpObj;
         pTextRanger[ 0 ] = pTmpRanger;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 45f84e2..a9061ab 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3171,7 +3171,7 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox)
             eShadowLocation = static_cast<const SvxShadowItem*>(pItem)->GetLocation();
 
         const SvxBoxItemLine* pBrd = aBorders;
-        const sal_Char** pBrdNms = (const sal_Char**)aBorderNames;
+        const sal_Char** pBrdNms = aBorderNames;
         for (int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms)
         {
             if (const editeng::SvxBorderLine* pLn = rBox.GetLine(*pBrd))
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 6ffaf31..68efc1c 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -860,7 +860,7 @@ void WW8Export::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFormat& rForm
     memcpy( aSprmAnld, aSprmAnldDefault, sizeof( aSprmAnld ) );
     WW8_ANLD* pA = reinterpret_cast<WW8_ANLD*>(aSprmAnld + 2);  // handy pointer
 
-    sal_uInt8* pChars = (sal_uInt8*)(pA->rgchAnld);
+    sal_uInt8* pChars = pA->rgchAnld;
     sal_uInt16 nCharLen = 31;
 
     if( nSwLevel == 11 )
diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx
index 707f368..8413077 100644
--- a/sw/source/uibase/app/mainwn.cxx
+++ b/sw/source/uibase/app/mainwn.cxx
@@ -95,7 +95,7 @@ void EndProgress( SwDocShell *pDocShell )
         sal_uInt16 i;
         for ( i = 0; i < pProgressContainer->size(); ++i )
         {
-            SwProgress *pTmp = (SwProgress*)(*pProgressContainer)[i];
+            SwProgress *pTmp = (*pProgressContainer)[i];
             if ( pTmp->pDocShell == pDocShell )
             {
                 pProgress = pTmp;
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index cfeca30..b855277 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -176,7 +176,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
                     aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() ));
 
                     Graphic aCompressedGraphic( aDialog->GetCompressedGraphic() );
-                    rSh.ReRead(OUString(), OUString(), (const Graphic*) &aCompressedGraphic);
+                    rSh.ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aCompressedGraphic));
 
                     rSh.SetAttrItem(aCrop);
 
@@ -856,7 +856,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
     Graphic aGraphic = *rShell.GetGraphic();
     GraphicNativeTransform aTransform(aGraphic);
     aTransform.rotate(aRotation);
-    rShell.ReRead(OUString(), OUString(), (const Graphic*) &aGraphic);
+    rShell.ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aGraphic));
 
     SwFlyFrmAttrMgr aManager(false, &rShell, rShell.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
     const long nRotatedWidth = aManager.GetSize().Height();
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 48a0d51..4d3f12c 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -300,7 +300,7 @@ void SwGlossaryList::Update()
             for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles )
             {
                 const OUString aTitle = aFiles[ nFiles ];
-                ::DateTime* pDT = (::DateTime*) aDateTimeArr[ nFiles ];
+                ::DateTime* pDT = aDateTimeArr[ nFiles ];
 
                 OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() ));
 
commit 3fa5ac8eb9ee6c58d3733a6e2cc18f673d37565d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:26 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I35229af6f25db931bd98bdf53add2f2ed65774c0

diff --git a/include/svx/svdlayer.hxx b/include/svx/svdlayer.hxx
index d485ed9..0a79bd9 100644
--- a/include/svx/svdlayer.hxx
+++ b/include/svx/svdlayer.hxx
@@ -137,7 +137,7 @@ public:
     SdrLayer* GetLayer(const OUString& rName, bool bInherited);
     const SdrLayer* GetLayer(const OUString& rName, bool bInherited) const;
     SdrLayerID GetLayerID(const OUString& rName, bool bInherited) const;
-          SdrLayer*    GetLayerPerID(sal_uInt16 nID)                                     { return const_cast<SdrLayer*>(((const SdrLayerAdmin*)this)->GetLayerPerID(nID)); }
+          SdrLayer*    GetLayerPerID(sal_uInt16 nID)                                     { return const_cast<SdrLayer*>(const_cast<const SdrLayerAdmin*>(this)->GetLayerPerID(nID)); }
     const SdrLayer*    GetLayerPerID(sal_uInt16 nID) const;
 
     void SetControlLayerName(const OUString& rNewName);
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 95f466d..2937840 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -1799,7 +1799,7 @@ Sequence< Any> FmGridControl::getSelectionBookmarks()
     Sequence< Any> aBookmarks(nSelectedRows);
     if ( nSelectedRows )
     {
-        Any* pBookmarks = (Any*)aBookmarks.getArray();
+        Any* pBookmarks = aBookmarks.getArray();
 
         // (I'm not sure if the problem isn't deeper : The szenario : a large table displayed by a grid with a
         // thread-safe cursor (dBase). On loading the sdb-cursor started a counting thread. While this counting progress
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 4e7cb83..08e3932 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2667,7 +2667,7 @@ bool DbListBox::commitControl()
     if (static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryCount())
     {
         aSelectSeq.realloc(1);
-        *(sal_Int16 *)aSelectSeq.getArray() = (sal_Int16)static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryPos();
+        *aSelectSeq.getArray() = (sal_Int16)static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryPos();
     }
     aVal <<= aSelectSeq;
     m_rColumn.getModel()->setPropertyValue(FM_PROP_SELECT_SEQ, aVal);
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 3548871..25a9da7 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -310,7 +310,7 @@ bool FmFormData::IsEqualWithoutChildren( FmEntryData* pEntryData )
     if( !pEntryData->ISA(FmFormData) )
         return false;
     FmFormData* pFormData = static_cast<FmFormData*>(pEntryData);
-    if( (XForm*)m_xForm.get() != (XForm*)pFormData->GetFormIface().get() )
+    if( m_xForm.get() != pFormData->GetFormIface().get() )
         return false;
 
     return FmEntryData::IsEqualWithoutChildren( pFormData );
@@ -475,7 +475,7 @@ bool FmControlData::IsEqualWithoutChildren( FmEntryData* pEntryData )
         return false;
     FmControlData* pControlData = static_cast<FmControlData*>(pEntryData);
 
-    if( (XFormComponent*)m_xFormComponent.get() != (XFormComponent*)pControlData->GetFormComponent().get() )
+    if( m_xFormComponent.get() != pControlData->GetFormComponent().get() )
         return false;
 
     return FmEntryData::IsEqualWithoutChildren( pControlData );
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 0b32ca0..b028941 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -486,7 +486,7 @@ void FmXUndoEnvironment::Removed(FmFormObj* pObj)
         Reference< XIndexContainer >  xForm(xContent->getParent(), UNO_QUERY);
         if (xForm.is())
         {
-            Reference< XIndexAccess >  xIndexAccess((XIndexContainer*)xForm.get());
+            Reference< XIndexAccess >  xIndexAccess(xForm.get());
             // Feststellen an welcher Position sich das Kind befunden hat
             const sal_Int32 nPos = getElementPos(xIndexAccess, xContent);
             if (nPos >= 0)
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 5558b92..51db499 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -279,7 +279,7 @@ Reference< XFormController >  getControllerSearchChildren( const Reference< XInd
         for (sal_Int32 n = xIndex->getCount(); n-- && !xController.is(); )
         {
             xIndex->getByIndex(n) >>= xController;
-            if ((XTabControllerModel*)xModel.get() == (XTabControllerModel*)xController->getModel().get())
+            if (xModel.get() == xController->getModel().get())
                 return xController;
             else
             {
@@ -299,7 +299,7 @@ Reference< XFormController >  FormViewPageWindowAdapter::getController( const Re
     for (::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin();
          i != m_aControllerList.end(); ++i)
     {
-        if ((XTabControllerModel*)(*i)->getModel().get() == (XTabControllerModel*)xModel.get())
+        if ((*i)->getModel().get() == xModel.get())
             return *i;
 
         // the current-round controller isn't the right one. perhaps one of its children ?
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 9e5bef9..e3e1127 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -1634,7 +1634,7 @@ void FormController::focusGained(const FocusEvent& e) throw( RuntimeException, s
         // do we need to keep the locking of the commit
         // we hold the lock as long as the control differs from the current
         // otherwise we disabled the lock
-        m_bCommitLock = m_bCommitLock && (XControl*)xControl.get() != (XControl*)m_xCurrentControl.get();
+        m_bCommitLock = m_bCommitLock && xControl.get() != m_xCurrentControl.get();
         if (m_bCommitLock)
             return;
 
@@ -1972,7 +1972,7 @@ void FormController::addToEventAttacher(const Reference< XControl > & xControl)
         for( ; nPos; )
         {
             m_xModelAsIndex->getByIndex(--nPos) >>= xTemp;
-            if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get())
+            if (xComp.get() == xTemp.get())
             {
                 m_xModelAsManager->attach( nPos, Reference<XInterface>( xControl, UNO_QUERY ), makeAny(xControl) );
                 break;
@@ -1999,7 +1999,7 @@ void FormController::removeFromEventAttacher(const Reference< XControl > & xCont
         for( ; nPos; )
         {
             m_xModelAsIndex->getByIndex(--nPos) >>= xTemp;
-            if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get())
+            if (xComp.get() == xTemp.get())
             {
                 m_xModelAsManager->detach( nPos, Reference<XInterface>( xControl, UNO_QUERY ) );
                 break;
diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx
index 4609295..57a944f 100644
--- a/svx/source/svdraw/svdlayer.cxx
+++ b/svx/source/svdraw/svdlayer.cxx
@@ -269,7 +269,7 @@ sal_uInt16 SdrLayerAdmin::GetLayerPos(SdrLayer* pLayer) const
 
 SdrLayer* SdrLayerAdmin::GetLayer(const OUString& rName, bool bInherited)
 {
-    return const_cast<SdrLayer*>(((const SdrLayerAdmin*)this)->GetLayer(rName, bInherited));
+    return const_cast<SdrLayer*>(const_cast<const SdrLayerAdmin*>(this)->GetLayer(rName, bInherited));
 }
 
 const SdrLayer* SdrLayerAdmin::GetLayer(const OUString& rName, bool /*bInherited*/) const
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index 912b8d8..de50647 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -108,8 +108,8 @@ void getLightingDirectionDefaults( const Direction3D **pLighting1Defaults, const
         Direction3D( -50000, 0, 10000 )
     };
 
-    *pLighting1Defaults = (const Direction3D *)aLighting1Defaults;
-    *pLighting2Defaults = (const Direction3D *)aLighting2Defaults;
+    *pLighting1Defaults = aLighting1Defaults;
+    *pLighting2Defaults = aLighting2Defaults;
 };
 
 static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
@@ -591,7 +591,7 @@ void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rB
 
                     SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
                     SfxPoolItem* aItems[] = { &aItem, 0 };
-                    rBindings.Execute( SID_EXTRUSION_DEPTH, (const SfxPoolItem**)aItems );
+                    rBindings.Execute( SID_EXTRUSION_DEPTH, const_cast<const SfxPoolItem**>(aItems) );
                 }
             }
             break;
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 72b2661..7fc75ce 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -497,7 +497,7 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi
                 {
                     SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg->getScale() );
                     SfxPoolItem* aItems[] = { &aItem, 0 };
-                    rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, (const SfxPoolItem**)aItems );
+                    rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) );
                 }
             }
         }
commit 56209b9040c63ef422cffe3795d6bd6ef95ec80e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:21 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I5862e1b0492f51b679a47ec8a08e1ca392a0a1fa

diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 6b0fee8..8abb03b 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -427,7 +427,7 @@ void SfxItemPool_Impl::readTheItems (
                 {
                     // Loaded Item
                     SfxPoolItem *&rpNewItem =
-                        (SfxPoolItem*&)(*ppArr)->operator[](nNew);
+                        (*ppArr)->operator[](nNew);
 
                     // Unused surrogate?
                     if ( !rpNewItem )
@@ -450,7 +450,7 @@ void SfxItemPool_Impl::readTheItems (
                 if ( !bFound )
                 {
                     if ( nFree != SAL_MAX_UINT32 )
-                        (SfxPoolItem*&)(*ppArr)->operator[](nFree) = pOldItem;
+                        (*ppArr)->operator[](nFree) = pOldItem;
                     else
                         (*ppArr)->push_back( pOldItem );
                 }
commit fea2e004d4236da14f878cb2da0a76ded3ee77c2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:15 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I5e665deb034b564de90e65981384ea5a2d892980

diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 3a389ab..5d87161 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -3222,7 +3222,7 @@ SvLBoxTab* SvImpLBox::NextTab( SvLBoxTab* pTab )
     for( int nTab=0; nTab < (nTabCount-1); nTab++)
     {
         if( pView->aTabs[nTab]==pTab )
-            return (SvLBoxTab*)(pView->aTabs[nTab+1]);
+            return pView->aTabs[nTab+1];
     }
     return 0;
 }
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index b8d32ec..a39c169 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -715,13 +715,13 @@ sal_Handle FontList::GetFirstFontInfo(const OUString& rName) const
 
 sal_Handle FontList::GetNextFontInfo( sal_Handle hFontInfo )
 {
-    ImplFontListFontInfo* pInfo = static_cast<ImplFontListFontInfo*>((void*)hFontInfo);
+    ImplFontListFontInfo* pInfo = static_cast<ImplFontListFontInfo*>(hFontInfo);
     return (sal_Handle)(pInfo->mpNext);
 }
 
 const vcl::FontInfo& FontList::GetFontInfo( sal_Handle hFontInfo )
 {
-    ImplFontListFontInfo* pInfo = static_cast<ImplFontListFontInfo*>((void*)hFontInfo);
+    ImplFontListFontInfo* pInfo = static_cast<ImplFontListFontInfo*>(hFontInfo);
     return *pInfo;
 }
 
commit a2d5dc55f4d985cf80d33732eb45d1b60d7018f0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:10 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I773ac633fb3f7de25c62b1e802ddce4ca2cc31c3

diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index 4987b3d..72a3a29 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -153,7 +153,7 @@ bool StgCompObjStream::Store()
     WriteInt32( -1L );
     WriteClsId( *this, aClsId );             // Class ID
     WriteInt32( aAsciiUserName.getLength() + 1 );
-    WriteCharPtr( (const char *)aAsciiUserName.getStr() );
+    WriteCharPtr( aAsciiUserName.getStr() );
     WriteUChar( 0 );             // string terminator
     WriteClipboardFormat( *this, nCbFormat );
     WriteInt32( 0 );             // terminator
diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx
index 7ff16c3..bba6d8f 100644
--- a/sot/source/sdstor/storinfo.cxx
+++ b/sot/source/sdstor/storinfo.cxx
@@ -79,7 +79,7 @@ void WriteClipboardFormat( SvStream & rStm, SotClipboardFormatId nFormat )
         OString aAsciiCbFmt(OUStringToOString(aCbFmt,
                                               RTL_TEXTENCODING_ASCII_US));
         rStm.WriteInt32( aAsciiCbFmt.getLength() + 1 );
-        rStm.WriteCharPtr( (const char *)aAsciiCbFmt.getStr() );
+        rStm.WriteCharPtr( aAsciiCbFmt.getStr() );
         rStm.WriteUChar( 0 );
     }
     else if( nFormat != SotClipboardFormatId::NONE )
commit d8ba942b99b8d8853afaefac5b211a8f297519ff
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:05 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Id45e303225602e401a5c3b640185bf476c94a0bb

diff --git a/shell/source/backends/kde4be/kde4access.cxx b/shell/source/backends/kde4be/kde4access.cxx
index 33a7789..f2a849d 100644
--- a/shell/source/backends/kde4be/kde4access.cxx
+++ b/shell/source/backends/kde4be/kde4access.cxx
@@ -57,7 +57,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
             aClientProgram = "kmail";
         else
             aClientProgram = aClientProgram.section(SPACE, 0, 0);
-        sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
+        sClientProgram = reinterpret_cast<const sal_Unicode *>(aClientProgram.utf16());
         return css::beans::Optional< css::uno::Any >(
             true, uno::makeAny( sClientProgram ) );
     } else if (id == "SourceViewFontHeight")
@@ -77,7 +77,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
 
         aFixedFont = KGlobalSettings::fixedFont();
         aFontName = aFixedFont.family();
-        sFontName = (const sal_Unicode *) aFontName.utf16();
+        sFontName = reinterpret_cast<const sal_Unicode *>(aFontName.utf16());
         return css::beans::Optional< css::uno::Any >(
             true, uno::makeAny( sFontName ) );
     } else if (id == "EnableATToolSupport")
@@ -93,7 +93,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         OUString sDocumentsURL;
         if ( aDocumentsDir.endsWith(QChar('/')) )
             aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
-        sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
+        sDocumentsDir = reinterpret_cast<const sal_Unicode *>(aDocumentsDir.utf16());
         osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
         return css::beans::Optional< css::uno::Any >(
             true, uno::makeAny( sDocumentsURL ) );
@@ -119,7 +119,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         if ( !aFTPProxy.isEmpty() )
         {
             KUrl aProxy(aFTPProxy);
-            OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+            OUString sProxy = reinterpret_cast<const sal_Unicode *>(aProxy.host().utf16());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sProxy ) );
         }
@@ -171,7 +171,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         if ( !aHTTPProxy.isEmpty() )
         {
             KUrl aProxy(aHTTPProxy);
-            OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+            OUString sProxy = reinterpret_cast<const sal_Unicode *>(aProxy.host().utf16());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sProxy ) );
         }
@@ -223,7 +223,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         if ( !aHTTPSProxy.isEmpty() )
         {
             KUrl aProxy(aHTTPSProxy);
-            OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+            OUString sProxy = reinterpret_cast<const sal_Unicode *>(aProxy.host().utf16());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sProxy ) );
         }
@@ -271,7 +271,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
             OUString sNoProxyFor;
 
             aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
-            sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
+            sNoProxyFor = reinterpret_cast<const sal_Unicode *>(aNoProxyFor.utf16());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sNoProxyFor ) );
         }
diff --git a/shell/source/backends/kdebe/kdeaccess.cxx b/shell/source/backends/kdebe/kdeaccess.cxx
index b7de82a..2088ebc 100644
--- a/shell/source/backends/kdebe/kdeaccess.cxx
+++ b/shell/source/backends/kdebe/kdeaccess.cxx
@@ -53,7 +53,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
             aClientProgram = "kmail";
         else
             aClientProgram = aClientProgram.section(SPACE, 0, 0);
-        sClientProgram = (const sal_Unicode *) aClientProgram.ucs2();
+        sClientProgram = reinterpret_cast<const sal_Unicode *>(aClientProgram.ucs2());
         return css::beans::Optional< css::uno::Any >(
             true, uno::makeAny( sClientProgram ) );
     } else if (id == "SourceViewFontHeight")
@@ -73,7 +73,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
 
         aFixedFont = KGlobalSettings::fixedFont();
         aFontName = aFixedFont.family();
-        sFontName = (const sal_Unicode *) aFontName.ucs2();
+        sFontName = reinterpret_cast<const sal_Unicode *>(aFontName.ucs2());
         return css::beans::Optional< css::uno::Any >(
             true, uno::makeAny( sFontName ) );
     } else if (id == "EnableATToolSupport")
@@ -89,7 +89,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         OUString sDocumentsURL;
         if ( aDocumentsDir.endsWith(QChar('/')) )
             aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
-        sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2();
+        sDocumentsDir = reinterpret_cast<const sal_Unicode *>(aDocumentsDir.ucs2());
         osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
         return css::beans::Optional< css::uno::Any >(
             true, uno::makeAny( sDocumentsURL ) );
@@ -115,7 +115,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         if ( !aFTPProxy.isEmpty() )
         {
             KURL aProxy(aFTPProxy);
-            OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
+            OUString sProxy = reinterpret_cast<const sal_Unicode *>(aProxy.host().ucs2());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sProxy ) );
         }
@@ -167,7 +167,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         if ( !aHTTPProxy.isEmpty() )
         {
             KURL aProxy(aHTTPProxy);
-            OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
+            OUString sProxy = reinterpret_cast<const sal_Unicode *>(aProxy.host().ucs2());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sProxy ) );
         }
@@ -219,7 +219,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
         if ( !aHTTPSProxy.isEmpty() )
         {
             KURL aProxy(aHTTPSProxy);
-            OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
+            OUString sProxy = reinterpret_cast<const sal_Unicode *>(aProxy.host().ucs2());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sProxy ) );
         }
@@ -267,7 +267,7 @@ css::beans::Optional< css::uno::Any > getValue(OUString const & id) {
             OUString sNoProxyFor;
 
             aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
-            sNoProxyFor = (const sal_Unicode *) aNoProxyFor.ucs2();
+            sNoProxyFor = reinterpret_cast<const sal_Unicode *>(aNoProxyFor.ucs2());
             return css::beans::Optional< css::uno::Any >(
                 true, uno::makeAny( sNoProxyFor ) );
         }
diff --git a/shell/source/backends/macbe/macbackend.mm b/shell/source/backends/macbe/macbackend.mm
index 57b0a21..f2fff03 100644
--- a/shell/source/backends/macbe/macbackend.mm
+++ b/shell/source/backends/macbe/macbackend.mm
@@ -184,7 +184,7 @@ rtl::OUString CFStringToOUString(const CFStringRef sOrig) {
 
     CFRelease(sOrig);
 
-    return rtl::OUString::createFromAscii((sal_Char*)sBuffer);
+    return rtl::OUString::createFromAscii(sBuffer);
 }
 
 rtl::OUString GetOUString( NSString* pStr )
commit 8c8bdc6091b7373dcf9ccf98fe1b8e7af914c9a4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:28:00 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I60298e919c29454c0a3bc8d745029e4a5d4cbea6

diff --git a/include/sfx2/styfitem.hxx b/include/sfx2/styfitem.hxx
index a3ed4d9..12f7083 100644
--- a/include/sfx2/styfitem.hxx
+++ b/include/sfx2/styfitem.hxx
@@ -76,7 +76,7 @@ public:
                         { return aEntryList.size(); }
 
     const SfxStyleFamilyItem* at(size_t nIdx) const
-                        { return (SfxStyleFamilyItem*)(aEntryList.empty() ? NULL : aEntryList[nIdx]); }
+                        { return aEntryList.empty() ? NULL : aEntryList[nIdx]; }
 
     /** updates the images of all single SfxStyleFamilyItems with new images from the given resource
 
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index cbab9be..07d2805 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3320,7 +3320,7 @@ sal_Int64 SAL_CALL SfxBaseModel::getSomething( const Sequence< sal_Int8 >& aIden
         SfxObjectShell *const pObjectShell(GetObjectShell());
         if (pObjectShell)
         {
-            return reinterpret_cast<sal_Int64>((SfxObjectShell*) pObjectShell);
+            return reinterpret_cast<sal_Int64>(pObjectShell);
         }
     }
 
commit 609707dd218613c5bd2416d681cba78c9cefdca6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:27:54 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Ie77fdb078c9c8f8ed01dfd6c5dd583c6535803b2

diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index a01bec3..c1395f8 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -737,7 +737,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen,
     const unsigned int buf_increment_size = 16384;
 
     *pOutBuf = static_cast<sal_uInt8*>(rtl_reallocateMemory( *pOutBuf, buf_increment_size ));
-    aZStr.next_out      = (Bytef*)*pOutBuf;
+    aZStr.next_out      = reinterpret_cast<Bytef*>(*pOutBuf);
     aZStr.avail_out     = buf_increment_size;
     *pOutLen = buf_increment_size;
     while( err != Z_STREAM_END && err >= Z_OK && aZStr.avail_in )
@@ -749,7 +749,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen,
             {
                 const int nNewAlloc = *pOutLen + buf_increment_size;
                 *pOutBuf = static_cast<sal_uInt8*>(rtl_reallocateMemory( *pOutBuf, nNewAlloc ));
-                aZStr.next_out = (Bytef*)(*pOutBuf + *pOutLen);
+                aZStr.next_out = reinterpret_cast<Bytef*>(*pOutBuf + *pOutLen);
                 aZStr.avail_out = buf_increment_size;
                 *pOutLen = nNewAlloc;
             }
diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
index 37ec3b9..46185ea 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -150,7 +150,7 @@ void PngHelper::endChunk( size_t nStart, OutputBuffer& o_rOutputBuf )
     set( nDataLen, o_rOutputBuf, nStart );
 
     // append chunk crc
-    sal_uInt32 nChunkCRC = getCRC( (sal_uInt8*)&o_rOutputBuf[nStart+4], nLen-4 );
+    sal_uInt32 nChunkCRC = getCRC( reinterpret_cast<sal_uInt8*>(&o_rOutputBuf[nStart+4]), nLen-4 );
     append( nChunkCRC, o_rOutputBuf );
 }
 
commit 04b9ff9a8842bc23306c38f9bd1af7cd941d0eb8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:27:50 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Ic77431126be9259bf6381243d1ee682d687c493e

diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index c7bfef9..15d4dd3 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1214,7 +1214,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
             sal_Int16   nDepth, nMask, nNumberingRule[ 10 ];
             sal_uInt32  nTextOfs = pPara->nTextOfs;
             sal_uInt32  nTabs = pPara->maTabStop.getLength();
-            const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray();
+            const ::com::sun::star::style::TabStop* pTabStop = pPara->maTabStop.getConstArray();
 
             for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
             {
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 1987b05..e815e07 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -3010,7 +3010,7 @@ bool HtmlExport::CreateImageNumberFile()
     sal_uLong nErr = aFile.createStream(aFull, pStr);
     if(nErr == 0)
     {
-        pStr->WriteCharPtr( (const char *)"1" );
+        pStr->WriteCharPtr( "1" );
         nErr = aFile.close();
     }
 
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index b201d9e..51ea22c 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -568,7 +568,7 @@ void incomingCallback( void *userRefCon,
 
     BluetoothServer* pServer = static_cast<BluetoothServer*>(userRefCon);
 
-    IOBluetoothRFCOMMChannel* channel = [IOBluetoothRFCOMMChannel withRFCOMMChannelRef:(IOBluetoothRFCOMMChannelRef)objectRef];
+    IOBluetoothRFCOMMChannel* channel = [IOBluetoothRFCOMMChannel withRFCOMMChannelRef:reinterpret_cast<IOBluetoothRFCOMMChannelRef>(objectRef)];
 
     OSXBluetoothWrapper* socket = new OSXBluetoothWrapper( channel);
     Communicator* pCommunicator = new Communicator( socket );
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index e9c5f00..d4ed8fa 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -633,7 +633,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             {
                 if( rReq.GetSlot() == SID_CHANGEBEZIER )
                 {
-                    WaitObject aWait( (Window*)GetActiveWindow() );
+                    WaitObject aWait( GetActiveWindow() );
                     mpDrawView->ConvertMarkedToPathObj(false);
                 }
                 else
@@ -644,7 +644,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                     }
                     else
                     {
-                        WaitObject aWait( (Window*)GetActiveWindow() );
+                        WaitObject aWait( GetActiveWindow() );
                         mpDrawView->ConvertMarkedToPolyObj(false);
                     }
                 }
@@ -676,7 +676,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->ConvertMarkedToPathObj(true);
 
                 Invalidate(SID_CONVERT_TO_CONTOUR);
@@ -704,7 +704,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
 
                 // create SdrGrafObj from metafile/bitmap
                 Graphic aGraphic;
@@ -2184,7 +2184,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->CombineMarkedObjects(false);
             }
             Cancel();
@@ -2221,7 +2221,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->MergeMarkedObjects(SDR_MERGE_MERGE);
             }
             Cancel();
@@ -2242,7 +2242,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->MergeMarkedObjects(SDR_MERGE_SUBSTRACT);
             }
             Cancel();
@@ -2263,7 +2263,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->MergeMarkedObjects(SDR_MERGE_INTERSECT);
             }
             Cancel();
@@ -2275,7 +2275,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         {
             if ( mpDrawView->IsDismantlePossible(false) )
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->DismantleMarkedObjects(false);
             }
             Cancel();
@@ -2292,7 +2292,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             }
             else
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->CombineMarkedObjects(true);
             }
             Cancel();
@@ -2309,17 +2309,17 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 
             if ( mpDrawView->IsBreak3DObjPossible() )
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->Break3DObj();
             }
             else if ( mpDrawView->IsDismantlePossible(true) )
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 mpDrawView->DismantleMarkedObjects(true);
             }
             else if ( mpDrawView->IsImportMtfPossible() )
             {
-                WaitObject aWait( (Window*)GetActiveWindow() );
+                WaitObject aWait( GetActiveWindow() );
                 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
                 const size_t nAnz=rMarkList.GetMarkCount();
 
@@ -2391,7 +2391,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                         mpDrawView->SdrEndTextEdit();
                     }
 
-                    WaitObject aWait( (Window*)GetActiveWindow() );
+                    WaitObject aWait( GetActiveWindow() );
                     mpDrawView->ConvertMarkedObjTo3D(true);
                 }
             }
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index b6e814a..9f3c356 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -727,7 +727,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
             ;
     }
 
-    mpDrawView->SetAttributes (*(const SfxItemSet *) pAttr.get());
+    mpDrawView->SetAttributes (*const_cast<const SfxItemSet *>(pAttr.get()));
     rReq.Ignore ();
 }
 
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index d7bc78f..516f487 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -338,7 +338,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
                                       )->Execute() == RET_YES )
                     {
                         // implicit transformation into bezier
-                        WaitObject aWait( (Window*)GetActiveWindow() );
+                        WaitObject aWait( GetActiveWindow() );
                         mpDrawView->ConvertMarkedToPathObj(false);
                     }
                 }
@@ -375,7 +375,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
                                       )->Execute() == RET_YES )
                     {
                         // implicit transformation into bezier
-                        WaitObject aWait( (Window*)GetActiveWindow() );
+                        WaitObject aWait( GetActiveWindow() );
                         mpDrawView->ConvertMarkedToPathObj(false);
                     }
                 }
@@ -853,7 +853,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
 
         case SID_PASTE:
         {
-            WaitObject aWait( (Window*)GetActiveWindow() );
+            WaitObject aWait( GetActiveWindow() );
 
             if(HasCurrentFunction())
             {
@@ -870,7 +870,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
 
         case SID_PASTE_UNFORMATTED:
         {
-            WaitObject aWait( (Window*)GetActiveWindow() );
+            WaitObject aWait( GetActiveWindow() );
 
             if(HasCurrentFunction())
             {
@@ -894,7 +894,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
 
         case SID_CLIPBOARD_FORMAT_ITEMS:
         {
-            WaitObject              aWait( (Window*)GetActiveWindow() );
+            WaitObject              aWait( GetActiveWindow() );
             TransferableDataHelper  aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
             const SfxItemSet*       pReqArgs = rReq.GetArgs();
             SotClipboardFormatId    nFormat = SotClipboardFormatId::NONE;
commit 9e1e8858d12ab76ce928b1f499e2de210a6e443d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:27:48 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: I23f887e88ad21b715e62b05ac6874ab88597ea90

diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index a679779..d0e3c46 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -65,7 +65,7 @@ ScAddInListener* ScAddInListener::Get( uno::Reference<sheet::XVolatileResult> xV
 
     for(::std::list<ScAddInListener*>::iterator iter = aAllListeners.begin(); iter != aAllListeners.end(); ++iter)
     {
-        if ( pComp == (sheet::XVolatileResult*)(*iter)->xVolRes.get() )
+        if ( pComp == (*iter)->xVolRes.get() )
         {
             pLst = *iter;
             break;
diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index 64cc52b..2b941ac 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -176,13 +176,13 @@ bool InitExternalFunc(const OUString& rModuleName)
     osl::Module* pLib = new osl::Module( aNP );
     if (pLib->is())
     {
-        FARPROC fpGetCount = (FARPROC)pLib->getFunctionSymbol(GETFUNCTIONCOUNT);
-        FARPROC fpGetData = (FARPROC)pLib->getFunctionSymbol(GETFUNCTIONDATA);
+        FARPROC fpGetCount = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(GETFUNCTIONCOUNT));
+        FARPROC fpGetData = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(GETFUNCTIONDATA));
         if ((fpGetCount != NULL) && (fpGetData != NULL))
         {
-            FARPROC fpIsAsync = (FARPROC)pLib->getFunctionSymbol(ISASYNC);
-            FARPROC fpAdvice = (FARPROC)pLib->getFunctionSymbol(ADVICE);
-            FARPROC fpSetLanguage = (FARPROC)pLib->getFunctionSymbol(SETLANGUAGE);
+            FARPROC fpIsAsync = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(ISASYNC));
+            FARPROC fpAdvice = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(ADVICE));
+            FARPROC fpSetLanguage = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(SETLANGUAGE));
             if ( fpSetLanguage )
             {
                 LanguageType eLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
@@ -257,7 +257,7 @@ bool FuncData::Call(void** ppParam) const
 #else
     bool bRet = false;
     osl::Module* pLib = pModuleData->GetInstance();
-    FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(aFuncName);
+    FARPROC fProc = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(aFuncName));
     if (fProc != NULL)
     {
         switch (nParamCount)
@@ -355,7 +355,7 @@ bool FuncData::Unadvice( double nHandle )
 #else
     bool bRet = false;
     osl::Module* pLib = pModuleData->GetInstance();
-    FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(UNADVICE);
+    FARPROC fProc = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(UNADVICE));
     if (fProc != NULL)
     {
         reinterpret_cast< ::Unadvice>(fProc)(nHandle);
@@ -382,7 +382,7 @@ bool FuncData::getParamDesc( OUString& aName, OUString& aDesc, sal_uInt16 nParam
     if ( nParam <= nParamCount )
     {
         osl::Module* pLib = pModuleData->GetInstance();
-        FARPROC fProc = (FARPROC) pLib->getFunctionSymbol(GETPARAMDESC);
+        FARPROC fProc = reinterpret_cast<FARPROC>(pLib->getFunctionSymbol(GETPARAMDESC));
         if ( fProc != NULL )
         {
             sal_Char pcName[256];
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 37ec636..fec9373 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -701,7 +701,6 @@ bool ScCondFormatDlg::ParseXmlString(const OUString&    sXMLString,
 OUString ScCondFormatDlg::GenerateXmlString(sal_uInt32 nIndex, sal_uInt8 nType, bool bManaged)
 {
     OUString sReturn;
-    sal_Int32 nSize = 0;
 
     OString sTagName;
     OString sTagValue;
@@ -745,7 +744,8 @@ OUString ScCondFormatDlg::GenerateXmlString(sal_uInt32 nIndex, sal_uInt8 nType,
 
     xmlAddChild(pXmlRoot, pXmlNode);
 
-    xmlDocDumpMemory(pXmlDoc, &pBuffer, (int*)&nSize);
+    int nSize = 0;
+    xmlDocDumpMemory(pXmlDoc, &pBuffer, &nSize);
 
     sReturn = OUString(reinterpret_cast<char const *>(pBuffer), nSize, RTL_TEXTENCODING_UTF8);
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 29343a1..d25986b 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5674,7 +5674,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
 
     uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
     if (xPropSet.is())
-        lcl_CopyProperties( aImpl, *(beans::XPropertySet*)xPropSet.get() );
+        lcl_CopyProperties( aImpl, *xPropSet.get() );
 
     //  ausfuehren...
 
commit e60cea3c8d14c1146ed2855024872fecb0959f66
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 2 11:27:42 2015 +0200

    loplugin:cstylecast: deal with those that are (technically) const_cast
    
    Change-Id: Iad01e628b692a6dcf882696908de0ef1f24c04c4

diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index ca3318f..65e0057 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -161,7 +161,7 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 nR
             "dlopen(" << pModuleName << ", " << rtld_mode << "): "
                 << dlerror());
 #endif
-        return ((oslModule)(pLib));
+        return pLib;
     }
     return NULL;
 }
@@ -206,7 +206,7 @@ sal_Bool SAL_CALL
 osl_getModuleHandle(rtl_uString *, oslModule *pResult)
 {
 #if !defined(DISABLE_DYNLOADING) || defined(IOS)
-    *pResult = (oslModule) RTLD_DEFAULT;
+    *pResult = static_cast<oslModule>(RTLD_DEFAULT);
 #else
     *pResult = NULL;
 #endif
diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index 515a2ed..bc51fba 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -163,7 +163,7 @@ static void globalMutexInitImpl() {
 oslMutex * SAL_CALL osl_getGlobalMutex()
 {
     /* necessary to get a "oslMutex *" */
-    static oslMutex globalMutex = (oslMutex) &globalMutexImpl;
+    static oslMutex globalMutex = &globalMutexImpl;
 
     static pthread_once_t once = PTHREAD_ONCE_INIT;
     if (pthread_once(&once, &globalMutexInitImpl) != 0) {
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index af4e59e..1198e73 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -240,7 +240,7 @@ static void ChildStatusProc(void *pData)
 
             // No need to check the return value of execv. If we return from
             // it, an error has occurred.
-            execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
+            execv(data.m_pszArgs[0], const_cast<char **>(data.m_pszArgs));
         }
 
         OSL_TRACE("Failed to exec, errno=%d (%s)", errno, strerror(errno));
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 6aba809..2bc7217 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -460,7 +460,7 @@ oslSocket __osl_createSocketImpl(int Socket)
 void __osl_destroySocketImpl(oslSocket Socket)
 {
     if ( Socket != NULL)
-        free((struct oslSocketImpl *) Socket);
+        free(Socket);
 #if OSL_DEBUG_LEVEL > 1
     g_nSocketImpl --;
 #endif
@@ -2353,7 +2353,7 @@ oslSocketSet SAL_CALL osl_createSocketSet()
         FD_ZERO(&pSet->m_Set);
     }
 
-    return (oslSocketSet)pSet;
+    return pSet;
 }
 
 void SAL_CALL osl_destroySocketSet(oslSocketSet Set)
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
index 5e6f099..2a18e35 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
@@ -91,13 +91,13 @@ void test::oustringbuffer::Utf32::appendUtf32() {
     rtl::OUString res1(buf1.makeStringAndClear());
     createMessage(message, res1, rtl::OUString(str2, str2Len));
     CPPUNIT_ASSERT_MESSAGE(
-        (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
+        message.getStr(), res1 == rtl::OUString(str2, str2Len));
     rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
     buf2.appendUtf32(0x10000);
     rtl::OUString res2(buf2.makeStringAndClear());
     createMessage(message, res2, rtl::OUString(str3, str3Len));
     CPPUNIT_ASSERT_MESSAGE(
-        (const char *)message.getStr(), res2 == rtl::OUString(str3, str3Len));
+        message.getStr(), res2 == rtl::OUString(str3, str3Len));
 }
 
 void test::oustringbuffer::Utf32::insertUtf32() {
@@ -113,13 +113,13 @@ void test::oustringbuffer::Utf32::insertUtf32() {
     rtl::OUString res1(buf1.makeStringAndClear());
     createMessage(message, res1, rtl::OUString(str2, str2Len));
     CPPUNIT_ASSERT_MESSAGE(
-        (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
+        message.getStr(), res1 == rtl::OUString(str2, str2Len));
     rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
     buf2.insertUtf32(2, 0x10FFFF);
     rtl::OUString res2(buf2.makeStringAndClear());
     createMessage(message, res2, rtl::OUString(str3, str3Len));
     CPPUNIT_ASSERT_MESSAGE(
-        (const char *) message.getStr(), res2 == rtl::OUString(str3, str3Len));
+        message.getStr(), res2 == rtl::OUString(str3, str3Len));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index 4eb64d3..0a54c96 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -64,8 +64,8 @@ void test::ostring::StringConcat::checkConcat()
     CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OString, const char[ 4 ] >, const char[ 4 ] > )), typeid( OString( "foo" ) + "bar" + "baz" ));
     CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + "bar" ));
     CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char[ 4 ] > )), typeid( OStringLiteral( "foo" ) + "bar" ));
-    CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + (const char*)"bar" ));
-    CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char* > )), typeid( OStringLiteral( "foo" ) + (const char*)"bar" ));
+    CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + static_cast<const char*>("bar") ));
+    CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char* > )), typeid( OStringLiteral( "foo" ) + static_cast<const char*>("bar") ));
     const char d1[] = "xyz";
     char d2[] = "abc";
     const char* d3 = d1;
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index af547ed..d8acf44 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -62,7 +62,7 @@ void test::ostring::StringLiterals::checkCtors()
     const char good1[] = "test";
     CPPUNIT_ASSERT( CONST_CTOR_USED( good1 ));
 
-    CPPUNIT_ASSERT( !CONST_CTOR_USED( (const char*) "test" ));
+    CPPUNIT_ASSERT( !CONST_CTOR_USED( static_cast<const char*>("test") ));
     const char* bad1 = good1;
     CPPUNIT_ASSERT( !CONST_CTOR_USED( bad1 ));
     char bad2[] = "test";
@@ -88,8 +88,8 @@ void test::ostring::StringLiterals::checkCtors()
     CPPUNIT_ASSERT( CONST_CTOR_USED( bad7[ 1 ] ));
 
 // Check that contents are correct and equal to the case when const char* ctor is used.
-    CPPUNIT_ASSERT( rtl::OString( (const char*)"" ) == rtl::OString( "" ));
-    CPPUNIT_ASSERT( rtl::OString( (const char*)"ab" ) == rtl::OString( "ab" ));
+    CPPUNIT_ASSERT( rtl::OString( static_cast<const char*>("") ) == rtl::OString( "" ));
+    CPPUNIT_ASSERT( rtl::OString( static_cast<const char*>("ab") ) == rtl::OString( "ab" ));
 
 // Check that contents are correct and equal to the case when RTL_CONSTASCII_STRINGPARAM is used.
     CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "" )) == rtl::OString( "" ));
@@ -192,33 +192,33 @@ void test::ostring::StringLiterals::checkNonConstUsage()
 
     rtl_string_unittest_const_literal = false; // start checking for OString conversions
     rtl_string_unittest_const_literal_function = false; // and check for const variants
-    CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = (const char*)foo_c );
+    CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = static_cast<const char*>(foo_c) );
     CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = foo_c );
-    CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( (const char*)fOo_c ));
+    CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( static_cast<const char*>(fOo_c) ));
     CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( fOo_c ));
-    CPPUNIT_ASSERT( foobarfoo.match( (const char*)bar_c, 3 ));
+    CPPUNIT_ASSERT( foobarfoo.match( static_cast<const char*>(bar_c), 3 ));
     CPPUNIT_ASSERT( foobarfoo.match( bar_c, 3 ));
-    CPPUNIT_ASSERT( foobar.match( (const char*)foo_c ));
+    CPPUNIT_ASSERT( foobar.match( static_cast<const char*>(foo_c) ));
     CPPUNIT_ASSERT( foobar.match( foo_c ));
-    CPPUNIT_ASSERT( FooBaRfoo.matchIgnoreAsciiCase( (const char*)bAr_c, 3 ));
+    CPPUNIT_ASSERT( FooBaRfoo.matchIgnoreAsciiCase( static_cast<const char*>(bAr_c), 3 ));
     CPPUNIT_ASSERT( FooBaRfoo.matchIgnoreAsciiCase( bAr_c, 3 ));
-    CPPUNIT_ASSERT( FooBaR.matchIgnoreAsciiCase( (const char*)fOo_c ));
+    CPPUNIT_ASSERT( FooBaR.matchIgnoreAsciiCase( static_cast<const char*>(fOo_c) ));
     CPPUNIT_ASSERT( FooBaR.matchIgnoreAsciiCase( fOo_c ));
-    CPPUNIT_ASSERT( foobar.startsWith( (const char*)foo_c ));
+    CPPUNIT_ASSERT( foobar.startsWith( static_cast<const char*>(foo_c) ));
     CPPUNIT_ASSERT( foobar.startsWith( foo_c ));
-    CPPUNIT_ASSERT( foobar.endsWith( (const char*)bar_c ));
+    CPPUNIT_ASSERT( foobar.endsWith( static_cast<const char*>(bar_c) ));
     CPPUNIT_ASSERT( foobar.endsWith( bar_c ));
 //    CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( (const char*)bar_c ));
 //    CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( bar_c ));
-    CPPUNIT_ASSERT( foo == (const char*)foo_c );
+    CPPUNIT_ASSERT( foo == static_cast<const char*>(foo_c) );
     CPPUNIT_ASSERT( foo == foo_c );
-    CPPUNIT_ASSERT( (const char*)foo_c == foo );
+    CPPUNIT_ASSERT( static_cast<const char*>(foo_c) == foo );
     CPPUNIT_ASSERT( foo_c == foo );
-    CPPUNIT_ASSERT( foo != (const char*)bar_c );
+    CPPUNIT_ASSERT( foo != static_cast<const char*>(bar_c) );
     CPPUNIT_ASSERT( foo != bar_c );
-    CPPUNIT_ASSERT( (const char*)foo_c != bar );
+    CPPUNIT_ASSERT( static_cast<const char*>(foo_c) != bar );
     CPPUNIT_ASSERT( foo_c != bar );
-    CPPUNIT_ASSERT( foobarfoo.indexOf( (const char*)foo_c, 1 ) == 6 );
+    CPPUNIT_ASSERT( foobarfoo.indexOf( static_cast<const char*>(foo_c), 1 ) == 6 );
     CPPUNIT_ASSERT( foobarfoo.indexOf( foo_c, 1 ) == 6 );
 //    CPPUNIT_ASSERT( foobarfoo.lastIndexOf( (const char*)foo_c ) == 6 );
 //    CPPUNIT_ASSERT( foobarfoo.lastIndexOf( foo_c ) == 6 );
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index ab0e4e6..f02bde5 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -134,10 +134,10 @@ void test::oustring::StringConcat::checkInvalid()
     CPPUNIT_ASSERT( !INVALID_CONCAT( OUString() + OUString()));
     CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OString( "b" )));
     CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringBuffer( "b" )));
-    CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + (const char*) "b" ));
+    CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast<const char*>("b") ));
     char d[] = "b";
     CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + d ));
-    CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + (char*)d ));
+    CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast<char*>(d) ));
     CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringLiteral( "b" )));
     CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + 1 ));
     rtl_String* rs = NULL;
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index a126104..9b85b31 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -62,7 +62,7 @@ void test::oustring::StringLiterals::checkCtors()
     const char good1[] = "test";
     CPPUNIT_ASSERT( VALID_CONVERSION( good1 ));
 
-    CPPUNIT_ASSERT( !VALID_CONVERSION( (const char*) "test" ));
+    CPPUNIT_ASSERT( !VALID_CONVERSION( static_cast<const char*>("test") ));
     const char* bad1 = good1;
     CPPUNIT_ASSERT( !VALID_CONVERSION( bad1 ));
     char bad2[] = "test";
diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx
index 381b2f0..192619d 100644
--- a/sal/textenc/tencinfo.cxx
+++ b/sal/textenc/tencinfo.cxx
@@ -793,9 +793,9 @@ const char* SAL_CALL rtl_getBestUnixCharsetFromTextEncoding( rtl_TextEncoding eT
 {
     const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
     if ( pData )
-        return (char const *) pData->mpBestUnixCharset;
+        return pData->mpBestUnixCharset;
     else if( eTextEncoding == RTL_TEXTENCODING_UNICODE )
-        return (char const *) "iso10646-1";
+        return "iso10646-1";
     else
         return 0;
 }
@@ -814,7 +814,7 @@ const char* SAL_CALL rtl_getBestMimeCharsetFromTextEncoding( rtl_TextEncoding eT
 {
     const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
     if ( pData )
-        return (char const *) pData->mpBestMimeCharset;
+        return pData->mpBestMimeCharset;
     else
         return 0;
 }
diff --git a/sal/textenc/textcvt.cxx b/sal/textenc/textcvt.cxx
index a11483f0..6292e24 100644
--- a/sal/textenc/textcvt.cxx
+++ b/sal/textenc/textcvt.cxx
@@ -125,7 +125,7 @@ rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnic
     if ( !pConverter )
         return 0;
     else if ( pConverter->mpCreateTextToUnicodeContext )
-        return (rtl_TextToUnicodeContext)pConverter->mpCreateTextToUnicodeContext();
+        return pConverter->mpCreateTextToUnicodeContext();
     else
         return reinterpret_cast<rtl_TextToUnicodeContext>(1);
 }

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list