summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2017-04-02 20:29:46 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2017-04-09 18:43:12 +0000
commitaa1ab248bd3dad450caabb445cd71874048d75b3 (patch)
treeb125e6f047fcf4c246dab61f1171e712c3c99d46
parentd57b9e83857253a1479f89fca18ea5856db39fb7 (diff)
downloadqtserialport-aa1ab248bd3dad450caabb445cd71874048d75b3.tar.gz
Simplify QSPP::standardBaudRates() method
We do not need to use the ifdef guards for the CBR_ constants, because constants are standard and always exists in native API. Change-Id: I75ae9ffc17b132786fe5e72791b3f7c82c72c76e Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport_win.cpp80
1 files changed, 8 insertions, 72 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index a69f975..43660ff 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -783,80 +783,16 @@ QSerialPortErrorInfo QSerialPortPrivate::getSystemError(int systemErrorCode) con
}
// This table contains standard values of baud rates that
-// are defined in MSDN and/or in Win SDK file winbase.h
-
-static const QList<qint32> standardBaudRatePairList()
-{
-
- static const QList<qint32> standardBaudRatesTable = QList<qint32>()
-
- #ifdef CBR_110
- << CBR_110
- #endif
-
- #ifdef CBR_300
- << CBR_300
- #endif
-
- #ifdef CBR_600
- << CBR_600
- #endif
-
- #ifdef CBR_1200
- << CBR_1200
- #endif
-
- #ifdef CBR_2400
- << CBR_2400
- #endif
-
- #ifdef CBR_4800
- << CBR_4800
- #endif
-
- #ifdef CBR_9600
- << CBR_9600
- #endif
-
- #ifdef CBR_14400
- << CBR_14400
- #endif
-
- #ifdef CBR_19200
- << CBR_19200
- #endif
-
- #ifdef CBR_38400
- << CBR_38400
- #endif
-
- #ifdef CBR_56000
- << CBR_56000
- #endif
-
- #ifdef CBR_57600
- << CBR_57600
- #endif
-
- #ifdef CBR_115200
- << CBR_115200
- #endif
-
- #ifdef CBR_128000
- << CBR_128000
- #endif
-
- #ifdef CBR_256000
- << CBR_256000
- #endif
- ;
-
- return standardBaudRatesTable;
-};
-
+// are defined in file winbase.h
QList<qint32> QSerialPortPrivate::standardBaudRates()
{
- return standardBaudRatePairList();
+ static const QList<qint32> baudRates = {
+ CBR_110, CBR_300, CBR_600, CBR_1200, CBR_2400,
+ CBR_4800, CBR_9600, CBR_14400, CBR_19200, CBR_38400,
+ CBR_56000, CBR_57600, CBR_115200, CBR_128000, CBR_256000
+ };
+
+ return baudRates;
}
QSerialPort::Handle QSerialPort::handle() const