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>
commitf4986a7716ce58749f6c61524fc01a20a51c8214
parentd34fce4a5d12789ded107631e22cb6ef54d35eee
authorDenis Shienkov <denis.shienkov@gmail.com>
committerDenis Shienkov <denis.shienkov@gmail.com>
commit timeTue, 8 Jul 2014 09:35:48 +0200