diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e167e572..e251717bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ add_definitions( -DQT_NO_FOREACH -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII - #-DQT_NO_CAST_FROM_BYTEARRAY + -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CONTEXTLESS_CONNECT diff --git a/src/lib/dataloggerservice.cpp b/src/lib/dataloggerservice.cpp index 89b6ea661..b595bea61 100644 --- a/src/lib/dataloggerservice.cpp +++ b/src/lib/dataloggerservice.cpp @@ -404,7 +404,7 @@ DataLoggerService::Metadata DataLoggerServicePrivate::parseMetadata(const QByteA qCDebug(lc) << value.mid(7,12).toHex(','); metadata.status = static_cast(value.at(0)); - metadata.scale = qFromLittleEndian(value.mid(1,4)); + metadata.scale = qFromLittleEndian(value.mid(1,4).constData()); metadata.mode = static_cast(value.at(5)); metadata.range = static_cast(value.at(6)); @@ -416,13 +416,13 @@ DataLoggerService::Metadata DataLoggerServicePrivate::parseMetadata(const QByteA */ if (value.size() == 15) { - metadata.updateInterval = qFromLittleEndian(value.mid(7,2))*1000; - metadata.numberOfSamples = qFromLittleEndian(value.mid(9,2)); - metadata.timestamp = qFromLittleEndian(value.mid(11,4)); + metadata.updateInterval = qFromLittleEndian(value.mid(7,2).constData())*1000; + metadata.numberOfSamples = qFromLittleEndian(value.mid(9,2).constData()); + metadata.timestamp = qFromLittleEndian(value.mid(11,4).constData()); } else if (value.size() == 23) { - metadata.updateInterval = qFromLittleEndian(value.mid(7,4)); - metadata.numberOfSamples = qFromLittleEndian(value.mid(11,2)); - metadata.timestamp = qFromLittleEndian(value.mid(19,4)); + metadata.updateInterval = qFromLittleEndian(value.mid(7,4).constData()); + metadata.numberOfSamples = qFromLittleEndian(value.mid(11,2).constData()); + metadata.timestamp = qFromLittleEndian(value.mid(19,4).constData()); } else { qCWarning(lc).noquote() << tr("Cannot decode metadata of %n byte/s: %1", nullptr, value.size()) .arg(toHexString(value)); @@ -442,7 +442,7 @@ DataLoggerService::Samples DataLoggerServicePrivate::parseSamples(const QByteArr return samples; } while ((samples.size()*2) < value.size()) { - samples.append(qFromLittleEndian(value.mid(samples.size()*2,2))); + samples.append(qFromLittleEndian(value.mid(samples.size()*2,2).constData())); } qCDebug(lc).noquote() << tr("Read %n sample/s from %1-bytes.", nullptr, samples.size()).arg(value.size()); return samples; diff --git a/src/lib/dsoservice.cpp b/src/lib/dsoservice.cpp index 01bba0d97..b9a27887a 100644 --- a/src/lib/dsoservice.cpp +++ b/src/lib/dsoservice.cpp @@ -366,12 +366,12 @@ DsoService::Metadata DsoServicePrivate::parseMetadata(const QByteArray &value) } metadata.status = static_cast(value.at(0)); - metadata.scale = qFromLittleEndian(value.mid(1,4)); + metadata.scale = qFromLittleEndian(value.mid(1,4).constData()); metadata.mode = static_cast(value.at(5)); metadata.range = static_cast(value.at(6)); - metadata.samplingWindow = qFromLittleEndian(value.mid(7,4)); - metadata.numberOfSamples = qFromLittleEndian(value.mid(11,2)); - metadata.samplingRate = qFromLittleEndian(value.mid(13,4)); + metadata.samplingWindow = qFromLittleEndian(value.mid(7,4).constData()); + metadata.numberOfSamples = qFromLittleEndian(value.mid(11,2).constData()); + metadata.samplingRate = qFromLittleEndian(value.mid(13,4).constData()); return metadata; } @@ -387,7 +387,7 @@ DsoService::Samples DsoServicePrivate::parseSamples(const QByteArray &value) return samples; } while ((samples.size()*2) < value.size()) { - samples.append(qFromLittleEndian(value.mid(samples.size()*2,2))); + samples.append(qFromLittleEndian(value.mid(samples.size()*2,2).constData())); } qCDebug(lc).noquote() << tr("Read %n sample/s from %1-bytes.", nullptr, samples.size()).arg(value.size()); return samples; diff --git a/src/lib/genericaccessservice.cpp b/src/lib/genericaccessservice.cpp index d2b97bee3..f877b7117 100644 --- a/src/lib/genericaccessservice.cpp +++ b/src/lib/genericaccessservice.cpp @@ -203,7 +203,7 @@ quint16 GenericAccessServicePrivate::parseAppearance(const QByteArray &value) if (!checkSize(QLatin1String("Appearance"), value, 2, 2)) { return std::numeric_limits::max(); } - const quint16 appearance = qFromLittleEndian(value); + const quint16 appearance = qFromLittleEndian(value.constData()); qCDebug(lc).noquote() << tr("Appearance: %1.").arg(appearance); return appearance; } diff --git a/src/lib/multimeterservice.cpp b/src/lib/multimeterservice.cpp index 26dd17e92..26eb725a8 100644 --- a/src/lib/multimeterservice.cpp +++ b/src/lib/multimeterservice.cpp @@ -317,7 +317,7 @@ MultimeterService::Reading MultimeterServicePrivate::parseReading(const QByteArr } reading.status = MultimeterService::MeterStatus(value.at(0)); - reading.value = qFromLittleEndian(value.mid(1,4)); + reading.value = qFromLittleEndian(value.mid(1,4).constData()); reading.mode = static_cast(value.at(5)); reading.range = static_cast(value.at(6)); return reading; diff --git a/src/lib/statusservice.cpp b/src/lib/statusservice.cpp index 371edcd9b..d14c9a19c 100644 --- a/src/lib/statusservice.cpp +++ b/src/lib/statusservice.cpp @@ -594,16 +594,16 @@ StatusService::DeviceCharacteristics StatusServicePrivate::parseDeviceCharacteri } characteristics.firmwareVersion = QVersionNumber( - qFromLittleEndian(value.mid(0,1)), - qFromLittleEndian(value.mid(1,1))); - characteristics.maximumVoltage = qFromLittleEndian(value.mid(2,2)); - characteristics.maximumCurrent = qFromLittleEndian(value.mid(4,2)); - characteristics.maximumResistance = qFromLittleEndian(value.mid(6,2)); - characteristics.maximumSamplingRate = qFromLittleEndian(value.mid(8,2)); - characteristics.samplingBufferSize = qFromLittleEndian(value.mid(10,2)); - characteristics.capabilityMask = qFromLittleEndian(value.mid(12,2)); + qFromLittleEndian(value.mid(0,1).constData()), + qFromLittleEndian(value.mid(1,1).constData())); + characteristics.maximumVoltage = qFromLittleEndian(value.mid(2,2).constData()); + characteristics.maximumCurrent = qFromLittleEndian(value.mid(4,2).constData()); + characteristics.maximumResistance = qFromLittleEndian(value.mid(6,2).constData()); + characteristics.maximumSamplingRate = qFromLittleEndian(value.mid(8,2).constData()); + characteristics.samplingBufferSize = qFromLittleEndian(value.mid(10,2).constData()); + characteristics.capabilityMask = qFromLittleEndian(value.mid(12,2).constData()); characteristics.macAddress = QBluetoothAddress(qFromBigEndian - (QByteArray(2, '\0') + value.mid(14,6))); + ((QByteArray(2, '\0') + value.mid(14,6)).constData())); qCDebug(lc).noquote() << tr("Firmware version: ") << characteristics.firmwareVersion; qCDebug(lc).noquote() << tr("Maximum voltage: ") << characteristics.maximumVoltage; @@ -646,7 +646,7 @@ StatusService::Status StatusServicePrivate::parseStatus(const QByteArray &value) } status.deviceStatus = static_cast(value.at(0)); - status.batteryVoltage = qFromLittleEndian(value.mid(1,4)); + status.batteryVoltage = qFromLittleEndian(value.mid(1,4).constData()); if (value.size() >= 6) { // Battery Status added to Pokit API docs v1.00. status.batteryStatus = static_cast(value.at(5)); }