More fixes for compile warnings

This commit is contained in:
Collin Kidder
2019-08-08 21:49:03 -04:00
parent e7e65b7216
commit 947f24f267
9 changed files with 34 additions and 30 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ public:
int bus; int bus;
bool extended; bool extended;
bool isReceived; bool isReceived;
uint32_t len; //# of bytes this message should have (as reported) int len; //# of bytes this message should have (as reported)
uint32_t actualSize; //# we actually got int actualSize; //# we actually got
QVector<unsigned char> data; QVector<unsigned char> data;
uint64_t timestamp; uint64_t timestamp;
}; };
+6 -6
View File
@@ -4,14 +4,14 @@
#include "isotp_handler.h" #include "isotp_handler.h"
#include <QDebug> #include <QDebug>
QVector<CODE_STRUCT> UDS_DIAG_CTRL_SUB = { static QVector<CODE_STRUCT> UDS_DIAG_CTRL_SUB = {
{1,"DFLT_SESS", "Default session"}, {1,"DFLT_SESS", "Default session"},
{2,"PROG_SESS", "Programming Session"}, {2,"PROG_SESS", "Programming Session"},
{3,"EXT_SESS", "Extended Diagnostics Session"}, {3,"EXT_SESS", "Extended Diagnostics Session"},
{4,"SAFETY_SESS", "Safety System Diagnostics Session"}, {4,"SAFETY_SESS", "Safety System Diagnostics Session"},
}; };
QVector<CODE_STRUCT> UDS_ECU_RESET_SUB = { static QVector<CODE_STRUCT> UDS_ECU_RESET_SUB = {
{1,"HARD_RESET", "Hard reset of ECU"}, {1,"HARD_RESET", "Hard reset of ECU"},
{2,"KEYOFFON_RESET", "Simulated key off then on reset"}, {2,"KEYOFFON_RESET", "Simulated key off then on reset"},
{3,"SOFT_RESET", "Soft reset - leaving RAM intact"}, {3,"SOFT_RESET", "Soft reset - leaving RAM intact"},
@@ -19,7 +19,7 @@ QVector<CODE_STRUCT> UDS_ECU_RESET_SUB = {
{5,"DIS_POWERDOWN_RESET", "Disable sleep mode"}, {5,"DIS_POWERDOWN_RESET", "Disable sleep mode"},
}; };
QVector<CODE_STRUCT> UDS_COMM_CTRL_SUB = { static QVector<CODE_STRUCT> UDS_COMM_CTRL_SUB = {
{0,"COMM_NORMAL", "Enable both Rx and Tx of normal messages"}, {0,"COMM_NORMAL", "Enable both Rx and Tx of normal messages"},
{1,"COMM_DIS_TX", "Enable reception of normal messages but don't Tx them"}, {1,"COMM_DIS_TX", "Enable reception of normal messages but don't Tx them"},
{3,"COMM_DIS_ALL", "Disable both Rx and Tx of non-diagnostics messages"}, {3,"COMM_DIS_ALL", "Disable both Rx and Tx of non-diagnostics messages"},
@@ -27,13 +27,13 @@ QVector<CODE_STRUCT> UDS_COMM_CTRL_SUB = {
{5,"COMM_ENHANC", "Addressed bus master should set related sub-bus to app scheduling mode"}, {5,"COMM_ENHANC", "Addressed bus master should set related sub-bus to app scheduling mode"},
}; };
QVector<CODE_STRUCT> UDS_ROUTINE_SUB = { static QVector<CODE_STRUCT> UDS_ROUTINE_SUB = {
{1,"START_ROUTINE", "Start routine by given ID"}, {1,"START_ROUTINE", "Start routine by given ID"},
{2,"STOP_ROUTINE", "Stop routine by given ID"}, {2,"STOP_ROUTINE", "Stop routine by given ID"},
{3,"GET_ROUTINE_RESULTS", "Get results from routine specified by ID"}, {3,"GET_ROUTINE_RESULTS", "Get results from routine specified by ID"},
}; };
QVector<CODE_STRUCT> UDS_SERVICE_DESC = { static QVector<CODE_STRUCT> UDS_SERVICE_DESC = {
{1, "OBDII_SHOW_CURRENT", "OBDII - Show current data"}, {1, "OBDII_SHOW_CURRENT", "OBDII - Show current data"},
{2, "OBDII_SHOW_FREEZE", "OBDII - Show freeze data"}, {2, "OBDII_SHOW_FREEZE", "OBDII - Show freeze data"},
{3, "OBDII_SHOW_STORED_DTC", "OBDII - Show stored DTC codes"}, {3, "OBDII_SHOW_STORED_DTC", "OBDII - Show stored DTC codes"},
@@ -84,7 +84,7 @@ QVector<CODE_STRUCT> UDS_SERVICE_DESC = {
{0xFF, "UNKNOWN_CODE", "Unknown, likely proprietary UDS function code"} {0xFF, "UNKNOWN_CODE", "Unknown, likely proprietary UDS function code"}
}; };
QVector<CODE_STRUCT> UDS_NEG_RESPONSE = static QVector<CODE_STRUCT> UDS_NEG_RESPONSE =
{ {
{0x10, "GENERAL_REJECT", "General rejection (no other codes matched)"}, {0x10, "GENERAL_REJECT", "General rejection (no other codes matched)"},
{0x11, "SERVICE_NOTSUPP", "ECU does not support this service code"}, {0x11, "SERVICE_NOTSUPP", "ECU does not support this service code"},
+4 -4
View File
@@ -65,7 +65,7 @@ namespace UDS_SERVICES
struct CODE_STRUCT struct CODE_STRUCT
{ {
unsigned int code; int code;
QString shortDesc; QString shortDesc;
QString longDesc; QString longDesc;
}; };
@@ -73,9 +73,9 @@ struct CODE_STRUCT
class UDS_MESSAGE: public ISOTP_MESSAGE class UDS_MESSAGE: public ISOTP_MESSAGE
{ {
public: public:
unsigned int service; int service;
unsigned int subFunc; int subFunc;
unsigned int subFuncLen; int subFuncLen;
bool isErrorReply; bool isErrorReply;
UDS_MESSAGE(); UDS_MESSAGE();
+4 -4
View File
@@ -253,13 +253,13 @@ bool CANConManager::sendFrames(const QList<CANFrame>& pFrames)
//the bus numbers if bus wasn't -1 so that they're local to the device //the bus numbers if bus wasn't -1 so that they're local to the device
bool CANConManager::addTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QObject *receiver) bool CANConManager::addTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QObject *receiver)
{ {
int tempBusVal; //int tempBusVal;
int busBase = 0; int busBase = 0;
foreach (CANConnection* conn, mConns) foreach (CANConnection* conn, mConns)
{ {
if (pBusId == -1) conn->addTargettedFrame(pBusId, ID, mask, receiver); if (pBusId == -1) conn->addTargettedFrame(pBusId, ID, mask, receiver);
else if (pBusId < (uint32_t)(busBase + conn->getNumBuses())) else if (pBusId < (busBase + conn->getNumBuses()))
{ {
qDebug() << "Forwarding targetted frame setting to a connection object"; qDebug() << "Forwarding targetted frame setting to a connection object";
conn->addTargettedFrame(pBusId - busBase, ID, mask, receiver); conn->addTargettedFrame(pBusId - busBase, ID, mask, receiver);
@@ -272,13 +272,13 @@ bool CANConManager::addTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QO
bool CANConManager::removeTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QObject *receiver) bool CANConManager::removeTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QObject *receiver)
{ {
int tempBusVal; //int tempBusVal;
int busBase = 0; int busBase = 0;
foreach (CANConnection* conn, mConns) foreach (CANConnection* conn, mConns)
{ {
if (pBusId == -1) conn->removeTargettedFrame(pBusId, ID, mask, receiver); if (pBusId == -1) conn->removeTargettedFrame(pBusId, ID, mask, receiver);
else if (pBusId < (uint32_t)(busBase + conn->getNumBuses())) else if (pBusId < (busBase + conn->getNumBuses()))
{ {
qDebug() << "Forwarding targetted frame setting to a connection object"; qDebug() << "Forwarding targetted frame setting to a connection object";
conn->removeTargettedFrame(pBusId - busBase, ID, mask, receiver); conn->removeTargettedFrame(pBusId - busBase, ID, mask, receiver);
+1 -1
View File
@@ -77,7 +77,7 @@ bool SerialBusConnection::piGetBusSettings(int pBusIdx, CANBus& pBus)
void SerialBusConnection::piSetBusSettings(int pBusIdx, CANBus bus) void SerialBusConnection::piSetBusSettings(int pBusIdx, CANBus bus)
{ {
CANConStatus stats; //CANConStatus stats;
/* sanity checks */ /* sanity checks */
if(0 != pBusIdx) if(0 != pBusIdx)
return; return;
+6 -6
View File
@@ -1258,7 +1258,7 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
tokens = line.simplified().split(' '); tokens = line.simplified().split(' ');
if (tokens.length() > 5) if (tokens.length() > 5)
{ {
thisFrame.timestamp = (uint64_t)(tokens[0].toDouble() * (double)1000000.0); thisFrame.timestamp = static_cast<uint64_t>(tokens[0].toDouble() * 1000000.0);
thisFrame.ID = tokens[2].toUInt(nullptr, 16); thisFrame.ID = tokens[2].toUInt(nullptr, 16);
thisFrame.len = tokens[5].toUInt(); thisFrame.len = tokens[5].toUInt();
if (thisFrame.len > 8) return false; if (thisFrame.len > 8) return false;
@@ -1266,11 +1266,11 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
thisFrame.bus = tokens[1].toUInt(); thisFrame.bus = tokens[1].toUInt();
thisFrame.extended = (thisFrame.ID > 0x7FF); thisFrame.extended = (thisFrame.ID > 0x7FF);
thisFrame.remote = false; thisFrame.remote = false;
for (unsigned int d = 6; d < (6 + thisFrame.len); d++) for (int d = 6; d < (6 + static_cast<int>(thisFrame.len)); d++)
{ {
if (tokens.count() > d) if (tokens.count() > d)
{ {
thisFrame.data[d - 6] = tokens[d].toInt(nullptr, 16); thisFrame.data[d - 6] = static_cast<unsigned char>(tokens[d].toInt(nullptr, 16));
} }
else //expected byte wasn't there to read. Set it zero and set error flag else //expected byte wasn't there to read. Set it zero and set error flag
{ {
@@ -2907,7 +2907,7 @@ bool FrameFileIO::isCanDumpFile(QString filename)
ret = timeExp.exactMatch(tokens[0]); ret = timeExp.exactMatch(tokens[0]);
if(!ret) isMatch = false; if(!ret) isMatch = false;
uint64_t timestamp = (uint64_t)(timeExp.cap(1).toDouble(&ret) * (double)1000000.0); /*uint64_t timestamp = (uint64_t)*/(timeExp.cap(1).toDouble(&ret) /** (double)1000000.0*/);
if(!ret) isMatch = false; if(!ret) isMatch = false;
if (line.contains('[')) //the expanded format if (line.contains('[')) //the expanded format
@@ -2941,7 +2941,7 @@ bool FrameFileIO::isCanDumpFile(QString filename)
} }
/* ID */ /* ID */
int ID = IdValExp.cap(1).toInt(&ret, 16); /*int ID = */IdValExp.cap(1).toInt(&ret, 16);
QString val= IdValExp.cap(2); QString val= IdValExp.cap(2);
@@ -2965,7 +2965,7 @@ bool FrameFileIO::isCanDumpFile(QString filename)
isMatch = false; isMatch = false;
break; break;
} }
int data = valExp.cap(1).toInt(&ret, 16); /*int data = */valExp.cap(1).toInt(&ret, 16);
if(!ret) if(!ret)
{ {
isMatch = false; isMatch = false;
+1
View File
@@ -604,6 +604,7 @@ void FramePlaybackWindow::changeLooping(bool check)
void FramePlaybackWindow::changeSendingBus(int newIdx) void FramePlaybackWindow::changeSendingBus(int newIdx)
{ {
Q_UNUSED(newIdx);
calculateWhichBus(); calculateWhichBus();
} }
+3
View File
@@ -5,6 +5,9 @@
QString HexTicker::getTickLabel (double tick, const QLocale& locale, QChar formatChar, int precision) QString HexTicker::getTickLabel (double tick, const QLocale& locale, QChar formatChar, int precision)
{ {
Q_UNUSED(formatChar);
Q_UNUSED(precision);
Q_UNUSED(locale);
int valu = static_cast<int>(tick); int valu = static_cast<int>(tick);
//qDebug() << valu; //qDebug() << valu;
return "0x" + QString::number(valu, 16).toUpper().rightJustified(3,'0'); return "0x" + QString::number(valu, 16).toUpper().rightJustified(3,'0');
+7 -7
View File
@@ -232,7 +232,7 @@ void CANScriptHelper::sendFrame(QJSValue bus, QJSValue id, QJSValue length, QJSV
CANFrame frame; CANFrame frame;
frame.extended = false; frame.extended = false;
frame.remote = false; frame.remote = false;
frame.ID = id.toInt(); frame.ID = static_cast<uint32_t>(id.toInt());
frame.len = length.toUInt(); frame.len = length.toUInt();
if (frame.len > 8) frame.len = 8; if (frame.len > 8) frame.len = 8;
@@ -338,7 +338,7 @@ void ISOTPScriptHelper::newISOMessage(ISOTP_MESSAGE msg)
args << msg.bus << msg.ID << msg.len; args << msg.bus << msg.ID << msg.len;
QJSValue dataBytes = scriptEngine->newArray(static_cast<uint>(msg.len)); QJSValue dataBytes = scriptEngine->newArray(static_cast<uint>(msg.len));
for (unsigned int j = 0; j < msg.len; j++) dataBytes.setProperty(j, QJSValue(msg.data[j])); for (int j = 0; j < msg.len; j++) dataBytes.setProperty(static_cast<quint32>(j), QJSValue(msg.data[j]));
args.append(dataBytes); args.append(dataBytes);
gotFrameFunction.call(args); gotFrameFunction.call(args);
} }
@@ -386,12 +386,12 @@ void UDSScriptHelper::sendUDS(QJSValue bus, QJSValue id, QJSValue service, QJSVa
msg.data.reserve(msg.len); msg.data.reserve(msg.len);
for (unsigned int i = 0; i < msg.len; i++) for (int i = 0; i < msg.len; i++)
{ {
msg.data.append(static_cast<uint8_t>(data.property(i).toInt())); msg.data.append(static_cast<uint8_t>(data.property(static_cast<quint32>(i)).toInt()));
} }
msg.bus = (uint32_t)bus.toInt(); msg.bus = bus.toInt();
if (msg.ID > 0x7FF) msg.extended = true; if (msg.ID > 0x7FF) msg.extended = true;
@@ -414,9 +414,9 @@ void UDSScriptHelper::newUDSMessage(UDS_MESSAGE msg)
QJSValueList args; QJSValueList args;
args << msg.bus << msg.ID << msg.service << msg.subFunc << msg.len; args << msg.bus << msg.ID << msg.service << msg.subFunc << msg.len;
QJSValue dataBytes = scriptEngine->newArray(msg.len); QJSValue dataBytes = scriptEngine->newArray(static_cast<unsigned int>(msg.len));
for (unsigned int j = 0; j < msg.data.length(); j++) dataBytes.setProperty(j, QJSValue(msg.data[j])); for (int j = 0; j < msg.data.length(); j++) dataBytes.setProperty(static_cast<quint32>(j), QJSValue(msg.data[j]));
args.append(dataBytes); args.append(dataBytes);
gotFrameFunction.call(args); gotFrameFunction.call(args);
} }