mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: introduce copy_qstring() function
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common occurrences that they seem worthy of a short helper-function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b72cc1f317
commit
d1572a8d95
19 changed files with 116 additions and 108 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "downloadfromdcthread.h"
|
||||
#include "core/libdivecomputer.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
|
|
@ -281,12 +282,12 @@ int DCDeviceData::diveId() const
|
|||
|
||||
void DCDeviceData::setVendor(const QString& vendor)
|
||||
{
|
||||
data.vendor = strdup(qPrintable(vendor));
|
||||
data.vendor = copy_qstring(vendor);
|
||||
}
|
||||
|
||||
void DCDeviceData::setProduct(const QString& product)
|
||||
{
|
||||
data.product = strdup(qPrintable(product));
|
||||
data.product = copy_qstring(product);
|
||||
}
|
||||
|
||||
void DCDeviceData::setDevName(const QString& devName)
|
||||
|
|
@ -303,11 +304,11 @@ void DCDeviceData::setDevName(const QString& devName)
|
|||
QString back = devName.mid(idx1 + 1, idx2 - idx1 - 1);
|
||||
QString newDevName = back.indexOf(':') >= 0 ? back : front;
|
||||
qWarning() << "Found invalid bluetooth device" << devName << "corrected to" << newDevName << ".";
|
||||
data.devname = strdup(qPrintable(newDevName));
|
||||
data.devname = copy_qstring(newDevName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
data.devname = strdup(qPrintable(devName));
|
||||
data.devname = copy_qstring(devName);
|
||||
}
|
||||
|
||||
void DCDeviceData::setDevBluetoothName(const QString& name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue