Fix QSP::bytesToWrite() on Windows


After calling the WriteFile() function, QSP::bytesToWrite() should
return zero, but did return the size of writeBuffer.

On Windows, we must not to cut a size of the writeBuffer until the
asynchronous write operation has completed. So we need to make use of an
additional actualBytesToWrite variable, the value of which is increased
when new data is added to the writeBuffer, and decreased after calling
the WriteFile() function.

This change also entails the modification of the QSP::writeData() method
and deleting the QSP::startWriting() method. Now all platform-dependent
code (related to startWriting(), and to copying of memory to
writeBuffer) resides in the new QSP::writeData() method. But this
modification does not change the behavior on platforms other than Windows.

Tested on Windows with the virtual com0com serial ports using Qt5.

Change-Id: I35c1428ad374c0709d6c352a93c552898e947bde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
commit62dfdeb3642250bdb642dbf607a8c7b95e57835e
parentd9a29ff7cc479e8a9e6d418de6408866f0dce4b6
authorDenis Shienkov <denis.shienkov@gmail.com>
committerDenis Shienkov <denis.shienkov@gmail.com>
commit timeMon, 6 Oct 2014 15:40:02 +0200