summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-07-01 09:59:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-07-01 10:56:14 +0100
commit5ace3f3b4f2f916d8b2acab1b5cc0fe2a5a19dee (patch)
tree00cdcfc6ef33bc558bda62935d46377f033975d6 /sw
parent62cb50fd9b97358114dcc4d0c1afdcdd04341b0c (diff)
clang scan-build: various warnings
Change-Id: I4bdfb074b3cf6fcb49765322308dfa4b9ed67713
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/flowfrm.cxx2
-rw-r--r--sw/source/core/text/porlay.cxx2
-rw-r--r--sw/source/core/undo/undel.cxx4
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx4
-rw-r--r--sw/source/filter/xml/xmltexte.cxx4
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx18
6 files changed, 16 insertions, 18 deletions
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 233f0e6dc3c8..a13ddbcaf84e 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -230,7 +230,7 @@ bool SwFlowFrm::IsKeep( const SwAttrSet& rAttrs, bool bCheckIfLastRowShouldKeep
if ( ! pSet )
pSet = pNxt->GetAttrSet();
- OSL_ENSURE( pSet, "No AttrSet to check keep attribute" );
+ assert(pSet && "No AttrSet to check keep attribute");
if ( pSet->GetPageDesc().GetPageDesc() )
bKeep = false;
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 3c8f77bc3ba0..dd5066a0af7e 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -601,7 +601,7 @@ SwScriptInfo::~SwScriptInfo()
// Sw Script Types (SW_LATIN, SW_CJK, SW_CTL), used to identify the font
sal_uInt8 SwScriptInfo::WhichFont( sal_Int32 nIdx, const OUString* pTxt, const SwScriptInfo* pSI )
{
- SAL_WARN_IF( !pTxt && !pSI, "sw.core", "How should I determine the script type?" );
+ assert((pSI || pTxt) && "How should I determine the script type?");
sal_uInt16 nScript;
// First we try to use our SwScriptInfo
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index cb3180292e10..470dbf468e6a 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -359,8 +359,6 @@ bool SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
if( pSttTxtNd )
{
bool bOneNode = nSttNode == nEndNode;
- sal_Int32 nLen = bOneNode ? nEndCntnt - nSttCntnt
- : pSttTxtNd->GetTxt().getLength() - nSttCntnt;
SwRegHistory aRHst( *pSttTxtNd, pHistory );
// always save all text atttibutes because of possibly overlapping
// areas of on/off
@@ -370,7 +368,7 @@ bool SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
pHistory->CopyFmtAttr( *pSttTxtNd->GetpSwAttrSet(), nNdIdx );
// the length might have changed (!!Fields!!)
- nLen = ((bOneNode)
+ sal_Int32 nLen = ((bOneNode)
? pEnd->nContent.GetIndex()
: pSttTxtNd->GetTxt().getLength())
- pStt->nContent.GetIndex();
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index c2d7ff4b3d5d..a8bd5feabfb8 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1845,7 +1845,7 @@ static bool WW8GetFieldPara(WW8PLCFspecial& rPLCF, WW8FieldDesc& rF)
rPLCF.advance();
- if((((sal_uInt8*)pData)[0] & 0x1f ) != 0x13 ) // No beginning?
+ if (!pData || (((sal_uInt8*)pData)[0] & 0x1f) != 0x13) // No beginning?
goto Err;
rF.nId = ((sal_uInt8*)pData)[1];
@@ -1932,7 +1932,7 @@ sal_Int32 WW8ScannerBase::WW8ReadString( SvStream& rStrm, OUString& rStr,
WW8_CP nNextPieceCp = nBehindTextCp; // Initialization, important for Ver6
do
{
- bool bIsUnicode, bPosOk;
+ bool bIsUnicode(false), bPosOk(false);
WW8_FC fcAct = WW8Cp2Fc(nAktStartCp,&bIsUnicode,&nNextPieceCp,&bPosOk);
// Probably aimed beyond file end, doesn't matter!
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index d2e26177a6ac..09cb3f01f93b 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -68,10 +68,10 @@ SwNoTxtNode *SwXMLTextParagraphExport::GetNoTxtNode(
const Reference < XPropertySet >& rPropSet ) const
{
Reference<XUnoTunnel> xCrsrTunnel( rPropSet, UNO_QUERY );
- OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" );
+ assert(xCrsrTunnel.is() && "missing XUnoTunnel for embedded");
SwXFrame *pFrame = reinterpret_cast< SwXFrame * >(
sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( SwXFrame::getUnoTunnelId() )));
- OSL_ENSURE( pFrame, "SwXFrame missing" );
+ assert(pFrame && "SwXFrame missing");
SwFrmFmt *pFrmFmt = pFrame->GetFrmFmt();
const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx();
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index ed6744193ee8..bb6bfc3cf58d 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -322,10 +322,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+ assert(pFact && "SwAbstractDialogFactory fail!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR_DRAW));
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
+ assert(pDlg && "Dialogdiet fail!");
if (nSlot == SID_CHAR_DLG_EFFECT)
{
pDlg->SetCurPageId("fonteffects");
@@ -346,10 +346,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
case FN_FORMAT_FOOTNOTE_DLG:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+ assert(pFact && "SwAbstractDialogFactory fail!");
boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), rView.GetWrtShell()));
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
+ assert(pDlg && "Dialogdiet fail!");
pDlg->Execute();
break;
}
@@ -357,10 +357,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
{
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
+ assert(pFact && "Dialogdiet fail!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
GetView().GetWindow(), &aTmp, GetView().GetWrtShell()));
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
+ assert(pDlg && "Dialogdiet fail!");
pDlg->Execute();
pDlg.reset();
rReq.Done();
@@ -419,10 +419,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+ assert(pFact && "SwAbstractDialogFactory fail!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr,DLG_STD, 0, true ));
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
+ assert(pDlg && "Dialogdiet fail!");
sal_uInt16 nRet = pDlg->Execute();
if(RET_OK == nRet)
{
@@ -580,7 +580,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
break;
default:
- OSL_ENSURE(!this, "wrong dispatcher");
+ assert(!this && "wrong dispatcher");
return;
}
if(nEEWhich && pNewAttrs)