From de48fd192b7973c4849ec79bce4cd491b5e8550f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 10 Oct 2016 21:02:16 +0200 Subject: QToolBarAreaLayoutInfo: add missing break statements in switch in distance() A fall-through here is logically non-sensical, because of symmetry (or lack thereof). Thus, a break must have been intended. Add it. While we're at it, also replace the default case label with the non-functional enum value QInternal::DockCount, so that -Wswitch can warn us if ever there should be a new DockPosition. Found independently by both GCC 7 and Coverity. Coverity-Id: 11145 Coverity-Id: 11146 Coverity-Id: 11147 Change-Id: I6bb31c1517e40f0cb06ceaee5aeb6fa78b84a523 Reviewed-by: Edward Welbourne --- src/widgets/widgets/qtoolbararealayout.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index 16b1115dd6..f42c1f0ed9 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -598,16 +598,21 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const case QInternal::LeftDock: if (pos.y() < rect.bottom()) return pos.x() - rect.right(); + break; case QInternal::RightDock: if (pos.y() < rect.bottom()) return rect.left() - pos.x(); + break; case QInternal::TopDock: if (pos.x() < rect.right()) return pos.y() - rect.bottom(); + break; case QInternal::BottomDock: if (pos.x() < rect.right()) return rect.top() - pos.y(); - default: + break; + + case QInternal::DockCount: break; } return -1; -- cgit v1.2.3