ScxmlEditor.TransitionItem: fix signed overflow warning

transitionitem.cpp:247: warning: assuming signed overflow does not occur
when assuming that (X - c) <= X is always true [-Wstrict-overflow]
     if (idSnap >= 0 && idSnap < m_cornerPoints.count()) {
         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: Icc0b21c21326663f801ffef2b82fdd4b2679bf07
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
Nikita Baryshnikov
2017-08-21 11:47:33 +03:00
parent bd4428eb84
commit 0a548fe2bc

View File

@@ -244,7 +244,7 @@ void TransitionItem::snapToAnyPoint(int id, const QPointF &newPoint, int diff)
void TransitionItem::snapPointToPoint(int idSnap, const QPointF &p, int diff)
{
if (idSnap >= 0 && idSnap < m_cornerPoints.count()) {
if (idSnap >= 0 && static_cast<uint>(idSnap) < static_cast<uint>(m_cornerPoints.count())) {
if (qAbs(p.x() - m_cornerPoints[idSnap].x()) < diff)
m_cornerPoints[idSnap].setX(p.x());
if (qAbs(p.y() - m_cornerPoints[idSnap].y()) < diff)