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
+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)
{