From b6a15a28cd944979bf5c2f3f765493ed42180190 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 12 Aug 2019 22:02:07 -0400 Subject: [PATCH] More fixes for compiler warnings - cleaning up code and making assumptions more clear --- canframemodel.cpp | 6 +- framefileio.cpp | 131 +++++++++++++++++---------------- re/graphingwindow.cpp | 3 +- re/graphingwindow.h | 4 +- re/sniffer/SnifferDelegate.cpp | 2 +- utility.h | 5 +- 6 files changed, 78 insertions(+), 73 deletions(-) diff --git a/canframemodel.cpp b/canframemodel.cpp index 4e35555..95f30a2 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -209,12 +209,12 @@ uint64_t CANFrameModel::getCANFrameVal(int row, Column col) if (frame.isReceived) return 1; return 0; case Column::Bus: - return frame.bus; + return static_cast(frame.bus); case Column::Length: - return frame.len; + return static_cast(frame.len); case Column::ASCII: //sort both the same for now case Column::Data: - for (uint32_t i = 0; i < frame.len; i++) temp += ((uint64_t)frame.data[i] << (56 - (8 * i))); + for (int i = 0; i < frame.len; i++) temp += (static_cast(frame.data[i]) << (56 - (8 * i))); //qDebug() << temp; return temp; case Column::NUM_COLUMN: diff --git a/framefileio.cpp b/framefileio.cpp index 0f3eb35..2846bda 100644 --- a/framefileio.cpp +++ b/framefileio.cpp @@ -483,11 +483,11 @@ bool FrameFileIO::loadVehicleSpyFile(QString filename, QVector *frames thisFrame.bus = 0; thisFrame.remote = false; tempTime = now; - tempTime = tempTime.addMSecs(tokens[1].toDouble() * 1000.0); + tempTime = tempTime.addMSecs(static_cast(tokens[1].toDouble() * 1000.0)); thisFrame.timestamp = static_cast(tempTime.toMSecsSinceEpoch() * 1000); if (tokens[5].startsWith("T")) thisFrame.isReceived = false; else thisFrame.isReceived = true; - thisFrame.ID = tokens[9].toInt(nullptr, 16); + thisFrame.ID = static_cast(tokens[9].toInt(nullptr, 16)); if (tokens[11].startsWith("T")) thisFrame.extended = true; else thisFrame.extended = false; @@ -496,7 +496,7 @@ bool FrameFileIO::loadVehicleSpyFile(QString filename, QVector *frames { if (tokens[12 + i].length() > 0) { - thisFrame.data[i] = tokens[12 + i].toInt(nullptr, 16); + thisFrame.data[i] = static_cast(tokens[12 + i].toInt(nullptr, 16)); thisFrame.len++; } else break; @@ -637,7 +637,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector* frames) multiplier = 1; //special case. Assume no decimal means microseconds } //qDebug() << "decimal places " << decimalPlaces; - thisFrame.timestamp = (int64_t)(tokens[0].toDouble() * multiplier); + thisFrame.timestamp = static_cast((tokens[0].toDouble() * multiplier)); thisFrame.bus = 0; char firstChar = tokens[1].left(1)[0]; if (firstChar >= '1' && firstChar <= '9') @@ -648,18 +648,18 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector* frames) } if (firstChar == 'R' || firstChar == 'T') { - thisFrame.ID = tokens[2].toInt(nullptr, 16); + thisFrame.ID = static_cast(tokens[2].toInt(nullptr, 16)); if (tokens[1] == "R29" || tokens[1] == "T29") thisFrame.extended = true; else thisFrame.extended = false; if (firstChar == 'T') thisFrame.isReceived = false; else thisFrame.isReceived = true; thisFrame.len = tokens.length() - 3; thisFrame.remote = false; - for (unsigned int d = 0; d < thisFrame.len; d++) + for (int d = 0; d < thisFrame.len; d++) { if (tokens[d + 3] != "") { - thisFrame.data[d] = tokens[d + 3].toInt(nullptr, 16); + thisFrame.data[d] = static_cast(tokens[d + 3].toInt(nullptr, 16)); } else thisFrame.data[d] = 0; } @@ -768,18 +768,18 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector* frames) multiplier = 1; //special case. Assume no decimal means microseconds } //qDebug() << "decimal places " << decimalPlaces; - thisFrame.timestamp = (int64_t)(tokens[0].toDouble() * multiplier); - thisFrame.ID = tokens[1].toInt(nullptr, 16); + thisFrame.timestamp = static_cast(tokens[0].toDouble() * multiplier); + thisFrame.ID = static_cast(tokens[1].toInt(nullptr, 16)); thisFrame.extended = (thisFrame.ID > 0x7FF); thisFrame.isReceived = true; thisFrame.remote = false; thisFrame.bus = 0; thisFrame.len = tokens[2].toInt(nullptr, 16); - for (unsigned int d = 0; d < thisFrame.len; d++) + for (int d = 0; d < thisFrame.len; d++) { if (tokens[d + 3] != "") { - thisFrame.data[d] = tokens[d + 3].toInt(nullptr, 16); + thisFrame.data[d] = static_cast(tokens[d + 3].toInt(nullptr, 16)); } else thisFrame.data[d] = 0; } @@ -884,19 +884,19 @@ bool FrameFileIO::loadCANOpenFile(QString filename, QVector* frames) QList tokens = line.split(','); if (tokens.length() > 11) { - thisFrame.timestamp = (int64_t)(tokens[1].simplified().toDouble() * 1000.0); - thisFrame.ID = Utility::ParseStringToNum(tokens[5].simplified()); + thisFrame.timestamp = static_cast(tokens[1].simplified().toDouble() * 1000.0); + thisFrame.ID = static_cast(Utility::ParseStringToNum(tokens[5].simplified())); thisFrame.extended = (thisFrame.ID > 0x7FF); thisFrame.isReceived = true; thisFrame.remote = false; thisFrame.bus = 0; QList dataTok = tokens[11].simplified().split(' '); thisFrame.len = dataTok.length(); - for (unsigned int d = 0; d < thisFrame.len; d++) + for (int d = 0; d < thisFrame.len; d++) { if (dataTok[d] != "") { - thisFrame.data[d] = dataTok[d].simplified().toInt(nullptr, 16); + thisFrame.data[d] = static_cast(dataTok[d].simplified().toInt(nullptr, 16)); } else thisFrame.data[d] = 0; } @@ -949,7 +949,7 @@ bool FrameFileIO::saveCRTDFile(QString filename, const QVector* frames outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8()); outFile->putChar(' '); - for (unsigned int temp = 0; temp < frames->at(c).len; temp++) + for (int temp = 0; temp < frames->at(c).len; temp++) { outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); outFile->putChar(' '); @@ -993,7 +993,7 @@ bool FrameFileIO::isPCANFile(QString filename) { if (fileVersion == 1) { - int id = line.mid(28, 8).simplified().toUInt(nullptr, 16); + uint32_t id = line.mid(28, 8).simplified().toUInt(nullptr, 16); if (id > 0 && id < 0x1FFFFFFF) { int len = line.mid(38,1).toInt(); @@ -1004,7 +1004,7 @@ bool FrameFileIO::isPCANFile(QString filename) else if (fileVersion == 2) { - int id = line.mid(25, 8).simplified().toUInt(nullptr, 16); + uint32_t id = line.mid(25, 8).simplified().toUInt(nullptr, 16); if (id > 0 && id < 0x1FFFFFFF) { int len = line.mid(37,2).trimmed().toInt(); @@ -1100,11 +1100,11 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector* frames) } else { QList tokens = line.mid(41, thisFrame.len * 3).split(' '); thisFrame.remote = false; - for (unsigned int d = 0; d < thisFrame.len; d++) + for (int d = 0; d < thisFrame.len; d++) { if (tokens[d] != "") { - thisFrame.data[d] = tokens[d].toInt(nullptr, 16); + thisFrame.data[d] = static_cast(tokens[d].toInt(nullptr, 16)); } else thisFrame.data[d] = 0; } @@ -1114,7 +1114,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector* frames) } else if (fileVersion == 2) { - thisFrame.timestamp = (uint64_t)(line.mid(8, 13).simplified().toDouble() * 1000.0); + thisFrame.timestamp = static_cast(line.mid(8, 13).simplified().toDouble() * 1000.0); thisFrame.ID = line.mid(25, 8).simplified().toUInt(nullptr, 16); if (thisFrame.ID < 0x1FFFFFFF) { @@ -1132,11 +1132,11 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector* frames) } else { QList tokens = line.mid(40, thisFrame.len * 3).split(' '); thisFrame.remote = false; - for (unsigned int d = 0; d < thisFrame.len; d++) + for (int d = 0; d < thisFrame.len; d++) { if (tokens[d] != "") { - thisFrame.data[d] = tokens[d].toInt(nullptr, 16); + thisFrame.data[d] = static_cast(tokens[d].toInt(nullptr, 16)); } else thisFrame.data[d] = 0; } @@ -1190,11 +1190,11 @@ bool FrameFileIO::isCanalyzerASC(QString filename) tokens = line.simplified().split(' '); if (tokens.length() > 5) { - uint64_t time = (uint64_t)(tokens[0].toDouble() * (double)1000000.0); + uint64_t time = static_cast(tokens[0].toDouble() * 1000000.0); if (time <= 0) isMatch = false; - int id = tokens[2].toUInt(nullptr, 16); + uint32_t id = static_cast(tokens[2].toUInt(nullptr, 16)); if (id < 1 || id > 0x1FFFFFFF) isMatch = false; - int len = tokens[5].toUInt(); + int len = tokens[5].toInt(); if (len < 0 || len > 8) isMatch = false; if (tokens.count() < (len + 6)) isMatch = false; } @@ -1260,10 +1260,11 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector* frames) { thisFrame.timestamp = static_cast(tokens[0].toDouble() * 1000000.0); thisFrame.ID = tokens[2].toUInt(nullptr, 16); - thisFrame.len = tokens[5].toUInt(); + thisFrame.len = tokens[5].toInt(); if (thisFrame.len > 8) return false; + if (thisFrame.len < 0) return false; thisFrame.isReceived = tokens[3].toUpper().contains("RX"); - thisFrame.bus = tokens[1].toUInt(); + thisFrame.bus = tokens[1].toInt(); thisFrame.extended = (thisFrame.ID > 0x7FF); thisFrame.remote = false; for (int d = 6; d < (6 + static_cast(thisFrame.len)); d++) @@ -1350,7 +1351,7 @@ bool FrameFileIO::saveCanalyzerASC(QString filename, const QVector* fr outFile->write(QString::number(frames->at(c).len).toUtf8()); outFile->write(" "); - for (unsigned int temp = 0; temp < frames->at(c).len; temp++) + for (int temp = 0; temp < frames->at(c).len; temp++) { outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); outFile->write(" "); @@ -1376,7 +1377,7 @@ bool FrameFileIO::isCanalyzerBLF(QString filename) delete inFile; return false; } - inFile->read((char *)&header, sizeof(header)); + inFile->read(reinterpret_cast(&header), sizeof(header)); if (qFromLittleEndian(header.sig) == 0x47474F4C) { qDebug() << "Proper BLF file header token"; @@ -1458,7 +1459,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector* frames) CANFrame thisFrame; QByteArray line; int fileVersion = 1; - long long timeStamp = Utility::GetTimeMS(); + uint64_t timeStamp = Utility::GetTimeMS(); int lineCounter = 0; bool foundErrors = false; thisFrame.remote = false; @@ -1488,8 +1489,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector* frames) { if (tokens[0].length() > 3) { - long long temp = tokens[0].toLongLong(); - thisFrame.timestamp = temp; + thisFrame.timestamp = tokens[0].toULongLong(); } else { @@ -1497,7 +1497,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector* frames) thisFrame.timestamp = timeStamp; } - thisFrame.ID = tokens[1].toInt(nullptr, 16); + thisFrame.ID = tokens[1].toUInt(nullptr, 16); if (tokens[2].toUpper().contains("TRUE")) thisFrame.extended = 1; else thisFrame.extended = 0; @@ -1507,24 +1507,26 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector* frames) { thisFrame.isReceived = true; thisFrame.bus = tokens[3].toInt(); - thisFrame.len = tokens[4].toUInt(); + thisFrame.len = tokens[4].toInt(); if (thisFrame.len > 8) thisFrame.len = 8; + if (thisFrame.len < 0) thisFrame.len = 0; for (int c = 0; c < 8; c++) thisFrame.data[c] = 0; - if (thisFrame.len + 5 > (unsigned int) tokens.length()) thisFrame.len = tokens.length() - 5; - for (unsigned int d = 0; d < thisFrame.len; d++) - thisFrame.data[d] = tokens[5 + d].toInt(nullptr, 16); + if (thisFrame.len + 5 > tokens.length()) thisFrame.len = tokens.length() - 5; + for (int d = 0; d < thisFrame.len; d++) + thisFrame.data[d] = static_cast(tokens[5 + d].toInt(nullptr, 16)); } else if (fileVersion == 2) { if (tokens[3].at(0) == 'R') thisFrame.isReceived = true; else thisFrame.isReceived = false; thisFrame.bus = tokens[4].toInt(); - thisFrame.len = tokens[5].toUInt(); + thisFrame.len = tokens[5].toInt(); if (thisFrame.len > 8) thisFrame.len = 8; - if (thisFrame.len + 6 > (unsigned int) tokens.length()) thisFrame.len = tokens.length() - 6; + if (thisFrame.len < 0) thisFrame.len = 0; + if (thisFrame.len + 6 > tokens.length()) thisFrame.len = tokens.length() - 6; for (int c = 0; c < 8; c++) thisFrame.data[c] = 0; - for (unsigned int d = 0; d < thisFrame.len; d++) - thisFrame.data[d] = tokens[6 + d].toInt(nullptr, 16); + for (int d = 0; d < thisFrame.len; d++) + thisFrame.data[d] = static_cast(tokens[6 + d].toInt(nullptr, 16)); } frames->append(thisFrame); @@ -1578,7 +1580,7 @@ bool FrameFileIO::saveNativeCSVFile(QString filename, const QVector* f outFile->write(QString::number(frames->at(c).len).toUtf8()); outFile->putChar(44); - for (unsigned int temp = 0; temp < 8; temp++) + for (int temp = 0; temp < 8; temp++) { if (temp < frames->at(c).len) outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); @@ -1661,7 +1663,7 @@ bool FrameFileIO::writeContinuousNative(const QVector* frames, int beg continuousFile.write(QString::number(frames->at(c).len).toUtf8()); continuousFile.putChar(44); - for (unsigned int temp = 0; temp < 8; temp++) + for (int temp = 0; temp < 8; temp++) { if (temp < frames->at(c).len) continuousFile.write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); @@ -1739,7 +1741,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector* frames QFile *inFile = new QFile(filename); CANFrame thisFrame; QByteArray line; - long long timeStamp = Utility::GetTimeMS(); + uint64_t timeStamp = Utility::GetTimeMS(); int lineCounter = 0; bool foundErrors = false; thisFrame.remote = false; @@ -1767,7 +1769,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector* frames timeStamp += 5000; thisFrame.timestamp = timeStamp; - thisFrame.ID = tokens[0].toInt(nullptr, 16); + thisFrame.ID = tokens[0].toUInt(nullptr, 16); if (thisFrame.ID > 0x7FF) thisFrame.extended = true; else thisFrame.extended = false; thisFrame.bus = 0; @@ -1775,7 +1777,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector* frames QList dataTok = tokens[1].split(' '); thisFrame.len = dataTok.length(); if (thisFrame.len > 8) thisFrame.len = 8; - for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = dataTok[d].toInt(nullptr, 16); + for (int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = static_cast(dataTok[d].toInt(nullptr, 16)); frames->append(thisFrame); } @@ -1813,7 +1815,7 @@ bool FrameFileIO::saveGenericCSVFile(QString filename, const QVector* outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8()); outFile->putChar(44); - for (unsigned int temp = 0; temp < frames->at(c).len; temp++) + for (int temp = 0; temp < frames->at(c).len; temp++) { outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); outFile->putChar(' '); @@ -1862,7 +1864,7 @@ bool FrameFileIO::isLogFile(QString filename) int ID = tokens[3].right(tokens[3].length() - 2).toInt(nullptr, 16); if (ID < 1 || ID > 0x1FFFFFFF) isMatch = false; if (tokens[4] != "S" && tokens[4] != "X" && tokens[4] != "SR" && tokens[4] != "XR") isMatch = false; - int len = tokens[5].toUInt(); + int len = tokens[5].toInt(); if (len > 8) isMatch = false; } else isMatch = false; @@ -1944,12 +1946,12 @@ bool FrameFileIO::loadLogFile(QString filename, QVector* frames) if (tokens.length() >= 6) { QList timeToks = tokens[0].split(':'); - timeStamp = (timeToks[0].toInt() * (1000ul * 1000ul * 60ul * 60ul)) + (timeToks[1].toInt() * (1000ul * 1000ul * 60ul)) - + (timeToks[2].toInt() * (1000ul * 1000ul)) + (timeToks[3].toInt() * 100ul); + timeStamp = (timeToks[0].toUInt() * (1000ul * 1000ul * 60ul * 60ul)) + (timeToks[1].toUInt() * (1000ul * 1000ul * 60ul)) + + (timeToks[2].toUInt() * (1000ul * 1000ul)) + (timeToks[3].toUInt() * 100ul); thisFrame.timestamp = timeStamp; if (tokens[1].at(0) == 'R') thisFrame.isReceived = true; else thisFrame.isReceived = false; - thisFrame.ID = tokens[3].right(tokens[3].length() - 2).toInt(nullptr, 16); + thisFrame.ID = tokens[3].right(tokens[3].length() - 2).toUInt(nullptr, 16); if (tokens[4] == "S") { thisFrame.extended = false; thisFrame.remote = false; @@ -1964,11 +1966,12 @@ bool FrameFileIO::loadLogFile(QString filename, QVector* frames) thisFrame.remote = true; } thisFrame.bus = tokens[2].toInt() - 1; - thisFrame.len = tokens[5].toUInt(); + thisFrame.len = tokens[5].toInt(); if (thisFrame.len > 8) thisFrame.len = 8; + if (thisFrame.len < 0) thisFrame.len = 0; if (!thisFrame.remote) { - for (unsigned int d = 0; d < thisFrame.len; d++) - thisFrame.data[d] = tokens[d + 6].toInt(nullptr, 16); + for (int d = 0; d < thisFrame.len; d++) + thisFrame.data[d] = static_cast(tokens[d + 6].toInt(nullptr, 16)); } frames->append(thisFrame); } @@ -2038,7 +2041,7 @@ bool FrameFileIO::saveLogFile(QString filename, const QVector* frames) outFile->write(QString::number(frames->at(c).len).toUtf8() + " "); if (!frames->at(c).remote) { - for (unsigned int temp = 0; temp < frames->at(c).len; temp++) + for (int temp = 0; temp < frames->at(c).len; temp++) { outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); outFile->putChar(' '); @@ -2125,8 +2128,8 @@ bool FrameFileIO::loadIXXATFile(QString filename, QVector* frames) QStringList timeToks = timePortion.split(':'); if (timeToks.length() >= 3) { - timeStamp = (timeToks[0].toInt() * (1000ul * 1000ul * 60ul * 60ul)) + (timeToks[1].toInt() * (1000ul * 1000ul * 60ul)) - + (timeToks[2].toDouble() * (1000.0 * 1000.0)); + timeStamp = (timeToks[0].toUInt() * (1000ul * 1000ul * 60ul * 60ul)) + (timeToks[1].toUInt() * (1000ul * 1000ul * 60ul)) + + static_cast(timeToks[2].toDouble() * (1000.0 * 1000.0)); } else { @@ -2135,7 +2138,7 @@ bool FrameFileIO::loadIXXATFile(QString filename, QVector* frames) return false; } thisFrame.timestamp = timeStamp; - thisFrame.ID = Utility::unQuote(tokens[1]).toInt(nullptr, 16); + thisFrame.ID = Utility::unQuote(tokens[1]).toUInt(nullptr, 16); QString tempStr = Utility::unQuote(tokens[2]).toUpper(); if (tempStr.length() > 0) { @@ -2156,7 +2159,7 @@ bool FrameFileIO::loadIXXATFile(QString filename, QVector* frames) QStringList dataToks = Utility::unQuote(tokens[4]).simplified().split(' '); thisFrame.len = dataToks.length(); if (thisFrame.len > 8) return false; - for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = dataToks[d].toInt(nullptr, 16); + for (int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = static_cast(dataToks[d].toInt(nullptr, 16)); frames->append(thisFrame); } else return false; @@ -2206,7 +2209,7 @@ bool FrameFileIO::saveIXXATFile(QString filename, const QVector* frame else outFile->write(",\"Std\""); outFile->write(",\"\",\""); - for (unsigned int temp = 0; temp < frames->at(c).len; temp++) + for (int temp = 0; temp < frames->at(c).len; temp++) { outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8()); outFile->putChar(' '); @@ -2245,14 +2248,14 @@ bool FrameFileIO::isCANDOFile(QString filename) data = inFile->read(12); - int ID = (((unsigned int)data[3] & 0x0F) * 256 + (unsigned int)data[2]); - int len = (unsigned char)data[3] >> 4; + int ID = ((data[3] & 0x0F) * 256 + data[2]); + int len = data[3] >> 4; if (len <= 8 && ID <= 0x7FF) { if (len < 8) { - if (data[4 + len] != (char)0xFF) isMatch = false; + if (data[4 + len] != static_cast(0xFF)) isMatch = false; } } else isMatch = false; diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index 3522d9f..3b0d34a 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -224,6 +224,7 @@ void GraphingWindow::updatedFrames(int numFrames) void GraphingWindow::plottableClick(QCPAbstractPlottable* plottable, int dataIdx, QMouseEvent* event) { + Q_UNUSED(dataIdx); qDebug() << "plottableClick"; double x, y; QCPGraph *graph = reinterpret_cast(plottable); @@ -1150,7 +1151,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) //qDebug() << tempVal; if (secondsMode) { - params.x[j] = (double)(frameCache[k].timestamp) / 1000000.0; + params.x[j] = (frameCache[k].timestamp) / 1000000.0; } else { diff --git a/re/graphingwindow.h b/re/graphingwindow.h index 2d08220..0d4781e 100644 --- a/re/graphingwindow.h +++ b/re/graphingwindow.h @@ -19,8 +19,8 @@ public: bool intelFormat; bool isSigned; uint64_t mask; - float bias; - float scale; + double bias; + double scale; int stride; int strideSoFar; QColor color; diff --git a/re/sniffer/SnifferDelegate.cpp b/re/sniffer/SnifferDelegate.cpp index 543d0e8..bd594a0 100644 --- a/re/sniffer/SnifferDelegate.cpp +++ b/re/sniffer/SnifferDelegate.cpp @@ -51,7 +51,7 @@ void SnifferDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio if (index.column() > 9) return; - int x, y; + int x; SnifferItem *item = static_cast(index.internalPointer()); int idx = index.column() - 2; int val = item->getData(idx); diff --git a/utility.h b/utility.h index 5540295..e9f8b65 100644 --- a/utility.h +++ b/utility.h @@ -67,10 +67,11 @@ public: return pInput.toUInt(pOk_p, 0); } - static long GetTimeMS() + static uint64_t GetTimeMS() { QDateTime stamp = QDateTime::currentDateTime(); - return (long)(((stamp.time().hour() * 3600) + (stamp.time().minute() * 60) + (stamp.time().second()) * 1000) + stamp.time().msec()); + return (((static_cast(stamp.time().hour()) * 3600ull) + (static_cast(stamp.time().minute()) * 60ull) + + (static_cast(stamp.time().second())) * 1000ull) + static_cast(stamp.time().msec())); } //prints hex numbers in uppercase with 0's filling out the number depending