diff options
author | Liang Qi <liang.qi@qt.io> | 2017-01-25 10:26:13 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-01-25 10:26:13 +0100 |
commit | 4458f9376aa88b556e38d81180c5966889009bfb (patch) | |
tree | 44b5b9921eb4f9cf5030317685544c4d20820935 /src/serialport/qserialport_unix.cpp | |
parent | 23902340662f1ef6f5dafe68a34b593aed6ea497 (diff) | |
parent | f640521532087dc76d36b25a6c49b2f64afcd4de (diff) | |
download | qtserialport-4458f9376aa88b556e38d81180c5966889009bfb.tar.gz |
Merge remote-tracking branch 'origin/5.8' into devv5.9.0-alpha1
Conflicts:
.qmake.conf
Change-Id: Ie713faf0d6395f11477fceb35c93388756e33fae
Diffstat (limited to 'src/serialport/qserialport_unix.cpp')
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 8e06ada..fafe8c5 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -778,6 +778,8 @@ bool QSerialPortPrivate::readNotification() char *ptr = buffer.reserve(bytesToRead); const qint64 readBytes = readFromPort(ptr, bytesToRead); + buffer.chop(bytesToRead - qMax(readBytes, qint64(0))); + if (readBytes <= 0) { QSerialPortErrorInfo error = getSystemError(); if (error.errorCode != QSerialPort::ResourceError) @@ -785,12 +787,9 @@ bool QSerialPortPrivate::readNotification() else setReadNotificationEnabled(false); setError(error); - buffer.chop(bytesToRead); return false; } - buffer.chop(bytesToRead - qMax(readBytes, qint64(0))); - newBytes = buffer.size() - newBytes; // If read buffer is full, disable the read port notifier. |