Changed a lot of pointer references to const (it's more correct and

fixes a weird problem), fixed a problem with JSON to DBC, a few other
fixes
This commit is contained in:
Collin Kidder
2020-02-13 22:01:06 -05:00
parent 1a5d67d09e
commit d550fa79a0
18 changed files with 76 additions and 62 deletions
+3 -3
View File
@@ -123,7 +123,7 @@ void FileComparatorWindow::calculateDetails()
QTreeWidgetItem *interestedOnlyBase, *referenceOnlyBase = nullptr, *sharedBase, *bitmapBaseInterested, *bitmapBaseReference = nullptr;
QTreeWidgetItem *valuesBase, *detail, *sharedItem, *valuesInterested, *valuesReference = nullptr;
uint64_t tmp;
unsigned char *data;
const unsigned char *data;
int dataLen;
bool uniqueInterested = ui->ckUniqueToInterested->isChecked();
@@ -154,7 +154,7 @@ void FileComparatorWindow::calculateDetails()
for (int x = 0; x < interestedFrames.count(); x++)
{
CANFrame frame = interestedFrames.at(x);
data = reinterpret_cast<unsigned char *>(frame.payload().data());
data = reinterpret_cast<const unsigned char *>(frame.payload().constData());
dataLen = frame.payload().count();
if (interestedIDs.contains(frame.frameId())) //if we saw this ID before then add to the QList in there
@@ -201,7 +201,7 @@ void FileComparatorWindow::calculateDetails()
for (int x = 0; x < referenceFrames.count(); x++)
{
CANFrame frame = referenceFrames.at(x);
data = reinterpret_cast<unsigned char *>(frame.payload().data());
data = reinterpret_cast<const unsigned char *>(frame.payload().constData());
dataLen = frame.payload().count();
if (referenceIDs.contains(frame.frameId())) //if we saw this ID before then add to the QList in there
+4 -4
View File
@@ -397,7 +397,7 @@ void FlowViewWindow::updatedFrames(int numFrames)
{
QVector<double>newX[8];
QVector<double>newY[8];
unsigned char *data;
const unsigned char *data;
int dataLen = 0;
const CANFrame *thisFrame;
@@ -436,7 +436,7 @@ void FlowViewWindow::updatedFrames(int numFrames)
for (int i = modelFrames->count() - numFrames; i < modelFrames->count(); i++)
{
thisFrame = &modelFrames->at(i);
data = reinterpret_cast<unsigned char *>(thisFrame->payload().data());
data = reinterpret_cast<const unsigned char *>(thisFrame->payload().constData());
dataLen = thisFrame->payload().length();
if (!foundID.contains(thisFrame->frameId()))
@@ -502,7 +502,7 @@ void FlowViewWindow::createGraph(int byteNum)
{
int tempVal;
float minval=1000000, maxval = -100000;
unsigned char *data;
const unsigned char *data;
int dataLen = 0;
const CANFrame *frame;
@@ -520,7 +520,7 @@ void FlowViewWindow::createGraph(int byteNum)
for (int j = 0; j < numEntries; j++)
{
frame = &frameCache[j];
data = reinterpret_cast<unsigned char *>(frame->payload().data());
data = reinterpret_cast<const unsigned char *>(frame->payload().constData());
dataLen = frame->payload().length();
tempVal = data[byteNum];
+3 -3
View File
@@ -278,7 +278,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
if (thisFrame.frameId() == static_cast<uint32_t>(targettedID)) frameCache.append(thisFrame);
}
unsigned char *data = reinterpret_cast<unsigned char *>(frameCache.at(0).payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(frameCache.at(0).payload().constData());
int dataLen = frameCache.at(0).payload().length();
ui->treeDetails->clear();
@@ -367,7 +367,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
}
for (int j = 0; j < 64; j++) bitfieldHistogram[j] = 0;
data = reinterpret_cast<unsigned char *>(frameCache.at(0).payload().data());
data = reinterpret_cast<const unsigned char *>(frameCache.at(0).payload().constData());
dataLen = frameCache.at(0).payload().length();
for (int c = 0; c < dataLen; c++)
@@ -383,7 +383,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
//then find all data points
for (int j = 0; j < frameCache.count(); j++)
{
data = reinterpret_cast<unsigned char *>(frameCache.at(j).payload().data());
data = reinterpret_cast<const unsigned char *>(frameCache.at(j).payload().constData());
dataLen = frameCache.at(j).payload().length();
byteGraphX.append(j);
+2 -2
View File
@@ -208,7 +208,7 @@ void ISOTP_InterpreterWindow::showDetailView()
msg = &messages[rowNum];
unsigned char *data = reinterpret_cast<unsigned char *>(msg->payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(msg->payload().constData());
int dataLen = msg->payload().length();
if (msg->reportedLength != dataLen)
@@ -266,7 +266,7 @@ void ISOTP_InterpreterWindow::newISOMessage(ISOTP_MESSAGE msg)
int rowNum;
QString tempString;
unsigned char *data = reinterpret_cast<unsigned char *>(msg.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData());
int dataLen = msg.payload().length();
if ((msg.reportedLength != dataLen) && !ui->cbShowIncomplete->isChecked()) return;
+2 -2
View File
@@ -6,7 +6,7 @@
SnifferItem::SnifferItem(const CANFrame& pFrame, quint32 seq):
mID(pFrame.frameId())
{
unsigned char *data = reinterpret_cast<unsigned char *>(pFrame.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(pFrame.payload().constData());
int dataLen = pFrame.payload().length();
for (int i = 0; i < 0; i++) {
@@ -117,7 +117,7 @@ void SnifferItem::update(const CANFrame& pFrame, quint32 timeSeq, bool mute)
mLastTime = mCurrentTime;
mCurrSeqVal = timeSeq;
unsigned char *data = reinterpret_cast<unsigned char *>(pFrame.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(pFrame.payload().constData());
int dataLen = pFrame.payload().length();
/* copy new value */
+4 -1
View File
@@ -354,7 +354,7 @@ void UDSScanWindow::gotUDSReply(UDS_MESSAGE msg)
int offset = ui->spinReplyOffset->value();
UDS_MESSAGE sentFrame;
bool gotReply = false;
unsigned char *data = reinterpret_cast<unsigned char *>(msg.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData());
int dataLen = msg.payload().length();
int numSending = sendingFrames.length();
@@ -488,6 +488,9 @@ void UDSScanWindow::sendNextMsg()
else
{
waitTimer->stop();
udsHandler->setReception(false);
udsHandler->setProcessAllIDs(false);
udsHandler->setFlowCtrl(false);
ui->btnScan->setText("Start Scan");
currentlyRunning = false;
}