[Libreoffice-commits] core.git: 4 commits - hwpfilter/source sw/source
Caolán McNamara
caolanm at redhat.com
Thu Apr 23 13:09:06 PDT 2015
hwpfilter/source/hwpeq.cxx | 2 -
sw/source/filter/ww8/wrtw8sty.cxx | 16 +++-----
sw/source/filter/ww8/wrtww8.cxx | 69 +++++++++++++++++++-------------------
3 files changed, 43 insertions(+), 44 deletions(-)
New commits:
commit 028769528d1835c9069eb7e717a1aa2186c51351
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 23 17:27:41 2015 +0100
cppcheck: silence assertWithSideEffect
Change-Id: Iaaf69ea5e8d5eeaa3a61660c3abe04ff3e83d061
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index baf3cf5..7ea8815 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -461,7 +461,7 @@ static eq_stack *stk = 0;
void push_token(MzString &white, MzString &token, istream *strm)
{
// one time stack
- assert(stk->state(strm) == false);
+ assert(stk->token.length() == 0);
stk->white = white;
stk->token = token;
commit b1166d7b05845798fdc3016c37fe6932331c1ba3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 23 17:16:02 2015 +0100
de-trainwreck if statement
if( 0 != (pINetFmt = static_cast<const SwFmtINetFmt*>(rDoc.GetAttrPool().GetItem2(
RES_TXTATR_INETFMT, n ) ) ) &&
0 != ( pTxtAttr = pINetFmt->GetTxtINetFmt()) &&
0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
pTxtNd->GetNodes().IsDocNodes() )
Change-Id: I3420be28c5c6d92b9532dbfaa1e0d1afa297bd87
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 8e2253e..0481e7b 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1992,11 +1992,10 @@ static sal_uInt16 lcl_TCFlags(SwDoc &rDoc, const SwTableBox * pBox, sal_Int32 nR
{
SfxItemSet aCoreSet(rDoc.GetAttrPool(), RES_CHRATR_ROTATE, RES_CHRATR_ROTATE);
static_cast<const SwTxtNode*>(pCNd)->GetAttr( aCoreSet, 0, static_cast<const SwTxtNode*>(pCNd)->GetTxt().getLength());
- const SvxCharRotateItem * pRotate = NULL;
const SfxPoolItem * pRotItem;
if ( SfxItemState::SET == aCoreSet.GetItemState(RES_CHRATR_ROTATE, true, &pRotItem))
{
- pRotate = static_cast<const SvxCharRotateItem*>(pRotItem);
+ const SvxCharRotateItem * pRotate = static_cast<const SvxCharRotateItem*>(pRotItem);
if(pRotate && pRotate->GetValue() == 900)
{
nFlags = nFlags | 0x0004 | 0x0008;
@@ -2941,43 +2940,45 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL)
void MSWordExportBase::CollectOutlineBookmarks(const SwDoc &rDoc)
{
- const SwFmtINetFmt* pINetFmt;
- const SwTxtINetFmt* pTxtAttr;
- const SwTxtNode* pTxtNd;
-
- sal_uInt32 n, nMaxItems = rDoc.GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
- for( n = 0; n < nMaxItems; ++n )
+ sal_uInt32 nMaxItems = rDoc.GetAttrPool().GetItemCount2(RES_TXTATR_INETFMT);
+ for (sal_uInt32 n = 0; n < nMaxItems; ++n)
{
- if( 0 != (pINetFmt = static_cast<const SwFmtINetFmt*>(rDoc.GetAttrPool().GetItem2(
- RES_TXTATR_INETFMT, n ) ) ) &&
- 0 != ( pTxtAttr = pINetFmt->GetTxtINetFmt()) &&
- 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
- pTxtNd->GetNodes().IsDocNodes() )
- {
- AddLinkTarget( pINetFmt->GetValue() );
- }
+ const SwFmtINetFmt* pINetFmt = static_cast<const SwFmtINetFmt*>(rDoc.GetAttrPool().GetItem2(RES_TXTATR_INETFMT, n));
+ if (!pINetFmt)
+ continue;
+
+ const SwTxtINetFmt* pTxtAttr = pINetFmt->GetTxtINetFmt();
+ if (!pTxtAttr)
+ continue;
+
+ const SwTxtNode* pTxtNd = pTxtAttr->GetpTxtNode();
+ if (!pTxtNd)
+ continue;
+
+ if (!pTxtNd->GetNodes().IsDocNodes())
+ continue;
+
+ AddLinkTarget( pINetFmt->GetValue() );
}
- const SwFmtURL *pURL;
nMaxItems = rDoc.GetAttrPool().GetItemCount2( RES_URL );
- for( n = 0; n < nMaxItems; ++n )
+ for (sal_uInt32 n = 0; n < nMaxItems; ++n)
{
- if( 0 != (pURL = static_cast<const SwFmtURL*>(rDoc.GetAttrPool().GetItem2(
- RES_URL, n ) ) ) )
+ const SwFmtURL *pURL = static_cast<const SwFmtURL*>(rDoc.GetAttrPool().GetItem2(RES_URL, n));
+ if (!pURL)
+ continue;
+
+ AddLinkTarget(pURL->GetURL());
+ const ImageMap *pIMap = pURL->GetMap();
+ if (!pIMap)
+ continue;
+
+ for (sal_uInt16 i=0; i < pIMap->GetIMapObjectCount(); ++i)
{
- AddLinkTarget( pURL->GetURL() );
- const ImageMap *pIMap = pURL->GetMap();
- if( pIMap )
- {
- for( sal_uInt16 i=0; i<pIMap->GetIMapObjectCount(); i++ )
- {
- const IMapObject* pObj = pIMap->GetIMapObject( i );
- if( pObj )
- {
- AddLinkTarget( pObj->GetURL() );
- }
- }
- }
+ const IMapObject* pObj = pIMap->GetIMapObject(i);
+ if (!pObj)
+ continue;
+ AddLinkTarget( pObj->GetURL() );
}
}
}
commit 44b352c8e84f4a16eea3fc14123a28b7ec232f12
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 23 17:08:39 2015 +0100
fix scope
Change-Id: I114d3d0d45614f8af5004014fd0a61027fdc9e54
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 336050a..8e2253e 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -812,7 +812,6 @@ bool WW8_WrMagicTable::Write( WW8Export& rWrt )
void WW8_WrMagicTable::Append( WW8_CP nCp, sal_uLong nData)
{
- SVBT32 nLittle;
/*
Tell the undocumented table hack that everything between here and the last
table position is nontable text, don't do it if the previous position is
@@ -820,6 +819,7 @@ void WW8_WrMagicTable::Append( WW8_CP nCp, sal_uLong nData)
*/
if ((!Count()) || (Prev() != nCp))
{
+ SVBT32 nLittle;
UInt32ToSVBT32(nData,nLittle);
WW8_WrPlc1::Append(nCp, nLittle);
}
commit 4eaf7792423802736904a4390355b5718a122d48
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 23 17:04:03 2015 +0100
cppcheck: cstyleCast, these cast's are unnecessary anyway
and make both uses the same pattern
Change-Id: Ia4170b29ad948af08bfb842a7e28dd7550eb27bf
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 1b4a5d9..e9d4723 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2208,14 +2208,12 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp,
}
}
}
- else if( i < aSpareFmts.size() )
+ else if (i < aSpareFmts.size() && aSpareFmts[i])
{
- if( const SwFrmFmt* pFmt = (const SwFrmFmt*)aSpareFmts[ i ] )
- {
- const SwNodeIndex* pNdIdx = pFmt->GetCntnt().GetCntntIdx();
- rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
- pNdIdx->GetNode().EndOfSectionIndex(), nTTyp );
- }
+ const SwFrmFmt& rFmt = *aSpareFmts[i];
+ const SwNodeIndex* pNdIdx = rFmt.GetCntnt().GetCntntIdx();
+ rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
+ pNdIdx->GetNode().EndOfSectionIndex(), nTTyp );
}
// CR at end of one textbox text ( otherwise WW gpft :-( )
@@ -2458,9 +2456,9 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
}
if( NULL == pObj )
{
- if( i < aSpareFmts.size() && aSpareFmts[ i ] )
+ if (i < aSpareFmts.size() && aSpareFmts[i])
{
- const SwFrmFmt& rFmt = *(const SwFrmFmt*)aSpareFmts[ i ];
+ const SwFrmFmt& rFmt = *aSpareFmts[i];
const SwFmtChain* pChn = &rFmt.GetChain();
while( pChn->GetNext() )
More information about the Libreoffice-commits
mailing list