Unify handling of errors of the overlapped I/O result
Each q_completeXXX() slot does call of GetOverlappedResult()
and differently interprets an error depending on the type of
I/O operation (read, write or communication).
It is more reasonable to make it in the separate method
handleOverlappedResult() which returns the number of the
transferred bytes or -1 in case of error.
Besides, this method accepts the additional integer parameter
which expresses type of overlapped operation using the
existing QSerialPort::Direction enumeration. The type of the
communication operation has not separate value, so is used
zero value for it.
Tested build on Windows 7/8 using Qt4 and then Qt5.
Change-Id: I8482392d06279bc430656e50b1e4392c513885c6
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>