mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-07 11:59:57 +03:00
Fix some compilation warnings part 1
This commit is contained in:
@@ -73,9 +73,11 @@ QString AsciiView::hexDump(const QVector<unsigned char> &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<unsigned char>(data[i + j]), 2, 16, QChar('0')).toUpper();
|
||||
line += QString("%1 ")
|
||||
.arg(static_cast<unsigned char>(data[static_cast<int>(i + j)]), 2, 16, QChar('0'))
|
||||
.toUpper();
|
||||
} else {
|
||||
line += " ";
|
||||
}
|
||||
@@ -83,8 +85,8 @@ QString AsciiView::hexDump(const QVector<unsigned char> &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<int>(i + j)];
|
||||
line += (c >= 32 && c <= 126) ? QChar::fromLatin1(static_cast<char>(c)) : QChar('.');
|
||||
}
|
||||
result += line + "\n";
|
||||
|
||||
@@ -34,8 +34,9 @@ QVector<QPair<QString, int>> 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<int>(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));
|
||||
|
||||
@@ -115,15 +115,15 @@ QPair<QStringList, QJsonArray> utils::scanDevices(bool initializing)
|
||||
|
||||
static const QRegularExpression regex("\\}\\n\\{");
|
||||
|
||||
while ((endIndex = allDevicesOutput.indexOf(regex, startIndex)) != -1) {
|
||||
while ((endIndex = allDevicesOutput.indexOf(regex, static_cast<int>(startIndex))) != -1) {
|
||||
++endIndex;
|
||||
QString jsonFragment = allDevicesOutput.mid(startIndex, endIndex - startIndex);
|
||||
QString jsonFragment = allDevicesOutput.mid(static_cast<int>(startIndex), static_cast<int>(endIndex - startIndex));
|
||||
deviceOutputs.append(jsonFragment);
|
||||
startIndex = endIndex;
|
||||
}
|
||||
|
||||
if (startIndex < allDevicesOutput.size()) {
|
||||
QString jsonFragment = allDevicesOutput.mid(startIndex);
|
||||
QString jsonFragment = allDevicesOutput.mid(static_cast<int>(startIndex));
|
||||
deviceOutputs.append(jsonFragment);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user