jiuzhuaxiong / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

Invalid return values on failed read/write operation #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile software on 64 bit windows environment 
2. Do something to get failed write or read operation
3. Get return value of 0xFFFFFFFF instead of -1

On error QextSerialPort returns (DWORD)-1, which equals to 32 bits set. This 
will fail on 64 bit system where that value is a positive (and large) integer.

Error value is returned like this:
qint64 QextSerialPort::writeData(...)
{
    ...
    return (DWORD)-1;   // Equal to 4294967295
}

It should be:
qint64 QextSerialPort::writeData(...)
{
    ...
    return -1;   // Actually returns -1
}

Attached diff contains a fix for this.
(It also removes two unused variable warnings)

Original issue reported on code.google.com by seppo.ra...@gmail.com on 27 Jan 2011 at 2:36

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by dbzhang...@gmail.com on 16 Mar 2012 at 6:24