summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2013-05-06 18:00:38 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-03 15:24:06 +0200
commitf2ef8e15dbb5496ab0a0c73644bf58b91fca49af (patch)
tree5ef3ddeff1ffb147ffdba002bc1553805fbce91d
parent58365228b3181ed03188fc8ff56007ea22678bb5 (diff)
downloadqtserialport-f2ef8e15dbb5496ab0a0c73644bf58b91fca49af.tar.gz
Windows: Fix waitAnyEvent() method
Wrong comparison between unsigned variable waitResult and signed size of vector. The waitResult variable was interpreted as signed data type, that led to an wrong result of comparison (e.g. when waitResult = WAIT_FAILED (0xFFFFFFFF)). The solution - convert the size of the array to an unsigned data type and leave waitResult without conversion. Thanks to "boo kan, ong". Task-number: QTBUG-32017 Change-Id: Iff25304d3d0345f47e3edc363a999a7b979cb1bb Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
-rw-r--r--src/serialport/qserialport_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index e8d4d62..c3261a2 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -960,7 +960,7 @@ bool QSerialPortPrivate::waitAnyEvent(int msecs, bool *timedOut,
return false;
}
- if (int(waitResult) > (handles.count() - 1))
+ if (waitResult >= DWORD(WAIT_OBJECT_0 + handles.count()))
return false;
HANDLE h = handles.at(waitResult - WAIT_OBJECT_0);