CANFrame.len is now unsigned int
This commit is contained in:
+24
-27
@@ -322,7 +322,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
|
||||
else thisFrame.isReceived = true;
|
||||
thisFrame.bus = 0;
|
||||
thisFrame.len = tokens.length() - 3;
|
||||
for (int d = 0; d < thisFrame.len; d++)
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++)
|
||||
{
|
||||
if (tokens[d + 3] != "")
|
||||
{
|
||||
@@ -379,7 +379,7 @@ bool FrameFileIO::saveCRTDFile(QString filename, const QVector<CANFrame>* frames
|
||||
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
|
||||
outFile->putChar(' ');
|
||||
|
||||
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||
for (unsigned int temp = 0; temp < frames->at(c).len; temp++)
|
||||
{
|
||||
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||
outFile->putChar(' ');
|
||||
@@ -446,9 +446,9 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
|
||||
{
|
||||
thisFrame.isReceived = true;
|
||||
thisFrame.bus = tokens[3].toInt();
|
||||
thisFrame.len = tokens[4].toInt();
|
||||
thisFrame.len = tokens[4].toUInt();
|
||||
for (int c = 0; c < 8; c++) thisFrame.data[c] = 0;
|
||||
for (int d = 0; d < thisFrame.len; d++)
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++)
|
||||
thisFrame.data[d] = tokens[5 + d].toInt(NULL, 16);
|
||||
}
|
||||
else if (fileVersion == 2)
|
||||
@@ -456,10 +456,10 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
|
||||
if (tokens[3].at(0) == 'R') thisFrame.isReceived = true;
|
||||
else thisFrame.isReceived = false;
|
||||
thisFrame.bus = tokens[4].toInt();
|
||||
thisFrame.len = tokens[5].toInt();
|
||||
if (thisFrame.len + 6 > tokens.length()) thisFrame.len = tokens.length() - 6;
|
||||
thisFrame.len = tokens[5].toUInt();
|
||||
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 (int d = 0; d < thisFrame.len; d++)
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++)
|
||||
thisFrame.data[d] = tokens[6 + d].toInt(NULL, 16);
|
||||
}
|
||||
|
||||
@@ -570,7 +570,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 (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(NULL, 16);
|
||||
|
||||
frames->append(thisFrame);
|
||||
}
|
||||
@@ -608,7 +608,7 @@ bool FrameFileIO::saveGenericCSVFile(QString filename, const QVector<CANFrame>*
|
||||
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
|
||||
outFile->putChar(44);
|
||||
|
||||
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||
for (unsigned int temp = 0; temp < frames->at(c).len; temp++)
|
||||
{
|
||||
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||
outFile->putChar(' ');
|
||||
@@ -696,10 +696,9 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
|
||||
if (tokens[4] == "s") thisFrame.extended = false;
|
||||
else thisFrame.extended = true;
|
||||
thisFrame.bus = tokens[2].toInt() - 1;
|
||||
thisFrame.len = tokens[5].toInt();
|
||||
thisFrame.len = tokens[5].toUInt();
|
||||
if (thisFrame.len > 8) thisFrame.len = 8;
|
||||
if (thisFrame.len < 0) thisFrame.len = 0;
|
||||
for (int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = tokens[d + 6].toInt(NULL, 16);
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = tokens[d + 6].toInt(NULL, 16);
|
||||
frames->append(thisFrame);
|
||||
}
|
||||
else foundErrors = true;
|
||||
@@ -759,7 +758,7 @@ bool FrameFileIO::saveLogFile(QString filename, const QVector<CANFrame>* frames)
|
||||
else outFile->write(" s ");
|
||||
outFile->write(QString::number(frames->at(c).len).toUtf8() + " ");
|
||||
|
||||
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||
for (unsigned int temp = 0; temp < frames->at(c).len; temp++)
|
||||
{
|
||||
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||
outFile->putChar(' ');
|
||||
@@ -836,7 +835,7 @@ bool FrameFileIO::loadIXXATFile(QString filename, QVector<CANFrame>* frames)
|
||||
|
||||
QStringList dataToks = unQuote(tokens[4]).simplified().split(' ');
|
||||
thisFrame.len = dataToks.length();
|
||||
for (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(NULL, 16);
|
||||
frames->append(thisFrame);
|
||||
}
|
||||
else foundErrors = true;
|
||||
@@ -889,7 +888,7 @@ bool FrameFileIO::saveIXXATFile(QString filename, const QVector<CANFrame>* frame
|
||||
else outFile->write(",\"Std\"");
|
||||
outFile->write(",\"\",\"");
|
||||
|
||||
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||
for (unsigned int temp = 0; temp < frames->at(c).len; temp++)
|
||||
{
|
||||
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||
outFile->putChar(' ');
|
||||
@@ -952,7 +951,7 @@ bool FrameFileIO::loadCANDOFile(QString filename, QVector<CANFrame>* frames)
|
||||
|
||||
if (thisFrame.len <= 8 && thisFrame.ID <= 0x7FF)
|
||||
{
|
||||
for (int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)data[4 + d];
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)data[4 + d];
|
||||
frames->append(thisFrame);
|
||||
}
|
||||
else foundErrors = true;
|
||||
@@ -1008,7 +1007,7 @@ bool FrameFileIO::saveCANDOFile(QString filename, const QVector<CANFrame>* frame
|
||||
data[1] = (char)(ms & 0xFF);
|
||||
data[2] = (char)(id & 0xFF);
|
||||
data[3] = (char)((id >> 8) + (thisFrame.len << 4));
|
||||
for (int d = 0; d < thisFrame.len; d++) data[4 + d] = (char)thisFrame.data[d];
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++) data[4 + d] = (char)thisFrame.data[d];
|
||||
outFile->write(data);
|
||||
}
|
||||
}
|
||||
@@ -1074,11 +1073,10 @@ bool FrameFileIO::loadMicrochipFile(QString filename, QVector<CANFrame>* frames)
|
||||
if (thisFrame.ID <= 0x7FF) thisFrame.extended = false;
|
||||
else thisFrame.extended = true;
|
||||
thisFrame.bus = 0;
|
||||
thisFrame.len = tokens[3].toInt();
|
||||
thisFrame.len = tokens[3].toUInt();
|
||||
if (thisFrame.len > 8) thisFrame.len = 8;
|
||||
if (thisFrame.len < 0) thisFrame.len = 0;
|
||||
if (thisFrame.len + 4 > tokens.length()) thisFrame.len = tokens.length() - 4;
|
||||
for (int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)Utility::ParseStringToNum(tokens[4 + d]);
|
||||
if (thisFrame.len + 4 > (unsigned int) tokens.length()) thisFrame.len = tokens.length() - 4;
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)Utility::ParseStringToNum(tokens[4 + d]);
|
||||
frames->append(thisFrame);
|
||||
}
|
||||
else foundErrors = true;
|
||||
@@ -1140,7 +1138,7 @@ bool FrameFileIO::saveMicrochipFile(QString filename, const QVector<CANFrame>* f
|
||||
outFile->write("0x" + QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8() + ";");
|
||||
outFile->write(QString::number(frames->at(c).len).toUtf8() + ";");
|
||||
|
||||
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||
for (unsigned int temp = 0; temp < frames->at(c).len; temp++)
|
||||
{
|
||||
outFile->write("0x" + QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||
outFile->putChar(';');
|
||||
@@ -1233,12 +1231,11 @@ bool FrameFileIO::loadTraceFile(QString filename, QVector<CANFrame>* frames)
|
||||
if (thisFrame.ID <= 0x7FF) thisFrame.extended = false;
|
||||
else thisFrame.extended = true;
|
||||
thisFrame.bus = 0;
|
||||
thisFrame.len = tokens[3].toInt();
|
||||
if (thisFrame.len < 0) thisFrame.len = 0;
|
||||
thisFrame.len = tokens[3].toUInt();
|
||||
if (thisFrame.len > 8) thisFrame.len = 8;
|
||||
QList<QByteArray> dataToks = tokens[4].split(' ');
|
||||
if (thisFrame.len > dataToks.length()) thisFrame.len = dataToks.length();
|
||||
for (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 = (unsigned int) dataToks.length();
|
||||
for (unsigned int d = 0; d < thisFrame.len; d++) thisFrame.data[d] = (unsigned char)dataToks[d].toInt(NULL, 16);
|
||||
frames->append(thisFrame);
|
||||
}
|
||||
else foundErrors = true;
|
||||
@@ -1325,7 +1322,7 @@ bool FrameFileIO::saveTraceFile(QString filename, const QVector<CANFrame> * fram
|
||||
|
||||
outFile->write(QString::number(frames->at(c).len).toUtf8() + "\t");
|
||||
|
||||
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||
for (unsigned int temp = 0; temp < frames->at(c).len; temp++)
|
||||
{
|
||||
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||
outFile->putChar(' ');
|
||||
|
||||
Reference in New Issue
Block a user