Many little changes to get rid of compile-time warnings.

There now should be no warnings when compiling on LINUX. YMMV elsewhere.
This commit is contained in:
Collin Kidder
2020-02-15 19:52:18 -05:00
parent d550fa79a0
commit e4a3854af4
21 changed files with 89 additions and 93 deletions
+2 -2
View File
@@ -356,7 +356,7 @@ void ISOTP_HANDLER::setProcessAll(bool state)
processAll = state; processAll = state;
} }
void ISOTP_HANDLER::addFilter(uint32_t pBusId, uint32_t ID, uint32_t mask) void ISOTP_HANDLER::addFilter(int pBusId, uint32_t ID, uint32_t mask)
{ {
CANFilter filt; CANFilter filt;
filt.ID = ID; filt.ID = ID;
@@ -366,7 +366,7 @@ void ISOTP_HANDLER::addFilter(uint32_t pBusId, uint32_t ID, uint32_t mask)
filters.append(filt); filters.append(filt);
} }
void ISOTP_HANDLER::removeFilter(uint32_t pBusId, uint32_t ID, uint32_t mask) void ISOTP_HANDLER::removeFilter(int pBusId, uint32_t ID, uint32_t mask)
{ {
for (int i = 0; i < filters.count(); i++) for (int i = 0; i < filters.count(); i++)
{ {
+2 -2
View File
@@ -22,8 +22,8 @@ public:
void sendISOTPFrame(int bus, int ID, QByteArray data); void sendISOTPFrame(int bus, int ID, QByteArray data);
void setProcessAll(bool state); void setProcessAll(bool state);
void setFlowCtrl(bool state); void setFlowCtrl(bool state);
void addFilter(uint32_t pBusId, uint32_t ID, uint32_t mask); void addFilter(int pBusId, uint32_t ID, uint32_t mask);
void removeFilter(uint32_t pBusId, uint32_t ID, uint32_t mask); void removeFilter(int pBusId, uint32_t ID, uint32_t mask);
void clearAllFilters(); void clearAllFilters();
public slots: public slots:
-4
View File
@@ -326,7 +326,6 @@ QString UDS_HANDLER::getNegativeResponseLong(int respCode)
QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg) QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
{ {
QString buildString; QString buildString;
bool isResponse = true;
int dataSize; int dataSize;
int addrSize; int addrSize;
const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData()); const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData());
@@ -334,18 +333,15 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
if (msg.isErrorReply) if (msg.isErrorReply)
{ {
isResponse = true;
buildString.append("UDS ERROR Response\n"); buildString.append("UDS ERROR Response\n");
buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n"); buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n");
} }
else if (msg.service < 0x3F || (msg.service > 0x7F && msg.service < 0xAF)) { else if (msg.service < 0x3F || (msg.service > 0x7F && msg.service < 0xAF)) {
isResponse = false;
buildString.append("UDS Request\n"); buildString.append("UDS Request\n");
buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n"); buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n");
} }
else else
{ {
isResponse = true;
buildString.append("UDS Positive Response\n"); buildString.append("UDS Positive Response\n");
buildString.append("Service: " + getServiceLongDesc(msg.service - 0x40) + "\n"); buildString.append("Service: " + getServiceLongDesc(msg.service - 0x40) + "\n");
} }
+2 -1
View File
@@ -9,7 +9,8 @@ public:
CANBus(); CANBus();
CANBus(const CANBus&); CANBus(const CANBus&);
bool operator==(const CANBus&) const; bool operator==(const CANBus&) const;
virtual ~CANBus(){}; CANBus& operator=(const CANBus& other) = default;
//virtual ~CANBus(){}
int speed; int speed;
bool listenOnly; bool listenOnly;
+1 -1
View File
@@ -214,7 +214,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame)
foreach (CANConnection* conn, mConns) foreach (CANConnection* conn, mConns)
{ {
//check if this CAN connection is supposed to handle the requested bus //check if this CAN connection is supposed to handle the requested bus
if (pFrame.bus < (uint32_t)(busBase + conn->getNumBuses())) if (pFrame.bus < (busBase + conn->getNumBuses()))
{ {
workingFrame.bus -= busBase; workingFrame.bus -= busBase;
workingFrame.isReceived = false; workingFrame.isReceived = false;
+1 -1
View File
@@ -8,8 +8,8 @@ CANConnection::CANConnection(QString pPort,
int pNumBuses, int pNumBuses,
int pQueueLen, int pQueueLen,
bool pUseThread) : bool pUseThread) :
mQueue(),
mNumBuses(pNumBuses), mNumBuses(pNumBuses),
mQueue(),
mPort(pPort), mPort(pPort),
mDriver(pDriver), mDriver(pDriver),
mType(pType), mType(pType),
+3 -3
View File
@@ -9,9 +9,9 @@
#include "gvretserial.h" #include "gvretserial.h"
GVRetSerial::GVRetSerial(QString portName, bool useTcp) : GVRetSerial::GVRetSerial(QString portName, bool useTcp) :
CANConnection(portName, "gvret", CANCon::GVRET_SERIAL, 3, 4000, true), CANConnection(portName, "gvret", CANCon::GVRET_SERIAL, 3, 4000, true),
useTcp(useTcp), mTimer(this), /*NB: set this as parent of timer to manage it from working thread */
mTimer(this) /*NB: set this as parent of timer to manage it from working thread */ useTcp(useTcp)
{ {
sendDebug("GVRetSerial()"); sendDebug("GVRetSerial()");
+1 -1
View File
@@ -91,7 +91,7 @@ protected:
QUdpSocket *udpClient; QUdpSocket *udpClient;
int framesRapid; int framesRapid;
STATE rx_state; STATE rx_state;
uint32_t rx_step; int rx_step;
CANFrame buildFrame; CANFrame buildFrame;
qint64 buildTimestamp; qint64 buildTimestamp;
quint32 buildId; quint32 buildId;
+3 -3
View File
@@ -46,7 +46,7 @@ bool DBCSignalHandler::addSignal(DBC_SIGNAL &sig)
bool DBCSignalHandler::removeSignal(DBC_SIGNAL *sig) bool DBCSignalHandler::removeSignal(DBC_SIGNAL *sig)
{ {
Q_UNUSED(sig); Q_UNUSED(sig)
//if (sigs.removeAll(*sig) > 0) return true; //if (sigs.removeAll(*sig) > 0) return true;
return false; return false;
} }
@@ -1698,7 +1698,7 @@ void DBCHandler::swapFiles(int pos1, int pos2)
if (pos2 < 0) return; if (pos2 < 0) return;
if (pos2 >= loadedFiles.count()) return; if (pos2 >= loadedFiles.count()) return;
loadedFiles.swap(pos1, pos2); loadedFiles.swapItemsAt(pos1, pos2);
} }
/* /*
@@ -1711,7 +1711,7 @@ DBC_MESSAGE* DBCHandler::findMessage(const CANFrame &frame)
{ {
for(int i = 0; i < loadedFiles.count(); i++) for(int i = 0; i < loadedFiles.count(); i++)
{ {
if (loadedFiles[i].getAssocBus() == -1 || frame.bus == (unsigned int)loadedFiles[i].getAssocBus()) if (loadedFiles[i].getAssocBus() == -1 || frame.bus == loadedFiles[i].getAssocBus())
{ {
DBC_MESSAGE* msg = loadedFiles[i].messageHandler->findMsgByID(frame.frameId()); DBC_MESSAGE* msg = loadedFiles[i].messageHandler->findMsgByID(frame.frameId());
if (msg != nullptr) return msg; if (msg != nullptr) return msg;
+3 -1
View File
@@ -270,6 +270,8 @@ void DBCLoadSaveWindow::editFile()
void DBCLoadSaveWindow::matchingCriteriaChanged(int index) void DBCLoadSaveWindow::matchingCriteriaChanged(int index)
{ {
Q_UNUSED(index)
if (inhibitCellProcessing) return; if (inhibitCellProcessing) return;
// We don't know which combobox changed, so we just update all of them // We don't know which combobox changed, so we just update all of them
for (int row=0; row<ui->tableFiles->rowCount(); row++) for (int row=0; row<ui->tableFiles->rowCount(); row++)
@@ -312,7 +314,7 @@ void DBCLoadSaveWindow::cellChanged(int row, int col)
{ {
DBCFile *file = dbcHandler->getFileByIdx(row); DBCFile *file = dbcHandler->getFileByIdx(row);
int bus = ui->tableFiles->item(row, col)->text().toInt(); int bus = ui->tableFiles->item(row, col)->text().toInt();
int numBuses = CANConManager::getInstance()->getNumBuses(); //int numBuses = CANConManager::getInstance()->getNumBuses();
if (bus > -2) if (bus > -2)
{ {
file->setAssocBus(bus); file->setAssocBus(bus);
+16 -16
View File
@@ -102,7 +102,7 @@ void DBCMainEditor::setFileIdx(int idx)
void DBCMainEditor::closeEvent(QCloseEvent *event) void DBCMainEditor::closeEvent(QCloseEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event)
writeSettings(); writeSettings();
sigEditor->close(); sigEditor->close();
} }
@@ -197,7 +197,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
if (dbcFile->findNodeByName(newName) != nullptr) //duplicates an existing node! if (dbcFile->findNodeByName(newName) != nullptr) //duplicates an existing node!
{ {
QMessageBox msg; QMessageBox msg;
msg.setParent(0); msg.setParent(nullptr);
msg.setText("An existing node with that name already exists! Aborting!"); msg.setText("An existing node with that name already exists! Aborting!");
msg.exec(); msg.exec();
return; return;
@@ -275,7 +275,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
if (msg != nullptr) if (msg != nullptr)
{ {
QMessageBox msg; QMessageBox msg;
msg.setParent(0); msg.setParent(nullptr);
msg.setText("An existing msg with that ID already exists! Aborting!"); msg.setText("An existing msg with that ID already exists! Aborting!");
msg.exec(); msg.exec();
@@ -296,7 +296,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
{ {
if ((uint) referenceFrames->at(i).frameId() == msgID) if ((uint) referenceFrames->at(i).frameId() == msgID)
{ {
newMsg.len = referenceFrames->at(i).payload().length(); newMsg.len = static_cast<unsigned int>(referenceFrames->at(i).payload().length());
break; break;
} }
} }
@@ -395,14 +395,14 @@ void DBCMainEditor::onCellClickedMessage(int row, int col)
QTableWidgetItem* firstCol = ui->MessagesTable->item(row, 0); QTableWidgetItem* firstCol = ui->MessagesTable->item(row, 0);
bool ret = false; bool ret = false;
DBC_MESSAGE *msg; DBC_MESSAGE *msg;
int msgID; uint32_t msgID;
if (col == 3) //3 is the signals field. If clicked we go to the signals dialog if (col == 3) //3 is the signals field. If clicked we go to the signals dialog
{ {
QTableWidgetItem* msg = ui->MessagesTable->item(row, 0); QTableWidgetItem* msg = ui->MessagesTable->item(row, 0);
if(msg) { if(msg) {
QString idString = msg->text(); QString idString = msg->text();
DBC_MESSAGE *message = dbcFile->messageHandler->findMsgByID(Utility::ParseStringToNum(idString)); DBC_MESSAGE *message = dbcFile->messageHandler->findMsgByID(static_cast<uint32_t>(Utility::ParseStringToNum(idString)));
sigEditor->setMessageRef(message); sigEditor->setMessageRef(message);
sigEditor->setFileIdx(fileIdx); sigEditor->setFileIdx(fileIdx);
sigEditor->setWindowModality(Qt::WindowModal); sigEditor->setWindowModality(Qt::WindowModal);
@@ -416,8 +416,8 @@ void DBCMainEditor::onCellClickedMessage(int row, int col)
} }
if (col == 4) if (col == 4)
{ {
QColor newColor = QColorDialog::getColor(thisItem->backgroundColor()); QColor newColor = QColorDialog::getColor(thisItem->background().color());
thisItem->setBackgroundColor(newColor); thisItem->setBackground(newColor);
if(!firstCol) return; if(!firstCol) return;
@@ -443,8 +443,8 @@ void DBCMainEditor::onCellClickedMessage(int row, int col)
} }
if (col == 5) if (col == 5)
{ {
QColor newColor = QColorDialog::getColor(thisItem->backgroundColor()); QColor newColor = QColorDialog::getColor(thisItem->background().color());
thisItem->setBackgroundColor(newColor); thisItem->setBackground(newColor);
if(!firstCol) return; if(!firstCol) return;
@@ -523,11 +523,11 @@ void DBCMainEditor::refreshMessagesTable(const DBC_NODE *node)
QTableWidgetItem *msgLen = new QTableWidgetItem(QString::number(msg->len)); QTableWidgetItem *msgLen = new QTableWidgetItem(QString::number(msg->len));
QTableWidgetItem *msgSignals = new QTableWidgetItem(QString::number(msg->sigHandler->getCount())); QTableWidgetItem *msgSignals = new QTableWidgetItem(QString::number(msg->sigHandler->getCount()));
QTableWidgetItem *fgColor = new QTableWidgetItem(""); QTableWidgetItem *fgColor = new QTableWidgetItem("");
if (msg->fgColor.isValid()) fgColor->setBackgroundColor(msg->fgColor); if (msg->fgColor.isValid()) fgColor->setBackground(msg->fgColor);
else fgColor->setBackgroundColor(QColor(dbcFile->findAttributeByName("GenMsgForegroundColor")->defaultValue.toString())); else fgColor->setBackground(QColor(dbcFile->findAttributeByName("GenMsgForegroundColor")->defaultValue.toString()));
QTableWidgetItem *bgColor = new QTableWidgetItem(""); QTableWidgetItem *bgColor = new QTableWidgetItem("");
if (msg->bgColor.isValid()) bgColor->setBackgroundColor(msg->bgColor); if (msg->bgColor.isValid()) bgColor->setBackground(msg->bgColor);
else bgColor->setBackgroundColor(QColor(dbcFile->findAttributeByName("GenMsgBackgroundColor")->defaultValue.toString())); else bgColor->setBackground(QColor(dbcFile->findAttributeByName("GenMsgBackgroundColor")->defaultValue.toString()));
QTableWidgetItem *msgComment = new QTableWidgetItem(msg->comment); QTableWidgetItem *msgComment = new QTableWidgetItem(msg->comment);
@@ -558,8 +558,8 @@ void DBCMainEditor::insertBlankRow()
for(int i=1 ; i < ui->MessagesTable->columnCount(); i++) for(int i=1 ; i < ui->MessagesTable->columnCount(); i++)
{ {
QTableWidgetItem *item = new QTableWidgetItem(""); QTableWidgetItem *item = new QTableWidgetItem("");
if (i == 4) item->setBackgroundColor(QApplication::palette().color(QPalette::WindowText)); //foreground color if (i == 4) item->setBackground(QApplication::palette().color(QPalette::WindowText)); //foreground color
if (i == 5) item->setBackgroundColor(QApplication::palette().color(QPalette::Base)); if (i == 5) item->setBackground(QApplication::palette().color(QPalette::Base));
item->setFlags(item->flags() & ~Qt::ItemIsEditable); item->setFlags(item->flags() & ~Qt::ItemIsEditable);
ui->MessagesTable->setItem(rowIdx, i, item); ui->MessagesTable->setItem(rowIdx, i, item);
} }
+2 -2
View File
@@ -997,11 +997,11 @@ void JSEdit::updateSidebar()
int maxLines = blockCount(); int maxLines = blockCount();
for (int number = 10; number < maxLines; number *= 10) for (int number = 10; number < maxLines; number *= 10)
++digits; ++digits;
sw += fontMetrics().width('w') * digits; sw += fontMetrics().horizontalAdvance('w') * digits;
} }
if (d->codeFolding) { if (d->codeFolding) {
int fh = fontMetrics().lineSpacing(); int fh = fontMetrics().lineSpacing();
int fw = fontMetrics().width('w'); int fw = fontMetrics().horizontalAdvance('w');
d->sidebar->foldIndicatorWidth = qMax(fw, fh); d->sidebar->foldIndicatorWidth = qMax(fw, fh);
sw += d->sidebar->foldIndicatorWidth; sw += d->sidebar->foldIndicatorWidth;
} }
+8 -8
View File
@@ -849,14 +849,14 @@ void MainWindow::showGraphingWindow()
{ {
if (!graphingWindow) { if (!graphingWindow) {
graphingWindow = new GraphingWindow(model->getListReference()); graphingWindow = new GraphingWindow(model->getListReference());
connect(graphingWindow, SIGNAL(sendCenterTimeID(int32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double))); connect(graphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double)));
connect(this, SIGNAL(sendCenterTimeID(int32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); connect(this, SIGNAL(sendCenterTimeID(uint32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double)));
} }
if (flowViewWindow) //connect the two external windows together if (flowViewWindow) //connect the two external windows together
{ {
connect(graphingWindow, SIGNAL(sendCenterTimeID(int32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); connect(graphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double)));
connect(flowViewWindow, SIGNAL(sendCenterTimeID(int32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double)));
} }
graphingWindow->show(); graphingWindow->show();
} }
@@ -1026,14 +1026,14 @@ void MainWindow::showFlowViewWindow()
flowViewWindow = new FlowViewWindow(model->getListReference()); flowViewWindow = new FlowViewWindow(model->getListReference());
else else
flowViewWindow = new FlowViewWindow(model->getFilteredListReference()); flowViewWindow = new FlowViewWindow(model->getFilteredListReference());
connect(flowViewWindow, SIGNAL(sendCenterTimeID(int32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double))); connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double)));
connect(this, SIGNAL(sendCenterTimeID(int32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); connect(this, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double)));
} }
if (graphingWindow) if (graphingWindow)
{ {
connect(graphingWindow, SIGNAL(sendCenterTimeID(int32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); connect(graphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double)));
connect(flowViewWindow, SIGNAL(sendCenterTimeID(int32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double)));
} }
flowViewWindow->show(); flowViewWindow->show();
+1 -1
View File
@@ -115,7 +115,7 @@ signals:
void framesUpdated(int numFrames); //something has updated the frame list (send at gui update frequency) void framesUpdated(int numFrames); //something has updated the frame list (send at gui update frequency)
void frameUpdateRapid(int numFrames); void frameUpdateRapid(int numFrames);
void settingsUpdated(); void settingsUpdated();
void sendCenterTimeID(int32_t ID, double timestamp); void sendCenterTimeID(uint32_t ID, double timestamp);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
+4 -5
View File
@@ -51,9 +51,8 @@ MotorControllerConfigWindow::~MotorControllerConfigWindow()
void MotorControllerConfigWindow::updatedFrames(int numFrames) void MotorControllerConfigWindow::updatedFrames(int numFrames)
{ {
CANFrame thisFrame; CANFrame thisFrame;
int id; uint32_t id;
int param; QTableWidgetItem *item = nullptr;
QTableWidgetItem *item;
if (numFrames == -1) //all frames deleted if (numFrames == -1) //all frames deleted
{ {
@@ -74,12 +73,12 @@ void MotorControllerConfigWindow::updatedFrames(int numFrames)
{ {
if ((char)thisFrame.payload()[2] == 0) if ((char)thisFrame.payload()[2] == 0)
{ {
int paramID = thisFrame.payload()[0] + (thisFrame.payload()[1] * 256); uint32_t paramID = static_cast<uint32_t>(thisFrame.payload()[0] + (thisFrame.payload()[1] * 256));
for (int i = 0; i < params.length(); i++) for (int i = 0; i < params.length(); i++)
{ {
if (params[i].paramID == paramID) if (params[i].paramID == paramID)
{ {
params[i].value = thisFrame.payload()[4] + (thisFrame.payload()[5] * 256); params[i].value = static_cast<uint16_t>(thisFrame.payload()[4] + (thisFrame.payload()[5] * 256));
if (params[i].paramType == ASCII) item = new QTableWidgetItem(); //QString::fromUtf8((char *)params[i].value, 2)); if (params[i].paramType == ASCII) item = new QTableWidgetItem(); //QString::fromUtf8((char *)params[i].value, 2));
if (params[i].paramType == HEX) item = new QTableWidgetItem(Utility::formatHexNum(params[i].value)); if (params[i].paramType == HEX) item = new QTableWidgetItem(Utility::formatHexNum(params[i].value));
if (params[i].paramType == DEC) if (params[i].paramType == DEC)
+13 -13
View File
@@ -36,7 +36,7 @@ void FileComparatorWindow::showEvent(QShowEvent *)
void FileComparatorWindow::closeEvent(QCloseEvent *event) void FileComparatorWindow::closeEvent(QCloseEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event)
writeSettings(); writeSettings();
} }
@@ -118,8 +118,8 @@ void FileComparatorWindow::clearReference()
void FileComparatorWindow::calculateDetails() void FileComparatorWindow::calculateDetails()
{ {
QMap<int, FrameData> interestedIDs; QMap<uint32_t, FrameData> interestedIDs;
QMap<int, FrameData> referenceIDs; QMap<uint32_t, FrameData> referenceIDs;
QTreeWidgetItem *interestedOnlyBase, *referenceOnlyBase = nullptr, *sharedBase, *bitmapBaseInterested, *bitmapBaseReference = nullptr; QTreeWidgetItem *interestedOnlyBase, *referenceOnlyBase = nullptr, *sharedBase, *bitmapBaseInterested, *bitmapBaseReference = nullptr;
QTreeWidgetItem *valuesBase, *detail, *sharedItem, *valuesInterested, *valuesReference = nullptr; QTreeWidgetItem *valuesBase, *detail, *sharedItem, *valuesInterested, *valuesReference = nullptr;
uint64_t tmp; uint64_t tmp;
@@ -131,7 +131,7 @@ void FileComparatorWindow::calculateDetails()
QProgressDialog progress(this); QProgressDialog progress(this);
progress.setWindowModality(Qt::WindowModal); progress.setWindowModality(Qt::WindowModal);
progress.setLabelText("Calculating differences"); progress.setLabelText("Calculating differences");
progress.setCancelButton(0); progress.setCancelButton(nullptr);
progress.setRange(0,0); progress.setRange(0,0);
progress.setMinimumDuration(0); progress.setMinimumDuration(0);
progress.show(); progress.show();
@@ -159,7 +159,7 @@ void FileComparatorWindow::calculateDetails()
if (interestedIDs.contains(frame.frameId())) //if we saw this ID before then add to the QList in there if (interestedIDs.contains(frame.frameId())) //if we saw this ID before then add to the QList in there
{ {
for (unsigned int y = 0; y < dataLen; y++) for (int y = 0; y < dataLen; y++)
{ {
interestedIDs[frame.frameId()].values[y][data[y]]++; interestedIDs[frame.frameId()].values[y][data[y]]++;
tmp = data[y]; tmp = data[y];
@@ -184,7 +184,7 @@ void FileComparatorWindow::calculateDetails()
} }
} }
//memset(newData->values, 0, 256 * 8); //memset(newData->values, 0, 256 * 8);
for (unsigned int y = 0; y < dataLen; y++) for (int y = 0; y < dataLen; y++)
{ {
newData->values[y][data[y]] = 1; newData->values[y][data[y]] = 1;
tmp = data[y]; tmp = data[y];
@@ -206,7 +206,7 @@ void FileComparatorWindow::calculateDetails()
if (referenceIDs.contains(frame.frameId())) //if we saw this ID before then add to the QList in there if (referenceIDs.contains(frame.frameId())) //if we saw this ID before then add to the QList in there
{ {
for (unsigned int y = 0; y < dataLen; y++) for (int y = 0; y < dataLen; y++)
{ {
referenceIDs[frame.frameId()].values[y][data[y]]++; referenceIDs[frame.frameId()].values[y][data[y]]++;
tmp = data[y]; tmp = data[y];
@@ -229,7 +229,7 @@ void FileComparatorWindow::calculateDetails()
} }
} }
//memset(newData->values, 0, 256 * 8); //memset(newData->values, 0, 256 * 8);
for (unsigned int y = 0; y < dataLen; y++) for (int y = 0; y < dataLen; y++)
{ {
newData->values[y][data[y]] = 1; newData->values[y][data[y]] = 1;
tmp = data[y]; tmp = data[y];
@@ -246,7 +246,7 @@ void FileComparatorWindow::calculateDetails()
//now we iterate through the IDs within both files and see which are unique to one file and which //now we iterate through the IDs within both files and see which are unique to one file and which
//are shared //are shared
bool interestedHadUnique = false; bool interestedHadUnique = false;
QMap<int, FrameData>::iterator i; QMap<uint32_t, FrameData>::iterator i;
int framesCounter = 0; int framesCounter = 0;
for (i = interestedIDs.begin(); i != interestedIDs.end(); ++i) for (i = interestedIDs.begin(); i != interestedIDs.end(); ++i)
{ {
@@ -257,7 +257,7 @@ void FileComparatorWindow::calculateDetails()
qApp->processEvents(); qApp->processEvents();
} }
int keyone = i.key(); uint32_t keyone = i.key();
if (!referenceIDs.contains(keyone)) if (!referenceIDs.contains(keyone))
{ {
valuesBase = new QTreeWidgetItem(); valuesBase = new QTreeWidgetItem();
@@ -324,7 +324,7 @@ void FileComparatorWindow::calculateDetails()
for (int j = 0; j < 256; j++) for (int j = 0; j < 256; j++)
{ {
detail = new QTreeWidgetItem(); detail = new QTreeWidgetItem();
detail->setText(0, Utility::formatHexNum(j)); detail->setText(0, Utility::formatHexNum(static_cast<unsigned int>(j)));
if ((interested.values[i][j] > 0) && (reference.values[i][j] == 0) ) if ((interested.values[i][j] > 0) && (reference.values[i][j] == 0) )
{ {
valuesInterested->addChild(detail); valuesInterested->addChild(detail);
@@ -344,10 +344,10 @@ void FileComparatorWindow::calculateDetails()
if (!uniqueInterested) if (!uniqueInterested)
{ {
QMap<int, FrameData>::iterator itwo; QMap<uint32_t, FrameData>::iterator itwo;
for (itwo = referenceIDs.begin(); itwo != referenceIDs.end(); ++itwo) for (itwo = referenceIDs.begin(); itwo != referenceIDs.end(); ++itwo)
{ {
int keytwo = itwo.key(); unsigned int keytwo = itwo.key();
if (!interestedIDs.contains(keytwo)) if (!interestedIDs.contains(keytwo))
{ {
valuesBase = new QTreeWidgetItem(); valuesBase = new QTreeWidgetItem();
+1 -1
View File
@@ -14,7 +14,7 @@ class FileComparatorWindow;
struct FrameData struct FrameData
{ {
int ID; uint32_t ID;
int dataLen; int dataLen;
uint64_t bitmap; uint64_t bitmap;
int values[8][256]; //first index is the data byte, second is # of times we saw that value int values[8][256]; //first index is the data byte, second is # of times we saw that value
+2 -4
View File
@@ -501,9 +501,8 @@ void FlowViewWindow::removeAllGraphs()
void FlowViewWindow::createGraph(int byteNum) void FlowViewWindow::createGraph(int byteNum)
{ {
int tempVal; int tempVal;
float minval=1000000, maxval = -100000; double minval = 1000000.0, maxval = -100000.0;
const unsigned char *data; const unsigned char *data;
int dataLen = 0;
const CANFrame *frame; const CANFrame *frame;
qDebug() << "Create Graph " << byteNum; qDebug() << "Create Graph " << byteNum;
@@ -521,14 +520,13 @@ void FlowViewWindow::createGraph(int byteNum)
{ {
frame = &frameCache[j]; frame = &frameCache[j];
data = reinterpret_cast<const unsigned char *>(frame->payload().constData()); data = reinterpret_cast<const unsigned char *>(frame->payload().constData());
dataLen = frame->payload().length();
tempVal = data[byteNum]; tempVal = data[byteNum];
if (graphByTime) if (graphByTime)
{ {
if (secondsMode){ if (secondsMode){
x[byteNum][j] = (double)(frame->timeStamp().microSeconds()) / 1000000.0; x[byteNum][j] = frame->timeStamp().microSeconds() / 1000000.0;
} }
else else
{ {
+1 -1
View File
@@ -40,7 +40,7 @@ private slots:
void gotCellClick(int x, int y); void gotCellClick(int x, int y);
signals: signals:
void sendCenterTimeID(int32_t ID, double timestamp); void sendCenterTimeID(uint32_t ID, double timestamp);
private: private:
Ui::FlowViewWindow *ui; Ui::FlowViewWindow *ui;
+22 -22
View File
@@ -244,10 +244,10 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
{ {
int targettedID; int targettedID;
int minLen, maxLen, thisLen; int minLen, maxLen, thisLen;
uint64_t avgInterval; int64_t avgInterval;
uint64_t minInterval; int64_t minInterval;
uint64_t maxInterval; int64_t maxInterval;
uint64_t thisInterval; int64_t thisInterval;
int minData[8]; int minData[8];
int maxData[8]; int maxData[8];
int dataHistogram[256][8]; int dataHistogram[256][8];
@@ -377,8 +377,8 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
//qDebug() << referenceBits[c]; //qDebug() << referenceBits[c];
} }
std::vector<uint64_t> sortedIntervals; std::vector<int64_t> sortedIntervals;
uint64_t intervalSum = 0; int64_t intervalSum = 0;
//then find all data points //then find all data points
for (int j = 0; j < frameCache.count(); j++) for (int j = 0; j < frameCache.count(); j++)
@@ -387,7 +387,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
dataLen = frameCache.at(j).payload().length(); dataLen = frameCache.at(j).payload().length();
byteGraphX.append(j); byteGraphX.append(j);
for (uint32_t bytcnt = 0; bytcnt < dataLen; bytcnt++) for (int bytcnt = 0; bytcnt < dataLen; bytcnt++)
{ {
byteGraphY[bytcnt].append(data[bytcnt]); byteGraphY[bytcnt].append(data[bytcnt]);
} }
@@ -429,7 +429,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
} }
std::sort(sortedIntervals.begin(), sortedIntervals.end()); std::sort(sortedIntervals.begin(), sortedIntervals.end());
uint64_t intervalStdDiv = 0, intervalPctl5 = 0, intervalPctl95 = 0, intervalMean = 0, intervalVariance = 0; int64_t intervalStdDiv = 0, intervalPctl5 = 0, intervalPctl95 = 0, intervalMean = 0, intervalVariance = 0;
int maxTimeCounter = -1; int maxTimeCounter = -1;
if (sortedIntervals.size() > 0) if (sortedIntervals.size() > 0)
@@ -441,17 +441,17 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
} }
intervalVariance /= sortedIntervals.size(); intervalVariance /= sortedIntervals.size();
intervalStdDiv = sqrt(intervalVariance); intervalStdDiv = static_cast<int>(sqrt(intervalVariance));
intervalPctl5 = sortedIntervals[floor(0.05 * sortedIntervals.size())]; intervalPctl5 = sortedIntervals[static_cast<unsigned int>(floor(0.05 * sortedIntervals.size()))];
intervalPctl95 = sortedIntervals[floor(0.95 * sortedIntervals.size())]; intervalPctl95 = sortedIntervals[static_cast<unsigned int>(floor(0.95 * sortedIntervals.size()))];
uint64_t step = ceil((maxInterval - minInterval) / numIntervalHistBars); uint64_t step = static_cast<unsigned int>(ceil((maxInterval - minInterval) / numIntervalHistBars));
qDebug() << "Step: " << step << " minInt: " << minInterval << " maxInt: " << maxInterval; qDebug() << "Step: " << step << " minInt: " << minInterval << " maxInt: " << maxInterval;
int index = 0; unsigned int index = 0;
int counter = 0; int counter = 0;
for(int l = 0; l <= numIntervalHistBars; l++) { for(int l = 0; l <= numIntervalHistBars; l++) {
uint64_t currentMax = maxInterval - ((numIntervalHistBars - l) * step); // avoid missing the biggest value due to rounding errors int64_t currentMax = maxInterval - ((numIntervalHistBars - l) * step); // avoid missing the biggest value due to rounding errors
qDebug() << "CurrentMax: " << currentMax; qDebug() << "CurrentMax: " << currentMax;
while(index < sortedIntervals.size()) { while(index < sortedIntervals.size()) {
if(sortedIntervals[index] <= currentMax) { if(sortedIntervals[index] <= currentMax) {
@@ -483,22 +483,22 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Average inter-frame interval: ") + QString::number(avgInterval / 1000.0f) + "ms"); tempItem->setText(0, tr("Average inter-frame interval: ") + QString::number(avgInterval / 1000.0) + "ms");
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Minimum inter-frame interval: ") + QString::number(minInterval / 1000.0f) + "ms"); tempItem->setText(0, tr("Minimum inter-frame interval: ") + QString::number(minInterval / 1000.0) + "ms");
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Maximum inter-frame interval: ") + QString::number(maxInterval / 1000.0f) + "ms"); tempItem->setText(0, tr("Maximum inter-frame interval: ") + QString::number(maxInterval / 1000.0) + "ms");
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Inter-frame interval variation: ") + QString::number((maxInterval - minInterval) / 1000.0f) + "ms"); tempItem->setText(0, tr("Inter-frame interval variation: ") + QString::number((maxInterval - minInterval) / 1000.0) + "ms");
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Interval standard deviation: ") + QString::number(intervalStdDiv / 1000.0f) + "ms"); tempItem->setText(0, tr("Interval standard deviation: ") + QString::number(intervalStdDiv / 1000.0) + "ms");
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Minimum range to fit 90% of inter-frame intervals: ") + QString::number((intervalPctl95 - intervalPctl5) / 1000.0f) + "ms"); tempItem->setText(0, tr("Minimum range to fit 90% of inter-frame intervals: ") + QString::number((intervalPctl95 - intervalPctl5) / 1000.0) + "ms");
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
for (int c = 0; c < maxLen; c++) for (int c = 0; c < maxLen; c++)
{ {
@@ -515,7 +515,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
dataBase->addChild(tempItem); dataBase->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, tr("Range: ") + Utility::formatNumber((char)minData[c]) + tr(" to ") + Utility::formatNumber((char)maxData[c])); tempItem->setText(0, tr("Range: ") + Utility::formatNumber((unsigned int)minData[c]) + tr(" to ") + Utility::formatNumber((unsigned int)maxData[c]));
dataBase->addChild(tempItem); dataBase->addChild(tempItem);
histBase->setText(0, tr("Histogram")); histBase->setText(0, tr("Histogram"));
dataBase->addChild(histBase); dataBase->addChild(histBase);
@@ -525,7 +525,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
if (dataHistogram[d][c] > 0) if (dataHistogram[d][c] > 0)
{ {
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
tempItem->setText(0, QString::number(d) + "/0x" + QString::number(d, 16) +" (" + Utility::formatByteAsBinary(d) +") -> " + QString::number(dataHistogram[d][c])); tempItem->setText(0, QString::number(d) + "/0x" + QString::number(d, 16) +" (" + Utility::formatByteAsBinary(static_cast<uint8_t>(d)) +") -> " + QString::number(dataHistogram[d][c]));
histBase->addChild(tempItem); histBase->addChild(tempItem);
} }
} }
+1 -1
View File
@@ -71,7 +71,7 @@ private slots:
void zoomOut(); void zoomOut();
signals: signals:
void sendCenterTimeID(int32_t ID, double timestamp); void sendCenterTimeID(uint32_t ID, double timestamp);
private: private:
Ui::GraphingWindow *ui; Ui::GraphingWindow *ui;