From aa1ab248bd3dad450caabb445cd71874048d75b3 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sun, 2 Apr 2017 20:29:46 +0300 Subject: 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 Reviewed-by: Denis Shienkov --- src/serialport/qserialport_win.cpp | 80 ++++---------------------------------- 1 file changed, 8 insertions(+), 72 deletions(-) (limited to 'src') 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 standardBaudRatePairList() -{ - - static const QList standardBaudRatesTable = QList() - - #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 QSerialPortPrivate::standardBaudRates() { - return standardBaudRatePairList(); + static const QList 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 -- cgit v1.2.1