diff --git a/bus_protocols/isotp_handler.cpp b/bus_protocols/isotp_handler.cpp index 4293699..583cdc5 100644 --- a/bus_protocols/isotp_handler.cpp +++ b/bus_protocols/isotp_handler.cpp @@ -356,7 +356,7 @@ void ISOTP_HANDLER::setProcessAll(bool 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; filt.ID = ID; @@ -366,7 +366,7 @@ void ISOTP_HANDLER::addFilter(uint32_t pBusId, uint32_t ID, uint32_t mask) 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++) { diff --git a/bus_protocols/isotp_handler.h b/bus_protocols/isotp_handler.h index 72ada5e..f45e0ba 100644 --- a/bus_protocols/isotp_handler.h +++ b/bus_protocols/isotp_handler.h @@ -22,8 +22,8 @@ public: void sendISOTPFrame(int bus, int ID, QByteArray data); void setProcessAll(bool state); void setFlowCtrl(bool state); - void addFilter(uint32_t pBusId, uint32_t ID, uint32_t mask); - void removeFilter(uint32_t pBusId, uint32_t ID, uint32_t mask); + void addFilter(int pBusId, uint32_t ID, uint32_t mask); + void removeFilter(int pBusId, uint32_t ID, uint32_t mask); void clearAllFilters(); public slots: diff --git a/bus_protocols/uds_handler.cpp b/bus_protocols/uds_handler.cpp index 29bbb47..d218c5d 100644 --- a/bus_protocols/uds_handler.cpp +++ b/bus_protocols/uds_handler.cpp @@ -326,7 +326,6 @@ QString UDS_HANDLER::getNegativeResponseLong(int respCode) QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg) { QString buildString; - bool isResponse = true; int dataSize; int addrSize; const unsigned char *data = reinterpret_cast(msg.payload().constData()); @@ -334,18 +333,15 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg) if (msg.isErrorReply) { - isResponse = true; buildString.append("UDS ERROR Response\n"); buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n"); } else if (msg.service < 0x3F || (msg.service > 0x7F && msg.service < 0xAF)) { - isResponse = false; buildString.append("UDS Request\n"); buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n"); } else { - isResponse = true; buildString.append("UDS Positive Response\n"); buildString.append("Service: " + getServiceLongDesc(msg.service - 0x40) + "\n"); } diff --git a/connections/canbus.h b/connections/canbus.h index fb2d382..b127059 100644 --- a/connections/canbus.h +++ b/connections/canbus.h @@ -9,7 +9,8 @@ public: CANBus(); CANBus(const CANBus&); bool operator==(const CANBus&) const; - virtual ~CANBus(){}; + CANBus& operator=(const CANBus& other) = default; + //virtual ~CANBus(){} int speed; bool listenOnly; diff --git a/connections/canconmanager.cpp b/connections/canconmanager.cpp index 9ae1f11..a1e0cab 100644 --- a/connections/canconmanager.cpp +++ b/connections/canconmanager.cpp @@ -214,7 +214,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) foreach (CANConnection* conn, mConns) { //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.isReceived = false; diff --git a/connections/canconnection.cpp b/connections/canconnection.cpp index 27850ff..ef6e176 100644 --- a/connections/canconnection.cpp +++ b/connections/canconnection.cpp @@ -8,8 +8,8 @@ CANConnection::CANConnection(QString pPort, int pNumBuses, int pQueueLen, bool pUseThread) : - mQueue(), mNumBuses(pNumBuses), + mQueue(), mPort(pPort), mDriver(pDriver), mType(pType), diff --git a/connections/gvretserial.cpp b/connections/gvretserial.cpp index d84a875..4275f0f 100644 --- a/connections/gvretserial.cpp +++ b/connections/gvretserial.cpp @@ -9,9 +9,9 @@ #include "gvretserial.h" GVRetSerial::GVRetSerial(QString portName, bool useTcp) : - 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 */ + CANConnection(portName, "gvret", CANCon::GVRET_SERIAL, 3, 4000, true), + mTimer(this), /*NB: set this as parent of timer to manage it from working thread */ + useTcp(useTcp) { sendDebug("GVRetSerial()"); diff --git a/connections/gvretserial.h b/connections/gvretserial.h index 3df1350..4dc5e47 100644 --- a/connections/gvretserial.h +++ b/connections/gvretserial.h @@ -91,7 +91,7 @@ protected: QUdpSocket *udpClient; int framesRapid; STATE rx_state; - uint32_t rx_step; + int rx_step; CANFrame buildFrame; qint64 buildTimestamp; quint32 buildId; diff --git a/dbc/dbchandler.cpp b/dbc/dbchandler.cpp index 0393e36..15b2207 100644 --- a/dbc/dbchandler.cpp +++ b/dbc/dbchandler.cpp @@ -46,7 +46,7 @@ bool DBCSignalHandler::addSignal(DBC_SIGNAL &sig) bool DBCSignalHandler::removeSignal(DBC_SIGNAL *sig) { - Q_UNUSED(sig); + Q_UNUSED(sig) //if (sigs.removeAll(*sig) > 0) return true; return false; } @@ -1698,7 +1698,7 @@ void DBCHandler::swapFiles(int pos1, int pos2) if (pos2 < 0) 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++) { - 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()); if (msg != nullptr) return msg; diff --git a/dbc/dbcloadsavewindow.cpp b/dbc/dbcloadsavewindow.cpp index 0c9b400..5cdedd9 100644 --- a/dbc/dbcloadsavewindow.cpp +++ b/dbc/dbcloadsavewindow.cpp @@ -270,6 +270,8 @@ void DBCLoadSaveWindow::editFile() void DBCLoadSaveWindow::matchingCriteriaChanged(int index) { + Q_UNUSED(index) + if (inhibitCellProcessing) return; // We don't know which combobox changed, so we just update all of them for (int row=0; rowtableFiles->rowCount(); row++) @@ -312,7 +314,7 @@ void DBCLoadSaveWindow::cellChanged(int row, int col) { DBCFile *file = dbcHandler->getFileByIdx(row); int bus = ui->tableFiles->item(row, col)->text().toInt(); - int numBuses = CANConManager::getInstance()->getNumBuses(); + //int numBuses = CANConManager::getInstance()->getNumBuses(); if (bus > -2) { file->setAssocBus(bus); diff --git a/dbc/dbcmaineditor.cpp b/dbc/dbcmaineditor.cpp index 8687ce6..df2e906 100644 --- a/dbc/dbcmaineditor.cpp +++ b/dbc/dbcmaineditor.cpp @@ -102,7 +102,7 @@ void DBCMainEditor::setFileIdx(int idx) void DBCMainEditor::closeEvent(QCloseEvent *event) { - Q_UNUSED(event); + Q_UNUSED(event) writeSettings(); sigEditor->close(); } @@ -197,7 +197,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col) if (dbcFile->findNodeByName(newName) != nullptr) //duplicates an existing node! { QMessageBox msg; - msg.setParent(0); + msg.setParent(nullptr); msg.setText("An existing node with that name already exists! Aborting!"); msg.exec(); return; @@ -275,7 +275,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col) if (msg != nullptr) { QMessageBox msg; - msg.setParent(0); + msg.setParent(nullptr); msg.setText("An existing msg with that ID already exists! Aborting!"); msg.exec(); @@ -296,7 +296,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col) { if ((uint) referenceFrames->at(i).frameId() == msgID) { - newMsg.len = referenceFrames->at(i).payload().length(); + newMsg.len = static_cast(referenceFrames->at(i).payload().length()); break; } } @@ -395,14 +395,14 @@ void DBCMainEditor::onCellClickedMessage(int row, int col) QTableWidgetItem* firstCol = ui->MessagesTable->item(row, 0); bool ret = false; DBC_MESSAGE *msg; - int msgID; + uint32_t msgID; if (col == 3) //3 is the signals field. If clicked we go to the signals dialog { QTableWidgetItem* msg = ui->MessagesTable->item(row, 0); if(msg) { QString idString = msg->text(); - DBC_MESSAGE *message = dbcFile->messageHandler->findMsgByID(Utility::ParseStringToNum(idString)); + DBC_MESSAGE *message = dbcFile->messageHandler->findMsgByID(static_cast(Utility::ParseStringToNum(idString))); sigEditor->setMessageRef(message); sigEditor->setFileIdx(fileIdx); sigEditor->setWindowModality(Qt::WindowModal); @@ -416,8 +416,8 @@ void DBCMainEditor::onCellClickedMessage(int row, int col) } if (col == 4) { - QColor newColor = QColorDialog::getColor(thisItem->backgroundColor()); - thisItem->setBackgroundColor(newColor); + QColor newColor = QColorDialog::getColor(thisItem->background().color()); + thisItem->setBackground(newColor); if(!firstCol) return; @@ -443,8 +443,8 @@ void DBCMainEditor::onCellClickedMessage(int row, int col) } if (col == 5) { - QColor newColor = QColorDialog::getColor(thisItem->backgroundColor()); - thisItem->setBackgroundColor(newColor); + QColor newColor = QColorDialog::getColor(thisItem->background().color()); + thisItem->setBackground(newColor); if(!firstCol) return; @@ -523,11 +523,11 @@ void DBCMainEditor::refreshMessagesTable(const DBC_NODE *node) QTableWidgetItem *msgLen = new QTableWidgetItem(QString::number(msg->len)); QTableWidgetItem *msgSignals = new QTableWidgetItem(QString::number(msg->sigHandler->getCount())); QTableWidgetItem *fgColor = new QTableWidgetItem(""); - if (msg->fgColor.isValid()) fgColor->setBackgroundColor(msg->fgColor); - else fgColor->setBackgroundColor(QColor(dbcFile->findAttributeByName("GenMsgForegroundColor")->defaultValue.toString())); + if (msg->fgColor.isValid()) fgColor->setBackground(msg->fgColor); + else fgColor->setBackground(QColor(dbcFile->findAttributeByName("GenMsgForegroundColor")->defaultValue.toString())); QTableWidgetItem *bgColor = new QTableWidgetItem(""); - if (msg->bgColor.isValid()) bgColor->setBackgroundColor(msg->bgColor); - else bgColor->setBackgroundColor(QColor(dbcFile->findAttributeByName("GenMsgBackgroundColor")->defaultValue.toString())); + if (msg->bgColor.isValid()) bgColor->setBackground(msg->bgColor); + else bgColor->setBackground(QColor(dbcFile->findAttributeByName("GenMsgBackgroundColor")->defaultValue.toString())); QTableWidgetItem *msgComment = new QTableWidgetItem(msg->comment); @@ -558,8 +558,8 @@ void DBCMainEditor::insertBlankRow() for(int i=1 ; i < ui->MessagesTable->columnCount(); i++) { QTableWidgetItem *item = new QTableWidgetItem(""); - if (i == 4) item->setBackgroundColor(QApplication::palette().color(QPalette::WindowText)); //foreground color - if (i == 5) item->setBackgroundColor(QApplication::palette().color(QPalette::Base)); + if (i == 4) item->setBackground(QApplication::palette().color(QPalette::WindowText)); //foreground color + if (i == 5) item->setBackground(QApplication::palette().color(QPalette::Base)); item->setFlags(item->flags() & ~Qt::ItemIsEditable); ui->MessagesTable->setItem(rowIdx, i, item); } diff --git a/jsedit.cpp b/jsedit.cpp index 96c64cb..aff5f81 100644 --- a/jsedit.cpp +++ b/jsedit.cpp @@ -997,11 +997,11 @@ void JSEdit::updateSidebar() int maxLines = blockCount(); for (int number = 10; number < maxLines; number *= 10) ++digits; - sw += fontMetrics().width('w') * digits; + sw += fontMetrics().horizontalAdvance('w') * digits; } if (d->codeFolding) { int fh = fontMetrics().lineSpacing(); - int fw = fontMetrics().width('w'); + int fw = fontMetrics().horizontalAdvance('w'); d->sidebar->foldIndicatorWidth = qMax(fw, fh); sw += d->sidebar->foldIndicatorWidth; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 99bab53..08a096e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -849,14 +849,14 @@ void MainWindow::showGraphingWindow() { if (!graphingWindow) { graphingWindow = new GraphingWindow(model->getListReference()); - connect(graphingWindow, SIGNAL(sendCenterTimeID(int32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double))); - connect(this, SIGNAL(sendCenterTimeID(int32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(graphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), this, 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 { - connect(graphingWindow, SIGNAL(sendCenterTimeID(int32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); - connect(flowViewWindow, SIGNAL(sendCenterTimeID(int32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(graphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); } graphingWindow->show(); } @@ -1026,14 +1026,14 @@ void MainWindow::showFlowViewWindow() flowViewWindow = new FlowViewWindow(model->getListReference()); else flowViewWindow = new FlowViewWindow(model->getFilteredListReference()); - connect(flowViewWindow, SIGNAL(sendCenterTimeID(int32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double))); - connect(this, SIGNAL(sendCenterTimeID(int32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double))); + connect(this, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); } if (graphingWindow) { - connect(graphingWindow, SIGNAL(sendCenterTimeID(int32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); - connect(flowViewWindow, SIGNAL(sendCenterTimeID(int32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(graphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), graphingWindow, SLOT(gotCenterTimeID(int32_t,double))); } flowViewWindow->show(); diff --git a/mainwindow.h b/mainwindow.h index eec38a8..e780f88 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -115,7 +115,7 @@ signals: void framesUpdated(int numFrames); //something has updated the frame list (send at gui update frequency) void frameUpdateRapid(int numFrames); void settingsUpdated(); - void sendCenterTimeID(int32_t ID, double timestamp); + void sendCenterTimeID(uint32_t ID, double timestamp); private: Ui::MainWindow *ui; diff --git a/motorcontrollerconfigwindow.cpp b/motorcontrollerconfigwindow.cpp index 1fe9dae..15b8d0d 100644 --- a/motorcontrollerconfigwindow.cpp +++ b/motorcontrollerconfigwindow.cpp @@ -51,9 +51,8 @@ MotorControllerConfigWindow::~MotorControllerConfigWindow() void MotorControllerConfigWindow::updatedFrames(int numFrames) { CANFrame thisFrame; - int id; - int param; - QTableWidgetItem *item; + uint32_t id; + QTableWidgetItem *item = nullptr; if (numFrames == -1) //all frames deleted { @@ -74,12 +73,12 @@ void MotorControllerConfigWindow::updatedFrames(int numFrames) { if ((char)thisFrame.payload()[2] == 0) { - int paramID = thisFrame.payload()[0] + (thisFrame.payload()[1] * 256); + uint32_t paramID = static_cast(thisFrame.payload()[0] + (thisFrame.payload()[1] * 256)); for (int i = 0; i < params.length(); i++) { if (params[i].paramID == paramID) { - params[i].value = thisFrame.payload()[4] + (thisFrame.payload()[5] * 256); + params[i].value = static_cast(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 == HEX) item = new QTableWidgetItem(Utility::formatHexNum(params[i].value)); if (params[i].paramType == DEC) diff --git a/re/filecomparatorwindow.cpp b/re/filecomparatorwindow.cpp index 8525470..a159146 100644 --- a/re/filecomparatorwindow.cpp +++ b/re/filecomparatorwindow.cpp @@ -36,7 +36,7 @@ void FileComparatorWindow::showEvent(QShowEvent *) void FileComparatorWindow::closeEvent(QCloseEvent *event) { - Q_UNUSED(event); + Q_UNUSED(event) writeSettings(); } @@ -118,8 +118,8 @@ void FileComparatorWindow::clearReference() void FileComparatorWindow::calculateDetails() { - QMap interestedIDs; - QMap referenceIDs; + QMap interestedIDs; + QMap referenceIDs; QTreeWidgetItem *interestedOnlyBase, *referenceOnlyBase = nullptr, *sharedBase, *bitmapBaseInterested, *bitmapBaseReference = nullptr; QTreeWidgetItem *valuesBase, *detail, *sharedItem, *valuesInterested, *valuesReference = nullptr; uint64_t tmp; @@ -131,7 +131,7 @@ void FileComparatorWindow::calculateDetails() QProgressDialog progress(this); progress.setWindowModality(Qt::WindowModal); progress.setLabelText("Calculating differences"); - progress.setCancelButton(0); + progress.setCancelButton(nullptr); progress.setRange(0,0); progress.setMinimumDuration(0); 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 { - for (unsigned int y = 0; y < dataLen; y++) + for (int y = 0; y < dataLen; y++) { interestedIDs[frame.frameId()].values[y][data[y]]++; tmp = data[y]; @@ -184,7 +184,7 @@ void FileComparatorWindow::calculateDetails() } } //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; 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 { - for (unsigned int y = 0; y < dataLen; y++) + for (int y = 0; y < dataLen; y++) { referenceIDs[frame.frameId()].values[y][data[y]]++; tmp = data[y]; @@ -229,7 +229,7 @@ void FileComparatorWindow::calculateDetails() } } //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; 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 //are shared bool interestedHadUnique = false; - QMap::iterator i; + QMap::iterator i; int framesCounter = 0; for (i = interestedIDs.begin(); i != interestedIDs.end(); ++i) { @@ -257,7 +257,7 @@ void FileComparatorWindow::calculateDetails() qApp->processEvents(); } - int keyone = i.key(); + uint32_t keyone = i.key(); if (!referenceIDs.contains(keyone)) { valuesBase = new QTreeWidgetItem(); @@ -324,7 +324,7 @@ void FileComparatorWindow::calculateDetails() for (int j = 0; j < 256; j++) { detail = new QTreeWidgetItem(); - detail->setText(0, Utility::formatHexNum(j)); + detail->setText(0, Utility::formatHexNum(static_cast(j))); if ((interested.values[i][j] > 0) && (reference.values[i][j] == 0) ) { valuesInterested->addChild(detail); @@ -344,10 +344,10 @@ void FileComparatorWindow::calculateDetails() if (!uniqueInterested) { - QMap::iterator itwo; + QMap::iterator itwo; for (itwo = referenceIDs.begin(); itwo != referenceIDs.end(); ++itwo) { - int keytwo = itwo.key(); + unsigned int keytwo = itwo.key(); if (!interestedIDs.contains(keytwo)) { valuesBase = new QTreeWidgetItem(); diff --git a/re/filecomparatorwindow.h b/re/filecomparatorwindow.h index d348255..61cef8c 100644 --- a/re/filecomparatorwindow.h +++ b/re/filecomparatorwindow.h @@ -14,7 +14,7 @@ class FileComparatorWindow; struct FrameData { - int ID; + uint32_t ID; int dataLen; uint64_t bitmap; int values[8][256]; //first index is the data byte, second is # of times we saw that value diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index 3cab711..9d8f3de 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -501,9 +501,8 @@ void FlowViewWindow::removeAllGraphs() void FlowViewWindow::createGraph(int byteNum) { int tempVal; - float minval=1000000, maxval = -100000; + double minval = 1000000.0, maxval = -100000.0; const unsigned char *data; - int dataLen = 0; const CANFrame *frame; qDebug() << "Create Graph " << byteNum; @@ -521,14 +520,13 @@ void FlowViewWindow::createGraph(int byteNum) { frame = &frameCache[j]; data = reinterpret_cast(frame->payload().constData()); - dataLen = frame->payload().length(); tempVal = data[byteNum]; if (graphByTime) { if (secondsMode){ - x[byteNum][j] = (double)(frame->timeStamp().microSeconds()) / 1000000.0; + x[byteNum][j] = frame->timeStamp().microSeconds() / 1000000.0; } else { diff --git a/re/flowviewwindow.h b/re/flowviewwindow.h index a18e5f3..258c614 100644 --- a/re/flowviewwindow.h +++ b/re/flowviewwindow.h @@ -40,7 +40,7 @@ private slots: void gotCellClick(int x, int y); signals: - void sendCenterTimeID(int32_t ID, double timestamp); + void sendCenterTimeID(uint32_t ID, double timestamp); private: Ui::FlowViewWindow *ui; diff --git a/re/frameinfowindow.cpp b/re/frameinfowindow.cpp index fa5e8a9..656549a 100644 --- a/re/frameinfowindow.cpp +++ b/re/frameinfowindow.cpp @@ -244,10 +244,10 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) { int targettedID; int minLen, maxLen, thisLen; - uint64_t avgInterval; - uint64_t minInterval; - uint64_t maxInterval; - uint64_t thisInterval; + int64_t avgInterval; + int64_t minInterval; + int64_t maxInterval; + int64_t thisInterval; int minData[8]; int maxData[8]; int dataHistogram[256][8]; @@ -377,8 +377,8 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) //qDebug() << referenceBits[c]; } - std::vector sortedIntervals; - uint64_t intervalSum = 0; + std::vector sortedIntervals; + int64_t intervalSum = 0; //then find all data points for (int j = 0; j < frameCache.count(); j++) @@ -387,7 +387,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) dataLen = frameCache.at(j).payload().length(); byteGraphX.append(j); - for (uint32_t bytcnt = 0; bytcnt < dataLen; bytcnt++) + for (int bytcnt = 0; bytcnt < dataLen; bytcnt++) { byteGraphY[bytcnt].append(data[bytcnt]); } @@ -429,7 +429,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) } 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; if (sortedIntervals.size() > 0) @@ -441,17 +441,17 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) } intervalVariance /= sortedIntervals.size(); - intervalStdDiv = sqrt(intervalVariance); + intervalStdDiv = static_cast(sqrt(intervalVariance)); - intervalPctl5 = sortedIntervals[floor(0.05 * sortedIntervals.size())]; - intervalPctl95 = sortedIntervals[floor(0.95 * sortedIntervals.size())]; + intervalPctl5 = sortedIntervals[static_cast(floor(0.05 * sortedIntervals.size()))]; + intervalPctl95 = sortedIntervals[static_cast(floor(0.95 * sortedIntervals.size()))]; - uint64_t step = ceil((maxInterval - minInterval) / numIntervalHistBars); + uint64_t step = static_cast(ceil((maxInterval - minInterval) / numIntervalHistBars)); qDebug() << "Step: " << step << " minInt: " << minInterval << " maxInt: " << maxInterval; - int index = 0; + unsigned int index = 0; int counter = 0; 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; while(index < sortedIntervals.size()) { if(sortedIntervals[index] <= currentMax) { @@ -483,22 +483,22 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) baseNode->addChild(tempItem); 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); 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); 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); 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); 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); 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); for (int c = 0; c < maxLen; c++) { @@ -515,7 +515,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) dataBase->addChild(tempItem); 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); histBase->setText(0, tr("Histogram")); dataBase->addChild(histBase); @@ -525,7 +525,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) if (dataHistogram[d][c] > 0) { 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(d)) +") -> " + QString::number(dataHistogram[d][c])); histBase->addChild(tempItem); } } diff --git a/re/graphingwindow.h b/re/graphingwindow.h index 0d4781e..20d35c1 100644 --- a/re/graphingwindow.h +++ b/re/graphingwindow.h @@ -71,7 +71,7 @@ private slots: void zoomOut(); signals: - void sendCenterTimeID(int32_t ID, double timestamp); + void sendCenterTimeID(uint32_t ID, double timestamp); private: Ui::GraphingWindow *ui;