summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-11-28 15:20:48 +0100
committerMichael Stahl <mstahl@redhat.com>2016-11-29 09:49:48 +0000
commitd36ca60964cf20b738ead1020c41c2f586a16660 (patch)
treebafad47f21da450089d2ea79446d551c5bdf65de
parent5a13d6146e21355803b7c803ab98143dd41b8416 (diff)
extensions,sc,sd,vcl: de-obfuscate assignments in conditions to help GCC
GCC 6.2.1 with -Og produces spurious -Werror=maybe-uninitialized on variables that are assigned in conditions; perhaps it's better to de-obfuscate the code if even GCC is confused about it. Change-Id: Ia2f8209df893a8e5659ca72f4cde3d7d847574e1 Reviewed-on: https://gerrit.libreoffice.org/31332 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--extensions/source/scanner/sanedlg.cxx6
-rw-r--r--sc/source/core/tool/token.cxx10
-rw-r--r--sd/source/filter/ppt/pptin.cxx6
-rw-r--r--sd/source/ui/view/drawview.cxx6
-rw-r--r--vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx2
5 files changed, 19 insertions, 11 deletions
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 1bf9ffa1978e..cea597cb109b 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -1470,8 +1470,10 @@ bool SaneDlg::SetAdjustedNumericalValue(
double fValue,
int nElement )
{
- int nOption;
- if( ! Sane::IsSane() || ! mrSane.IsOpen() || ( nOption = mrSane.GetOptionByName( pOption ) ) == -1 )
+ if (! Sane::IsSane() || ! mrSane.IsOpen())
+ return false;
+ int const nOption(mrSane.GetOptionByName(pOption));
+ if (nOption == -1)
return false;
if( nElement < 0 || nElement >= mrSane.GetOptionElements( nOption ) )
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 53f4dc49756c..88970ed3d120 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -535,12 +535,14 @@ FormulaTokenRef extendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2
const ScAddress & rPos, bool bReuseDoubleRef )
{
- StackVar sv1, sv2;
+ StackVar sv1 = rTok1.GetType();
// Doing a RangeOp with RefList is probably utter nonsense, but Xcl
// supports it, so do we.
- if (((sv1 = rTok1.GetType()) != svSingleRef && sv1 != svDoubleRef && sv1 != svRefList &&
- sv1 != svExternalSingleRef && sv1 != svExternalDoubleRef ) ||
- ((sv2 = rTok2.GetType()) != svSingleRef && sv2 != svDoubleRef && sv2 != svRefList))
+ if (sv1 != svSingleRef && sv1 != svDoubleRef && sv1 != svRefList
+ && sv1 != svExternalSingleRef && sv1 != svExternalDoubleRef)
+ return nullptr;
+ StackVar sv2 = rTok2.GetType();
+ if (sv2 != svSingleRef && sv2 != svDoubleRef && sv2 != svRefList)
return nullptr;
ScTokenRef xRes;
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 78b5e274c7cd..304194b268c7 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -725,10 +725,12 @@ bool ImplSdPPTImport::Import()
}
}
}
- SdPage* pMPage;
sal_uInt16 i;
- for ( i = 0; i < mpDoc->GetMasterPageCount() && ( (pMPage = static_cast<SdPage*>(mpDoc->GetMasterPage( i ))) != nullptr ); i++ )
+ for (i = 0; i < mpDoc->GetMasterPageCount(); ++i)
{
+ SdPage *const pMPage(static_cast<SdPage*>(mpDoc->GetMasterPage(i)));
+ if (pMPage == nullptr)
+ break;
SetPageNum( i, PPT_MASTERPAGE );
// importing master page objects
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 9292cf50a08e..d91cc295a6ca 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -539,11 +539,13 @@ void DrawView::DeleteMarked()
if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
{
pPage = static_cast< SdPage* >( pObj->GetPage() );
- PresObjKind ePresObjKind;
- if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
+ if (pPage)
{
+ PresObjKind ePresObjKind(pPage->GetPresObjKind(pObj));
switch( ePresObjKind )
{
+ case PRESOBJ_NONE:
+ continue; // ignore it
case PRESOBJ_GRAPHIC:
case PRESOBJ_OBJECT:
case PRESOBJ_CHART:
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index d4f8dfb71427..59dbb79b0a8e 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -231,7 +231,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(m_pFilterView), false);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(m_pFilterView), true);
- GtkCellRenderer *cell;
+ GtkCellRenderer *cell = nullptr;
for (i = 0; i < 2; ++i)
{