summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-03 15:43:04 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-03 20:47:58 +0100
commit49747ff2337fd1f4a3ee8e16d6328b8dacad99ec (patch)
tree110901102d4ae356b161434a4e4064a28a0a738a /sw
parent0981f1d8c8a8918b5f28bf5605023b07e73b0d44 (diff)
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I75082c85862b83ed2503900186ce9c70783e54db Reviewed-on: https://gerrit.libreoffice.org/62817 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx18
-rw-r--r--sw/source/core/draw/dview.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx21
3 files changed, 16 insertions, 34 deletions
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 4e203e565108..be9f7610bee3 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -729,7 +729,8 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
bool bSaveInXMLImportFlag = m_rDoc.IsInXMLImport();
m_rDoc.SetInXMLImport( false );
// and then hide/display everything
- void (SwRangeRedline::*pFnc)(sal_uInt16, size_t) = nullptr;
+ void (SwRangeRedline::*pFnc)(sal_uInt16, size_t); // Allow compiler warn if use of
+ // uninitialized ptr is possible
RedlineFlags eShowMode = RedlineFlags::ShowMask & eMode;
if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
@@ -747,16 +748,13 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
CheckAnchoredFlyConsistency(m_rDoc);
CHECK_REDLINE( *this )
- if (pFnc)
- {
- for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
- for (size_t i = 0; i < mpRedlineTable->size(); ++i)
- ((*mpRedlineTable)[i]->*pFnc)(nLoop, i);
+ for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
+ for (size_t i = 0; i < mpRedlineTable->size(); ++i)
+ ((*mpRedlineTable)[i]->*pFnc)(nLoop, i);
- //SwRangeRedline::MoveFromSection routinely changes
- //the keys that mpRedlineTable is sorted by
- mpRedlineTable->Resort();
- }
+ //SwRangeRedline::MoveFromSection routinely changes
+ //the keys that mpRedlineTable is sorted by
+ mpRedlineTable->Resort();
CheckAnchoredFlyConsistency(m_rDoc);
CHECK_REDLINE( *this )
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index e97a4a70954f..9cafe342e3a6 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -954,16 +954,9 @@ void SwDrawView::DeleteMarked()
pTmpRoot->StartAllAction();
pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
// replace marked <SwDrawVirtObj>-objects by its reference objects.
+ if (SdrPageView* pDrawPageView = m_rImp.GetPageView())
{
- SdrPageView* pDrawPageView = m_rImp.GetPageView();
- if ( pDrawPageView )
- {
- SdrMarkView* pMarkView = &(pDrawPageView->GetView());
- if ( pMarkView )
- {
- ReplaceMarkedDrawVirtObjs( *pMarkView );
- }
- }
+ ReplaceMarkedDrawVirtObjs(pDrawPageView->GetView());
}
// Check what textboxes have to be deleted afterwards.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 47022173a6ea..b691312b5794 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6178,7 +6178,7 @@ void DocxAttributeOutput::SectionType( sal_uInt8 nBreakCode )
/* break code: 0 No break, 1 New column
2 New page, 3 Even page, 4 Odd page
*/
- const char* pType = nullptr;
+ const char* pType;
switch ( nBreakCode )
{
case 1: pType = "nextColumn"; break;
@@ -6188,10 +6188,7 @@ void DocxAttributeOutput::SectionType( sal_uInt8 nBreakCode )
default: pType = "continuous"; break;
}
- if ( pType )
- m_pSerializer->singleElementNS( XML_w, XML_type,
- FSNS( XML_w, XML_val ), pType,
- FSEND );
+ m_pSerializer->singleElementNS(XML_w, XML_type, FSNS(XML_w, XML_val), pType, FSEND);
}
void DocxAttributeOutput::TextVerticalAdjustment( const drawing::TextVerticalAdjust nVA )
@@ -6254,7 +6251,7 @@ void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEnc
void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
{
- const char *pFamily = nullptr;
+ const char* pFamily;
switch ( eFamily )
{
case FAMILY_ROMAN: pFamily = "roman"; break;
@@ -6265,15 +6262,12 @@ void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
default: pFamily = "auto"; break; // no font family
}
- if ( pFamily )
- m_pSerializer->singleElementNS( XML_w, XML_family,
- FSNS( XML_w, XML_val ), pFamily,
- FSEND );
+ m_pSerializer->singleElementNS(XML_w, XML_family, FSNS(XML_w, XML_val), pFamily, FSEND);
}
void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const
{
- const char *pPitch = nullptr;
+ const char* pPitch;
switch ( ePitch )
{
case PITCH_VARIABLE: pPitch = "variable"; break;
@@ -6281,10 +6275,7 @@ void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const
default: pPitch = "default"; break; // no info about the pitch
}
- if ( pPitch )
- m_pSerializer->singleElementNS( XML_w, XML_pitch,
- FSNS( XML_w, XML_val ), pPitch,
- FSEND );
+ m_pSerializer->singleElementNS(XML_w, XML_pitch, FSNS(XML_w, XML_val), pPitch, FSEND);
}
void DocxAttributeOutput::EmbedFont( const OUString& name, FontFamily family, FontPitch pitch )