diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/android.cpp | 2 | ||||
-rw-r--r-- | core/configuredivecomputerthreads.cpp | 12 | ||||
-rw-r--r-- | core/divecomputer.cpp | 10 | ||||
-rw-r--r-- | core/divelogexportlogic.cpp | 2 | ||||
-rw-r--r-- | core/prefs-macros.h | 10 | ||||
-rw-r--r-- | core/qt-ble.cpp | 2 | ||||
-rw-r--r-- | core/qthelper.cpp | 38 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 8 |
8 files changed, 42 insertions, 42 deletions
diff --git a/core/android.cpp b/core/android.cpp index 7c9965c16..5234f35a9 100644 --- a/core/android.cpp +++ b/core/android.cpp @@ -52,7 +52,7 @@ static const char *system_default_path_append(const char *append) if (append) path += QString("/%1").arg(append); - return strdup(path.toUtf8().data()); + return strdup(qPrintable(path)); } const char *system_default_directory(void) 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: diff --git a/core/divecomputer.cpp b/core/divecomputer.cpp index 43219ed05..08b6948d4 100644 --- a/core/divecomputer.cpp +++ b/core/divecomputer.cpp @@ -57,11 +57,11 @@ const DiveComputerNode *DiveComputerList::get(const QString &m) void DiveComputerNode::showchanges(const QString &n, const QString &s, const QString &f) const { if (nickName != n) - qDebug("new nickname %s for DC model %s deviceId 0x%x", n.toUtf8().data(), model.toUtf8().data(), deviceId); + qDebug("new nickname %s for DC model %s deviceId 0x%x", qPrintable(n), qPrintable(model), deviceId); if (serialNumber != s) - qDebug("new serial number %s for DC model %s deviceId 0x%x", s.toUtf8().data(), model.toUtf8().data(), deviceId); + qDebug("new serial number %s for DC model %s deviceId 0x%x", qPrintable(s), qPrintable(model), deviceId); if (firmware != f) - qDebug("new firmware version %s for DC model %s deviceId 0x%x", f.toUtf8().data(), model.toUtf8().data(), deviceId); + qDebug("new firmware version %s for DC model %s deviceId 0x%x", qPrintable(f), qPrintable(model), deviceId); } void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QString f) @@ -132,8 +132,8 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char * found = true; } if (found) - callback(f, node->model.toUtf8().data(), node->deviceId, node->nickName.toUtf8().data(), - node->serialNumber.toUtf8().data(), node->firmware.toUtf8().data()); + callback(f, qPrintable(node->model), node->deviceId, qPrintable(node->nickName), + qPrintable(node->serialNumber), qPrintable(node->firmware)); } } diff --git a/core/divelogexportlogic.cpp b/core/divelogexportlogic.cpp index 5df24dce2..283cffbca 100644 --- a/core/divelogexportlogic.cpp +++ b/core/divelogexportlogic.cpp @@ -143,7 +143,7 @@ void exportHtmlInitLogic(const QString &filename, struct htmlExportSetting &hes) exportHTMLsettings(json_settings, hes); exportHTMLstatistics(stat_file, hes); - export_translation(translation.toUtf8().data()); + export_translation(qPrintable(translation)); export_HTML(qPrintable(json_dive_data), qPrintable(photosDirectory), hes.selectedOnly, hes.listOnly); diff --git a/core/prefs-macros.h b/core/prefs-macros.h index 15a9a9867..16a92aa24 100644 --- a/core/prefs-macros.h +++ b/core/prefs-macros.h @@ -60,11 +60,11 @@ else \ prefs.field = defval -#define GET_TXT(name, field) \ - v = s.value(QString(name)); \ - if (v.isValid()) \ - prefs.field = strdup(v.toString().toUtf8().constData()); \ - else \ +#define GET_TXT(name, field) \ + v = s.value(QString(name)); \ + if (v.isValid()) \ + prefs.field = strdup(qPrintable(v.toString())); \ + else \ prefs.field = copy_string(default_prefs.field) #define SAVE_OR_REMOVE_SPECIAL(_setting, _default, _compare, _value) \ diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index b39bd5331..cc1f4e00a 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -334,7 +334,7 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d return DC_STATUS_IO; default: qDebug() << "failed to connect to the controller " << devaddr << "with error" << controller->errorString(); - report_error("Failed to connect to %s: '%s'", devaddr, controller->errorString().toUtf8().data()); + report_error("Failed to connect to %s: '%s'", devaddr, qPrintable(controller->errorString())); delete controller; return DC_STATUS_IO; } diff --git a/core/qthelper.cpp b/core/qthelper.cpp index bbbb1e0f2..483e90b21 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -94,12 +94,12 @@ extern "C" const char *printGPSCoords(int lat, int lon) latsec = (latmin % 1000000) * 60; lonsec = (lonmin % 1000000) * 60; result.sprintf("%u%s%02d\'%06.3f\"%s %u%s%02d\'%06.3f\"%s", - latdeg, UTF8_DEGREE, latmin / 1000000, latsec / 1000000, lath.toUtf8().data(), - londeg, UTF8_DEGREE, lonmin / 1000000, lonsec / 1000000, lonh.toUtf8().data()); + latdeg, UTF8_DEGREE, latmin / 1000000, latsec / 1000000, qPrintable(lath), + londeg, UTF8_DEGREE, lonmin / 1000000, lonsec / 1000000, qPrintable(lonh)); } else { result.sprintf("%f %f", (double) lat / 1000000.0, (double) lon / 1000000.0); } - return strdup(result.toUtf8().data()); + return strdup(qPrintable(result)); } /** @@ -354,7 +354,7 @@ extern "C" timestamp_t picture_get_timestamp(const char *filename) int retval; // filename might not be the actual filename, so let's go via the hash. - if (readfile(localFilePath(QString(filename)).toUtf8().data(), &mem) <= 0) + if (readfile(qPrintable(localFilePath(QString(filename))), &mem) <= 0) return 0; retval = exif.parseFrom((const unsigned char *)mem.buffer, (unsigned)mem.size); free(mem.buffer); @@ -998,7 +998,7 @@ QString get_short_dive_date_string(timestamp_t when) const char *get_dive_date_c_string(timestamp_t when) { QString text = get_dive_date_string(when); - return strdup(text.toUtf8().data()); + return strdup(qPrintable(text)); } extern "C" const char *get_current_date() @@ -1008,7 +1008,7 @@ extern "C" const char *get_current_date() current_date = loc.toString(ts, QString(prefs.date_format_short)); - return strdup(current_date.toUtf8().data()); + return strdup(qPrintable(current_date)); } bool is_same_day(timestamp_t trip_when, timestamp_t dive_when) @@ -1066,7 +1066,7 @@ extern "C" void reverseGeoLookup(degrees_t latitude, degrees_t longitude, uint32 QJsonObject address = obj.value("address").toObject(); qDebug() << "found country:" << address.value("country").toString(); struct dive_site *ds = get_dive_site_by_uuid(uuid); - ds->notes = add_to_string(ds->notes, "countrytag: %s", address.value("country").toString().toUtf8().data()); + ds->notes = add_to_string(ds->notes, "countrytag: %s", qPrintable(address.value("country").toString())); } } @@ -1098,7 +1098,7 @@ const QString hashfile_name() extern "C" char *hashfile_name_string() { - return strdup(hashfile_name().toUtf8().data()); + return strdup(qPrintable(hashfile_name())); } void read_hashes() @@ -1266,7 +1266,7 @@ const QString picturedir() extern "C" char *picturedir_string() { - return strdup(picturedir().toUtf8().data()); + return strdup(qPrintable(picturedir())); } /* when we get a picture from git storage (local or remote) and can't find the picture @@ -1293,7 +1293,7 @@ extern "C" void picture_load_exif_data(struct picture *p) easyexif::EXIFInfo exif; memblock mem; - if (readfile(localFilePath(QString(p->filename)).toUtf8().data(), &mem) <= 0) + if (readfile(qPrintable(localFilePath(QString(p->filename))), &mem) <= 0) goto picture_load_exit; if (exif.parseFrom((const unsigned char *)mem.buffer, (unsigned)mem.size) != PARSE_EXIF_SUCCESS) goto picture_load_exit; @@ -1458,7 +1458,7 @@ extern "C" char *cloud_url() { QString filename; getCloudURL(filename); - return strdup(filename.toUtf8().data()); + return strdup(qPrintable(filename)); } extern "C" bool getProxyString(char **buffer) @@ -1558,7 +1558,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) { if (parseLine.contains("//DIVE NR: ")) { params[pnr++] = strdup("diveNro"); - params[pnr++] = strdup(parseLine.replace(QString::fromLatin1("//DIVE NR: "), QString::fromLatin1("")).toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.replace(QString::fromLatin1("//DIVE NR: "), QString::fromLatin1("")))); break; } } @@ -1573,7 +1573,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) { if (parseLine.contains("//Hardware Version: ")) { params[pnr++] = strdup("hw"); - params[pnr++] = strdup(parseLine.replace(QString::fromLatin1("//Hardware Version: "), QString::fromLatin1("\"Seabear ")).trimmed().append("\"").toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.replace(QString::fromLatin1("//Hardware Version: "), QString::fromLatin1("\"Seabear ")).trimmed().append("\""))); break; } } @@ -1586,7 +1586,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) { if (parseLine.contains("//Log interval: ")) { params[pnr++] = strdup("delta"); - params[pnr++] = strdup(parseLine.remove(QString::fromLatin1("//Log interval: ")).trimmed().remove(QString::fromLatin1(" s")).toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.remove(QString::fromLatin1("//Log interval: ")).trimmed().remove(QString::fromLatin1(" s")))); break; } } @@ -1601,7 +1601,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) QString needle = "//Mode: "; if (parseLine.contains(needle)) { params[pnr++] = strdup("diveMode"); - params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""))); } } f.seek(0); @@ -1614,7 +1614,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) QString needle = "//Firmware Version: "; if (parseLine.contains(needle)) { params[pnr++] = strdup("Firmware"); - params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""))); } } f.seek(0); @@ -1623,7 +1623,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) QString needle = "//Serial number: "; if (parseLine.contains(needle)) { params[pnr++] = strdup("Serial"); - params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""))); } } f.seek(0); @@ -1632,7 +1632,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr) QString needle = "//GF: "; if (parseLine.contains(needle)) { params[pnr++] = strdup("GF"); - params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data()); + params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""))); } } f.seek(0); @@ -1735,7 +1735,7 @@ extern "C" void cache_insert(int tissue, int timestep, enum inertgas inertgas, d extern "C" void print_qt_versions() { - printf("%s\n", QStringLiteral("built with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()).toUtf8().data()); + printf("%s\n", qPrintable(QStringLiteral("built with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()))); } QMutex planLock; diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 04dcbe64d..dcb1f8382 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1914,9 +1914,9 @@ void DisplaySettingsObjectWrapper::setDivelistFont(const QString& value) s.beginGroup(group); s.setValue("divelist_font", value); - if (!subsurface_ignore_font(newValue.toUtf8().constData())) { + if (!subsurface_ignore_font(qPrintable(newValue))) { free((void *)prefs.divelist_font); - prefs.divelist_font = strdup(newValue.toUtf8().constData()); + prefs.divelist_font = strdup(qPrintable(newValue)); qApp->setFont(QFont(newValue)); } emit divelistFontChanged(newValue); @@ -2265,11 +2265,11 @@ void SettingsObjectWrapper::load() QString fontName = defaultFont.toString(); if (fontName.contains(",")) fontName = fontName.left(fontName.indexOf(",")); - if (subsurface_ignore_font(fontName.toUtf8().constData())) { + if (subsurface_ignore_font(qPrintable(fontName))) { defaultFont = QFont(prefs.divelist_font); } else { free((void *)prefs.divelist_font); - prefs.divelist_font = strdup(fontName.toUtf8().constData()); + prefs.divelist_font = strdup(qPrintable(fontName)); } defaultFont.setPointSizeF(prefs.font_size); qApp->setFont(defaultFont); |