@@ -67,12 +67,12 @@ int ProviderFtdi::open()
6767
6868 Debug (_log, " Opening FTDI device=%s" , QSTRING_CSTR (_deviceName));
6969
70- FTDI_CHECK_RESULT ((rc = ftdi_usb_open_string (_ftdic, QSTRING_CSTR (_deviceName))) < 0 );
70+ FTDI_CHECK_RESULT ((rc = ftdi_usb_open_string (_ftdic, QSTRING_CSTR (_deviceName))) < 0 )
7171 /* doing this disable resets things if they were in a bad state */
72- FTDI_CHECK_RESULT ((rc = ftdi_disable_bitbang (_ftdic)) < 0 );
73- FTDI_CHECK_RESULT ((rc = ftdi_setflowctrl (_ftdic, SIO_DISABLE_FLOW_CTRL)) < 0 );
74- FTDI_CHECK_RESULT ((rc = ftdi_set_bitmode (_ftdic, 0x00 , BITMODE_RESET)) < 0 );
75- FTDI_CHECK_RESULT ((rc = ftdi_set_bitmode (_ftdic, 0xff , BITMODE_MPSSE)) < 0 );
72+ FTDI_CHECK_RESULT ((rc = ftdi_disable_bitbang (_ftdic)) < 0 )
73+ FTDI_CHECK_RESULT ((rc = ftdi_setflowctrl (_ftdic, SIO_DISABLE_FLOW_CTRL)) < 0 )
74+ FTDI_CHECK_RESULT ((rc = ftdi_set_bitmode (_ftdic, 0x00 , BITMODE_RESET)) < 0 )
75+ FTDI_CHECK_RESULT ((rc = ftdi_set_bitmode (_ftdic, 0xff , BITMODE_MPSSE)) < 0 )
7676
7777 double reference_clock = 60e6 ;
7878 int divisor = (reference_clock / 2 / _baudRate_Hz) - 1 ;
@@ -86,7 +86,7 @@ int ProviderFtdi::open()
8686 pinDirection
8787 };
8888
89- FTDI_CHECK_RESULT ((rc = ftdi_write_data (_ftdic, buf.data (), buf.size ())) != buf.size ());
89+ FTDI_CHECK_RESULT (static_cast < size_t > (rc = ftdi_write_data (_ftdic, buf.data (), static_cast < int >( buf.size ()))) != buf.size ())
9090
9191 _isDeviceReady = true ;
9292 return rc;
@@ -134,7 +134,7 @@ int ProviderFtdi::writeBytes(const qint64 size, const uint8_t *data)
134134 // SET_BITS_LOW takes 2 arguments, so we're inserting data in -3 position from the end
135135 buf.insert (buf.end () - 3 , &data[0 ], &data[size]);
136136
137- FTDI_CHECK_RESULT ((rc = ftdi_write_data (_ftdic, buf.data (), buf.size ())) != buf.size ());
137+ FTDI_CHECK_RESULT (static_cast < size_t > (rc = ftdi_write_data (_ftdic, buf.data (), static_cast < int >( buf.size ()))) != buf.size ())
138138 return rc;
139139}
140140
@@ -152,7 +152,7 @@ QJsonObject ProviderFtdi::discover(const QJsonObject & /*params*/)
152152 struct ftdi_device_list *curdev = devlist;
153153 QMap<QString, uint8_t > deviceIndexes;
154154
155- while (curdev)
155+ while (curdev != nullptr )
156156 {
157157 libusb_device_descriptor desc;
158158 int rc = libusb_get_device_descriptor (curdev->dev , &desc);
@@ -161,8 +161,7 @@ QJsonObject ProviderFtdi::discover(const QJsonObject & /*params*/)
161161 QString vendorIdentifier = QString (" 0x%1" ).arg (desc.idVendor , 4 , 16 , QChar{' 0' });
162162 QString productIdentifier = QString (" 0x%1" ).arg (desc.idProduct , 4 , 16 , QChar{' 0' });
163163 QString vendorAndProduct = QString (" %1:%2" )
164- .arg (vendorIdentifier)
165- .arg (productIdentifier);
164+ .arg (vendorIdentifier,productIdentifier);
166165 uint8_t deviceIndex = deviceIndexes.value (vendorAndProduct, 0 );
167166
168167 char serial_string[128 ] = {0 };
@@ -174,7 +173,7 @@ QJsonObject ProviderFtdi::discover(const QJsonObject & /*params*/)
174173 QString ftdiOpenString;
175174 if (!serialNumber.isEmpty ())
176175 {
177- ftdiOpenString = QString (" s:%1:%2" ).arg (vendorAndProduct). arg ( serialNumber);
176+ ftdiOpenString = QString (" s:%1:%2" ).arg (vendorAndProduct, serialNumber);
178177 }
179178 else
180179 {
0 commit comments