diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-12-21 19:36:12 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-22 09:55:51 +0100 |
commit | 2ebb71468642b7ba3360d5169c0a7e5b3178c4dc (patch) | |
tree | 0ea9454dfdcc2a36f5c3dfa6bc506d3fc9e03379 /src/platformsupport/input | |
parent | 7426102c734509269701a1e1dfaecfd76143294f (diff) |
Fix warning about unused variable in QtPlatformSupport
GCC was complaining:
qevdevtouch.cpp:475:13: error: 'maxId' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Which got me scratching my head: maxId was unconditionally initialised. How
could GCC be complaining about it being uninitialised? Well, turns out that
bestId could be uninitialised and the code does:
if (bestId > maxId)
maxId = bestId;
Of course, if bestId was uninitialised, the warning should have been in the
"if" line first.
Change-Id: I5e174ab2957d76ad040c14fa6ef8535129b6dce3
Reviewed-by: Laszlo Agocs <lagocs83@gmail.com>
Diffstat (limited to 'src/platformsupport/input')
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouch.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 9dd607b425..042d7547b6 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -457,7 +457,7 @@ void QEvdevTouchScreenData::assignIds() int maxId = -1; QHash<int, Contact>::iterator it, ite, bestMatch; while (!pending.isEmpty() && !candidates.isEmpty()) { - int bestDist = -1, bestId; + int bestDist = -1, bestId = 0; for (it = pending.begin(), ite = pending.end(); it != ite; ++it) { int dist; int id = findClosestContact(candidates, it->x, it->y, &dist); |