Clang warning.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-03-22 15:29:50 +02:00
parent fb1d8ee221
commit 573e20f12d
2 changed files with 17 additions and 16 deletions

View File

@ -430,14 +430,14 @@ quint32 DialogTool::DNumber(const QString &baseName) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::FindNotExcludedNodeDown(QListWidget *listWidget, int candidate) int DialogTool::FindNotExcludedNodeDown(QListWidget *listWidget, int candidate)
{ {
SCASSERT(listWidget != nullptr); SCASSERT(listWidget != nullptr);
quint32 id = NULL_ID; int index = -1;
if (candidate < 0 || candidate >= listWidget->count()) if (candidate < 0 || candidate >= listWidget->count())
{ {
return id; return index;
} }
int i = candidate; int i = candidate;
@ -450,25 +450,25 @@ quint32 DialogTool::FindNotExcludedNodeDown(QListWidget *listWidget, int candida
if (not rowNode.IsExcluded()) if (not rowNode.IsExcluded())
{ {
id = rowNode.GetId(); index = i;
} }
++i; ++i;
} }
while (rowNode.IsExcluded() && i < listWidget->count()); while (rowNode.IsExcluded() && i < listWidget->count());
return id; return index;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::FindNotExcludedNodeUp(QListWidget *listWidget, int candidate) int DialogTool::FindNotExcludedNodeUp(QListWidget *listWidget, int candidate)
{ {
SCASSERT(listWidget != nullptr); SCASSERT(listWidget != nullptr);
quint32 id = NULL_ID; int index = -1;
if (candidate < 0 || candidate >= listWidget->count()) if (candidate < 0 || candidate >= listWidget->count())
{ {
return id; return index;
} }
int i = candidate; int i = candidate;
@ -481,14 +481,14 @@ quint32 DialogTool::FindNotExcludedNodeUp(QListWidget *listWidget, int candidate
if (not rowNode.IsExcluded()) if (not rowNode.IsExcluded())
{ {
id = rowNode.GetId(); index = i;
} }
--i; --i;
} }
while (rowNode.IsExcluded() && i > -1); while (rowNode.IsExcluded() && i > -1);
return id; return index;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -497,8 +497,8 @@ bool DialogTool::FirstPointEqualLast(QListWidget *listWidget)
SCASSERT(listWidget != nullptr); SCASSERT(listWidget != nullptr);
if (listWidget->count() > 1) if (listWidget->count() > 1)
{ {
const quint32 topId = FindNotExcludedNodeDown(listWidget, 0); const quint32 topId = RowId(listWidget, FindNotExcludedNodeDown(listWidget, 0));
const quint32 bottomId = FindNotExcludedNodeUp(listWidget, listWidget->count()-1); const quint32 bottomId = RowId(listWidget, FindNotExcludedNodeUp(listWidget, listWidget->count()-1));
return topId == bottomId; return topId == bottomId;
} }
return false; return false;
@ -510,8 +510,9 @@ bool DialogTool::DoublePoints(QListWidget *listWidget)
SCASSERT(listWidget != nullptr); SCASSERT(listWidget != nullptr);
for (int i=0, sz = listWidget->count()-1; i<sz; ++i) for (int i=0, sz = listWidget->count()-1; i<sz; ++i)
{ {
const quint32 firstId = FindNotExcludedNodeDown(listWidget, i); const int firstIndex = FindNotExcludedNodeDown(listWidget, i);
const quint32 secondId = FindNotExcludedNodeDown(listWidget, firstId+1); const quint32 firstId = RowId(listWidget, firstIndex);
const quint32 secondId = RowId(listWidget, FindNotExcludedNodeDown(listWidget, firstIndex+1));
if (firstId == secondId) if (firstId == secondId)
{ {

View File

@ -266,8 +266,8 @@ protected:
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
quint32 DNumber(const QString &baseName) const; quint32 DNumber(const QString &baseName) const;
static quint32 FindNotExcludedNodeDown(QListWidget *listWidget, int candidate); static int FindNotExcludedNodeDown(QListWidget *listWidget, int candidate);
static quint32 FindNotExcludedNodeUp(QListWidget *listWidget, int candidate); static int FindNotExcludedNodeUp(QListWidget *listWidget, int candidate);
static bool FirstPointEqualLast(QListWidget *listWidget); static bool FirstPointEqualLast(QListWidget *listWidget);
static bool DoublePoints(QListWidget *listWidget); static bool DoublePoints(QListWidget *listWidget);
static QString DialogWarningIcon(); static QString DialogWarningIcon();