From 0567d5ef1499dc1a0d224603892e69a52c186c2e Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Thu, 8 Aug 2019 22:09:02 -0400 Subject: [PATCH] More changes meant just to fix up compiler warnings. --- can_structs.h | 4 ++-- connections/gvretserial.cpp | 6 +++++- dbc/dbc_classes.cpp | 9 +++++---- dbc/dbchandler.cpp | 2 +- re/frameinfowindow.cpp | 23 +++++++++++------------ 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/can_structs.h b/can_structs.h index df976f5..d0b3063 100644 --- a/can_structs.h +++ b/can_structs.h @@ -9,11 +9,11 @@ struct CANFrame { public: uint32_t ID; - uint32_t bus; + int bus; bool extended; bool remote; bool isReceived; //did we receive this or send it? - uint32_t len; + int len; unsigned char data[8]; uint64_t timestamp; uint64_t timedelta; diff --git a/connections/gvretserial.cpp b/connections/gvretserial.cpp index 6244e41..523c3a5 100644 --- a/connections/gvretserial.cpp +++ b/connections/gvretserial.cpp @@ -941,6 +941,7 @@ void GVRetSerial::procRXChar(unsigned char c) break; case 9: lin1Baud |= c << 24; + break; case 10: lin2Enabled = (c & 0xF); break; @@ -1018,7 +1019,10 @@ void GVRetSerial::handleTick() return; } } - else if (doValidation); //qDebug() << "Comm connection validated"; + else if (doValidation) + { + //qDebug() << "Comm connection validated"; + } } if (doValidation && serial && serial->isOpen()) sendCommValidation(); if (doValidation && tcpClient && tcpClient->isOpen()) sendCommValidation(); diff --git a/dbc/dbc_classes.cpp b/dbc/dbc_classes.cpp index 4b25943..04b98e8 100644 --- a/dbc/dbc_classes.cpp +++ b/dbc/dbc_classes.cpp @@ -155,15 +155,16 @@ bool DBC_SIGNAL::processAsInt(const CANFrame &frame, int32_t &outValue) } if (valType == SIGNED_INT) isSigned = true; - if ( frame.len*8 < (startBit+signalSize) ) + if ( static_cast(frame.len * 8) < (startBit + signalSize) ) { result = 0; return false; } - result = Utility::processIntegerSignal(frame.data, startBit, signalSize, intelByteOrder, isSigned); - double endResult = ((double)result * factor) + bias; - result = (int32_t)endResult; + result = static_cast(Utility::processIntegerSignal(frame.data, startBit, signalSize, intelByteOrder, isSigned)); + + double endResult = (result * factor) + bias; + result = static_cast(endResult); cachedValue = result; outValue = result; return true; diff --git a/dbc/dbchandler.cpp b/dbc/dbchandler.cpp index e817b66..d873ae3 100644 --- a/dbc/dbchandler.cpp +++ b/dbc/dbchandler.cpp @@ -219,7 +219,7 @@ DBCFile::DBCFile() messageHandler->setJ1939(false); } -DBCFile::DBCFile(const DBCFile& cpy) +DBCFile::DBCFile(const DBCFile& cpy) : QObject() { messageHandler = new DBCMessageHandler; for (int i = 0 ; i < cpy.messageHandler->getCount() ; i++) diff --git a/re/frameinfowindow.cpp b/re/frameinfowindow.cpp index 2557450..4db0fbb 100644 --- a/re/frameinfowindow.cpp +++ b/re/frameinfowindow.cpp @@ -118,7 +118,6 @@ bool FrameInfoWindow::eventFilter(QObject *obj, QEvent *event) // standard event processing return QObject::eventFilter(obj, event); } - return false; } FrameInfoWindow::~FrameInfoWindow() @@ -186,12 +185,12 @@ void FrameInfoWindow::updatedFrames(int numFrames) unsigned int currID = 0; if (ui->listFrameID->currentItem()) - currID = (unsigned int)ui->listFrameID->currentItem()->text().toInt(nullptr, 16); + currID = static_cast(ui->listFrameID->currentItem()->text().toInt(nullptr, 16)); bool thisID = false; for (int x = modelFrames->count() - numFrames; x < modelFrames->count(); x++) { CANFrame thisFrame = modelFrames->at(x); - unsigned int id = thisFrame.ID; + int32_t id = static_cast(thisFrame.ID); if (!foundID.contains(id)) { foundID.append(id); @@ -240,7 +239,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) uint8_t referenceBits[8]; QTreeWidgetItem *baseNode, *dataBase, *histBase, *tempItem; - targettedID = Utility::ParseStringToNum(newID); + targettedID = static_cast(Utility::ParseStringToNum(newID)); if (modelFrames->count() == 0) return; @@ -255,7 +254,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) for (int i = 0; i < modelFrames->count(); i++) { CANFrame thisFrame = modelFrames->at(i); - if (thisFrame.ID == (unsigned int)targettedID) frameCache.append(thisFrame); + if (thisFrame.ID == static_cast(targettedID)) frameCache.append(thisFrame); } ui->treeDetails->clear(); @@ -286,23 +285,23 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) { jid.dest = jid.ps; tempItem = new QTreeWidgetItem(); - tempItem->setText(0, tr("Destination ID: ") + Utility::formatNumber(jid.dest)); + tempItem->setText(0, tr("Destination ID: ") + Utility::formatNumber(static_cast(jid.dest))); baseNode->addChild(tempItem); } tempItem = new QTreeWidgetItem(); - tempItem->setText(0, tr("SRC: ") + Utility::formatNumber(jid.src)); + tempItem->setText(0, tr("SRC: ") + Utility::formatNumber(static_cast(jid.src))); baseNode->addChild(tempItem); tempItem = new QTreeWidgetItem(); - tempItem->setText(0, tr("PGN: ") + Utility::formatNumber(jid.pgn) + "(" + QString::number(jid.pgn) + ")"); + tempItem->setText(0, tr("PGN: ") + Utility::formatNumber(static_cast(jid.pgn)) + "(" + QString::number(jid.pgn) + ")"); baseNode->addChild(tempItem); tempItem = new QTreeWidgetItem(); - tempItem->setText(0, tr("PF: ") + Utility::formatNumber(jid.pf)); + tempItem->setText(0, tr("PF: ") + Utility::formatNumber(static_cast(jid.pf))); baseNode->addChild(tempItem); tempItem = new QTreeWidgetItem(); - tempItem->setText(0, tr("PS: ") + Utility::formatNumber(jid.ps)); + tempItem->setText(0, tr("PS: ") + Utility::formatNumber(static_cast(jid.ps))); baseNode->addChild(tempItem); } @@ -337,7 +336,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) for (int j = 0; j < frameCache.count(); j++) { byteGraphX.append(j); - for (int bytcnt = 0; bytcnt < frameCache[j].len; bytcnt++) + for (uint32_t bytcnt = 0; bytcnt < frameCache[j].len; bytcnt++) { byteGraphY[bytcnt].append(frameCache[j].data[bytcnt]); } @@ -386,7 +385,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) { intervalMean = intervalSum / sortedIntervals.size(); - for(int l = 0; l < sortedIntervals.size(); l++) { + for(int l = 0; l < static_cast(sortedIntervals.size()); l++) { intervalVariance += ((sortedIntervals[l] - intervalMean) * (sortedIntervals[l] - intervalMean)); }