diff options
author | Laszlo Papp <lpapp@kde.org> | 2014-03-04 06:47:33 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-04 12:26:46 +0100 |
commit | 903c050fa4fdd2124f9f0709520b75a557080a92 (patch) | |
tree | 2dcd470313b1fb92135edcc1bea579fdbed14ded /src | |
parent | 959775c41683033adbd99faab7e3d70e0009c143 (diff) | |
download | qtserialport-903c050fa4fdd2124f9f0709520b75a557080a92.tar.gz |
Use early return on error in the open method
It was done like that for consistency with QFile, probably, but it is not a good
style in Qt overall.
Change-Id: I5233a7f0f03cab947b061520fe2ec64585632920
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/serialport/qserialport.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 3f14662..cfb30bc 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -525,15 +525,15 @@ bool QSerialPort::open(OpenMode mode) } clearError(); - if (d->open(mode)) { - QIODevice::open(mode); + if (!d->open(mode)) + return false; - d->dataTerminalReady = isDataTerminalReady(); - d->requestToSend = isRequestToSend(); + QIODevice::open(mode); - return true; - } - return false; + d->dataTerminalReady = isDataTerminalReady(); + d->requestToSend = isRequestToSend(); + + return true; } /*! |