summaryrefslogtreecommitdiffstats
path: root/core/configuredivecomputerthreads.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-02-25 13:51:41 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-03-14 13:55:36 +0200
commitb72cc1f31784346884c8552c22f1e4c3c6d5ed1d (patch)
tree00a04967dc56ccdc69ee998058c13911292ecef7 /core/configuredivecomputerthreads.cpp
parent4e44fe7598430f9879736ec2d00b99b15dc05451 (diff)
downloadsubsurface-b72cc1f31784346884c8552c22f1e4c3c6d5ed1d.tar.gz
Cleanup: consistently use qPrintable()
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/configuredivecomputerthreads.cpp')
-rw-r--r--core/configuredivecomputerthreads.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/configuredivecomputerthreads.cpp b/core/configuredivecomputerthreads.cpp
index 0d9a553e8..885cd0226 100644
--- a/core/configuredivecomputerthreads.cpp
+++ b/core/configuredivecomputerthreads.cpp
@@ -293,7 +293,7 @@ static dc_status_t write_suunto_vyper_settings(dc_device_t *device, DeviceDetail
rc = dc_device_write(device, SUUNTO_VYPER_CUSTOM_TEXT,
// Convert the customText to a 30 char wide padded with " "
- (const unsigned char *)QString("%1").arg(m_deviceDetails->customText, -30, QChar(' ')).toUtf8().data(),
+ (const unsigned char *)qPrintable(QString("%1").arg(m_deviceDetails->customText, -30, QChar(' '))),
SUUNTO_VYPER_CUSTOM_TEXT_LENGTH);
if (rc != DC_STATUS_SUCCESS)
return rc;
@@ -812,7 +812,7 @@ static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_de
//write general settings
//custom text
- rc = hw_ostc3_device_customtext(device, m_deviceDetails->customText.toUtf8().data());
+ rc = hw_ostc3_device_customtext(device, qPrintable(m_deviceDetails->customText));
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
@@ -1356,7 +1356,7 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
//write general settings
//custom text
- rc = hw_ostc3_device_customtext(device, m_deviceDetails->customText.toUtf8().data());
+ rc = hw_ostc3_device_customtext(device, qPrintable(m_deviceDetails->customText));
if (rc != DC_STATUS_SUCCESS)
return rc;
@@ -1891,7 +1891,7 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
} else {
data[64] = 1;
// Copy the string to the right place in the memory, padded with 0x20 (" ")
- strncpy((char *)data + 65, QString("%1").arg(m_deviceDetails->customText, -23, QChar(' ')).toUtf8().data(), 23);
+ strncpy((char *)data + 65, qPrintable(QString("%1").arg(m_deviceDetails->customText, -23, QChar(' '))), 23);
// And terminate the string.
if (m_deviceDetails->customText.length() <= 23)
data[65 + m_deviceDetails->customText.length()] = '}';
@@ -2227,10 +2227,10 @@ void FirmwareUpdateThread::run()
switch (dc_device_get_type(m_data->device)) {
#if DC_VERSION_CHECK(0, 5, 0)
case DC_FAMILY_HW_OSTC3:
- rc = hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
+ rc = hw_ostc3_device_fwupdate(m_data->device, qPrintable(m_fileName));
break;
case DC_FAMILY_HW_OSTC:
- rc = hw_ostc_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
+ rc = hw_ostc_device_fwupdate(m_data->device, qPrintable(m_fileName));
break;
#endif // divecomputer 0.5.0
default: