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 /sw/source/filter/ww8 | |
parent | 08bdb40656898fc484f5200b63610a31369ddd87 (diff) |
Some more loplugin:cstylecast: sw
note the two TODOs about suspicious casts
Change-Id: I324fa05b30a5c8aa1d9e9a6d488a1e295226e788
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 30 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 42 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 34 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8struc.hxx | 6 |
10 files changed, 73 insertions, 73 deletions
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) { |