diff --git a/src/asciiview.cpp b/src/asciiview.cpp index 1a5dd18..c7e2816 100644 --- a/src/asciiview.cpp +++ b/src/asciiview.cpp @@ -73,9 +73,11 @@ QString AsciiView::hexDump(const QVector &data) { QString line; line += QString("%1 ").arg(offset, 8, 16, QChar('0')).toUpper(); offset += 16; - for (int j = 0; j < 16; ++j) { + for (qsizetype j = 0; j < 16; ++j) { if (i + j < dataSize) { - line += QString("%1 ").arg(static_cast(data[i + j]), 2, 16, QChar('0')).toUpper(); + line += QString("%1 ") + .arg(static_cast(data[static_cast(i + j)]), 2, 16, QChar('0')) + .toUpper(); } else { line += " "; } @@ -83,8 +85,8 @@ QString AsciiView::hexDump(const QVector &data) { } line += " "; - for (int j = 0; j < 16 && i + j < dataSize; ++j) { - unsigned char c = data[i + j]; + for (qsizetype j = 0; j < 16 && i + j < dataSize; ++j) { + unsigned char c = data[static_cast(i + j)]; line += (c >= 32 && c <= 126) ? QChar::fromLatin1(static_cast(c)) : QChar('.'); } result += line + "\n"; diff --git a/src/jsonparser.cpp b/src/jsonparser.cpp index 98e2317..8503ba9 100644 --- a/src/jsonparser.cpp +++ b/src/jsonparser.cpp @@ -34,8 +34,9 @@ QVector> JsonParser::parse(const QString &json) } qsizetype colonPos = trimmedLine.indexOf(":"); if (colonPos != -1) { - QString key = removeQuotes(trimmedLine.left(colonPos)); - QString valueString = trimmedLine.mid(colonPos + 1).trimmed(); + int pos = static_cast(colonPos); + QString key = removeQuotes(trimmedLine.left(pos)); + QString valueString = trimmedLine.mid(pos + 1).trimmed(); valueString.chop(1); int value = valueString.toInt(); data.append(qMakePair(key, value)); diff --git a/src/utils.cpp b/src/utils.cpp index 1b52780..ae4416e 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -115,15 +115,15 @@ QPair utils::scanDevices(bool initializing) static const QRegularExpression regex("\\}\\n\\{"); - while ((endIndex = allDevicesOutput.indexOf(regex, startIndex)) != -1) { + while ((endIndex = allDevicesOutput.indexOf(regex, static_cast(startIndex))) != -1) { ++endIndex; - QString jsonFragment = allDevicesOutput.mid(startIndex, endIndex - startIndex); + QString jsonFragment = allDevicesOutput.mid(static_cast(startIndex), static_cast(endIndex - startIndex)); deviceOutputs.append(jsonFragment); startIndex = endIndex; } if (startIndex < allDevicesOutput.size()) { - QString jsonFragment = allDevicesOutput.mid(startIndex); + QString jsonFragment = allDevicesOutput.mid(static_cast(startIndex)); deviceOutputs.append(jsonFragment); }