Fixed up a bunch of compiler warnings.

There should be no functional difference, just less noise when compiling
This commit is contained in:
Collin Kidder
2019-08-08 21:15:51 -04:00
parent 27fa8e6c8b
commit e7e65b7216
27 changed files with 187 additions and 187 deletions
+1 -1
View File
@@ -242,7 +242,7 @@ void ISOTP_HANDLER::processFrame(const CANFrame &frame)
}
break;
case 2: //subsequent frames for multi-frame messages
pMsg = NULL;
pMsg = nullptr;
for (int i = 0; i < messageBuffer.length(); i++)
{
if (messageBuffer[i].ID == ID)
+11 -11
View File
@@ -209,10 +209,13 @@ uint64_t CANFrameModel::getCANFrameVal(int row, Column col)
return frame.len;
case Column::ASCII: //sort both the same for now
case Column::Data:
for (int i = 0; i < frame.len; i++) temp += ((uint64_t)frame.data[i] << (56 - (8 * i)));
for (uint32_t i = 0; i < frame.len; i++) temp += ((uint64_t)frame.data[i] << (56 - (8 * i)));
//qDebug() << temp;
return temp;
case Column::NUM_COLUMN:
return 0;
}
return 0;
}
void CANFrameModel::qSortCANFrameAsc(QVector<CANFrame> *frames, Column column, int lowerBound, int upperBound)
@@ -295,9 +298,6 @@ void CANFrameModel::recalcOverwrite()
qDebug() << "recalcOverwrite called in model";
int lastUnique = 0;
bool found;
mutex.lock();
beginResetModel();
@@ -358,10 +358,10 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
if (role == Qt::BackgroundColorRole)
{
if (dbcHandler != NULL && interpretFrames)
if (dbcHandler != nullptr && interpretFrames)
{
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
if (msg != NULL)
if (msg != nullptr)
{
return msg->bgColor;
}
@@ -378,10 +378,10 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
if (role == Qt::TextColorRole)
{
if (dbcHandler != NULL && interpretFrames)
if (dbcHandler != nullptr && interpretFrames)
{
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
if (msg != NULL)
if (msg != nullptr)
{
return msg->fgColor;
}
@@ -454,10 +454,10 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
tempString.append(" ");
}
//now, if we're supposed to interpret the data and the DBC handler is loaded then use it
if (dbcHandler != NULL && interpretFrames)
if (dbcHandler != nullptr && interpretFrames)
{
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
if (msg != NULL)
if (msg != nullptr)
{
tempString.append(" <Interpreted>\n");
tempString.append(msg->name + "\n" + msg->comment + "\n");
@@ -763,7 +763,7 @@ void CANFrameModel::loadFilterFile(QString filename)
if (line.length() > 2)
{
QList<QByteArray> tokens = line.split(',');
ID = tokens[0].toInt(NULL, 16);
ID = tokens[0].toInt(nullptr, 16);
if (tokens[1].toUpper() == "T") filters.insert(ID, true);
else filters.insert(ID, false);
}
+1 -1
View File
@@ -17,5 +17,5 @@ CANConnection* CanConFactory::create(type pType, QString pPortName, QString pDri
default: {}
}
return NULL;
return nullptr;
}
+5 -5
View File
@@ -4,7 +4,7 @@
#include "canconmanager.h"
#include "canconfactory.h"
CANConManager* CANConManager::mInstance = NULL;
CANConManager* CANConManager::mInstance = nullptr;
CANConManager* CANConManager::getInstance()
{
@@ -43,7 +43,7 @@ void CANConManager::resetTimeBasis()
CANConManager::~CANConManager()
{
mTimer.stop();
mInstance = NULL;
mInstance = nullptr;
}
void CANConManager::stopAllConnections()
@@ -142,7 +142,7 @@ CANConnection* CANConManager::getByName(const QString& pName) const
return conn_p;
}
return NULL;
return nullptr;
}
@@ -159,9 +159,9 @@ void CANConManager::refreshConnection(CANConnection* pConn_p)
emit connectionStatusUpdated(buses);
}
if (pConn_p->getQueue().peek() == NULL) return;
if (pConn_p->getQueue().peek() == nullptr) return;
CANFrame* frame_p = NULL;
CANFrame* frame_p = nullptr;
QVector<CANFrame> frames;
//Each connection only knows about its own bus numbers
+2 -2
View File
@@ -16,7 +16,7 @@ CANConnection::CANConnection(QString pPort,
mIsCapSuspended(false),
mStatus(CANCon::NOT_CONNECTED),
mStarted(false),
mThread_p(NULL)
mThread_p(nullptr)
{
/* register types */
qRegisterMetaType<CANBus>("CANBus");
@@ -48,7 +48,7 @@ CANConnection::~CANConnection()
mThread_p->quit();
mThread_p->wait();
delete mThread_p;
mThread_p = NULL;
mThread_p = nullptr;
}
mBusData.clear();
+3 -3
View File
@@ -87,11 +87,11 @@ QVariant CANConnectionModel::data(const QModelIndex &index, int role) const
case CANCon::GVRET_SERIAL: return "GVRET";
default: {}
}
else qDebug() << "Tried to show connection type but connection was NULL";
else qDebug() << "Tried to show connection type but connection was nullptr";
break;
case Column::Port:
if (conn_p) return conn_p->getPort();
else qDebug() << "Tried to show connection port but connection was NULL";
else qDebug() << "Tried to show connection port but connection was nullptr";
break;
case Column::Subtype:
return conn_p->getDriver();
@@ -138,7 +138,7 @@ void CANConnectionModel::replace(int idx , CANConnection* pConn_p)
CANConnection* CANConnectionModel::getAtIdx(int pIdx) const
{
if (pIdx < 0)
return NULL;
return nullptr;
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
+12 -12
View File
@@ -15,9 +15,9 @@ GVRetSerial::GVRetSerial(QString portName, bool useTcp) :
{
sendDebug("GVRetSerial()");
serial = NULL;
tcpClient = NULL;
udpClient = NULL;
serial = nullptr;
tcpClient = nullptr;
udpClient = nullptr;
rx_state = IDLE;
rx_step = 0;
validationCounter = 10; //how many times we can miss validation before we die
@@ -46,7 +46,7 @@ void GVRetSerial::sendDebug(const QString debugText)
void GVRetSerial::sendToSerial(const QByteArray &bytes)
{
if (serial == NULL && tcpClient == NULL && udpClient == NULL)
if (serial == nullptr && tcpClient == nullptr && udpClient == nullptr)
{
sendDebug("Attempt to write to serial port when it has not been initialized!");
return;
@@ -238,7 +238,7 @@ bool GVRetSerial::piSendFrame(const CANFrame& frame)
framesRapid++;
if (serial == NULL && tcpClient == NULL && udpClient == NULL) return false;
if (serial == nullptr && tcpClient == nullptr && udpClient == nullptr) return false;
if (serial && !serial->isOpen()) return false;
if (tcpClient && !tcpClient->isOpen()) return false;
if (udpClient && !udpClient->isOpen()) return false;
@@ -422,7 +422,7 @@ void GVRetSerial::deviceConnected()
}
void GVRetSerial::disconnectDevice() {
if (serial != NULL)
if (serial != nullptr)
{
if (serial->isOpen())
{
@@ -432,9 +432,9 @@ void GVRetSerial::disconnectDevice() {
}
serial->disconnect(); //disconnect all signals
delete serial;
serial = NULL;
serial = nullptr;
}
if (tcpClient != NULL)
if (tcpClient != nullptr)
{
if (tcpClient->isOpen())
{
@@ -442,9 +442,9 @@ void GVRetSerial::disconnectDevice() {
}
tcpClient->disconnect();
delete tcpClient;
tcpClient = NULL;
tcpClient = nullptr;
}
if (udpClient != NULL)
if (udpClient != nullptr)
{
if (udpClient->isOpen())
{
@@ -452,7 +452,7 @@ void GVRetSerial::disconnectDevice() {
}
udpClient->disconnect();
delete udpClient;
udpClient = NULL;
udpClient = nullptr;
}
setStatus(CANCon::NOT_CONNECTED);
@@ -1004,7 +1004,7 @@ void GVRetSerial::handleTick()
//qDebug() << validationCounter;
if (validationCounter == 0 && doValidation)
{
if (serial == NULL && tcpClient == NULL) return;
if (serial == nullptr && tcpClient == nullptr) return;
if ( (serial && serial->isOpen()) || (tcpClient && tcpClient->isOpen()) || (udpClient && udpClient->isOpen())) //if it's still false we have a problem...
{
sendDebug("Comm validation failed.");
+15 -15
View File
@@ -56,7 +56,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
//if this is a multiplexed signal then we have to see if it is even found in the current message
if (isMultiplexed)
{
if (parentMessage->multiplexorSignal != NULL)
if (parentMessage->multiplexorSignal != nullptr)
{
int val;
if (!parentMessage->multiplexorSignal->processAsInt(frame, val)) return false;
@@ -145,7 +145,7 @@ bool DBC_SIGNAL::processAsInt(const CANFrame &frame, int32_t &outValue)
//if this is a multiplexed signal then we have to see if it is even found in the current message
if (isMultiplexed)
{
if (parentMessage->multiplexorSignal != NULL)
if (parentMessage->multiplexorSignal != nullptr)
{
int val;
if (!parentMessage->multiplexorSignal->processAsInt(frame, val)) return false;
@@ -187,7 +187,7 @@ bool DBC_SIGNAL::processAsDouble(const CANFrame &frame, double &outValue)
//if this is a multiplexed signal then we have to see if it is even found in the current message
if (isMultiplexed)
{
if (parentMessage->multiplexorSignal != NULL)
if (parentMessage->multiplexorSignal != nullptr)
{
int val;
if (!parentMessage->multiplexorSignal->processAsInt(frame, val)) return false;
@@ -243,7 +243,7 @@ bool DBC_SIGNAL::processAsDouble(const CANFrame &frame, double &outValue)
DBC_ATTRIBUTE_VALUE *DBC_SIGNAL::findAttrValByName(QString name)
{
if (attributes.length() == 0) return NULL;
if (attributes.length() == 0) return nullptr;
for (int i = 0; i < attributes.length(); i++)
{
if (attributes[i].attrName.compare(name, Qt::CaseInsensitive) == 0)
@@ -251,19 +251,19 @@ DBC_ATTRIBUTE_VALUE *DBC_SIGNAL::findAttrValByName(QString name)
return &attributes[i];
}
}
return NULL;
return nullptr;
}
DBC_ATTRIBUTE_VALUE *DBC_SIGNAL::findAttrValByIdx(int idx)
{
if (idx < 0) return NULL;
if (idx >= attributes.count()) return NULL;
if (idx < 0) return nullptr;
if (idx >= attributes.count()) return nullptr;
return &attributes[idx];
}
DBC_ATTRIBUTE_VALUE *DBC_MESSAGE::findAttrValByName(QString name)
{
if (attributes.length() == 0) return NULL;
if (attributes.length() == 0) return nullptr;
for (int i = 0; i < attributes.length(); i++)
{
if (attributes[i].attrName.compare(name, Qt::CaseInsensitive) == 0)
@@ -271,19 +271,19 @@ DBC_ATTRIBUTE_VALUE *DBC_MESSAGE::findAttrValByName(QString name)
return &attributes[i];
}
}
return NULL;
return nullptr;
}
DBC_ATTRIBUTE_VALUE *DBC_MESSAGE::findAttrValByIdx(int idx)
{
if (idx < 0) return NULL;
if (idx >= attributes.count()) return NULL;
if (idx < 0) return nullptr;
if (idx >= attributes.count()) return nullptr;
return &attributes[idx];
}
DBC_ATTRIBUTE_VALUE *DBC_NODE::findAttrValByName(QString name)
{
if (attributes.length() == 0) return NULL;
if (attributes.length() == 0) return nullptr;
for (int i = 0; i < attributes.length(); i++)
{
if (attributes[i].attrName.compare(name, Qt::CaseInsensitive) == 0)
@@ -291,12 +291,12 @@ DBC_ATTRIBUTE_VALUE *DBC_NODE::findAttrValByName(QString name)
return &attributes[i];
}
}
return NULL;
return nullptr;
}
DBC_ATTRIBUTE_VALUE *DBC_NODE::findAttrValByIdx(int idx)
{
if (idx < 0) return NULL;
if (idx >= attributes.count()) return NULL;
if (idx < 0) return nullptr;
if (idx >= attributes.count()) return nullptr;
return &attributes[idx];
}
+1 -1
View File
@@ -1468,7 +1468,7 @@ void DBCHandler::swapFiles(int pos1, int pos2)
* Convenience function that encapsulates a whole lot of the details.
* You give it a canbus frame and it'll tell you whether there is a loaded DBC file that can
* interpret that frame for you.
* Returns NULL if there is no message definition that matches.
* Returns nullptr if there is no message definition that matches.
*/
DBC_MESSAGE* DBCHandler::findMessage(const CANFrame &frame)
{
+13 -13
View File
@@ -193,7 +193,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
QString newName = ui->NodesTable->item(row, col)->text().simplified().replace(' ', '_');
qDebug() << "new name: " << newName;
if (newName.length() == 0) return;
if (dbcFile->findNodeByName(newName) != NULL) //duplicates an existing node!
if (dbcFile->findNodeByName(newName) != nullptr) //duplicates an existing node!
{
QMessageBox msg;
msg.setParent(0);
@@ -217,7 +217,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
{
DBC_NODE *oldNode = dbcFile->findNodeByIdx(row);
QString nodeName = ui->NodesTable->item(row, col)->text().simplified().replace(' ', '_');
if (oldNode == NULL) return;
if (oldNode == nullptr) return;
if (row != 0) oldNode->name = nodeName;
else nodeName = oldNode->name;
inhibitCellChanged = true;
@@ -230,7 +230,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
QString nodeName = ui->NodesTable->item(row, 0)->text().simplified().replace(' ', '_');
qDebug() << "searching for node " << nodeName;
DBC_NODE *thisNode = dbcFile->findNodeByName(nodeName);
if (thisNode == NULL) return;
if (thisNode == nullptr) return;
thisNode->comment = ui->NodesTable->item(row, col)->text().simplified();
qDebug() << "New comment: " << thisNode->comment;
}
@@ -240,15 +240,15 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
void DBCMainEditor::onCellChangedMessage(int row,int col)
{
QTableWidgetItem* item = NULL;
QTableWidgetItem* item = nullptr;
bool ret = false;
DBC_MESSAGE *msg = NULL;
DBC_MESSAGE *msg = nullptr;
uint msgID;
if (inhibitCellChanged) return;
DBC_NODE *node = dbcFile->findNodeByIdx(ui->NodesTable->currentRow());
if (node == NULL)
if (node == nullptr)
{
qDebug() << "No node set?!? This is bad!";
return;
@@ -271,7 +271,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
ui->MessagesTable->item(row, 0)->setText("");
return;
}
if (msg != NULL)
if (msg != nullptr)
{
QMessageBox msg;
msg.setParent(0);
@@ -328,7 +328,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
{
QString msgName = ui->MessagesTable->item(row, 1)->text().simplified().replace(' ', '_');
if (msgName.length() == 0) return;
if( ret && (msg!=NULL) )
if( ret && (msg!=nullptr) )
msg->name = msgName;
break;
}
@@ -349,7 +349,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
ui->MessagesTable->item(row, col)->setText(QString::number(msgLen));
}
if( ret && (msg!=NULL) )
if( ret && (msg!=nullptr) )
msg->len = msgLen;
break;
}
@@ -358,7 +358,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
case 6: //comment
{
QString msgComment = ui->MessagesTable->item(row, col)->text().simplified();
if( ret && (msgComment!=NULL) )
if( ret && (msgComment!=nullptr) )
msg->comment = msgComment;
break;
}
@@ -376,7 +376,7 @@ void DBCMainEditor::onCellClickedNode(int row, int col)
currRow = row;
QTableWidgetItem *item = ui->NodesTable->item(currRow, 0);
QString nodeName;
if (item == NULL) return;
if (item == nullptr) return;
nodeName = item->text();
qDebug() << "Trying to find node with name " << nodeName;
@@ -476,7 +476,7 @@ void DBCMainEditor::refreshNodesTable()
int rowIdx;
if (dbcFile->findNodeByName("Vector__XXX") == NULL)
if (dbcFile->findNodeByName("Vector__XXX") == nullptr)
{
DBC_NODE newNode;
newNode.name = "Vector__XXX";
@@ -509,7 +509,7 @@ void DBCMainEditor::refreshMessagesTable(const DBC_NODE *node)
int rowIdx;
if (node != NULL)
if (node != nullptr)
{
for (int x = 0; x < dbcFile->messageHandler->getCount(); x++)
{
+23 -23
View File
@@ -17,8 +17,8 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
qsrand(QDateTime::currentMSecsSinceEpoch());
dbcHandler = DBCHandler::getReference();
dbcMessage = NULL;
currentSignal = NULL;
dbcMessage = nullptr;
currentSignal = nullptr;
QStringList headers2;
headers2 << "Value" << "Text";
@@ -46,7 +46,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->cbIntelFormat, &QCheckBox::toggled,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked();
if (currentSignal->valType == SP_FLOAT || currentSignal->valType == DP_FLOAT)
currentSignal->intelByteOrder = false;
@@ -56,13 +56,13 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->comboReceiver, &QComboBox::currentTextChanged,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
currentSignal->receiver = dbcFile->findNodeByName(ui->comboReceiver->currentText());
});
connect(ui->comboType, &QComboBox::currentTextChanged,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
switch (ui->comboType->currentIndex())
{
case 0:
@@ -92,7 +92,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtBias, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
double temp;
bool result;
temp = ui->txtBias->text().toDouble(&result);
@@ -102,7 +102,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtMaxVal, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
double temp;
bool result;
temp = ui->txtMaxVal->text().toDouble(&result);
@@ -112,7 +112,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtMinVal, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
double temp;
bool result;
temp = ui->txtMinVal->text().toDouble(&result);
@@ -121,7 +121,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtScale, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
double temp;
bool result;
temp = ui->txtScale->text().toDouble(&result);
@@ -130,20 +130,20 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtComment, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
currentSignal->comment = ui->txtComment->text().simplified().replace(' ', '_');
});
connect(ui->txtUnitName, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
currentSignal->unitName = ui->txtUnitName->text().simplified().replace(' ', '_');
});
connect(ui->txtBitLength, &QLineEdit::textChanged,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
int temp;
temp = Utility::ParseStringToNum(ui->txtBitLength->text());
if (temp < 0) return;
@@ -155,7 +155,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtName, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
QString tempNameStr = ui->txtName->text().simplified().replace(' ', '_');
if (tempNameStr.length() > 0) currentSignal->name = tempNameStr;
//need to update the list too.
@@ -165,7 +165,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
connect(ui->txtMultiplexValue, &QLineEdit::editingFinished,
[=]()
{
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
int temp;
temp = Utility::ParseStringToNum(ui->txtMultiplexValue->text());
//TODO: could look up the multiplexor and ensure that the value is within a range that the multiplexor could return
@@ -179,7 +179,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
currentSignal->isMultiplexed = true;
currentSignal->isMultiplexor = false;
//if the set multiplexor for the message was this signal then clear it
if (dbcMessage->multiplexorSignal == currentSignal) dbcMessage->multiplexorSignal = NULL;
if (dbcMessage->multiplexorSignal == currentSignal) dbcMessage->multiplexorSignal = nullptr;
}
});
@@ -189,7 +189,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
if (state && currentSignal) //signal is now set as a multiplexed signal
{
//don't allow this signal to be a multiplexor if there is already one for this message.
//if (dbcMessage->multiplexorSignal != currentSignal && dbcMessage->multiplexorSignal != NULL) return; //I spoke too soon above...
//if (dbcMessage->multiplexorSignal != currentSignal && dbcMessage->multiplexorSignal != nullptr) return; //I spoke too soon above...
currentSignal->isMultiplexed = false;
currentSignal->isMultiplexor = true;
//we just set that this is the multiplexor so update the message to show that as well.
@@ -204,7 +204,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
{
currentSignal->isMultiplexed = false;
currentSignal->isMultiplexor = false;
if (dbcMessage->multiplexorSignal == currentSignal) dbcMessage->multiplexorSignal = NULL;
if (dbcMessage->multiplexorSignal == currentSignal) dbcMessage->multiplexorSignal = nullptr;
}
});
@@ -286,7 +286,7 @@ void DBCSignalEditor::showEvent(QShowEvent* event)
{
QDialog::showEvent(event);
currentSignal = NULL;
currentSignal = nullptr;
refreshSignalsList();
}
@@ -422,7 +422,7 @@ void DBCSignalEditor::deleteCurrentSignal()
{
delete(ui->signalsList->item(currIdx));
dbcMessage->sigHandler->removeSignal(currIdx);
currentSignal = NULL;
currentSignal = nullptr;
}
}
@@ -461,7 +461,7 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
{
unsigned char bitpattern[8];
if (sig == NULL) {
if (sig == nullptr) {
ui->groupBox->setEnabled(false);
ui->txtName->setText("");
ui->txtBias->setText("");
@@ -578,7 +578,7 @@ void DBCSignalEditor::fillValueTable(DBC_SIGNAL *sig)
ui->valuesTable->clearContents();
ui->valuesTable->setRowCount(0);
if (sig == NULL) {
if (sig == nullptr) {
ui->valuesTable->setEnabled(false);
inhibitCellChanged = false;
return;
@@ -606,7 +606,7 @@ void DBCSignalEditor::clickSignalList(int row)
{
//qDebug() << ui->signalsList->item(row)->text();
DBC_SIGNAL *thisSig = (row<0) ? NULL : dbcMessage->sigHandler->findSignalByName(ui->signalsList->item(row)->text());
DBC_SIGNAL *thisSig = (row<0) ? nullptr : dbcMessage->sigHandler->findSignalByName(ui->signalsList->item(row)->text());
currentSignal = thisSig;
fillSignalForm(thisSig);
fillValueTable(thisSig);
@@ -615,7 +615,7 @@ void DBCSignalEditor::clickSignalList(int row)
void DBCSignalEditor::bitfieldClicked(int x, int y)
{
int bit = (7 - x) + (y * 8);
if (currentSignal == NULL) return;
if (currentSignal == nullptr) return;
currentSignal->startBit = bit;
if (currentSignal->valType == SP_FLOAT)
{
+50 -50
View File
@@ -50,7 +50,7 @@ bool FrameFileIO::saveFrameFile(QString &fileName, const QVector<CANFrame>* fram
QProgressDialog progress(qApp->activeWindow());
progress.setWindowModality(Qt::WindowModal);
progress.setLabelText("Saving file...");
progress.setCancelButton(0);
progress.setCancelButton(nullptr);
progress.setRange(0,0);
progress.setMinimumDuration(0);
progress.show();
@@ -176,7 +176,7 @@ bool FrameFileIO::loadFrameFile(QString &fileName, QVector<CANFrame>* frameCache
QProgressDialog progress(qApp->activeWindow());
progress.setWindowModality(Qt::WindowModal);
progress.setLabelText("Loading file...");
progress.setCancelButton(0);
progress.setCancelButton(nullptr);
progress.setRange(0,0);
progress.setMinimumDuration(0);
progress.show();
@@ -424,7 +424,7 @@ bool FrameFileIO::isVehicleSpyFile(QString filename)
QList<QByteArray> tokens = line.split(',');
if (tokens.length() > 20)
{
if (tokens[9].toInt(NULL, 16) > 0) isMatch = true;
if (tokens[9].toInt(nullptr, 16) > 0) isMatch = true;
}
}
}
@@ -483,11 +483,11 @@ bool FrameFileIO::loadVehicleSpyFile(QString filename, QVector<CANFrame> *frames
thisFrame.bus = 0;
thisFrame.remote = false;
tempTime = now;
tempTime.addMSecs(tokens[1].toDouble() * 1000.0);
thisFrame.timestamp = tempTime.toMSecsSinceEpoch() * 1000ul;
tempTime = tempTime.addMSecs(tokens[1].toDouble() * 1000.0);
thisFrame.timestamp = static_cast<uint64_t>(tempTime.toMSecsSinceEpoch() * 1000);
if (tokens[5].startsWith("T")) thisFrame.isReceived = false;
else thisFrame.isReceived = true;
thisFrame.ID = tokens[9].toInt(NULL, 16);
thisFrame.ID = tokens[9].toInt(nullptr, 16);
if (tokens[11].startsWith("T")) thisFrame.extended = true;
else thisFrame.extended = false;
@@ -496,7 +496,7 @@ bool FrameFileIO::loadVehicleSpyFile(QString filename, QVector<CANFrame> *frames
{
if (tokens[12 + i].length() > 0)
{
thisFrame.data[i] = tokens[12 + i].toInt(NULL, 16);
thisFrame.data[i] = tokens[12 + i].toInt(nullptr, 16);
thisFrame.len++;
}
else break;
@@ -648,7 +648,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
}
if (firstChar == 'R' || firstChar == 'T')
{
thisFrame.ID = tokens[2].toInt(NULL, 16);
thisFrame.ID = tokens[2].toInt(nullptr, 16);
if (tokens[1] == "R29" || tokens[1] == "T29") thisFrame.extended = true;
else thisFrame.extended = false;
if (firstChar == 'T') thisFrame.isReceived = false;
@@ -659,7 +659,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
{
if (tokens[d + 3] != "")
{
thisFrame.data[d] = tokens[d + 3].toInt(NULL, 16);
thisFrame.data[d] = tokens[d + 3].toInt(nullptr, 16);
}
else thisFrame.data[d] = 0;
}
@@ -700,7 +700,7 @@ bool FrameFileIO::isCANHackerFile(QString filename)
QList<QByteArray> tokens = line.split(' ');
if (tokens.length() > 3)
{
if (tokens[1].toInt(NULL, 16) > 0)
if (tokens[1].toInt(nullptr, 16) > 0)
{
int len = tokens[2].toInt();
if (len > -1 && len < 9)
@@ -769,17 +769,17 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
}
//qDebug() << "decimal places " << decimalPlaces;
thisFrame.timestamp = (int64_t)(tokens[0].toDouble() * multiplier);
thisFrame.ID = tokens[1].toInt(NULL, 16);
thisFrame.ID = tokens[1].toInt(nullptr, 16);
thisFrame.extended = (thisFrame.ID > 0x7FF);
thisFrame.isReceived = true;
thisFrame.remote = false;
thisFrame.bus = 0;
thisFrame.len = tokens[2].toInt(NULL, 16);
thisFrame.len = tokens[2].toInt(nullptr, 16);
for (unsigned int d = 0; d < thisFrame.len; d++)
{
if (tokens[d + 3] != "")
{
thisFrame.data[d] = tokens[d + 3].toInt(NULL, 16);
thisFrame.data[d] = tokens[d + 3].toInt(nullptr, 16);
}
else thisFrame.data[d] = 0;
}
@@ -896,7 +896,7 @@ bool FrameFileIO::loadCANOpenFile(QString filename, QVector<CANFrame>* frames)
{
if (dataTok[d] != "")
{
thisFrame.data[d] = dataTok[d].simplified().toInt(NULL, 16);
thisFrame.data[d] = dataTok[d].simplified().toInt(nullptr, 16);
}
else thisFrame.data[d] = 0;
}
@@ -993,7 +993,7 @@ bool FrameFileIO::isPCANFile(QString filename)
{
if (fileVersion == 1)
{
int id = line.mid(28, 8).simplified().toUInt(NULL, 16);
int id = line.mid(28, 8).simplified().toUInt(nullptr, 16);
if (id > 0 && id < 0x1FFFFFFF)
{
int len = line.mid(38,1).toInt();
@@ -1004,7 +1004,7 @@ bool FrameFileIO::isPCANFile(QString filename)
else if (fileVersion == 2)
{
int id = line.mid(25, 8).simplified().toUInt(NULL, 16);
int id = line.mid(25, 8).simplified().toUInt(nullptr, 16);
if (id > 0 && id < 0x1FFFFFFF)
{
int len = line.mid(37,2).trimmed().toInt();
@@ -1083,7 +1083,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
if (fileVersion == 1)
{
thisFrame.timestamp = (uint64_t)(line.mid(10, 8).simplified().toDouble() * 1000.0);
thisFrame.ID = line.mid(28, 8).simplified().toUInt(NULL, 16);
thisFrame.ID = line.mid(28, 8).simplified().toUInt(nullptr, 16);
if (thisFrame.ID < 0x1FFFFFFF)
{
thisFrame.len = line.mid(38,1).toInt();
@@ -1104,7 +1104,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{
if (tokens[d] != "")
{
thisFrame.data[d] = tokens[d].toInt(NULL, 16);
thisFrame.data[d] = tokens[d].toInt(nullptr, 16);
}
else thisFrame.data[d] = 0;
}
@@ -1115,7 +1115,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
else if (fileVersion == 2)
{
thisFrame.timestamp = (uint64_t)(line.mid(8, 13).simplified().toDouble() * 1000.0);
thisFrame.ID = line.mid(25, 8).simplified().toUInt(NULL, 16);
thisFrame.ID = line.mid(25, 8).simplified().toUInt(nullptr, 16);
if (thisFrame.ID < 0x1FFFFFFF)
{
thisFrame.len = line.mid(37,2).trimmed().toInt();
@@ -1136,7 +1136,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{
if (tokens[d] != "")
{
thisFrame.data[d] = tokens[d].toInt(NULL, 16);
thisFrame.data[d] = tokens[d].toInt(nullptr, 16);
}
else thisFrame.data[d] = 0;
}
@@ -1192,7 +1192,7 @@ bool FrameFileIO::isCanalyzerASC(QString filename)
{
uint64_t time = (uint64_t)(tokens[0].toDouble() * (double)1000000.0);
if (time <= 0) isMatch = false;
int id = tokens[2].toUInt(NULL, 16);
int id = tokens[2].toUInt(nullptr, 16);
if (id < 1 || id > 0x1FFFFFFF) isMatch = false;
int len = tokens[5].toUInt();
if (len < 0 || len > 8) isMatch = false;
@@ -1259,7 +1259,7 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
if (tokens.length() > 5)
{
thisFrame.timestamp = (uint64_t)(tokens[0].toDouble() * (double)1000000.0);
thisFrame.ID = tokens[2].toUInt(NULL, 16);
thisFrame.ID = tokens[2].toUInt(nullptr, 16);
thisFrame.len = tokens[5].toUInt();
if (thisFrame.len > 8) return false;
thisFrame.isReceived = tokens[3].toUpper().contains("RX");
@@ -1270,7 +1270,7 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
{
if (tokens.count() > d)
{
thisFrame.data[d - 6] = tokens[d].toInt(NULL, 16);
thisFrame.data[d - 6] = tokens[d].toInt(nullptr, 16);
}
else //expected byte wasn't there to read. Set it zero and set error flag
{
@@ -1497,7 +1497,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
thisFrame.timestamp = timeStamp;
}
thisFrame.ID = tokens[1].toInt(NULL, 16);
thisFrame.ID = tokens[1].toInt(nullptr, 16);
if (tokens[2].toUpper().contains("TRUE")) thisFrame.extended = 1;
else thisFrame.extended = 0;
@@ -1512,7 +1512,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
for (int c = 0; c < 8; c++) thisFrame.data[c] = 0;
if (thisFrame.len + 5 > (unsigned int) tokens.length()) thisFrame.len = tokens.length() - 5;
for (unsigned int d = 0; d < thisFrame.len; d++)
thisFrame.data[d] = tokens[5 + d].toInt(NULL, 16);
thisFrame.data[d] = tokens[5 + d].toInt(nullptr, 16);
}
else if (fileVersion == 2)
{
@@ -1524,7 +1524,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
if (thisFrame.len + 6 > (unsigned int) tokens.length()) thisFrame.len = tokens.length() - 6;
for (int c = 0; c < 8; c++) thisFrame.data[c] = 0;
for (unsigned int d = 0; d < thisFrame.len; d++)
thisFrame.data[d] = tokens[6 + d].toInt(NULL, 16);
thisFrame.data[d] = tokens[6 + d].toInt(nullptr, 16);
}
frames->append(thisFrame);
@@ -1706,7 +1706,7 @@ bool FrameFileIO::isGenericCSVFile(QString filename)
{
QList<QByteArray> tokens = line.split(',');
int ID = tokens[0].toInt(NULL, 16);
int ID = tokens[0].toInt(nullptr, 16);
if (ID < 1 || ID > 0x1FFFFFFF) isMatch = false;
if (tokens.count() < 2)
@@ -1767,7 +1767,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector<CANFrame>* frames
timeStamp += 5000;
thisFrame.timestamp = timeStamp;
thisFrame.ID = tokens[0].toInt(NULL, 16);
thisFrame.ID = tokens[0].toInt(nullptr, 16);
if (thisFrame.ID > 0x7FF) thisFrame.extended = true;
else thisFrame.extended = false;
thisFrame.bus = 0;
@@ -1775,7 +1775,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector<CANFrame>* frames
QList<QByteArray> dataTok = tokens[1].split(' ');
thisFrame.len = dataTok.length();
if (thisFrame.len > 8) thisFrame.len = 8;
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = dataTok[d].toInt(NULL, 16);
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = dataTok[d].toInt(nullptr, 16);
frames->append(thisFrame);
}
@@ -1859,7 +1859,7 @@ bool FrameFileIO::isLogFile(QString filename)
QList<QByteArray> timeToks = tokens[0].split(':');
if (timeToks.count() != 4) isMatch = false;
int ID = tokens[3].right(tokens[3].length() - 2).toInt(NULL, 16);
int ID = tokens[3].right(tokens[3].length() - 2).toInt(nullptr, 16);
if (ID < 1 || ID > 0x1FFFFFFF) isMatch = false;
if (tokens[4] != "S" && tokens[4] != "X" && tokens[4] != "SR" && tokens[4] != "XR") isMatch = false;
int len = tokens[5].toUInt();
@@ -1949,7 +1949,7 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
thisFrame.timestamp = timeStamp;
if (tokens[1].at(0) == 'R') thisFrame.isReceived = true;
else thisFrame.isReceived = false;
thisFrame.ID = tokens[3].right(tokens[3].length() - 2).toInt(NULL, 16);
thisFrame.ID = tokens[3].right(tokens[3].length() - 2).toInt(nullptr, 16);
if (tokens[4] == "S") {
thisFrame.extended = false;
thisFrame.remote = false;
@@ -1968,7 +1968,7 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
if (thisFrame.len > 8) thisFrame.len = 8;
if (!thisFrame.remote) {
for (unsigned int d = 0; d < thisFrame.len; d++)
thisFrame.data[d] = tokens[d + 6].toInt(NULL, 16);
thisFrame.data[d] = tokens[d + 6].toInt(nullptr, 16);
}
frames->append(thisFrame);
}
@@ -2135,7 +2135,7 @@ bool FrameFileIO::loadIXXATFile(QString filename, QVector<CANFrame>* frames)
return false;
}
thisFrame.timestamp = timeStamp;
thisFrame.ID = Utility::unQuote(tokens[1]).toInt(NULL, 16);
thisFrame.ID = Utility::unQuote(tokens[1]).toInt(nullptr, 16);
QString tempStr = Utility::unQuote(tokens[2]).toUpper();
if (tempStr.length() > 0)
{
@@ -2156,7 +2156,7 @@ bool FrameFileIO::loadIXXATFile(QString filename, QVector<CANFrame>* frames)
QStringList dataToks = Utility::unQuote(tokens[4]).simplified().split(' ');
thisFrame.len = dataToks.length();
if (thisFrame.len > 8) return false;
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = dataToks[d].toInt(NULL, 16);
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = dataToks[d].toInt(nullptr, 16);
frames->append(thisFrame);
}
else return false;
@@ -2184,7 +2184,7 @@ bool FrameFileIO::saveIXXATFile(QString filename, const QVector<CANFrame>* frame
outFile->write("ASCII Trace IXXAT SavvyCAN V" + QString::number(VERSION).toUtf8() + "\n");
outFile->write("Date: " + timestamp.toString("d:M:yyyy").toUtf8() + "\n");
outFile->write("Start time: " + timestamp.toString("h:m:s").toUtf8() + "\n");
timestamp.addMSecs((frames->last().timestamp - frames->first().timestamp) / 1000);
timestamp = timestamp.addMSecs((frames->last().timestamp - frames->first().timestamp) / 1000);
outFile->write("Stop time: " + timestamp.toString("h:m:s").toUtf8() + "\n");
outFile->write("Overruns: 0\n");
outFile->write("Baudrate: 500 kbit/s\n"); //could be a lie... this code has no way to know the baud rate (at the moment)
@@ -2609,12 +2609,12 @@ bool FrameFileIO::isTraceFile(QString filename)
QList<QByteArray> timestampToks = tokens[1].split(':');
if (timestampToks.count() != 4) isMatch = false;
int ID = tokens[2].toLong(NULL, 16);
long ID = tokens[2].toLong(nullptr, 16);
if (ID < 1 || ID > 0x1FFFFFFF) isMatch = false;
int len = tokens[3].toInt();
if (len > 8 || len < 0) isMatch = false;
QList<QByteArray> dataToks = tokens[4].split(' ');
if (len > (unsigned int) dataToks.length()) isMatch = false;
if (len > dataToks.length()) isMatch = false;
}
else isMatch = false;
}
@@ -2699,14 +2699,14 @@ bool FrameFileIO::loadTraceFile(QString filename, QVector<CANFrame>* frames)
{
QList<QByteArray> timestampToks = tokens[1].split(':');
timeStamp = timestampToks[0].toInt() * 1000000ul * 60 * 60;
timeStamp += timestampToks[1].toInt() * 1000000ul * 60;
timeStamp += timestampToks[2].toInt() * 1000000ul;
timeStamp = timestampToks[0].toInt() * 1000000l * 60 * 60;
timeStamp += timestampToks[1].toInt() * 1000000l * 60;
timeStamp += timestampToks[2].toInt() * 1000000l;
timeStamp += timestampToks[3].toInt() * 100;
thisFrame.timestamp = timeStamp;
thisFrame.timestamp = static_cast<uint32_t>(timeStamp);
thisFrame.ID = tokens[2].toLong(NULL, 16);
thisFrame.ID = static_cast<uint32_t>(tokens[2].toLong(nullptr, 16));
if (thisFrame.ID <= 0x7FF) thisFrame.extended = false;
else thisFrame.extended = true;
thisFrame.bus = 0;
@@ -2714,8 +2714,8 @@ bool FrameFileIO::loadTraceFile(QString filename, QVector<CANFrame>* frames)
thisFrame.len = tokens[3].toUInt();
if (thisFrame.len > 8) thisFrame.len = 8;
QList<QByteArray> dataToks = tokens[4].split(' ');
if (thisFrame.len > (unsigned int) dataToks.length()) thisFrame.len = (unsigned int) dataToks.length();
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)dataToks[d].toInt(NULL, 16);
if (thisFrame.len > (unsigned int) dataToks.length()) thisFrame.len = static_cast<unsigned int>(dataToks.length());
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)dataToks[d].toInt(nullptr, 16);
frames->append(thisFrame);
}
else foundErrors = true;
@@ -3044,9 +3044,9 @@ bool FrameFileIO::loadCanDumpFile(QString filename, QVector<CANFrame>* frames)
else thisFrame.extended = false;
thisFrame.remote = false;
thisFrame.len = tokens[3].at(1) - '0';
for (int c = 0; c < thisFrame.len; c++)
for (uint32_t c = 0; c < thisFrame.len; c++)
{
thisFrame.data[c] = tokens[4 + c].toInt(nullptr, 16);
thisFrame.data[c] = static_cast<unsigned char>(tokens[4 + c].toInt(nullptr, 16));
}
}
else //the more concise format (first one from list above)
@@ -3061,7 +3061,7 @@ bool FrameFileIO::loadCanDumpFile(QString filename, QVector<CANFrame>* frames)
}
/* ID */
thisFrame.ID = IdValExp.cap(1).toInt(&ret, 16);
thisFrame.ID = static_cast<uint32_t>(IdValExp.cap(1).toInt(&ret, 16));
if (IdValExp.cap(1).length() > 3) {
thisFrame.extended = true;
} else {
@@ -3185,13 +3185,13 @@ bool FrameFileIO::loadKvaserFile(QString filename, QVector<CANFrame> *frames, bo
//Chn Identifier Flg DLC D0...1...2...3...4...5...6..D7 Time Dir
// 0 000000AD 8 FF FF 00 00 00 00 00 00 154.266550 R
thisFrame.bus = line.mid(0,3).simplified().toInt();
thisFrame.ID = line.mid(4,10).simplified().toInt(NULL, base);
thisFrame.ID = line.mid(4,10).simplified().toInt(nullptr, base);
if (thisFrame.ID > 0x7FF) thisFrame.extended = true;
else thisFrame.extended = false;
thisFrame.remote = false;
thisFrame.len = line.mid(21, 3).simplified().toInt();
for (int i = 0; i < 8; i++) {
thisFrame.data[i] = line.mid(25 + i * 4, 3).simplified().toInt(NULL, base);
thisFrame.data[i] = line.mid(25 + i * 4, 3).simplified().toInt(nullptr, base);
}
thisFrame.timestamp = line.mid(57, 14).simplified().toDouble() * 1000000;
if (line.mid(72, 1).toUpper() == "R") thisFrame.isReceived = true;
@@ -3328,7 +3328,7 @@ bool FrameFileIO::loadCabanaFile(QString filename, QVector<CANFrame>* frames)
thisFrame.len = 8;
{
unsigned long long int tempData = tokens[3].toULongLong(NULL, 16);
unsigned long long int tempData = tokens[3].toULongLong(nullptr, 16);
thisFrame.data[0] = ((tempData >> 56) & 0xFF);
thisFrame.data[1] = ((tempData >> 48) & 0xFF);
thisFrame.data[2] = ((tempData >> 40) & 0xFF);
+7 -7
View File
@@ -40,7 +40,7 @@ FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, QWidge
modelFrames = frames;
currentSeqItem = NULL;
currentSeqItem = nullptr;
currentSeqNum = -1;
currentPosition = 0;
forward = true;
@@ -197,7 +197,7 @@ void FramePlaybackWindow::saveFilters()
for (int c = 0; c < ui->listID->count(); c++)
{
outFile->write(QString::number(ui->listID->item(c)->text().toInt(NULL, 16), 16).toUtf8());
outFile->write(QString::number(ui->listID->item(c)->text().toInt(nullptr, 16), 16).toUtf8());
outFile->putChar(',');
if (ui->listID->item(c)->checkState() == Qt::Checked) outFile->putChar('T');
else outFile->putChar('F');
@@ -244,7 +244,7 @@ void FramePlaybackWindow::loadFilters()
if (line.length() > 2)
{
QList<QByteArray> tokens = line.split(',');
ID = tokens[0].toInt(NULL, 16);
ID = tokens[0].toInt(nullptr, 16);
if (tokens[1].toUpper() == "T") checked = true;
else checked = false;
if (checked)
@@ -260,7 +260,7 @@ void FramePlaybackWindow::loadFilters()
for (int c = 0; c < ui->listID->count(); c++)
{
QListWidgetItem *item = ui->listID->item(c);
if (item->text().toInt(NULL, 16) == ID)
if (item->text().toInt(nullptr, 16) == ID)
{
item->setCheckState(Qt::Checked);
}
@@ -275,7 +275,7 @@ void FramePlaybackWindow::loadFilters()
void FramePlaybackWindow::refreshIDList()
{
if (currentSeqNum < 0 || currentSeqItem == NULL)
if (currentSeqNum < 0 || currentSeqItem == nullptr)
{
ui->listID->clear();
return;
@@ -463,7 +463,7 @@ void FramePlaybackWindow::btnDeleteCurrSeq()
else
{
currentSeqNum = -1;
currentSeqItem = NULL;
currentSeqItem = nullptr;
}
refreshIDList();
updateFrameLabel();
@@ -564,7 +564,7 @@ void FramePlaybackWindow::btnStopClick()
}
else {
currentSeqNum = -1;
currentSeqItem = NULL;
currentSeqItem = nullptr;
}
if (ui->tblSequence->rowCount() > 0)
{
+5 -5
View File
@@ -517,7 +517,7 @@ void FrameSenderWindow::doModifiers(int idx)
int FrameSenderWindow::fetchOperand(int idx, ModifierOperand op)
{
CANFrame *tempFrame = NULL;
CANFrame *tempFrame = nullptr;
if (op.ID == 0) //numeric constant
{
if (op.notOper) return ~op.databyte;
@@ -531,7 +531,7 @@ int FrameSenderWindow::fetchOperand(int idx, ModifierOperand op)
else //look up external data byte
{
tempFrame = lookupFrame(op.ID, op.bus);
if (tempFrame != NULL)
if (tempFrame != nullptr)
{
if (op.notOper) return ~tempFrame->data[op.databyte];
else return tempFrame->data[op.databyte];
@@ -548,11 +548,11 @@ int FrameSenderWindow::fetchOperand(int idx, ModifierOperand op)
/// <returns></returns>
CANFrame* FrameSenderWindow::lookupFrame(int ID, int bus)
{
if (!frameCache.contains(ID)) return NULL;
if (!frameCache.contains(ID)) return nullptr;
if (bus == -1 || frameCache[ID].bus == (unsigned int)bus) return &frameCache[ID];
return NULL;
return nullptr;
}
/// <summary>
@@ -791,7 +791,7 @@ void FrameSenderWindow::updateGridRow(int idx)
int gridLine = idx;
QString dataString;
QTableWidgetItem *item = ui->tableSender->item(gridLine, 9);
if (item == NULL) item = new QTableWidgetItem();
if (item == nullptr) item = new QTableWidgetItem();
item->setText(QString::number(temp->count));
if (!temp->remote) {
for (unsigned int i = 0; i < temp->len; i++)
+3 -3
View File
@@ -1,8 +1,8 @@
#include <QDebug>
#include <QtDebug>
#include "helpwindow.h"
#include "ui_helpwindow.h"
HelpWindow* HelpWindow::self = 0;
HelpWindow* HelpWindow::self = nullptr;
HelpWindow::HelpWindow(QWidget *parent) :
QDialog(parent),
@@ -14,7 +14,7 @@ HelpWindow::HelpWindow(QWidget *parent) :
m_helpEngine = new QHelpEngineCore(QApplication::applicationDirPath() +"/SavvyCAN.qhc", this);
if (!m_helpEngine->setupData()) {
delete m_helpEngine;
m_helpEngine = 0;
m_helpEngine = nullptr;
qDebug() << "Could not load help file!";
}
+6 -6
View File
@@ -17,7 +17,7 @@ allow scripts to load DBC files in support of the script - maybe the graphing sy
*/
QString MainWindow::loadedFileName = "";
MainWindow *MainWindow::selfRef = NULL;
MainWindow *MainWindow::selfRef = nullptr;
MainWindow *MainWindow::getReference()
{
@@ -238,7 +238,7 @@ void MainWindow::killWindow(QDialog *win)
{
win->close();
delete win;
win = NULL;
win = nullptr;
}
}
@@ -416,9 +416,9 @@ void MainWindow::overwriteToggled(bool state)
void MainWindow::updateFilterList()
{
if (model == NULL) return;
if (model == nullptr) return;
const QMap<int, bool> *filters = model->getFiltersReference();
if (filters == NULL) return;
if (filters == nullptr) return;
qDebug() << "updateFilterList called on MainWindow";
@@ -745,10 +745,10 @@ Data Bytes: 88 10 00 13 BB 00 06 00
outFile->write(builderString.toUtf8());
builderString = "";
if (dbcHandler != NULL)
if (dbcHandler != nullptr)
{
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
if (msg != NULL)
if (msg != nullptr)
{
for (int j = 0; j < msg->sigHandler->getCount(); j++)
{
+2 -2
View File
@@ -118,8 +118,8 @@ void FileComparatorWindow::calculateDetails()
{
QMap<int, FrameData> interestedIDs;
QMap<int, FrameData> referenceIDs;
QTreeWidgetItem *interestedOnlyBase, *referenceOnlyBase = NULL, *sharedBase, *bitmapBaseInterested, *bitmapBaseReference = NULL;
QTreeWidgetItem *valuesBase, *detail, *sharedItem, *valuesInterested, *valuesReference = NULL;
QTreeWidgetItem *interestedOnlyBase, *referenceOnlyBase = nullptr, *sharedBase, *bitmapBaseInterested, *bitmapBaseReference = nullptr;
QTreeWidgetItem *valuesBase, *detail, *sharedItem, *valuesInterested, *valuesReference = nullptr;
uint64_t tmp;
bool uniqueInterested = ui->ckUniqueToInterested->isChecked();
+1 -1
View File
@@ -186,7 +186,7 @@ void FrameInfoWindow::updatedFrames(int numFrames)
unsigned int currID = 0;
if (ui->listFrameID->currentItem())
currID = (unsigned int)ui->listFrameID->currentItem()->text().toInt(NULL, 16);
currID = (unsigned int)ui->listFrameID->currentItem()->text().toInt(nullptr, 16);
bool thisID = false;
for (int x = modelFrames->count() - numFrames; x < modelFrames->count(); x++)
{
+1 -1
View File
@@ -1186,7 +1186,7 @@ void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam)
selDecorator->setPen(selectedPen);
ui->graphingView->graph()->setSelectionDecorator(selDecorator);
if (params.graphName == NULL || params.graphName.length() == 0)
if (params.graphName == nullptr || params.graphName.length() == 0)
{
params.graphName = QString("0x") + QString::number(params.ID, 16) + ":" + QString::number(params.startBit);
params.graphName += "-" + QString::number(params.numBits);
+4 -4
View File
@@ -115,14 +115,14 @@ void ISOTP_InterpreterWindow::writeSettings()
void ISOTP_InterpreterWindow::interpretCapturedFrames()
{
clearList();
decoder->rapidFrames(NULL, *modelFrames);
decoder->rapidFrames(nullptr, *modelFrames);
}
void ISOTP_InterpreterWindow::listFilterItemChanged(QListWidgetItem *item)
{
if (item)
{
int id = item->text().toInt(NULL, 16);
int id = item->text().toInt(nullptr, 16);
bool state = item->checkState();
//qDebug() << id << "*" << state;
idFilters[id] = state;
@@ -134,7 +134,7 @@ void ISOTP_InterpreterWindow::filterAll()
for (int i = 0 ; i < ui->listFilter->count(); i++)
{
ui->listFilter->item(i)->setCheckState(Qt::Checked);
idFilters[ui->listFilter->item(1)->text().toInt(NULL, 16)] = true;
idFilters[ui->listFilter->item(1)->text().toInt(nullptr, 16)] = true;
}
}
@@ -143,7 +143,7 @@ void ISOTP_InterpreterWindow::filterNone()
for (int i = 0 ; i < ui->listFilter->count(); i++)
{
ui->listFilter->item(i)->setCheckState(Qt::Unchecked);
idFilters[ui->listFilter->item(1)->text().toInt(NULL, 16)] = false;
idFilters[ui->listFilter->item(1)->text().toInt(nullptr, 16)] = false;
}
}
+2 -2
View File
@@ -212,7 +212,7 @@ void NewGraphDialog::loadMessages()
{
DBC_MESSAGE *msg;
ui->cbMessages->clear();
if (dbcHandler == NULL) return;
if (dbcHandler == nullptr) return;
if (dbcHandler->getFileCount() == 0) return;
for (int y = 0; y < dbcHandler->getFileCount(); y++)
{
@@ -240,7 +240,7 @@ void NewGraphDialog::loadSignals(int idx)
DBC_MESSAGE *msg = dbcHandler->findMessage(ui->cbMessages->currentText());
DBC_SIGNAL *sig;
if (msg == NULL) return;
if (msg == nullptr) return;
ui->cbSignals->clear();
for (int x = 0; x < msg->sigHandler->getCount(); x++)
+1 -1
View File
@@ -61,7 +61,7 @@ SnifferWindow::SnifferWindow(QWidget *parent) :
SnifferWindow::~SnifferWindow()
{
closeEvent(NULL);
closeEvent(nullptr);
delete sniffDel;
delete ui;
}
+3 -3
View File
@@ -218,9 +218,9 @@ void UDSScanWindow::scanUDS()
ui->treeResults->clear();
sendingFrames.clear();
nodeService = NULL;
nodeID = NULL;
nodeSubFunc = NULL;
nodeService = nullptr;
nodeID = nullptr;
nodeSubFunc = nullptr;
UDS_MESSAGE test;
int typ, id;
+4 -4
View File
@@ -24,22 +24,22 @@ ScriptContainer::~ScriptContainer()
scriptText = "";
compileScript();
//delete scriptEngine; //doing this here seems to cause a crash. No crash if you don't.
//scriptEngine = NULL;
//scriptEngine = nullptr;
}
if (canHelper)
{
delete canHelper;
canHelper = NULL;
canHelper = nullptr;
}
if (isoHelper)
{
delete isoHelper;
isoHelper = NULL;
isoHelper = nullptr;
}
if (udsHelper)
{
delete udsHelper;
udsHelper = NULL;
udsHelper = nullptr;
}
qDebug() << "end of destruct";
}
+4 -4
View File
@@ -42,7 +42,7 @@ ScriptingWindow::ScriptingWindow(const QVector<CANFrame> *frames, QWidget *paren
connect(&valuesTimer, SIGNAL(timeout()), this, SLOT(valuesTimerElapsed()));
currentScript = NULL;
currentScript = nullptr;
elapsedTime.start();
valuesTimer.start(1000);
@@ -259,8 +259,8 @@ void ScriptingWindow::deleteCurrentScript()
thisScript = scripts.at(sel);
scripts.removeAt(sel);
delete thisScript; //causes a seg fault. Seems to be due to currently running javascript code. No idea how to stop code from running
thisScript = NULL;
currentScript = NULL;
thisScript = nullptr;
currentScript = nullptr;
if (ui->listLoadedScripts->count() > 0)
{
@@ -359,7 +359,7 @@ void ScriptingWindow::clickedLogClear()
void ScriptingWindow::log(QString text)
{
ScriptContainer *cont = qobject_cast<ScriptContainer*>(sender());
if (cont != NULL)
if (cont != nullptr)
ui->listLog->addItem(QString::number(elapsedTime.elapsed()) + "(" + cont->fileName + "): " + text);
else
ui->listLog->addItem(QString::number(elapsedTime.elapsed()) + ": " + text);
+2 -2
View File
@@ -33,7 +33,7 @@ public:
if (input.startsWith("0X") || input.startsWith("X")) //hex number
{
if (input.length() < 3) temp = 0;
else temp = input.right(input.size() - 2).toLongLong(NULL, 16);
else temp = input.right(input.size() - 2).toLongLong(nullptr, 16);
}
else if (input.startsWith("0B") || input.startsWith("B")) //binary number
{
@@ -56,7 +56,7 @@ public:
return ParseStringToNum(input.toUtf8());
}
static uint ParseStringToNum2(QString pInput, bool* pOk_p = NULL)
static uint ParseStringToNum2(QString pInput, bool* pOk_p = nullptr)
{
if(pInput.startsWith("0b"))
{
+5 -5
View File
@@ -14,7 +14,7 @@ template<class T>
class LFQueue
{
public:
LFQueue() : mSize(0), mArray(NULL){}
LFQueue() : mSize(0), mArray(nullptr){}
~LFQueue() {setSize(0);}
@@ -24,14 +24,14 @@ public:
if(mArray) {
delete[] mArray;
mArray = NULL;
mArray = nullptr;
}
if(size>0) {
mArray = new T[size];
if(mArray)
mSize = size;
return ( mArray!=NULL );
return ( mArray != nullptr );
}
return true;
@@ -44,7 +44,7 @@ public:
T* get() {
if(IS_FULL())
return NULL;
return nullptr;
return &(mArray[mWIdx.loadAcquire()]); /* prevent memory reordering (belt and braces) */
}
@@ -63,7 +63,7 @@ public:
T* peek() {
if(IS_EMPTY())
return NULL;
return nullptr;
return &(mArray[mRIdx.loadAcquire()]); /* prevent memory reordering (belt and braces) */
}