From edc210c33692fb12d029c7e66852a8e0fc88f9c5 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 5 Dec 2022 19:33:47 -0500 Subject: [PATCH] Only code clean up to remove many warnings. There should be no changes to program operation. --- SavvyCAN.pro | 1 - connections/gvretserial.cpp | 3 +++ connections/mqtt_bus.cpp | 6 +++--- dbc/dbc_classes.cpp | 2 +- dbc/dbchandler.cpp | 2 ++ dbc/dbcmaineditor.cpp | 24 ++++++++---------------- dbc/dbcnodeduplicateeditor.cpp | 12 ++++++------ dbc/dbcnoderebaseeditor.cpp | 8 ++++---- framefileio.cpp | 30 ++++++++++++++++++------------ jsedit.cpp | 4 ++-- mainwindow.cpp | 13 +++++++------ qcpaxistickerhex.cpp | 3 +++ re/flowviewwindow.cpp | 2 +- re/graphingwindow.cpp | 1 - re/sniffer/sniffermodel.cpp | 2 +- re/udsscanwindow.cpp | 2 -- signalviewerwindow.cpp | 4 ++-- utility.h | 2 +- 18 files changed, 62 insertions(+), 59 deletions(-) diff --git a/SavvyCAN.pro b/SavvyCAN.pro index be58289..822ab10 100644 --- a/SavvyCAN.pro +++ b/SavvyCAN.pro @@ -195,7 +195,6 @@ FORMS += ui/candatagrid.ui \ ui/connectionwindow.ui \ ui/dbcloadsavewindow.ui \ ui/dbcmaineditor.ui \ - ui/dbcnodeduplicateeditor.ui \ ui/dbcnoderebaseeditor.ui \ ui/dbcsignaleditor.ui \ ui/dbcnodeeditor.ui \ diff --git a/connections/gvretserial.cpp b/connections/gvretserial.cpp index fb2eaed..e59a668 100644 --- a/connections/gvretserial.cpp +++ b/connections/gvretserial.cpp @@ -798,6 +798,7 @@ void GVRetSerial::procRXChar(unsigned char c) break; case 9: buildFrame.bus = c; + break; default: if (rx_step < buildData.length() + 10) { @@ -1010,6 +1011,8 @@ void GVRetSerial::procRXChar(unsigned char c) emit status(stats); break; + case GET_FD_SETTINGS: + break; case GET_EXT_BUSES: switch (rx_step) { diff --git a/connections/mqtt_bus.cpp b/connections/mqtt_bus.cpp index bfaa04b..951828e 100644 --- a/connections/mqtt_bus.cpp +++ b/connections/mqtt_bus.cpp @@ -228,8 +228,8 @@ void MQTT_BUS::piSetBusSettings(int pBusIdx, CANBus bus) bool MQTT_BUS::piSendFrame(const CANFrame& frame) { QByteArray buffer; - int c; - quint32 ID; + //int c; + //quint32 ID; //qDebug() << "Sending out GVRET frame with id " << frame.ID << " on bus " << frame.bus; @@ -278,7 +278,7 @@ void MQTT_BUS::readSettings() void MQTT_BUS::clientMessageReceived(const QMQTT::Message& message) { - uint64_t timeBasis = CANConManager::getInstance()->getTimeBasis(); + //uint64_t timeBasis = CANConManager::getInstance()->getTimeBasis(); /* drop frame if capture is suspended */ diff --git a/dbc/dbc_classes.cpp b/dbc/dbc_classes.cpp index 5467b4f..a562ba7 100644 --- a/dbc/dbc_classes.cpp +++ b/dbc/dbc_classes.cpp @@ -155,7 +155,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o //a 32 bit single precision float. That's evil incarnate but it is very fast and small //in terms of new code. result = Utility::processIntegerSignal(frame.payload(), startBit, 32, intelByteOrder, false); - endResult = (*((float *)(&result)) * factor) + bias; + endResult = (*((float *)(&result)) * factor) + bias; //look away! This is awful. I don't even know for sure if it works. Should test that. } else //double precision float { diff --git a/dbc/dbchandler.cpp b/dbc/dbchandler.cpp index 27df434..b756290 100644 --- a/dbc/dbchandler.cpp +++ b/dbc/dbchandler.cpp @@ -1527,6 +1527,8 @@ bool DBCFile::saveFile(QString fileName) case ATTR_TYPE_SIG: msgOutput.append("SG_ "); break; + case ATTR_TYPE_ANY: + break; } msgOutput.append("\"" + dbc_attributes[x].name + "\" "); diff --git a/dbc/dbcmaineditor.cpp b/dbc/dbcmaineditor.cpp index 53982e3..7da57a4 100644 --- a/dbc/dbcmaineditor.cpp +++ b/dbc/dbcmaineditor.cpp @@ -160,6 +160,7 @@ void DBCMainEditor::writeSettings() void DBCMainEditor::onCustomMenuTree(QPoint point) { + Q_UNUSED(point); QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); @@ -259,7 +260,7 @@ void DBCMainEditor::onTreeDoubleClicked(const QModelIndex &index) Q_UNUSED(index) QTreeWidgetItem* firstCol = ui->treeDBC->currentItem(); - bool ret = false; + //bool ret = false; DBC_MESSAGE *msg; DBC_SIGNAL *sig; DBC_NODE *node; @@ -311,11 +312,6 @@ void DBCMainEditor::onTreeDoubleClicked(const QModelIndex &index) void DBCMainEditor::onTreeContextMenu(const QPoint & pos) { QTreeWidgetItem* firstCol = ui->treeDBC->currentItem(); - bool ret = false; - DBC_MESSAGE *msg; - DBC_SIGNAL *sig; - DBC_NODE *node; - uint32_t msgID; QString idString; qDebug() << firstCol->data(0, Qt::UserRole) << " - " << firstCol->text(0); @@ -324,7 +320,7 @@ void DBCMainEditor::onTreeContextMenu(const QPoint & pos) { case 1: //a node idString = firstCol->text(0).split(" ")[0]; - node = dbcFile->findNodeByName(idString); + //node = dbcFile->findNodeByName(idString); QAction *actionRebase = new QAction(QIcon(":/Resource/warning32.ico"), tr("Rebase all messages"), this); actionRebase->setStatusTip(tr("Rebase all messages in node")); @@ -338,7 +334,7 @@ void DBCMainEditor::onTreeContextMenu(const QPoint & pos) menu.addAction(actionRebase); menu.addAction(actionDupe); - QPoint pt(pos); + //QPoint pt(pos); menu.exec( ui->treeDBC->mapToGlobal(pos) ); break; } @@ -347,11 +343,7 @@ void DBCMainEditor::onTreeContextMenu(const QPoint & pos) void DBCMainEditor::onRebaseMessages() { QTreeWidgetItem* firstCol = ui->treeDBC->currentItem(); - bool ret = false; - DBC_MESSAGE *msg; - DBC_SIGNAL *sig; DBC_NODE *node; - uint32_t msgID; QString idString; idString = firstCol->text(0).split(" ")[0]; @@ -368,11 +360,11 @@ void DBCMainEditor::onRebaseMessages() void DBCMainEditor::onDuplicateNode() { QTreeWidgetItem* firstCol = ui->treeDBC->currentItem(); - bool ret = false; - DBC_MESSAGE *msg; - DBC_SIGNAL *sig; + //bool ret = false; + //DBC_MESSAGE *msg; + //DBC_SIGNAL *sig; + //uint32_t msgID; DBC_NODE *node; - uint32_t msgID; QString idString; idString = firstCol->text(0).split(" ")[0]; diff --git a/dbc/dbcnodeduplicateeditor.cpp b/dbc/dbcnodeduplicateeditor.cpp index 0c5b546..7ea5cd1 100644 --- a/dbc/dbcnodeduplicateeditor.cpp +++ b/dbc/dbcnodeduplicateeditor.cpp @@ -41,7 +41,7 @@ DBCNodeDuplicateEditor::DBCNodeDuplicateEditor(QWidget *parent) : return; } - uint rebaseDiff = newBase - lowestMsgId; + int32_t rebaseDiff = newBase - lowestMsgId; QList messagesForNode = dbcFile->messageHandler->findMsgsByNode(dbcNode); if(messagesForNode.count() == 0) @@ -70,11 +70,11 @@ DBCNodeDuplicateEditor::DBCNodeDuplicateEditor(QWidget *parent) : return; } - for (int i=0; iID + rebaseDiff; + int32_t newMsgId = messagesForNode[i]->ID + rebaseDiff; - if(newMsgId < 0 || newMsgId > 0x1FFFFFFFul) + if(newMsgId < 0 || newMsgId > 0x1FFFFFFFl) { QMessageBox::question(this, "Invalid Address Range", "The new starting address would cause a message to be outside of the valid address range.", QMessageBox::Ok); @@ -82,9 +82,9 @@ DBCNodeDuplicateEditor::DBCNodeDuplicateEditor(QWidget *parent) : } } - for (int i=0; iID + rebaseDiff; + int32_t newMsgId = messagesForNode[i]->ID + rebaseDiff; emit cloneMessageToNode(nodePtr, messagesForNode[i], newMsgId); } diff --git a/dbc/dbcnoderebaseeditor.cpp b/dbc/dbcnoderebaseeditor.cpp index 8ce105d..f99e1df 100644 --- a/dbc/dbcnoderebaseeditor.cpp +++ b/dbc/dbcnoderebaseeditor.cpp @@ -62,11 +62,11 @@ DBCNodeRebaseEditor::DBCNodeRebaseEditor(QWidget *parent) : return; } - for (int i=0; iID + rebaseDiff; + int32_t newMsgId = messagesForNode[i]->ID + rebaseDiff; - if(newMsgId < 0 || newMsgId > 0x1FFFFFFFul) + if(newMsgId < 0 || newMsgId > 0x1FFFFFFFl) { QMessageBox::question(this, "Invalid Address Range", "The new starting address would cause a message to be outside of the valid address range.", QMessageBox::Ok); @@ -74,7 +74,7 @@ DBCNodeRebaseEditor::DBCNodeRebaseEditor(QWidget *parent) : } } - for (int i=0; iID += rebaseDiff; emit updatedTreeInfo(messagesForNode[i]); diff --git a/framefileio.cpp b/framefileio.cpp index 0c11672..71de1cd 100644 --- a/framefileio.cpp +++ b/framefileio.cpp @@ -1551,9 +1551,9 @@ bool FrameFileIO::isCanalyzerASC(QString filename) { QFile *inFile = new QFile(filename); QByteArray line; - int lineCounter = 0; + //int lineCounter = 0; + //bool inHeader = true; bool isMatch = true; - bool inHeader = true; QList tokens; if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text)) @@ -4188,8 +4188,8 @@ bool FrameFileIO::loadTeslaAPFile(QString filename, QVector* frames) CANFrame thisFrame; int lineCounter = 0; QByteArray data; - int timeOffset = 0; - int64_t lastTimeStamp = 0; + //int timeOffset = 0; + //int64_t lastTimeStamp = 0; bool foundErrors = false; thisFrame.setFrameType(QCanBusFrame::DataFrame); TeslaAPCANRecord record; @@ -4246,7 +4246,7 @@ bool FrameFileIO::isCLX000File(QString filename) { } QTextStream fileStream(inFile.get()); - bool foundErrors = false; + //bool foundErrors = false; // Contains 16 lines of header prior to (potential) data. QString headerLine; @@ -4298,7 +4298,7 @@ bool FrameFileIO::isCLX000File(QString filename) { qDebug() << "Could not decode time format" << headerLine << "using pattern" << timeFormatPattern; return false; } - auto timeFormat = matchTimeFormat.captured("timeFormat").front().digitValue(); + //auto timeFormat = matchTimeFormat.captured("timeFormat").front().digitValue(); headerLine = fileStream.readLine(); QString const timeSeparatorPattern = "# Time separator: \"(?[" + validSeparators + "]?)\""; @@ -4308,7 +4308,7 @@ bool FrameFileIO::isCLX000File(QString filename) { qDebug() << "Could not decode time format" << headerLine << "using pattern" << timeSeparatorPattern; return false; } - QChar timeSeparator = matchTimeSeparator.captured("timeSeparator").front(); + //QChar timeSeparator = matchTimeSeparator.captured("timeSeparator").front(); headerLine = fileStream.readLine(); QString const timeSeparatorMsPattern = "# Time separator ms: \"(?[" + validSeparators + "]?)\""; @@ -4318,7 +4318,7 @@ bool FrameFileIO::isCLX000File(QString filename) { qDebug() << "Could not decode time format ms" << headerLine << "using pattern" << timeSeparatorMsPattern; return false; } - QChar timeSeparatorMs = matchTimeSeparatorMs.captured("timeSeparatorMs").front(); + //QChar timeSeparatorMs = matchTimeSeparatorMs.captured("timeSeparatorMs").front(); headerLine = fileStream.readLine(); QString const dateSeparatorPattern = "# Date separator: \"(?[" + validSeparators + "]?)\""; @@ -4328,7 +4328,7 @@ bool FrameFileIO::isCLX000File(QString filename) { qDebug() << "Could not decode time format ms" << headerLine << "using pattern" << dateSeparatorPattern; return false; } - QChar dateSeparator = matchDateSeparator.captured("dateSeparator").front(); + //QChar dateSeparator = matchDateSeparator.captured("dateSeparator").front(); headerLine = fileStream.readLine(); QString const timeDateSeparatorPattern = "# Time and date separator: \"(?[" + validSeparators + "]?)\""; @@ -4338,7 +4338,7 @@ bool FrameFileIO::isCLX000File(QString filename) { qDebug() << "Could not decode time format ms" << headerLine << "using pattern" << timeDateSeparatorPattern; return false; } - QChar timeDateSeparator = matchTimeDateSeparator.captured("timeDateSeparator").front(); + //QChar timeDateSeparator = matchTimeDateSeparator.captured("timeDateSeparator").front(); // Skip remaining header lines. fileStream.readLine(); @@ -4509,6 +4509,7 @@ bool FrameFileIO::loadCLX000File(QString filename, QVector* frames) { } // Fallthrough + [[fallthrough]]; } case 5: { // Handle month. @@ -4519,6 +4520,7 @@ bool FrameFileIO::loadCLX000File(QString filename, QVector* frames) { } // Fallthrough + [[fallthrough]]; } case 4: { // Handle day. @@ -4529,6 +4531,7 @@ bool FrameFileIO::loadCLX000File(QString filename, QVector* frames) { } // Fallthrough + [[fallthrough]]; } case 3: { // Handle hours. @@ -4539,6 +4542,7 @@ bool FrameFileIO::loadCLX000File(QString filename, QVector* frames) { } // Fallthrough + [[fallthrough]]; } case 2: { // Handle minutes. @@ -4549,6 +4553,7 @@ bool FrameFileIO::loadCLX000File(QString filename, QVector* frames) { } // Fallthrough + [[fallthrough]]; } case 1: { // Handle seconds. @@ -4559,6 +4564,7 @@ bool FrameFileIO::loadCLX000File(QString filename, QVector* frames) { } // Fallthrough + [[fallthrough]]; } case 0: { // Handle milliseconds. @@ -4736,7 +4742,7 @@ bool FrameFileIO::loadCANServerFile(QString filename, QVector* frames) if (fileIsGood) { - uint64_t lastFrameTime = 0; + //uint64_t lastFrameTime = 0; uint8_t data[1]; while (!inFile->atEnd()) @@ -4843,7 +4849,7 @@ bool FrameFileIO::loadCANServerFile(QString filename, QVector* frames) frameoffset *= 1000; frameTime += frameoffset; - lastFrameTime = frameTime; + //lastFrameTime = frameTime; thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, frameTime)); diff --git a/jsedit.cpp b/jsedit.cpp index edb1eef..8893443 100644 --- a/jsedit.cpp +++ b/jsedit.cpp @@ -481,12 +481,12 @@ void JSHighlighter::mark(const QString &str, Qt::CaseSensitivity caseSensitivity QStringList JSHighlighter::keywords() const { - return m_keywords.toList(); + return m_keywords.values(); } void JSHighlighter::setKeywords(const QStringList &keywords) { - m_keywords = QSet::fromList(keywords); + m_keywords = QSet(keywords.begin(), keywords.end()); rehighlight(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index b0bdf56..6383e1e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -677,7 +677,7 @@ void MainWindow::updateFilterList() for (filterIter = busFilters->begin(); filterIter != busFilters->end(); ++filterIter) { - QListWidgetItem *thisItem = FilterUtility::createCheckableBusFilterItem(filterIter.key(), filterIter.value(), ui->listBusFilters); + /*QListWidgetItem *thisItem = */ FilterUtility::createCheckableBusFilterItem(filterIter.key(), filterIter.value(), ui->listBusFilters); } inhibitFilterUpdate = false; } @@ -738,6 +738,7 @@ void MainWindow::filterClearAll() void MainWindow::logReceivedFrame(CANConnection* conn, QVector frames) { + Q_UNUSED(conn); if (continuousLogging) { FrameFileIO::writeContinuousNative(&frames, 0); @@ -1053,7 +1054,7 @@ void MainWindow::saveDecodedTextFileAsColumns(QString filename) QFile *outFile = new QFile(filename); const QVector *frames = model->getFilteredListReference(); - const unsigned char *data; + //const unsigned char *data; int dataLen; const CANFrame *frame; @@ -1064,7 +1065,7 @@ Time: 205.173000 ID: 0x20E Std Bus: 0 Len: 8 Data Bytes: 88 10 00 13 BB 00 06 00 SignalName Value */ - QList> msgsAndColumns; + QList> msgsAndColumns; int columnsAdded = 0; int dataStartCol = 0; @@ -1090,7 +1091,7 @@ Data Bytes: 88 10 00 13 BB 00 06 00 for (int c = 0; c < frames->count(); c++) { frame = &frames->at(c); - data = reinterpret_cast(frame->payload().constData()); + //data = reinterpret_cast(frame->payload().constData()); dataLen = frame->payload().count(); //add all column names @@ -1110,7 +1111,7 @@ Data Bytes: 88 10 00 13 BB 00 06 00 found = true; } if(found == false) - msgsAndColumns.append(QPair(msg->ID, columnsAdded)); + msgsAndColumns.append(QPair(msg->ID, columnsAdded)); } if(found == false) @@ -1147,7 +1148,7 @@ Data Bytes: 88 10 00 13 BB 00 06 00 { dataColumnsAdded = 0; frame = &frames->at(c); - data = reinterpret_cast(frame->payload().constData()); + //data = reinterpret_cast(frame->payload().constData()); dataLen = frame->payload().count(); QString builderString; diff --git a/qcpaxistickerhex.cpp b/qcpaxistickerhex.cpp index 45ca1ac..cc67171 100644 --- a/qcpaxistickerhex.cpp +++ b/qcpaxistickerhex.cpp @@ -3,6 +3,9 @@ QString QCPAxisTickerHex::getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) { + Q_UNUSED(locale); + Q_UNUSED(formatChar); + Q_UNUSED(precision); int64_t hexVal = static_cast(tick); return QString::number(hexVal, 16); } diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index 9e00d82..d1e2fdf 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -311,7 +311,7 @@ void FlowViewWindow::gotCenterTimeID(uint32_t ID, double timestamp) for (int j = 0; j < ui->listFrameID->count(); j++) { - int thisNum = FilterUtility::getIdAsInt(ui->listFrameID->item(j)); + uint32_t thisNum = FilterUtility::getIdAsInt(ui->listFrameID->item(j)); if (thisNum == ID) { ui->listFrameID->setCurrentRow(j); diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index bf6da55..568819d 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -1434,7 +1434,6 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) if (params.prevValLocation != QPointF(0,0)) { - int j = numEntries - 1; QCPItemBracket *bracket = new QCPItemBracket(ui->graphingView); bracket->left->setCoords(params.prevValLocation); bracket->right->setCoords(x, params.prevValLocation.y()); diff --git a/re/sniffer/sniffermodel.cpp b/re/sniffer/sniffermodel.cpp index 293a69d..25240ef 100644 --- a/re/sniffer/sniffermodel.cpp +++ b/re/sniffer/sniffermodel.cpp @@ -253,7 +253,7 @@ void SnifferModel::refresh() for (i = mMap.begin(); i != mMap.end(); ++i) { //i.value()->updateMarker(); - if(i.value()->elapsed() > mExpireInterval && !mNeverExpire) + if(i.value()->elapsed() > (int)mExpireInterval && !mNeverExpire) toRemove.append(i.key()); } diff --git a/re/udsscanwindow.cpp b/re/udsscanwindow.cpp index 69d6d51..9c8482b 100644 --- a/re/udsscanwindow.cpp +++ b/re/udsscanwindow.cpp @@ -178,7 +178,6 @@ void UDSScanWindow::loadScans() QString filename; QFileDialog dialog(qApp->activeWindow()); QSettings settings; - bool result = false; QStringList filters; filters.append(QString(tr("UDS Test Specification (*.uds *.UDS)"))); @@ -231,7 +230,6 @@ void UDSScanWindow::saveScans() QString filename; QFileDialog dialog(qApp->activeWindow()); QSettings settings; - bool result = false; QStringList filters; filters.append(QString(tr("UDS Test Specification (*.uds *.UDS)"))); diff --git a/signalviewerwindow.cpp b/signalviewerwindow.cpp index 8ec7936..628cf12 100644 --- a/signalviewerwindow.cpp +++ b/signalviewerwindow.cpp @@ -351,13 +351,13 @@ void SignalViewerWindow::loadDefinitions(bool append) QString msgName = QString(tokens[2]); QString sigName = QString(tokens[3]); DBC_MESSAGE *msg;; - if(msg = dbcHandler->findMessage(msgId)) + if( (msg = dbcHandler->findMessage(msgId)) ) { sig = msg->sigHandler->findSignalByName(sigName); if(sig) loadedSignals.append(sig); } - else if (msg = dbcHandler->findMessage(msgName)) + else if ( (msg = dbcHandler->findMessage(msgName)) ) { //this is not a very safe way to match since messages names can be duplicated sig = msg->sigHandler->findSignalByName(sigName); diff --git a/utility.h b/utility.h index b3daba8..78819f7 100644 --- a/utility.h +++ b/utility.h @@ -287,7 +287,7 @@ public: if (isSigned) { - int64_t mask = (1ULL << (sigSize - 1)); + uint64_t mask = (1ULL << (sigSize - 1)); if ((result & mask) == mask) //is the highest bit possible for this signal size set? { /*