diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-22 08:11:58 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-22 08:13:42 +0100 |
commit | e6c124ae3b4de78848344a172003de934e1cb163 (patch) | |
tree | 99bbb9c600af26b18842ef33fca9790685d55ccc | |
parent | 08bdb40656898fc484f5200b63610a31369ddd87 (diff) |
Some more loplugin:cstylecast: sw
note the two TODOs about suspicious casts
Change-Id: I324fa05b30a5c8aa1d9e9a6d488a1e295226e788
68 files changed, 254 insertions, 224 deletions
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx index fbb4c6648c14..4f51aefc27e3 100644 --- a/sw/inc/calc.hxx +++ b/sw/inc/calc.hxx @@ -140,7 +140,7 @@ struct SwCalcExp : public SwHash const SwFieldType* pFldType = 0 ); }; -SwHash* Find( const OUString& rSrch, SwHash** ppTable, +SwHash* Find( const OUString& rSrch, SwHash* const * ppTable, sal_uInt16 nTblSize, sal_uInt16* pPos = 0 ); void DeleteHashTable( SwHash** ppTable, sal_uInt16 nTblSize ); diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 9774dee72c30..4a1edd435a41 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -174,8 +174,8 @@ public: SectionType GetType() const { return m_Data.GetType(); } void SetType(SectionType const eType) { return m_Data.SetType(eType); } - SwSectionFmt* GetFmt() { return (SwSectionFmt*)GetRegisteredIn(); } - SwSectionFmt const * GetFmt() const { return (SwSectionFmt const *)GetRegisteredIn(); } + inline SwSectionFmt* GetFmt(); + inline SwSectionFmt const * GetFmt() const; // Set hidden/protected -> update the whole tree! // (Attributes/flags are set/get.) @@ -346,6 +346,16 @@ public: }; +SwSectionFmt* SwSection::GetFmt() +{ + return static_cast<SwSectionFmt*>(GetRegisteredIn()); +} + +SwSectionFmt const * SwSection::GetFmt() const +{ + return static_cast<SwSectionFmt const *>(GetRegisteredIn()); +} + inline SwSection* SwSection::GetParent() const { SwSectionFmt const * pFmt = GetFmt(); diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index e1840dd3054a..7528ced17835 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -394,7 +394,7 @@ protected: if (!mpXmlBuffer) dumpLayout(); - return xmlParseMemory((const char*)xmlBufferContent(mpXmlBuffer), xmlBufferLength(mpXmlBuffer));; + return xmlParseMemory(reinterpret_cast<const char*>(xmlBufferContent(mpXmlBuffer)), xmlBufferLength(mpXmlBuffer));; } /** @@ -413,9 +413,9 @@ protected: xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; OUString aRet; if (aAttribute.getLength()) - aRet = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(aAttribute.getStr()))); + aRet = OUString::createFromAscii(reinterpret_cast<char*>(xmlGetProp(pXmlNode, BAD_CAST(aAttribute.getStr())))); else - aRet = OUString::createFromAscii((const char*)xmlNodeGetContent(pXmlNode)); + aRet = OUString::createFromAscii(reinterpret_cast<char*>(xmlNodeGetContent(pXmlNode))); xmlFreeDoc(pXmlDoc); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index c2361415072e..0c5a0f8e4c9e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -534,7 +534,7 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx") sal_Int32 length = xmlXPathNodeSetGetLength(pXmlNodes); for(sal_Int32 index = 0; index < length; index++){ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[index]; - OUString attrVal = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("name"))); + OUString attrVal = OUString::createFromAscii(reinterpret_cast<char*>(xmlGetProp(pXmlNode, BAD_CAST("name")))); if (attrVal.isEmpty()){ CPPUNIT_FAIL("Font name is empty."); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 7d18e3e8b0c0..fa806794f0fd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -388,7 +388,7 @@ DECLARE_OOXMLEXPORT_TEST(testGenericTextField, "Unsupportedtextfields.docx") xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:r[2]/w:instrText"); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; - OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); + OUString contents = OUString::createFromAscii(reinterpret_cast<char*>((pXmlNode->children[0]).content)); CPPUNIT_ASSERT(contents.match("PRINTDATE \\* MERGEFORMAT")); xmlXPathFreeObject(pXmlObj); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 73831a90db73..8e6fa93531f9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -1566,7 +1566,7 @@ DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx") { CPPUNIT_ASSERT(pXmlObjs[index]->nodesetval != 0); xmlNodePtr pXmlNode = pXmlObjs[index]->nodesetval->nodeTab[0]; - OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); + OUString contents = OUString::createFromAscii(reinterpret_cast<const char*>((pXmlNode->children[0]).content)); CPPUNIT_ASSERT( contents.toInt64() <= IntMax ); xmlXPathFreeObject(pXmlObjs[index]); } diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index ece708398578..0bcc24ca2251 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -185,7 +185,7 @@ _CalcOp* FindOperator( const OUString& rSrch ) OperatorCompare ); } -SwHash* Find( const OUString& rStr, SwHash** ppTable, +SwHash* Find( const OUString& rStr, SwHash* const * ppTable, sal_uInt16 nTblSize, sal_uInt16* pPos ) { sal_uLong ii = 0; @@ -458,7 +458,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns ) if( !pFnd ) { // then check doc - SwHash** ppDocTbl = rDoc.getIDocumentFieldsAccess().GetUpdtFlds().GetFldTypeTable(); + SwHash* const * ppDocTbl = rDoc.getIDocumentFieldsAccess().GetUpdtFlds().GetFldTypeTable(); for( SwHash* pEntry = *(ppDocTbl+ii); pEntry; pEntry = pEntry->pNext ) { if( aStr == pEntry->aStr ) diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 618521d0640d..54976460452b 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -239,14 +239,14 @@ SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, bool bFwd, char* pFndChar = new char[ nArrLen * sizeof(_SwSrchChrAttr) ]; char* pStackChar = new char[ nArrLen * sizeof(_SwSrchChrAttr) ]; - pFndArr = (_SwSrchChrAttr*)pFndChar; - pStackArr = (_SwSrchChrAttr*)pStackChar; + pFndArr = reinterpret_cast<_SwSrchChrAttr*>(pFndChar); + pStackArr = reinterpret_cast<_SwSrchChrAttr*>(pStackChar); } SwAttrCheckArr::~SwAttrCheckArr() { - delete[] (char*)pFndArr; - delete[] (char*)pStackArr; + delete[] reinterpret_cast<char*>(pFndArr); + delete[] reinterpret_cast<char*>(pStackArr); } void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 9b8f594d9e29..12c334573c9c 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1197,7 +1197,7 @@ namespace //local functions originally from docfmt.cxx SwTableNode* pTblNd; const SwFmtPageDesc* pDesc; if( SfxItemState::SET == pOtherSet->GetItemState( RES_PAGEDESC, - false, (const SfxPoolItem**)&pDesc )) + false, reinterpret_cast<const SfxPoolItem**>(&pDesc) )) { if( pNode ) { @@ -1244,7 +1244,7 @@ namespace //local functions originally from docfmt.cxx if( pNode && 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) && 0 != (pTblNd = pNode->FindTableNode() ) && SfxItemState::SET == pOtherSet->GetItemState( RES_BREAK, - false, (const SfxPoolItem**)&pBreak ) ) + false, reinterpret_cast<const SfxPoolItem**>(&pBreak) ) ) { SwTableNode* pCurTblNd = pTblNd; while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) ) @@ -1275,7 +1275,7 @@ namespace //local functions originally from docfmt.cxx const SwNumRuleItem* pRule; sal_uInt16 nPoolId=0; if( SfxItemState::SET == pOtherSet->GetItemState( RES_PARATR_NUMRULE, - false, (const SfxPoolItem**)&pRule ) && + false, reinterpret_cast<const SfxPoolItem**>(&pRule) ) && !pDoc->FindNumRulePtr( pRule->GetValue() ) && USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(), nsSwGetPoolIdFromName::GET_POOLID_NUMRULE )) ) @@ -2674,7 +2674,7 @@ SwDrawFrmFmt* DocumentContentOperationsManager::InsertDrawObj( SwDrawFrmFmt* pFmt = m_rDoc.MakeDrawFrmFmt( OUString(), m_rDoc.GetDfltFrmFmt() ); const SwFmtAnchor* pAnchor = 0; - rFlyAttrSet.GetItemState( RES_ANCHOR, false, (const SfxPoolItem**) &pAnchor ); + rFlyAttrSet.GetItemState( RES_ANCHOR, false, reinterpret_cast<const SfxPoolItem**>(&pAnchor) ); pFmt->SetFmtAttr( rFlyAttrSet ); // Didn't set the Anchor yet? diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 9e7a32d96027..116af5956256 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -192,7 +192,7 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, if( pFlySet ) { pFlySet->GetItemState( RES_ANCHOR, false, - (const SfxPoolItem**)&pAnchor ); + reinterpret_cast<const SfxPoolItem**>(&pAnchor) ); if( SfxItemState::SET == pFlySet->GetItemState( RES_CNTNT, false )) { SfxItemSet aTmpSet( *pFlySet ); @@ -308,9 +308,9 @@ SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType, { const SwFmtAnchor* pAnch; if( (pFlySet && SfxItemState::SET == pFlySet->GetItemState( - RES_ANCHOR, false, (const SfxPoolItem**)&pAnch )) || + RES_ANCHOR, false, reinterpret_cast<const SfxPoolItem**>(&pAnch) )) || ( pFrmFmt && SfxItemState::SET == pFrmFmt->GetItemState( - RES_ANCHOR, true, (const SfxPoolItem**)&pAnch )) ) + RES_ANCHOR, true, reinterpret_cast<const SfxPoolItem**>(&pAnch) )) ) { if ( (FLY_AT_PAGE != pAnch->GetAnchorId()) ) { diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index a36f5f17444b..ac80f02db507 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -58,7 +58,7 @@ namespace TxtFmtCollFunc { if ( !pNewNumRuleItem ) { - pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, false, (const SfxPoolItem**)&pNewNumRuleItem ); + pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNewNumRuleItem) ); } if ( pNewNumRuleItem ) { @@ -78,7 +78,7 @@ namespace TxtFmtCollFunc SwNumRule* pNumRule( 0 ); const SwNumRuleItem* pNumRuleItem( 0 ); - rTxtFmtColl.GetItemState( RES_PARATR_NUMRULE, false, (const SfxPoolItem**)&pNumRuleItem ); + rTxtFmtColl.GetItemState( RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNumRuleItem) ); if ( pNumRuleItem ) { const OUString sNumRuleName = pNumRuleItem->GetValue(); @@ -135,22 +135,22 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) pNewChgSet = static_cast<const SwAttrSetChg*>(pNew); pOldChgSet = static_cast<const SwAttrSetChg*>(pOld); pNewChgSet->GetChgSet()->GetItemState( - RES_LR_SPACE, false, (const SfxPoolItem**)&pNewLRSpace ); + RES_LR_SPACE, false, reinterpret_cast<const SfxPoolItem**>(&pNewLRSpace) ); pNewChgSet->GetChgSet()->GetItemState( - RES_UL_SPACE, false, (const SfxPoolItem**)&pNewULSpace ); + RES_UL_SPACE, false, reinterpret_cast<const SfxPoolItem**>(&pNewULSpace) ); pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_FONTSIZE, - false, (const SfxPoolItem**)&(aFontSizeArr[0]) ); + false, reinterpret_cast<const SfxPoolItem**>(&(aFontSizeArr[0])) ); pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CJK_FONTSIZE, - false, (const SfxPoolItem**)&(aFontSizeArr[1]) ); + false, reinterpret_cast<const SfxPoolItem**>(&(aFontSizeArr[1])) ); pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CTL_FONTSIZE, - false, (const SfxPoolItem**)&(aFontSizeArr[2]) ); + false, reinterpret_cast<const SfxPoolItem**>(&(aFontSizeArr[2])) ); // #i70223#, #i84745# // check, if attribute set is applied to this paragraph style if ( bAssignedToListLevelOfOutlineStyle && pNewChgSet->GetTheChgdSet() == &GetAttrSet() ) { pNewChgSet->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, false, - (const SfxPoolItem**)&pNewNumRuleItem ); + reinterpret_cast<const SfxPoolItem**>(&pNewNumRuleItem) ); } break; @@ -206,7 +206,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) // Check against the own attributes if( pNewLRSpace && SfxItemState::SET == GetItemState( RES_LR_SPACE, false, - (const SfxPoolItem**)&pOldLRSpace )) + reinterpret_cast<const SfxPoolItem**>(&pOldLRSpace) )) { if( pOldLRSpace != pNewLRSpace ) // Avoid recursion (SetAttr!) { @@ -247,7 +247,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } if( pNewULSpace && SfxItemState::SET == GetItemState( - RES_UL_SPACE, false, (const SfxPoolItem**)&pOldULSpace ) && + RES_UL_SPACE, false, reinterpret_cast<const SfxPoolItem**>(&pOldULSpace) ) && pOldULSpace != pNewULSpace ) // Avoid recursion (SetAttr!) { SvxULSpaceItem aNew( *pOldULSpace ); @@ -282,7 +282,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { const SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize; if( pFSize && SfxItemState::SET == GetItemState( - pFSize->Which(), false, (const SfxPoolItem**)&pOldFSize ) && + pFSize->Which(), false, reinterpret_cast<const SfxPoolItem**>(&pOldFSize) ) && // Avoid recursion (SetAttr!) pFSize != pOldFSize ) { diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index c205c336a4ff..ab57814ace09 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -513,7 +513,7 @@ SwNumRule::~SwNumRule() if( !--mnRefCount ) // the last one closes the door (?) { // Numbering: - SwNumFmt** ppFmts = (SwNumFmt**)SwNumRule::maBaseFmts; + SwNumFmt** ppFmts = &SwNumRule::maBaseFmts[0][0]; int n; for( n = 0; n < MAXLEVEL; ++n, ++ppFmts ) @@ -523,7 +523,7 @@ SwNumRule::~SwNumRule() for( n = 0; n < MAXLEVEL; ++n, ++ppFmts ) delete *ppFmts, *ppFmts = 0; - ppFmts = (SwNumFmt**)SwNumRule::maLabelAlignmentBaseFmts; + ppFmts = &SwNumRule::maLabelAlignmentBaseFmts[0][0]; for( n = 0; n < MAXLEVEL; ++n, ++ppFmts ) delete *ppFmts, *ppFmts = 0; for( n = 0; n < MAXLEVEL; ++n, ++ppFmts ) diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 281477a358eb..74423c01b37f 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -732,7 +732,7 @@ void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, const SwTblBoxNumFormat* pNumFmtItem; const SvNumberformat* pNumFormat = 0; if( SfxItemState::SET == rSet.GetItemState( RES_BOXATR_FORMAT, true, - (const SfxPoolItem**)&pNumFmtItem ) && pNFmtr && + reinterpret_cast<const SfxPoolItem**>(&pNumFmtItem) ) && pNFmtr && 0 != (pNumFormat = pNFmtr->GetEntry( pNumFmtItem->GetValue() )) ) pFmt->SetValueFormat( const_cast<SvNumberformat*>(pNumFormat)->GetFormatstring(), pNumFormat->GetLanguage(), diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 1e8caaaa546e..8ff9262a6fd2 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -337,8 +337,8 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) aFrmSz.SetWidth( nSz / ( pCpyPara->nCpyCnt + 1 ) ); // Create a new Format for the new Box, specifying its size. - aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pNewFmt->GetDoc()-> - MakeTableLineFmt(); + aFindFrm.pNewFrmFmt = reinterpret_cast<SwTableBoxFmt*>(pNewFmt->GetDoc()-> + MakeTableLineFmt()); *aFindFrm.pNewFrmFmt = *pNewFmt; aFindFrm.pNewFrmFmt->SetFmtAttr( aFrmSz ); } @@ -1943,14 +1943,14 @@ lcl_CopyLineToDoc(const _FndLine& rFndLine, _CpyPara *const pCpyPara) if( itFind == pCpyPara->rTabFrmArr.end() ) { // It doesn't exist yet, so copy it - aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pCpyPara->pDoc->MakeTableLineFmt(); + aFindFrm.pNewFrmFmt = reinterpret_cast<SwTableBoxFmt*>(pCpyPara->pDoc->MakeTableLineFmt()); aFindFrm.pNewFrmFmt->CopyAttrs( *rFndLine.GetLine()->GetFrmFmt() ); pCpyPara->rTabFrmArr.insert( aFindFrm ); } else aFindFrm = *itFind; - SwTableLine* pNewLine = new SwTableLine( (SwTableLineFmt*)aFindFrm.pNewFrmFmt, + SwTableLine* pNewLine = new SwTableLine( reinterpret_cast<SwTableLineFmt*>(aFindFrm.pNewFrmFmt), rFndLine.GetBoxes().size(), pCpyPara->pInsBox ); if( pCpyPara->pInsBox ) { diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 04f697aaf101..09a0053198a7 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -43,8 +43,9 @@ // boxes and lines of a table struct _MapTblFrmFmt { - const SwFrmFmt *pOld, *pNew; - _MapTblFrmFmt( const SwFrmFmt *pOldFmt, const SwFrmFmt*pNewFmt ) + const SwFrmFmt *pOld; + SwFrmFmt *pNew; + _MapTblFrmFmt( const SwFrmFmt *pOldFmt, SwFrmFmt*pNewFmt ) : pOld( pOldFmt ), pNew( pNewFmt ) {} }; @@ -109,7 +110,7 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const return pTxtNd; } -static bool lcl_SrchNew( const _MapTblFrmFmt& rMap, const SwFrmFmt** pPara ) +static bool lcl_SrchNew( const _MapTblFrmFmt& rMap, SwFrmFmt** pPara ) { if( rMap.pOld != *pPara ) return true; @@ -138,9 +139,9 @@ static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT ); static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) { - SwTableBoxFmt* pBoxFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); + SwTableBoxFmt * pBoxFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); for( _MapTblFrmFmts::const_iterator it = pCT->rMapArr.begin(); it != pCT->rMapArr.end(); ++it ) - if ( !lcl_SrchNew( *it, (const SwFrmFmt**)&pBoxFmt ) ) + if ( !lcl_SrchNew( *it, reinterpret_cast<SwFrmFmt**>(&pBoxFmt) ) ) break; if( pBoxFmt == pBox->GetFrmFmt() ) // Create a new one? { @@ -200,9 +201,9 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT ) { - SwTableLineFmt* pLineFmt = static_cast<SwTableLineFmt*>(pLine->GetFrmFmt()); + SwTableLineFmt * pLineFmt = static_cast<SwTableLineFmt*>(pLine->GetFrmFmt()); for( _MapTblFrmFmts::const_iterator it = pCT->rMapArr.begin(); it != pCT->rMapArr.end(); ++it ) - if ( !lcl_SrchNew( *it, (const SwFrmFmt**)&pLineFmt ) ) + if ( !lcl_SrchNew( *it, reinterpret_cast<SwFrmFmt**>(&pLineFmt) ) ) break; if( pLineFmt == pLine->GetFrmFmt() ) // Create a new one? { diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index c59071c941b3..a116ab256313 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -575,7 +575,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) // The Flags in the BoxInfo Item decide whether a BorderLine is valid! if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, false, - (const SfxPoolItem**)&pSetBoxInfo) ) + reinterpret_cast<const SfxPoolItem**>(&pSetBoxInfo)) ) { pHori = pSetBoxInfo->GetHori(); pVert = pSetBoxInfo->GetVert(); @@ -591,7 +591,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) } if( SfxItemState::SET == rSet.GetItemState( RES_BOX, false, - (const SfxPoolItem**)&pSetBox) ) + reinterpret_cast<const SfxPoolItem**>(&pSetBox)) ) { pLeft = pSetBox->GetLeft(); pRight = pSetBox->GetRight(); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 164472376193..544352d8b724 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -855,7 +855,7 @@ SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType, pStartOfSection = this; } // Just do this temporarily until the EndNode is inserted - pEndOfSection = (SwEndNode*)this; + pEndOfSection = reinterpret_cast<SwEndNode*>(this); } SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos ) @@ -867,7 +867,7 @@ SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos ) pStartOfSection = this; } // Just do this temporarily until the EndNode is inserted - pEndOfSection = (SwEndNode*)this; + pEndOfSection = reinterpret_cast<SwEndNode*>(this); } void SwStartNode::CheckSectionCondColl() const diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 9d10d293bee7..f5d66b4b4b0a 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1430,7 +1430,7 @@ namespace if ( RES_ATTRSET_CHG == nWhich ) { static_cast<const SwAttrSetChg&>(_rItem).GetChgSet()-> - GetItemState( RES_ANCHOR, false, (const SfxPoolItem**)&pAnchorFmt ); + GetItemState( RES_ANCHOR, false, reinterpret_cast<const SfxPoolItem**>(&pAnchorFmt) ); } else if ( RES_ANCHOR == nWhich ) { diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 9fd46c183665..622e62486aa3 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -976,9 +976,9 @@ void SwAutoFormat::SetColl( sal_uInt16 nId, bool bHdLineOrText ) { aSet.Put( *m_pCurTxtNd->GetpSwAttrSet() ); // take HeaderLine/TextBody only if centered or right aligned, otherwise only justification - SvxAdjustItem* pAdj; + SvxAdjustItem const * pAdj; if( SfxItemState::SET == aSet.GetItemState( RES_PARATR_ADJUST, - false, (const SfxPoolItem**)&pAdj )) + false, reinterpret_cast<const SfxPoolItem**>(&pAdj) )) { SvxAdjust eAdj = pAdj->GetAdjust(); if( bHdLineOrText ? (SVX_ADJUST_RIGHT != eAdj && @@ -2236,10 +2236,10 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, RES_POOLCOLL_STANDARD == nPoolId ) { short nSz; - SvxLRSpaceItem* pLRSpace; + SvxLRSpaceItem const * pLRSpace; if( SfxItemState::SET == m_pCurTxtNd->GetSwAttrSet(). GetItemState( RES_LR_SPACE, true, - (const SfxPoolItem**)&pLRSpace ) && + reinterpret_cast<const SfxPoolItem**>(&pLRSpace) ) && ( 0 != (nSz = pLRSpace->GetTxtFirstLineOfst()) || 0 != pLRSpace->GetTxtLeft() ) ) { @@ -2473,11 +2473,11 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, if( m_pCurTxtNd->HasSwAttrSet() ) { short nSz; - SvxLRSpaceItem* pLRSpace; + SvxLRSpaceItem const * pLRSpace; if( bReplaceStyles && SfxItemState::SET == m_pCurTxtNd->GetSwAttrSet(). GetItemState( RES_LR_SPACE, false, - (const SfxPoolItem**)&pLRSpace ) && + reinterpret_cast<const SfxPoolItem**>(&pLRSpace) ) && ( 0 != (nSz = pLRSpace->GetTxtFirstLineOfst()) || 0 != pLRSpace->GetTxtLeft() ) ) { diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 397ab2d97a22..b7600144eeff 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -166,7 +166,8 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const nRet = static_cast<const SwSetExpField*>( pFld )->GetValue(); break; case RES_USERFLD: - nRet = ( (SwUserFieldType*) pFld )->GetValue(); + nRet = reinterpret_cast<SwUserFieldType const *>(pFld)->GetValue(); + //TODO: is that reinterpret_cast sound? break; case RES_TABLEFLD: { diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 10cd32de5d40..cc051fa3e808 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -66,7 +66,7 @@ public: { uno::Sequence< sal_Int8 > aSeq; rValue >>= aSeq; - OUString sStr( (sal_Char*)aSeq.getConstArray(), aSeq.getLength(), DDE_TXT_ENCODING ); + OUString sStr( reinterpret_cast<char const *>(aSeq.getConstArray()), aSeq.getLength(), DDE_TXT_ENCODING ); // remove not needed CR-LF at the end sal_Int32 n = sStr.getLength(); diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx index ed8b4791dcc7..1ac37eabae4e 100644 --- a/sw/source/core/inc/docfld.hxx +++ b/sw/source/core/inc/docfld.hxx @@ -180,7 +180,7 @@ public: } } - SwHash** GetFldTypeTable() const { return (SwHash**)aFldTypeTable; } + SwHash* const * GetFldTypeTable() const { return reinterpret_cast<SwHash* const *>(aFldTypeTable); } }; #endif diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index 1670f18a93e6..dfc4c7c2aa34 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -43,9 +43,8 @@ public: #endif ) {} - inline SwFntObj *First( ) { return (SwFntObj *)SwCache::First(); } - inline SwFntObj *Next( SwFntObj *pFntObj) - { return (SwFntObj *)SwCache::Next( (SwCacheObj *)pFntObj ); } + inline SwFntObj *First( ); + inline SwFntObj *Next( SwFntObj *pFntObj); void Flush(); }; @@ -120,6 +119,16 @@ public: void CreatePrtFont( const OutputDevice& rOut ); }; +SwFntObj *SwFntCache::First( ) +{ + return static_cast<SwFntObj *>(SwCache::First()); +} + +SwFntObj *SwFntCache::Next( SwFntObj *pFntObj) +{ + return static_cast<SwFntObj *>(SwCache::Next( pFntObj )); +} + class SwFntAccess : public SwCacheAccess { SwViewShell const *pShell; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 5f1bf977ed20..1e224c7cde18 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2547,17 +2547,17 @@ bool SwFrmFmt::supportsFullDrawingLayerFillAttributeSet() const void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { - SwFmtHeader *pH = 0; - SwFmtFooter *pF = 0; + SwFmtHeader const *pH = 0; + SwFmtFooter const *pF = 0; const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; if( RES_ATTRSET_CHG == nWhich ) { static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( - RES_HEADER, false, (const SfxPoolItem**)&pH ); + RES_HEADER, false, reinterpret_cast<const SfxPoolItem**>(&pH) ); static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( - RES_FOOTER, false, (const SfxPoolItem**)&pF ); + RES_FOOTER, false, reinterpret_cast<const SfxPoolItem**>(&pF) ); //UUUU reset fill information if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet()) @@ -2592,13 +2592,13 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if( pH && pH->IsActive() && !pH->GetHeaderFmt() ) { //If he doesn't have one, I'll add one SwFrmFmt *pFmt = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFmt( RND_STD_HEADER, 0 ); - pH->RegisterToFormat( *pFmt ); + const_cast<SwFmtHeader *>(pH)->RegisterToFormat( *pFmt ); } if( pF && pF->IsActive() && !pF->GetFooterFmt() ) { //If he doesn't have one, I'll add one SwFrmFmt *pFmt = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFmt( RND_STD_FOOTER, 0 ); - pF->RegisterToFormat( *pFmt ); + const_cast<SwFmtFooter *>(pF)->RegisterToFormat( *pFmt ); } SwFmt::Modify( pOld, pNew ); diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx index def75771e7c7..672bab301a69 100644 --- a/sw/source/core/layout/dumpfilter.cxx +++ b/sw/source/core/layout/dumpfilter.cxx @@ -55,7 +55,7 @@ namespace // Don't output the terminating \0 to the xml or the file will be invalid uno::Sequence< sal_Int8 > seq( nLen ); - strncpy( ( char * ) seq.getArray() , sBuffer, nLen ); + strncpy( reinterpret_cast<char *>(seq.getArray()), sBuffer, nLen ); xOut->writeBytes( seq ); } catch (const uno::Exception&) diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index e34faaac80a6..fbcc1e2f2358 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -83,7 +83,7 @@ void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, - (const SfxPoolItem**)&pAnch )) + reinterpret_cast<const SfxPoolItem**>(&pAnch) )) ; // The anchor pointer is set at GetItemState! else if( RES_ANCHOR == nWhich ) diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 0dfe1b814592..eeddb292df08 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -473,7 +473,7 @@ void SwFlyLayFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) const SwFmtAnchor *pAnch = 0; if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, - (const SfxPoolItem**)&pAnch )) + reinterpret_cast<const SfxPoolItem**>(&pAnch) )) ; // GetItemState sets the anchor pointer! else if( RES_ANCHOR == nWhich ) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 6e460da95713..ff129a28a523 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -387,7 +387,7 @@ void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) if( RES_ATTRSET_CHG == nWhich ) { if (pOld && pNew && SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( - RES_FRM_SIZE, false, (const SfxPoolItem**)&pNewSize)) + RES_FRM_SIZE, false, reinterpret_cast<const SfxPoolItem**>(&pNewSize))) { pOldSize = &static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->GetFrmSize(); } @@ -2187,13 +2187,13 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { const SfxItemSet& rSet = *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet(); if( SfxItemState::SET == rSet.GetItemState( RES_BOXATR_FORMAT, - false, (const SfxPoolItem**)&pNewFmt ) ) + false, reinterpret_cast<const SfxPoolItem**>(&pNewFmt) ) ) nOldFmt = static_cast<const SwTblBoxNumFormat&>(static_cast<const SwAttrSetChg*>(pOld)-> GetChgSet()->Get( RES_BOXATR_FORMAT )).GetValue(); rSet.GetItemState( RES_BOXATR_FORMULA, false, - (const SfxPoolItem**)&pNewFml ); + reinterpret_cast<const SfxPoolItem**>(&pNewFml) ); rSet.GetItemState( RES_BOXATR_VALUE, false, - (const SfxPoolItem**)&pNewVal ); + reinterpret_cast<const SfxPoolItem**>(&pNewVal) ); break; } case RES_BOXATR_FORMAT: @@ -2237,7 +2237,7 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { // fetch the current Item GetItemState( RES_BOXATR_FORMAT, false, - (const SfxPoolItem**)&pNewFmt ); + reinterpret_cast<const SfxPoolItem**>(&pNewFmt) ); nOldFmt = GetTblBoxNumFmt().GetValue(); nNewFmt = pNewFmt ? pNewFmt->GetValue() : nOldFmt; } @@ -2275,7 +2275,7 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) bool bChgTxt = true; double fVal = 0; if( !pNewVal && SfxItemState::SET != GetItemState( - RES_BOXATR_VALUE, false, (const SfxPoolItem**)&pNewVal )) + RES_BOXATR_VALUE, false, reinterpret_cast<const SfxPoolItem**>(&pNewVal) )) { // so far, no value has been set, so try to evaluate the content sal_uLong nNdPos = pBox->IsValidNumTxtNd( true ); @@ -2423,10 +2423,10 @@ bool SwTableBox::IsNumberChanged() const const SwTblBoxValue *pValue; if( SfxItemState::SET != GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, false, - (const SfxPoolItem**)&pValue )) + reinterpret_cast<const SfxPoolItem**>(&pValue) )) pValue = 0; if( SfxItemState::SET != GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT, false, - (const SfxPoolItem**)&pNumFmt )) + reinterpret_cast<const SfxPoolItem**>(&pNumFmt) )) pNumFmt = 0; sal_uLong nNdPos; diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index e72a7e9078cc..593dd18757d2 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -967,7 +967,8 @@ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf ) CalcAscent( rInf, pPor ); const SwFont* pTmpFnt = rInf.GetFont(); - sal_Int32 nExpect = std::min( sal_Int32( ((vcl::Font *)pTmpFnt)->GetSize().Height() ), + sal_Int32 nExpect = std::min( sal_Int32( reinterpret_cast<vcl::Font const *>(pTmpFnt)->GetSize().Height() ), + //TODO: is that reinterpret_cast sound? sal_Int32( pPor->GetAscent() ) ) / 8; if ( !nExpect ) nExpect = 1; diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 58e52f7b8cc5..a21f56efe93e 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -289,7 +289,7 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer ) const if ( name != NULL ) { - xmlTextWriterStartElement( writer, ( const xmlChar * ) name ); + xmlTextWriterStartElement( writer, reinterpret_cast<const xmlChar *>(name) ); dumpAsXmlAttributes( writer ); @@ -343,7 +343,7 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer ) const OString aTxt8 =OUStringToOString( aTxt, RTL_TEXTENCODING_UTF8 ); xmlTextWriterWriteString( writer, - ( const xmlChar * ) aTxt8.getStr( ) ); + reinterpret_cast<const xmlChar *>(aTxt8.getStr( )) ); XmlPortionDumper pdumper( writer ); pTxtFrm->VisitPortions( pdumper ); diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index 3808008cd28f..9c2b75299203 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -193,7 +193,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const // 2a) gueltiger Pointer? vgl. DELETEFF const SwTxtAttr *pHt = m_HintStarts[i]; - CHECK_ERR( 0xFF != *(unsigned char*)pHt, "HintsCheck: start ptr was deleted" ); + CHECK_ERR( 0xFF != *reinterpret_cast<unsigned char const *>(pHt), "HintsCheck: start ptr was deleted" ); // 3a) Stimmt die Start-Sortierung? sal_Int32 nIdx = pHt->GetStart(); @@ -210,7 +210,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const // 2b) gueltiger Pointer? vgl. DELETEFF const SwTxtAttr *pHtEnd = m_HintEnds[i]; - CHECK_ERR( 0xFF != *(unsigned char*)pHtEnd, "HintsCheck: end ptr was deleted" ); + CHECK_ERR( 0xFF != *reinterpret_cast<unsigned char const *>(pHtEnd), "HintsCheck: end ptr was deleted" ); // 3b) Stimmt die End-Sortierung? nIdx = *pHtEnd->GetAnyEnd(); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 9f11e58b1ca8..343eb6448627 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1288,7 +1288,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) // erfolgen (Fehleranfaellig !) const SwFmtAnchor* pAnchor = 0; pFmt->GetItemState( RES_ANCHOR, false, - (const SfxPoolItem**)&pAnchor ); + reinterpret_cast<const SfxPoolItem**>(&pAnchor) ); SwIndex aIdx( this, pAttr->GetStart() ); const OUString c(GetCharOfTxtAttr(*pAttr)); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index f98e3cb975a1..cadf03ad4201 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -1090,7 +1090,7 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos ) const SwFmtChain* pChainItem; if( SfxItemState::SET == rFmt.GetItemState( RES_CHAIN, false, - (const SfxPoolItem**)&pChainItem )) + reinterpret_cast<const SfxPoolItem**>(&pChainItem) )) { if( pChainItem->GetNext() || pChainItem->GetPrev() ) { diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 32e1311d9345..9f1e754227c0 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1892,7 +1892,7 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext) // need the SaveSections! rDoc.GetIDocumentUndoRedo().DoUndo( true ); - SwUndoTblNdsChg* pUndo = 0; + SwUndo* pUndo = 0; switch( nSetColType & 0xff ) { @@ -1901,20 +1901,20 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext) case nsTblChgWidthHeightType::WH_CELL_LEFT: case nsTblChgWidthHeightType::WH_CELL_RIGHT: rTbl.SetColWidth( *pBox, nSetColType, nAbsDiff, - nRelDiff, (SwUndo**)&pUndo ); + nRelDiff, &pUndo ); break; case nsTblChgWidthHeightType::WH_ROW_TOP: case nsTblChgWidthHeightType::WH_ROW_BOTTOM: case nsTblChgWidthHeightType::WH_CELL_TOP: case nsTblChgWidthHeightType::WH_CELL_BOTTOM: rTbl.SetRowHeight( *pBox, nSetColType, nAbsDiff, - nRelDiff, (SwUndo**)&pUndo ); + nRelDiff, &pUndo ); break; } if( pUndo ) { - pDelSects->transfer( pDelSects->begin(), *pUndo->pDelSects.get() ); + pDelSects->transfer( pDelSects->begin(), *static_cast<SwUndoTblNdsChg *>(pUndo)->pDelSects.get() ); delete pUndo; } rDoc.GetIDocumentUndoRedo().DoUndo( false ); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 89f184f19b11..f56e39685abc 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3457,7 +3457,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( // Need to add this to the other as well if (SfxItemState::SET == aBaseImpl.GetItemSet().GetItemState( bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET, - false, (const SfxPoolItem**)&pSetItem)) + false, reinterpret_cast<const SfxPoolItem**>(&pSetItem))) { lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); } @@ -3553,7 +3553,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( { const SvxSetItem* pSetItem = 0; - if(SfxItemState::SET == aBaseImpl.GetItemSet().GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false, (const SfxPoolItem**)&pSetItem)) + if(SfxItemState::SET == aBaseImpl.GetItemSet().GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false, reinterpret_cast<const SfxPoolItem**>(&pSetItem))) { // create a new SvxSetItem and get it's ItemSet as new target SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone()); @@ -3824,7 +3824,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pBase) ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); const SvxSetItem* pSetItem; - if(SfxItemState::SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false, (const SfxPoolItem**)&pSetItem)) + if(SfxItemState::SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false, reinterpret_cast<const SfxPoolItem**>(&pSetItem))) { // set at SfxItemSet of the corresponding SfxSetItem const SfxItemSet& rSetSet = pSetItem->GetItemSet(); diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index d4e534796661..079b7a711eef 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -343,8 +343,8 @@ sal_uLong SwASCIIParser::ReadChars() } else { - pStt = pLastStt = (sal_Unicode*)pArr; - pEnd = (sal_Unicode*)(pArr + lGCount); + pStt = pLastStt = reinterpret_cast<sal_Unicode*>(pArr); + pEnd = reinterpret_cast<sal_Unicode*>(pArr + lGCount); if( bSwapUnicode ) { diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 3ab18d83be1f..cef4d239ab84 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -302,7 +302,7 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen, if (bLE != bNativeLE) { bSwap = true; - sal_Char* pF = (sal_Char*)pNewBuf; + sal_Char* pF = reinterpret_cast<char*>(pNewBuf); sal_Char* pN = pF+1; for(sal_uLong n = 0; n < nNewLen; ++n, pF+=2, pN+=2 ) { diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index 11a7d85a4606..2f8e386e020e 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -103,7 +103,7 @@ void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc, SwCSS1Parser::SwCSS1Parser( SwDoc *pD, sal_uInt32 aFHeights[7], const OUString& rBaseURL, bool bNewDoc ) : SvxCSS1Parser( pD->GetAttrPool(), rBaseURL, MM50/2, - (sal_uInt16*)&aItemIds, sizeof(aItemIds) / sizeof(sal_uInt16) ), + reinterpret_cast<sal_uInt16*>(&aItemIds), sizeof(aItemIds) / sizeof(sal_uInt16) ), pDoc( pD ), nDropCapCnt( 0 ), bIsNewDoc( bNewDoc ), diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index 5e8ecf30f939..a6e77eea17bc 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -142,7 +142,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) // alle noch offenen Attribute beenden und hinter der Tabelle // neu aufspannen - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; ++pTbl ) { diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index 6c9a11decbfa..53a167312009 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -432,7 +432,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) } // die Attribute der Umgebung am Draw-Objekt setzen - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; ++pTbl ) { diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 34b83af77ea8..a07185a6bd9c 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -3301,7 +3301,7 @@ void _CellSaveStruct::InsertCell( SwHTMLParser& rParser, if( rParser.nContextStAttrMin == GetContextStAttrMin() ) { - _HTMLAttr** pTbl = (_HTMLAttr**)&rParser.aAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&rParser.aAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; ++pTbl ) @@ -3401,7 +3401,7 @@ HTMLTableCnts *SwHTMLParser::InsertTableContents( const SwNodeIndex& rSttPara = pPam->GetPoint()->nNode; sal_Int32 nSttCnt = pPam->GetPoint()->nContent.GetIndex(); - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; ++pTbl ) { diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 8960e3306e61..2bea7b58fc15 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -751,7 +751,7 @@ SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const OUString& rBaseURL, sal_ aItemIds.nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, false ); aWhichMap.insert( aWhichMap.begin(), 0 ); - SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16 *)&aItemIds, + SvParser::BuildWhichTbl( aWhichMap, reinterpret_cast<sal_uInt16 *>(&aItemIds), sizeof(aItemIds) / sizeof(sal_uInt16) ); if( pWhichIds && nWhichIds ) SvParser::BuildWhichTbl( aWhichMap, pWhichIds, nWhichIds ); @@ -3183,7 +3183,7 @@ void SvxCSS1Parser::ParseProperty( const OUString& rProperty, aSrch.pFunc = 0; void* pFound; - if( 0 != ( pFound = bsearch( (char *) &aSrch, + if( 0 != ( pFound = bsearch( &aSrch, (void*) aCSS1PropFnTab, sizeof( aCSS1PropFnTab ) / sizeof( CSS1PropEntry ), sizeof( CSS1PropEntry ), diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 138a64b71ef8..7a913055fa92 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2142,7 +2142,7 @@ bool SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, bool bUpdateNum ) const sal_Int32 nEndCnt = aOldPos.nContent.GetIndex(); const SwPosition& rPos = *pPam->GetPoint(); - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; ++pTbl ) { @@ -3233,8 +3233,8 @@ void SwHTMLParser::SaveAttrTab( _HTMLAttrTable& rNewAttrTab ) if( !aParaAttrs.empty() ) aParaAttrs.clear(); - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; - _HTMLAttr** pSaveTbl = (_HTMLAttr**)&rNewAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); + _HTMLAttr** pSaveTbl = reinterpret_cast<_HTMLAttr**>(&rNewAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; (++pTbl, ++pSaveTbl) ) @@ -3267,8 +3267,8 @@ void SwHTMLParser::SplitAttrTab( _HTMLAttrTable& rNewAttrTab, // alle noch offenen Attribute beenden und hinter der Tabelle // neu aufspannen - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; - _HTMLAttr** pSaveTbl = (_HTMLAttr**)&rNewAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); + _HTMLAttr** pSaveTbl = reinterpret_cast<_HTMLAttr**>(&rNewAttrTab); bool bSetAttr = true; const sal_Int32 nSttCnt = pPam->GetPoint()->nContent.GetIndex(); sal_Int32 nEndCnt = nSttCnt; @@ -3359,7 +3359,7 @@ void SwHTMLParser::SplitAttrTab( _HTMLAttrTable& rNewAttrTab, } } -void SwHTMLParser::RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab, +void SwHTMLParser::RestoreAttrTab( _HTMLAttrTable& rNewAttrTab, bool bSetNewStart ) { // preliminary paragraph attributes are not allowed here, they could @@ -3369,8 +3369,8 @@ void SwHTMLParser::RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab, if( !aParaAttrs.empty() ) aParaAttrs.clear(); - _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab; - _HTMLAttr** pSaveTbl = (_HTMLAttr**)&rNewAttrTab; + _HTMLAttr** pTbl = reinterpret_cast<_HTMLAttr**>(&aAttrTab); + _HTMLAttr** pSaveTbl = reinterpret_cast<_HTMLAttr**>(&rNewAttrTab); for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; (++pTbl, ++pSaveTbl) ) diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index c53f3c5fd15d..d9f7635cff42 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -517,7 +517,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient void SaveAttrTab( _HTMLAttrTable& rNewAttrTab ); void SplitAttrTab( const SwPosition& rNewPos ); void SplitAttrTab( _HTMLAttrTable& rNewAttrTab, bool bMoveEndBack = true ); - void RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab, + void RestoreAttrTab( _HTMLAttrTable& rNewAttrTab, bool bSetNewStart = false ); void InsertAttr( const SfxPoolItem& rItem, bool bLikePara = false, bool bInsAtStart=false ); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 30fe1bad735d..8a05642db44d 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1657,7 +1657,7 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS SVBT16 nSty; ShortToSVBT16( nStyle, nSty ); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nSty, (sal_uInt8*)&nSty+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nSty, nSty+2 ); // Style # if ( m_rWW8Export.bWrtWW8 ) { @@ -2764,7 +2764,7 @@ void WW8AttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeIn { TableRowEnd( pInner->getDepth() ); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nSty, (sal_uInt8*)&nSty+2); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nSty, nSty+2); // Style # TableInfoRow( pInner ); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data()); m_rWW8Export.pO->clear(); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 79abf1df7c08..fc5e14f374db 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -631,7 +631,7 @@ void WW8Export::OutputOlst( const SwNumRule& rRule ) *pFmt, (sal_uInt8)j ); } - pO->insert( pO->end(), (sal_uInt8*)&aOlst, (sal_uInt8*)&aOlst+sizeof( aOlst ) ); + pO->insert( pO->end(), reinterpret_cast<sal_uInt8*>(&aOlst), reinterpret_cast<sal_uInt8*>(&aOlst)+sizeof( aOlst ) ); } void WW8Export::Out_WwNumLvl( sal_uInt8 nWwLevel ) @@ -858,7 +858,7 @@ void WW8Export::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt, sal_uInt8 aSprmAnld[54]; memcpy( aSprmAnld, aSprmAnldDefault, sizeof( aSprmAnld ) ); - WW8_ANLD* pA = (WW8_ANLD*)(aSprmAnld + 2); // handy pointer + WW8_ANLD* pA = reinterpret_cast<WW8_ANLD*>(aSprmAnld + 2); // handy pointer sal_uInt8* pChars = (sal_uInt8*)(pA->rgchAnld); sal_uInt16 nCharLen = 31; @@ -869,7 +869,7 @@ void WW8Export::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt, BuildAnlvBase( pA->eAnlv, pChars, nCharLen, rRul, rFmt, nSwLevel ); // ... spit it out - OutSprmBytes( (sal_uInt8*)&aSprmAnld, sizeof( aSprmAnld ) ); + OutSprmBytes( reinterpret_cast<sal_uInt8*>(&aSprmAnld), sizeof( aSprmAnld ) ); } // Return: is it an outline? diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e59fdd95a46d..30998ebf584c 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -143,12 +143,12 @@ public: void Write( SvStream& rStrm, SwWW8WrGrf& rGrf ); bool IsEqualPos(WW8_FC nEndFc) const - { return !bCombined && nIMax && nEndFc == ((sal_Int32*)pFkp)[nIMax]; } + { return !bCombined && nIMax && nEndFc == reinterpret_cast<sal_Int32*>(pFkp)[nIMax]; } void MergeToNew( short& rVarLen, sal_uInt8 *& pNewSprms ); bool IsEmptySprm() const { return !bCombined && nIMax && !nOldVarLen; } void SetNewEnd( WW8_FC nEnd ) - { ((sal_Int32*)pFkp)[nIMax] = nEnd; } + { reinterpret_cast<sal_Int32*>(pFkp)[nIMax] = nEnd; } WW8_FC GetStartFc() const; WW8_FC GetEndFc() const; @@ -983,17 +983,17 @@ WW8_WrFkp::WW8_WrFkp(ePLCFT ePl, WW8_FC nStartFc, bool bWrtWW8) nItemSize( ( CHP == ePl ) ? 1 : ( bWrtWW8 ? 13 : 7 )), nIMax(0), nOldVarLen(0), bCombined(false) { - pFkp = (sal_uInt8*)new sal_Int32[128]; // 512 Byte - pOfs = (sal_uInt8*)new sal_Int32[128]; // 512 Byte + pFkp = reinterpret_cast<sal_uInt8*>(new sal_Int32[128]); // 512 Byte + pOfs = reinterpret_cast<sal_uInt8*>(new sal_Int32[128]); // 512 Byte memset( pFkp, 0, 4 * 128 ); memset( pOfs, 0, 4 * 128 ); - ( (sal_Int32*)pFkp )[0] = nStartFc; // 0th entry FC at nStartFc + reinterpret_cast<sal_Int32*>(pFkp)[0] = nStartFc; // 0th entry FC at nStartFc } WW8_WrFkp::~WW8_WrFkp() { - delete[] (sal_Int32 *)pFkp; - delete[] (sal_Int32 *)pOfs; + delete[] reinterpret_cast<sal_Int32 *>(pFkp); + delete[] reinterpret_cast<sal_Int32 *>(pOfs); } sal_uInt8 WW8_WrFkp::SearchSameSprm( sal_uInt16 nVarLen, const sal_uInt8* pSprms ) @@ -1064,7 +1064,7 @@ bool WW8_WrFkp::Append( WW8_FC nEndFc, sal_uInt16 nVarLen, const sal_uInt8* pSpr OSL_ENSURE( false, "Fkp::Append: Fkp is already combined" ); return false; } - sal_Int32 n = ((sal_Int32*)pFkp)[nIMax]; // last entry + sal_Int32 n = reinterpret_cast<sal_Int32*>(pFkp)[nIMax]; // last entry if( nEndFc <= n ) { OSL_ENSURE( nEndFc >= n, "+Fkp: FC backwards" ); @@ -1095,7 +1095,7 @@ bool WW8_WrFkp::Append( WW8_FC nEndFc, sal_uInt16 nVarLen, const sal_uInt8* pSpr // does it fits behind the CPs and offsets? return false; // no - ((sal_Int32*)pFkp)[nIMax + 1] = nEndFc; // insert FC + reinterpret_cast<sal_Int32*>(pFkp)[nIMax + 1] = nEndFc; // insert FC nOldVarLen = (sal_uInt8)nVarLen; if( nVarLen && !nOldP ) @@ -1215,14 +1215,14 @@ WW8_FC WW8_WrFkp::GetStartFc() const // zurueckgedreht werden. if( bCombined ) return SVBT32ToUInt32( pFkp ); // 0. Element - return ((sal_Int32*)pFkp)[0]; + return reinterpret_cast<sal_Int32*>(pFkp)[0]; } WW8_FC WW8_WrFkp::GetEndFc() const { if( bCombined ) return SVBT32ToUInt32( &(pFkp[nIMax*4]) ); // nIMax-tes SVBT32-Element - return ((sal_Int32*)pFkp)[nIMax]; + return reinterpret_cast<sal_Int32*>(pFkp)[nIMax]; } // Method for managing the piece table @@ -3911,7 +3911,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer { m_rWW8Export.WriteCR(pTmpNodeInfoInner); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nStyle, (sal_uInt8*)&nStyle+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nStyle, nStyle+2 ); // Style # TableInfoCell(pTmpNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry ( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data() ); @@ -3926,7 +3926,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer m_rWW8Export.WriteCR(pNodeInfoInner); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nStyle, (sal_uInt8*)&nStyle+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nStyle, nStyle+2 ); // Style # TableInfoCell(pNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data() ); @@ -3946,7 +3946,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer { m_rWW8Export.WriteCR(pTmpNodeInfoInner); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nStyle, (sal_uInt8*)&nStyle+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nStyle, nStyle+2 ); // Style # TableInfoCell(pTmpNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data() ); @@ -3961,7 +3961,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer TableRowEnd(pNodeInfoInner->getDepth()); ShortToSVBT16(0, nStyle); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nStyle, (sal_uInt8*)&nStyle+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nStyle, nStyle+2 ); // Style # TableInfoRow(pNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data() ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 3c5cb1a34640..1a80623d0ac0 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -993,7 +993,7 @@ void WW8AttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTe SVBT16 nSty; ShortToSVBT16( 0, nSty ); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nSty, (sal_uInt8*)&nSty+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nSty, nSty+2 ); // Style # TableInfoRow( pTextNodeInfoInner ); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data()); m_rWW8Export.pO->clear(); @@ -1078,7 +1078,7 @@ void WW8AttributeOutput::ParagraphStyle( sal_uInt16 nStyle ) SVBT16 nSty; ShortToSVBT16( nStyle, nSty ); - m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), (sal_uInt8*)&nSty, (sal_uInt8*)&nSty+2 ); // Style # + m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), nSty, nSty+2 ); // Style # } void WW8AttributeOutput::OutputWW8Attribute( sal_uInt8 nId, bool bVal ) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f3c771fa7c88..1c3096cdc434 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1711,7 +1711,7 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) nDel = 0; } - WW8_TBD* pTyp = (WW8_TBD*)(pData + 2*nDel + 2*nIns + 2); // Type Array + WW8_TBD const * pTyp = reinterpret_cast<WW8_TBD const *>(pData + 2*nDel + 2*nIns + 2); // Type Array SvxTabStopItem aAttr(0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP); @@ -2198,7 +2198,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) { sal_uLong nIndex = pSD->GetIdx() & 0xFFFF; // Index is (stupidly) multiplexed for WW8PLCFx_SubDocs if (pWwFib->lcbAtrdExtra/18 > nIndex) - nDateTime = SVBT32ToUInt32(*(SVBT32*)(pExtended+(nIndex*18))); + nDateTime = SVBT32ToUInt32(*reinterpret_cast<SVBT32*>(pExtended+(nIndex*18))); } DateTime aDate = msfilter::util::DTTM2DateTime(nDateTime); @@ -4967,7 +4967,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) for (size_t i=0; i < aLinkStrings.size() && i < aStringIds.size(); ++i) { ww::bytes stringId = aStringIds[i]; - WW8_STRINGID *stringIdStruct = (WW8_STRINGID*)(&stringId[0]); + WW8_STRINGID *stringIdStruct = reinterpret_cast<WW8_STRINGID*>(&stringId[0]); aLinkStringMap[SVBT16ToShort(stringIdStruct->nStringId)] = aLinkStrings[i]; } diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 06d446576eee..d6954ac02be6 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1570,9 +1570,9 @@ private: // verwaltet werden: rglst, hpllfo und hsttbListNames // die Strukturen hierfuer sind: LSTF, LVLF, LFO LFOLVL - void SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, const sal_uInt8* pTxt, + void SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV const &rAV, const sal_uInt8* pTxt, bool bOutline); - void SetAnld(SwNumRule* pNumR, WW8_ANLD* pAD, sal_uInt8 nSwLevel, bool bOutLine); + void SetAnld(SwNumRule* pNumR, WW8_ANLD const * pAD, sal_uInt8 nSwLevel, bool bOutLine); void SetNumOlst( SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLevel ); SwNumRule* GetStyRule(); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index b42eb8f67b4a..2fe6c6a72b3b 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -557,7 +557,7 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd, // helper methods for outline, numbering and bullets -static void SetBaseAnlv(SwNumFmt &rNum, WW8_ANLV &rAV, sal_uInt8 nSwLevel ) +static void SetBaseAnlv(SwNumFmt &rNum, WW8_ANLV const &rAV, sal_uInt8 nSwLevel ) { static const SvxExtNumType eNumA[8] = { SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER, SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N, SVX_NUM_ARABIC, @@ -624,7 +624,7 @@ static void SetBaseAnlv(SwNumFmt &rNum, WW8_ANLV &rAV, sal_uInt8 nSwLevel ) } } -void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, +void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV const &rAV, const sal_uInt8* pTxt, bool bOutline) { bool bInsert = false; // Default @@ -636,13 +636,13 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, OUString sTxt; if (bVer67) { - sTxt = OUString((sal_Char*)pTxt, rAV.cbTextBefore + rAV.cbTextAfter, eCharSet); + sTxt = OUString(reinterpret_cast<char const *>(pTxt), rAV.cbTextBefore + rAV.cbTextAfter, eCharSet); } else { for(sal_Int32 i = 0; i < rAV.cbTextBefore + rAV.cbTextAfter; ++i, pTxt += 2) { - sTxt += OUString(SVBT16ToShort(*(SVBT16*)pTxt)); + sTxt += OUString(SVBT16ToShort(*reinterpret_cast<SVBT16 const *>(pTxt))); } } @@ -716,14 +716,14 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, // SetAnld gets a WW-ANLD-Descriptor and a Level and modifies the NumRules // which are provided by pNumR. This is used for everything beside // outline inside the text. -void SwWW8ImplReader::SetAnld(SwNumRule* pNumR, WW8_ANLD* pAD, sal_uInt8 nSwLevel, +void SwWW8ImplReader::SetAnld(SwNumRule* pNumR, WW8_ANLD const * pAD, sal_uInt8 nSwLevel, bool bOutLine) { SwNumFmt aNF; if (pAD) { // there is a Anld-Sprm bAktAND_fNumberAcross = 0 != pAD->fNumberAcross; - WW8_ANLV &rAV = pAD->eAnlv; + WW8_ANLV const &rAV = pAD->eAnlv; SetBaseAnlv(aNF, rAV, nSwLevel); // set the base format SetAnlvStrings(aNF, rAV, pAD->rgchAnld, bOutLine ); // set the rest } @@ -821,13 +821,13 @@ void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, shor OUTLINE_RULE ); aNR = *rDoc.GetOutlineNumRule(); - SetAnld(&aNR, (WW8_ANLD*)pData, nSwNumLevel, true); + SetAnld(&aNR, reinterpret_cast<WW8_ANLD const *>(pData), nSwNumLevel, true); // Missing Levels need not be replenished rDoc.SetOutlineNumRule( aNR ); }else if( pStyles->nWwNumLevel == 10 || pStyles->nWwNumLevel == 11 ){ SwNumRule* pNR = GetStyRule(); - SetAnld(pNR, (WW8_ANLD*)pData, 0, false); + SetAnld(pNR, reinterpret_cast<WW8_ANLD const *>(pData), 0, false); pAktColl->SetFmtAttr( SwNumRuleItem( pNR->GetName() ) ); pStyInf = GetStyle(nAktColl); @@ -874,7 +874,7 @@ void SwWW8ImplReader::Read_OLST( sal_uInt16, const sal_uInt8* pData, short nLen pNumOlst = new WW8_OLST; if( nLen < sal::static_int_cast< sal_Int32 >(sizeof( WW8_OLST )) ) // fill if to short memset( pNumOlst, 0, sizeof( *pNumOlst ) ); - *pNumOlst = *(WW8_OLST*)pData; + *pNumOlst = *reinterpret_cast<WW8_OLST const *>(pData); } WW8LvlType GetNumType(sal_uInt8 nWwLevelNo) @@ -933,7 +933,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13) { // this is ROW numbering ? pS12 = pPlcxMan->HasParaSprm(bVer67 ? 12 : 0xC63E); // sprmAnld - if (pS12 && 0 != ((WW8_ANLD*)pS12)->fNumberAcross) + if (pS12 && 0 != reinterpret_cast<WW8_ANLD const *>(pS12)->fNumberAcross) sNumRule.clear(); } } @@ -961,7 +961,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13) { if (!pS12) pS12 = pPlcxMan->HasParaSprm(bVer67 ? 12 : 0xC63E); // sprmAnld - if (!pS12 || !((WW8_ANLD*)pS12)->fNumberAcross) + if (!pS12 || !reinterpret_cast<WW8_ANLD const *>(pS12)->fNumberAcross) pTableDesc->SetNumRuleName(pNumRule->GetName()); } } @@ -997,7 +997,7 @@ void SwWW8ImplReader::NextAnlLine(const sal_uInt8* pSprm13) // not defined yet // sprmAnld o. 0 const sal_uInt8* pS12 = pPlcxMan->HasParaSprm(bVer67 ? 12 : 0xC63E); - SetAnld(pNumRule, (WW8_ANLD*)pS12, nSwNumLevel, false); + SetAnld(pNumRule, reinterpret_cast<WW8_ANLD const *>(pS12), nSwNumLevel, false); } } else if( *pSprm13 > 0 && *pSprm13 <= MAXLEVEL ) // range WW:1..9 -> SW:0..8 @@ -1021,7 +1021,7 @@ void SwWW8ImplReader::NextAnlLine(const sal_uInt8* pSprm13) { // sprmAnld const sal_uInt8* pS12 = pPlcxMan->HasParaSprm(bVer67 ? 12 : 0xC63E); - SetAnld(pNumRule, (WW8_ANLD*)pS12, nSwNumLevel, false); + SetAnld(pNumRule, reinterpret_cast<WW8_ANLD const *>(pS12), nSwNumLevel, false); } } } @@ -1152,7 +1152,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS) WW8_TCell* pAktTC = pTCs; if( bVer67 ) { - WW8_TCellVer6* pTc = (WW8_TCellVer6*)pT; + WW8_TCellVer6 const * pTc = reinterpret_cast<WW8_TCellVer6 const *>(pT); for(i=0; i<nColsToRead; i++, ++pAktTC,++pTc) { if( i < nColsToRead ) @@ -1184,7 +1184,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS) } else { - WW8_TCellVer8* pTc = (WW8_TCellVer8*)pT; + WW8_TCellVer8 const * pTc = reinterpret_cast<WW8_TCellVer8 const *>(pT); for (int k = 0; k < nColsToRead; ++k, ++pAktTC, ++pTc ) { sal_uInt16 aBits1 = SVBT16ToShort( pTc->aBits1Ver8 ); @@ -1247,11 +1247,11 @@ void WW8TabBandDesc::ProcessSprmTSetBRC(int nBrcVer, const sal_uInt8* pParamsTSe WW8_TCell* pAktTC = pTCs + nitcFirst; WW8_BRCVer9 brcVer9; if( nBrcVer == 6 ) - brcVer9 = WW8_BRC(*(WW8_BRCVer6*)(pParamsTSetBRC+3)); + brcVer9 = WW8_BRC(*reinterpret_cast<WW8_BRCVer6 const *>(pParamsTSetBRC+3)); else if( nBrcVer == 8 ) - brcVer9 = *(WW8_BRC*)(pParamsTSetBRC+3); + brcVer9 = *reinterpret_cast<WW8_BRC const *>(pParamsTSetBRC+3); else - brcVer9 = *(WW8_BRCVer9*)(pParamsTSetBRC+3); + brcVer9 = *reinterpret_cast<WW8_BRCVer9 const *>(pParamsTSetBRC+3); for( int i = nitcFirst; i < nitcLim; ++i, ++pAktTC ) { @@ -1272,7 +1272,7 @@ void WW8TabBandDesc::ProcessSprmTTableBorders(int nBrcVer, const sal_uInt8* pPar // sprmTTableBorders if( nBrcVer == 6 ) { - WW8_BRCVer6 *pVer6 = (WW8_BRCVer6*)pParams; + WW8_BRCVer6 const *pVer6 = reinterpret_cast<WW8_BRCVer6 const *>(pParams); for (int i = 0; i < 6; ++i) aDefBrcs[i] = WW8_BRC(pVer6[i]); } @@ -1534,9 +1534,9 @@ void WW8TabBandDesc::ReadShd(const sal_uInt8* pS ) if (nAnz > nWwCols) nAnz = nWwCols; - SVBT16* pShd; + SVBT16 const * pShd; int i; - for(i=0, pShd = (SVBT16*)pS; i<nAnz; i++, pShd++ ) + for(i=0, pShd = reinterpret_cast<SVBT16 const *>(pS); i<nAnz; i++, pShd++ ) pSHDs[i].SetWWValue( *pShd ); } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index aeb40d07c555..2d63bfacd9b4 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -1223,11 +1223,11 @@ static bool _SetWW8_BRC(int nBrcVer, WW8_BRCVer9& rVar, const sal_uInt8* pS) if( pS ) { if ( nBrcVer == 9 ) - rVar = *(const WW8_BRCVer9*)pS; + rVar = *reinterpret_cast<const WW8_BRCVer9*>(pS); else if( nBrcVer == 8 ) - rVar = *(const WW8_BRC*)pS; + rVar = *reinterpret_cast<const WW8_BRC*>(pS); else // nBrcVer == 6 - rVar = WW8_BRC(*(const WW8_BRCVer6*)pS); + rVar = WW8_BRC(*reinterpret_cast<const WW8_BRCVer6*>(pS)); } return 0 != pS; @@ -3801,7 +3801,7 @@ void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, shor else { WW8_SHD aSHD; - aSHD.SetWWValue( *(SVBT16*)pData ); + aSHD.SetWWValue( *reinterpret_cast<SVBT16 const *>(pData) ); SwWW8Shade aSh( bVer67, aSHD ); NewAttr( SvxBrushItem( aSh.aColor, RES_CHRATR_BACKGROUND )); @@ -4635,7 +4635,7 @@ void SwWW8ImplReader::Read_Shade( sal_uInt16, const sal_uInt8* pData, short nLen else { WW8_SHD aSHD; - aSHD.SetWWValue( *(SVBT16*)pData ); + aSHD.SetWWValue( *reinterpret_cast<SVBT16 const *>(pData) ); SwWW8Shade aSh( bVer67, aSHD ); NewAttr(SvxBrushItem(aSh.aColor, RES_BACKGROUND)); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 62b90394b542..9cbf0d67bfbb 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -850,7 +850,7 @@ inline sal_uInt8 Get_Byte( sal_uInt8 *& p ) inline sal_uInt16 Get_UShort( sal_uInt8 *& p ) { - const sal_uInt16 n = SVBT16ToShort( *(SVBT16*)p ); + const sal_uInt16 n = SVBT16ToShort( *reinterpret_cast<SVBT16*>(p) ); p += 2; return n; } @@ -862,7 +862,7 @@ inline short Get_Short( sal_uInt8 *& p ) inline sal_uLong Get_ULong( sal_uInt8 *& p ) { - sal_uLong n = SVBT32ToUInt32( *(SVBT32*)p ); + sal_uLong n = SVBT32ToUInt32( *reinterpret_cast<SVBT32*>(p) ); p += 4; return n; } @@ -1998,7 +1998,7 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos, nIdx = 0; #endif // OSL_BIGENDIAN if( nStruct ) // Pointer to content array - pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1]; + pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]); else pPLCF_Contents = 0; // no content @@ -2148,7 +2148,7 @@ void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF) nIdx = 0; #endif // OSL_BIGENDIAN // Pointer to content array - pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1]; + pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]); } OSL_ENSURE(bValid, "Document has corrupt PLCF, ignoring it"); @@ -2165,7 +2165,7 @@ void WW8PLCF::MakeFailedPLCF() delete[] pPLCF_PosArray; pPLCF_PosArray = new sal_Int32[2]; pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX; - pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1]; + pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]); } void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) @@ -2227,7 +2227,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) if (!failure) { // Pointer to content array - pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1]; + pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]); sal_uInt8* p = pPLCF_Contents; for (sal_Int32 i = 0; i < ncpN; ++i) // construct PNs @@ -2327,7 +2327,7 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, #endif // OSL_BIGENDIAN // Pointer to content array - pPLCF_Contents = (sal_uInt8*)&pPLCF_PosArray[nIMax + 1]; + pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]); pSt->Seek( nOldPos ); } @@ -6468,7 +6468,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) if( eVersion <= ww::eWW2 ) { - WW8_FFN_BASE* pVer2 = (WW8_FFN_BASE*)pA; + WW8_FFN_BASE* pVer2 = reinterpret_cast<WW8_FFN_BASE*>(pA); for(sal_uInt16 i=0; i<nMax; ++i, ++p) { p->cbFfnM1 = pVer2->cbFfnM1; @@ -6477,8 +6477,8 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) p->fTrueType = 0; p->ff = 0; - p->wWeight = ( *(((sal_uInt8*)pVer2) + 1) ); - p->chs = ( *(((sal_uInt8*)pVer2) + 2) ); + p->wWeight = ( *(reinterpret_cast<sal_uInt8*>(pVer2) + 1) ); + p->chs = ( *(reinterpret_cast<sal_uInt8*>(pVer2) + 2) ); /* #i8726# 7- seems to encode the name in the same encoding as the font, e.g load the doc in 97 and save to see the unicode @@ -6488,25 +6488,25 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) if ((eEnc == RTL_TEXTENCODING_SYMBOL) || (eEnc == RTL_TEXTENCODING_DONTKNOW)) eEnc = RTL_TEXTENCODING_MS_1252; - p->sFontname = OUString ( (((const sal_Char*)pVer2) + 1 + 2), strlen((((const sal_Char*)pVer2) + 1 + 2)), eEnc); - pVer2 = (WW8_FFN_BASE*)( ((sal_uInt8*)pVer2) + pVer2->cbFfnM1 + 1 ); + p->sFontname = OUString ( (reinterpret_cast<char*>(pVer2) + 1 + 2), strlen((reinterpret_cast<char*>(pVer2) + 1 + 2)), eEnc); + pVer2 = reinterpret_cast<WW8_FFN_BASE*>( reinterpret_cast<sal_uInt8*>(pVer2) + pVer2->cbFfnM1 + 1 ); } } else if( eVersion < ww::eWW8 ) { - WW8_FFN_Ver6* pVer6 = (WW8_FFN_Ver6*)pA; + WW8_FFN_Ver6* pVer6 = reinterpret_cast<WW8_FFN_Ver6*>(pA); sal_uInt8 c2; for(sal_uInt16 i=0; i<nMax; ++i, ++p) { p->cbFfnM1 = pVer6->cbFfnM1; - c2 = *(((sal_uInt8*)pVer6) + 1); + c2 = *(reinterpret_cast<sal_uInt8*>(pVer6) + 1); p->prg = c2 & 0x02; p->fTrueType = (c2 & 0x04) >> 2; // ein Reserve-Bit ueberspringen p->ff = (c2 & 0x70) >> 4; - p->wWeight = SVBT16ToShort( *(SVBT16*)&pVer6->wWeight ); + p->wWeight = SVBT16ToShort( *reinterpret_cast<SVBT16*>(&pVer6->wWeight) ); p->chs = pVer6->chs; p->ibszAlt = pVer6->ibszAlt; /* @@ -6535,7 +6535,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) p->sFontname += ";Symbol"; } } - pVer6 = (WW8_FFN_Ver6*)( ((sal_uInt8*)pVer6) + pVer6->cbFfnM1 + 1 ); + pVer6 = reinterpret_cast<WW8_FFN_Ver6*>( reinterpret_cast<sal_uInt8*>(pVer6) + pVer6->cbFfnM1 + 1 ); } } else @@ -6570,7 +6570,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) // ein Reserve-Bit ueberspringen p->ff = (c2 & 0x70) >> 4; - p->wWeight = SVBT16ToShort(*(SVBT16*)pVer8); + p->wWeight = SVBT16ToShort(*reinterpret_cast<SVBT16*>(pVer8)); pVer8+=2; cbFfnM1-=2; diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index 56d06272d737..b37530feec13 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -41,13 +41,13 @@ inline void Set_UInt8( sal_uInt8 *& p, sal_uInt8 n ) inline void Set_UInt16( sal_uInt8 *& p, sal_uInt16 n ) { - ShortToSVBT16( n, *(SVBT16*)p ); + ShortToSVBT16( n, *reinterpret_cast<SVBT16*>(p) ); p+= 2; } inline void Set_UInt32( sal_uInt8 *& p, sal_uInt32 n ) { - UInt32ToSVBT32( n, *(SVBT32*)p ); + UInt32ToSVBT32( n, *reinterpret_cast<SVBT32*>(p) ); p+= 4; } @@ -601,7 +601,7 @@ public: sal_uInt16 GetValue() const { return maBits; } void SetValue(sal_uInt16 nVal) { maBits = nVal; } - void SetWWValue(SVBT16 nVal) { maBits = SVBT16ToShort(nVal); } + void SetWWValue(SVBT16 const nVal) { maBits = SVBT16ToShort(nVal); } void SetFore(sal_uInt8 nVal) { diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 19b1ebeac4fa..7a704f2f573e 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -187,7 +187,7 @@ void SwContentOptPage::Reset(const SfxItemSet* rSet) const SwElemItem* pElemAttr = 0; rSet->GetItemState( FN_PARAM_ELEM , false, - (const SfxPoolItem**)&pElemAttr ); + reinterpret_cast<const SfxPoolItem**>(&pElemAttr) ); if(pElemAttr) { m_pTblCB->Check (pElemAttr->bTable); @@ -414,7 +414,7 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet* ) const SwAddPrinterItem* pAddPrinterAttr = 0; if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ADDPRINTER , false, - (const SfxPoolItem**)&pAddPrinterAttr )) + reinterpret_cast<const SfxPoolItem**>(&pAddPrinterAttr) )) { m_pGrfCB->Check(pAddPrinterAttr->bPrintGraphic || pAddPrinterAttr->bPrintDraw); m_pCtrlFldCB->Check( pAddPrinterAttr->bPrintControl); @@ -1427,7 +1427,7 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet* rSet ) const SwDocDisplayItem* pDocDisplayAttr = 0; rSet->GetItemState( FN_PARAM_DOCDISP, false, - (const SfxPoolItem**)&pDocDisplayAttr ); + reinterpret_cast<const SfxPoolItem**>(&pDocDisplayAttr) ); if(pDocDisplayAttr) { m_pParaCB->Check ( pDocDisplayAttr->bParagraphEnd ); @@ -2385,7 +2385,7 @@ void SwTestTabPage::Reset( const SfxItemSet* ) const SwTestItem* pTestAttr = 0; if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_SWTEST , false, - (const SfxPoolItem**)&pTestAttr )) + reinterpret_cast<const SfxPoolItem**>(&pTestAttr) )) { m_pTest1CBox->Check(pTestAttr->bTest1); m_pTest2CBox->Check(pTestAttr->bTest2); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 084c73ba1e0e..4adaec9a62e9 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -382,9 +382,9 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl) return 0; } -IMPL_LINK( SwSortDlg, CheckHdl, CheckBox *, pCheck ) +IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl ) { - if( pCheck == ( CheckBox* ) m_pRowRB) + if( pControl == m_pRowRB) { m_pColLbl->SetText(aColTxt); m_pColEdt1->SetMax(nY); @@ -395,7 +395,7 @@ IMPL_LINK( SwSortDlg, CheckHdl, CheckBox *, pCheck ) m_pColEdt2->SetAccessibleName(aColTxt); m_pColEdt3->SetAccessibleName(aColTxt); } - else if( pCheck == ( CheckBox* ) m_pColumnRB) + else if( pControl == m_pColumnRB) { m_pColLbl->SetText(aRowTxt); m_pColEdt1->SetMax(nX); @@ -409,7 +409,7 @@ IMPL_LINK( SwSortDlg, CheckHdl, CheckBox *, pCheck ) else if(!m_pKeyCB1->IsChecked() && !m_pKeyCB2->IsChecked() && !m_pKeyCB3->IsChecked()) - pCheck->Check(true); + static_cast<CheckBox *>(pControl)->Check(true); return 0; } diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index c929c2136456..0fa0a4dfa491 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -177,14 +177,14 @@ IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, CheckBox *, pBtn ) return 0; } -IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox ) +IMPL_LINK( SwFormatTablePage, AutoClickHdl, void *, pControl ) { bool bRestore = true, bLeftEnable = false, bRightEnable= false, bWidthEnable= false, bOthers = true; - if ((RadioButton *)pBox == m_pFullBtn) + if (pControl == m_pFullBtn) { m_aLeftMF.SetPrcntValue(0); m_aRightMF.SetPrcntValue(0); @@ -193,26 +193,26 @@ IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox ) bFull = true; bRestore = false; } - else if ((RadioButton *)pBox == m_pLeftBtn) + else if (pControl == m_pLeftBtn) { bRightEnable = bWidthEnable = true; m_aLeftMF.SetPrcntValue(0); } - else if ((RadioButton *) pBox == m_pFromLeftBtn) + else if (pControl == m_pFromLeftBtn) { bLeftEnable = bWidthEnable = true; m_aRightMF.SetPrcntValue(0); } - else if ((RadioButton *) pBox == m_pRightBtn) + else if (pControl == m_pRightBtn) { bLeftEnable = bWidthEnable = true; m_aRightMF.SetPrcntValue(0); } - else if ((RadioButton *) pBox == m_pCenterBtn) + else if (pControl == m_pCenterBtn) { bLeftEnable = bWidthEnable = true; } - else if ((RadioButton *) pBox == m_pFreeBtn) + else if (pControl == m_pFreeBtn) { RightModify(); bLeftEnable = true; @@ -829,10 +829,10 @@ void SwTableColumnPage::Init(bool bWeb) m_pProportionalCB->SetClickHdl( aLk ); } -IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox ) +IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl ) { //move display window - if(pBox == (CheckBox *)m_pDownBtn) + if(pControl == m_pDownBtn) { if(aValueTbl[0] > 0) { @@ -840,7 +840,7 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox ) aValueTbl[i] -= 1; } } - if (pBox == (CheckBox *)m_pUpBtn) + if (pControl == m_pUpBtn) { if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 ) { diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index ce60c981dfd1..a9e00cf7172e 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -1335,7 +1335,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, const SwCondCollItem* pCondItem; if( SfxItemState::SET != rSet.GetItemState( FN_COND_COLL, false, - (const SfxPoolItem**)&pCondItem )) + reinterpret_cast<const SfxPoolItem**>(&pCondItem) )) pCondItem = 0; if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem ) diff --git a/sw/source/uibase/dialog/swabstdlg.cxx b/sw/source/uibase/dialog/swabstdlg.cxx index 7b5ec71bbe10..34c84c93d6e7 100644 --- a/sw/source/uibase/dialog/swabstdlg.cxx +++ b/sw/source/uibase/dialog/swabstdlg.cxx @@ -44,8 +44,8 @@ SwAbstractDialogFactory* SwAbstractDialogFactory::Create() static const OUString sLibName(SWUI_DLL_NAME); if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, sLibName, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) ) - fp = ( SwAbstractDialogFactory* (SAL_CALL*)() ) - aDialogLibrary.getFunctionSymbol( OUString("SwCreateDialogFactory")); + fp = reinterpret_cast<SwAbstractDialogFactory* (SAL_CALL*)()>( + aDialogLibrary.getFunctionSymbol( OUString("SwCreateDialogFactory"))); #else fp = SwCreateDialogFactory(); #endif diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 845ea02087d1..d389a48b8180 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3546,7 +3546,7 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, // Interfaces for Selection void SwTransferable::CreateSelection( SwWrtShell& rSh, - const SwViewShell * _pCreatorView ) + const SwFrameShell * _pCreatorView ) { SwModule *pMod = SW_MOD(); SwTransferable* pNew = new SwTransferable( rSh ); @@ -3559,7 +3559,7 @@ void SwTransferable::CreateSelection( SwWrtShell& rSh, } void SwTransferable::ClearSelection( SwWrtShell& rSh, - const SwViewShell * _pCreatorView) + const SwFrameShell * _pCreatorView) { SwModule *pMod = SW_MOD(); if( pMod->pXSelection && diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 43d76b38716a..2c603fef01b9 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -105,8 +105,7 @@ protected: virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - SwNavigationPI* GetParentWindow(){return - (SwNavigationPI*)Window::GetParent();} + SwNavigationPI* GetParentWindow(); virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE; virtual void DragFinished( sal_Int8 ) SAL_OVERRIDE; @@ -299,8 +298,7 @@ protected: DECL_LINK( DoubleClickHdl, void* ); bool IsInternalDrag() const {return bIsInternalDrag;} - SwNavigationPI* GetParentWindow() - { return (SwNavigationPI*)Window::GetParent(); } + SwNavigationPI* GetParentWindow(); void OpenDoc(const SwGlblDocContent*); void GotoContent(const SwGlblDocContent*); diff --git a/sw/source/uibase/inc/srtdlg.hxx b/sw/source/uibase/inc/srtdlg.hxx index c42a4cc6f809..a20fdeb6f04a 100644 --- a/sw/source/uibase/inc/srtdlg.hxx +++ b/sw/source/uibase/inc/srtdlg.hxx @@ -77,7 +77,7 @@ class SwSortDlg : public SvxStandardDialog virtual void Apply() SAL_OVERRIDE; sal_Unicode GetDelimChar() const; - DECL_LINK( CheckHdl, CheckBox * ); + DECL_LINK( CheckHdl, void * ); DECL_LINK( DelimHdl, RadioButton* ); DECL_LINK( LanguageHdl, ListBox* ); DECL_LINK(DelimCharHdl, void *); diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx index d5cb2acc806b..12a6392730be 100644 --- a/sw/source/uibase/inc/swdtflvr.hxx +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -35,7 +35,7 @@ class SwDocFac; class SwTextBlocks; class SwWrtShell; class SvxClipboardFmtItem; -class SwViewShell; +class SwFrameShell; class SwView_Impl; typedef sal_uInt16 TransferBufferType; @@ -63,7 +63,7 @@ class SW_DLLPUBLIC SwTransferable : public TransferableHelper SwWrtShell *pWrtShell; /* #96392# Added pCreatorView to distinguish SwFrameShell from SwWrtShell. */ - const SwViewShell *pCreatorView; + const SwFrameShell *pCreatorView; SwDocFac *pClpDocFac; Graphic *pClpGraphic, *pClpBitmap, *pOrigGrf; INetBookmark *pBkmk; // URL and description! @@ -197,9 +197,9 @@ public: // Interfaces for Selection /* #96392# Added pCreator to distinguish SwFrameShell from SwWrtShell. */ static void CreateSelection( SwWrtShell & rSh, - const SwViewShell * pCreator = NULL ); + const SwFrameShell * pCreator = NULL ); static void ClearSelection( SwWrtShell& rSh, - const SwViewShell * pCreator = NULL ); + const SwFrameShell * pCreator = NULL ); // the related SwView is being closed and the SwTransferable is invalid now void Invalidate() {pWrtShell = 0;} diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 19c69e6790f6..cc6a8c805c61 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -969,7 +969,7 @@ SwFrameShell::SwFrameShell(SwView &_rView) : SetHelpId(SW_FRAMESHELL); // #96392# Use this to announce it is the frame shell who creates the selection. - SwTransferable::CreateSelection( _rView.GetWrtShell(), (SwViewShell *) this ); + SwTransferable::CreateSelection( _rView.GetWrtShell(), this ); SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame)); } @@ -977,7 +977,7 @@ SwFrameShell::SwFrameShell(SwView &_rView) : SwFrameShell::~SwFrameShell() { // #96392# Only clear the selection if it was this frame shell who created it. - SwTransferable::ClearSelection( GetShell(), (SwViewShell *) this ); + SwTransferable::ClearSelection( GetShell(), this ); } void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index bd49752dc2ab..f89d66e7bb14 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -71,7 +71,7 @@ class SwFormatTablePage : public SfxTabPage void Init(); void ModifyHdl(const Edit* pEdit); - DECL_LINK( AutoClickHdl, CheckBox * ); + DECL_LINK( AutoClickHdl, void * ); DECL_LINK( RelWidthClickHdl, CheckBox * ); void RightModify(); DECL_LINK( UpDownLoseFocusHdl, MetricField * ); @@ -115,7 +115,7 @@ class SwTableColumnPage : public SfxTabPage bool bPercentMode:1; void Init(bool bWeb); - DECL_LINK( AutoClickHdl, CheckBox * ); + DECL_LINK( AutoClickHdl, void * ); void ModifyHdl( MetricField* pEdit ); DECL_LINK( UpHdl, MetricField * ); DECL_LINK( DownHdl, MetricField * ); diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index cfde02812e5b..f2112af54455 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -95,7 +95,7 @@ void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, bool bWeb ) const SwAddPrinterItem* pAddPrinterAttr; if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, false, - (const SfxPoolItem**)&pAddPrinterAttr ) ) + reinterpret_cast<const SfxPoolItem**>(&pAddPrinterAttr) ) ) { if( pIDDA ) pIDDA->setPrintData( *pAddPrinterAttr ); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5c4ee6e223b6..9b89a7b39dd0 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3537,6 +3537,11 @@ void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt ) SvTreeListBox::DataChanged( rDCEvt ); } +SwNavigationPI* SwContentTree::GetParentWindow() +{ + return static_cast<SwNavigationPI*>(Window::GetParent()); +} + sal_Int32 SwContentTree::GetEntryRealChildrenNum( SvTreeListEntry* pParent ) const { // ist es ein Inhaltstyp? diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 9b40f9d4f312..ae6d50e71bd8 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -1203,6 +1203,11 @@ IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl) return 0; } +SwNavigationPI* SwGlobalTree::GetParentWindow() +{ + return static_cast<SwNavigationPI*>(Window::GetParent()); +} + IMPL_STATIC_LINK_NOINSTANCE(SwGlobalTree, ShowFrameHdl, SwGlobalTree*, EMPTYARG) { const SfxObjectShell* pShell = SwGlobalTree::GetShowShell(); |