Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Wenzel <[email protected]>
  • Loading branch information
alexmucde committed Feb 29, 2024
1 parent db0ff68 commit 63824b1
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 24 deletions.
5 changes: 4 additions & 1 deletion plugin/dltsegmentationplugin/dltsegmentationplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ QWidget* DltSegmentationPlugin::initViewer()
}

void DltSegmentationPlugin::selectedIdxMsg(int index, QDltMsg &/*msg*/) {
Q_UNUSED(index)
if(!dltFile)
return;
}
Expand Down Expand Up @@ -130,7 +131,9 @@ void DltSegmentationPlugin::updateMsg(int index, QDltMsg &msg){
}
}

void DltSegmentationPlugin::updateMsgDecoded(int index, QDltMsg &){
void DltSegmentationPlugin::updateMsgDecoded(int index, QDltMsg &msg){
Q_UNUSED(index)
Q_UNUSED(msg)
if(nullptr == dltFile)
return;
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/dlttestrobotplugin/dlttestrobotplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ bool DltTestRobotPlugin::stateChanged(int index, QDltConnection::QDltConnectionS

bool DltTestRobotPlugin::autoscrollStateChanged(bool enabled)
{

Q_UNUSED(enabled)
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions plugin/nonverboseplugin/nonverboseplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ QStringList NonverbosePlugin::infoConfig()
{
QString text;
text += frame->id + QString(" AppI:%1 CtI:%2 Len:%3 MT:%4 MI:%5").arg(frame->appid).arg(frame->ctid).arg(frame->byteLength).arg(frame->messageType).arg(frame->messageInfo);
int c = 0;
/* foreach(DltFibexPduRef *ref, frame->pdureflist)
/*int c = 0;
foreach(DltFibexPduRef *ref, frame->pdureflist)
{
if(c == 0)
text += " (";
Expand Down
12 changes: 6 additions & 6 deletions qdlt/qdltmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ quint32 QDltMsg::checkMsgSize(const char *data,quint32 size)
if(storageHeaderVersion==1)
{
sizeStorageHeader = sizeof(DltStorageHeader);
if(size < (int)(sizeStorageHeader))
if(size < (quint32)(sizeStorageHeader))
{
// length error
return 0;
Expand All @@ -202,7 +202,7 @@ quint32 QDltMsg::checkMsgSize(const char *data,quint32 size)
(((quint64)(*((quint8*) (data + 9))))<<8)|
(((quint64)(*((quint8*) (data + 8)))));
quint8 ecuIdLength = *((quint8*) (data + 13));
if(size < (int)(14+ecuIdLength)) {
if(size < (quint32)(14+ecuIdLength)) {
return 0; // length error
}
storageHeaderEcuId = QString(QByteArray(data+14,ecuIdLength));
Expand All @@ -216,7 +216,7 @@ quint32 QDltMsg::checkMsgSize(const char *data,quint32 size)
}

/* get DLT protocol version */
if(size < (int)(sizeStorageHeader+4)) {
if(size < (quint32)(sizeStorageHeader+4)) {
return 0;
}
quint32 htyp2 = *((quint32*) (data + sizeStorageHeader));
Expand All @@ -226,7 +226,7 @@ quint32 QDltMsg::checkMsgSize(const char *data,quint32 size)
if(versionNumber==1)
{
const DltStandardHeader *standardheader = 0;
unsigned int extra_size,headersize,datasize;
unsigned int extra_size,headersize;

if(size < (int)(sizeStorageHeader+sizeof(DltStandardHeader))) {
return 0;
Expand All @@ -245,7 +245,7 @@ quint32 QDltMsg::checkMsgSize(const char *data,quint32 size)
}
else
{
if(size < (DLT_SWAP_16(standardheader->len) + sizeStorageHeader))
if(size < (quint32)(DLT_SWAP_16(standardheader->len) + sizeStorageHeader))
{
// whole message does not fit
return 0;
Expand Down Expand Up @@ -302,7 +302,7 @@ quint32 QDltMsg::checkMsgSize(const char *data,quint32 size)
/* get Message Length */
quint16 messageLength = messageLength = qFromBigEndian(*((quint16*) (data + 5 + sizeStorageHeader)));

if(size < (messageLength+sizeStorageHeader))
if(size < (quint32)(messageLength+sizeStorageHeader))
{
// whole message does not fit
return 0;
Expand Down
2 changes: 1 addition & 1 deletion qdlt/qdltpluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ bool QDltPluginManager::setPluginPriority(const QString name, unsigned int prio)
bool result = false;

//if prio is too large, put to the end of the list
if(prio >= plugins.size()) {
if(prio >= (unsigned int) (plugins.size())) {
prio = plugins.size() - 1;
}

Expand Down
21 changes: 10 additions & 11 deletions src/dltimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void DltImporter::dltIpcFromPCAP(QFile &outputfile,QString fileName,QWidget *par
counterRecords ++;
quint64 pos = 12;
//Read EtherType
if(record.size()<(pos+2))
if(record.size()<(qsizetype)(pos+2))
{
inputfile.close();
qDebug() << "dltFromPCAP:" << "Size Error: Cannot read Record";
Expand Down Expand Up @@ -170,7 +170,7 @@ void DltImporter::dltIpcFromMF4(QFile &outputfile,QString fileName,QWidget *pare

mdf_hdr_t mdfHeader,mdfDgHeader,mdfCgHeader,mdfCnHeader,mdfTxHeader;
memset((char*)&mdfHeader,0,sizeof(mdf_hdr_t));
quint64 pos,posDg;
quint64 pos;

while(inputfile.read((char*)&mdfHeader,sizeof(mdf_hdr_t))==sizeof(mdf_hdr_t))
{
Expand Down Expand Up @@ -622,9 +622,8 @@ void DltImporter::dltIpcFromMF4(QFile &outputfile,QString fileName,QWidget *pare
}
if(!recordData.isEmpty())
{
int pos = 0;
quint64 time = hdBlockLinks.start_time_ns+plpRaw.timeStamp+(hdBlockLinks.hd_tz_offset_min+hdBlockLinks.hd_dst_offset_min)*60*1000000000;
if(!ipcFromPlpRaw(&plpRaw,outputfile,recordData,pos,ethFrame.etherType,time/1000000000,time%1000000000/1000))
if(!ipcFromPlpRaw(&plpRaw,outputfile,recordData,time/1000000000,time%1000000000/1000))
{
inputfile.close();
qDebug() << "fromMF4: ERROR:" << "Size Error: Cannot read Ethernet Frame";
Expand Down Expand Up @@ -697,7 +696,7 @@ bool DltImporter::ipcFromEthernetFrame(QFile &outputfile,QByteArray &record,int
}
if(etherType==0x2090) // PLP packet found
{
if(record.size()<(pos+sizeof(plp_header_t)))
if(record.size()<(qsizetype)(pos+sizeof(plp_header_t)))
{
qDebug() << "ipcFromEthernetFrame: Size issue!";
return false;
Expand All @@ -717,11 +716,11 @@ bool DltImporter::ipcFromEthernetFrame(QFile &outputfile,QByteArray &record,int
{
inSegment = false;
}
bool multiFrame = qFromBigEndian(plpHeader->probeFlags) & 0x8;
//bool multiFrame = qFromBigEndian(plpHeader->probeFlags) & 0x8;
if(qFromBigEndian(plpHeader->probeId) == 0xd0 && qFromBigEndian(plpHeader->msgType) == 0x500)
{
counterRecordsIPC++;
while(record.size()>=(pos+sizeof(plp_header_data_t)))
while(record.size()>=(qsizetype)(pos+sizeof(plp_header_data_t)))
{
plp_header_data_t *plpHeaderData = (plp_header_data_t *) (record.data()+pos);

Expand Down Expand Up @@ -807,7 +806,7 @@ bool DltImporter::ipcFromEthernetFrame(QFile &outputfile,QByteArray &record,int
return true;
}

bool DltImporter::ipcFromPlpRaw(mdf_plpRaw_t *plpRaw, QFile &outputfile,QByteArray &record,int pos,quint16 etherType,quint32 sec,quint32 usec)
bool DltImporter::ipcFromPlpRaw(mdf_plpRaw_t *plpRaw, QFile &outputfile,QByteArray &record,quint32 sec,quint32 usec)
{
bool startOfSegment = plpRaw->probeFlags & 0x2;
if(startOfSegment)
Expand All @@ -820,7 +819,7 @@ bool DltImporter::ipcFromPlpRaw(mdf_plpRaw_t *plpRaw, QFile &outputfile,QByteArr
{
inSegment = false;
}
bool multiFrame = plpRaw->probeFlags & 0x8;
//bool multiFrame = plpRaw->probeFlags & 0x8;
if(plpRaw->probeId == 0xd0 && plpRaw->msgType == 0x500)
{
counterRecordsIPC++;
Expand Down Expand Up @@ -970,7 +969,7 @@ bool DltImporter::dltFromEthernetFrame(QFile &outputfile,QByteArray &record,int
}
if(etherType==0x2090) // PLP packet found
{
if(record.size()<(pos+sizeof(plp_header_t)))
if(record.size()<(qsizetype)(pos+sizeof(plp_header_t)))
{
qDebug() << "dltFromEthernetFrame: Size issue!";
return false;
Expand Down Expand Up @@ -1013,7 +1012,7 @@ bool DltImporter::dltFromEthernetFrame(QFile &outputfile,QByteArray &record,int
qDebug() << "Size issue!";
return false;
}
quint16 identification = (((quint16)record.at(pos))<<8)|((quint16)(record.at(pos+1)&0xff));
//quint16 identification = (((quint16)record.at(pos))<<8)|((quint16)(record.at(pos+1)&0xff));
pos+=2;
if(record.size()<(pos+2))
{
Expand Down
2 changes: 1 addition & 1 deletion src/dltimporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class DltImporter
bool dltFrame(QFile &outputfile,QByteArray &record,int pos,quint32 sec = 0,quint32 usec = 0);
bool dltFromEthernetFrame(QFile &outputfile,QByteArray &record,int pos,quint16 etherType,quint32 sec = 0,quint32 usec = 0);
bool ipcFromEthernetFrame(QFile &outputfile,QByteArray &record,int pos,quint16 etherType,quint32 sec = 0,quint32 usec = 0);
bool ipcFromPlpRaw(mdf_plpRaw_t *plpRaw, QFile &outputfile,QByteArray &record,int pos,quint16 etherType,quint32 sec = 0,quint32 usec = 0);
bool ipcFromPlpRaw(mdf_plpRaw_t *plpRaw, QFile &outputfile,QByteArray &record,quint32 sec = 0,quint32 usec = 0);

void writeDLTMessageToFile(QFile &outputfile,QByteArray &bufferHeader,char* bufferPayload,quint32 bufferPayloadSize,EcuItem* ecuitem = 0,quint32 sec = 0,quint32 usec = 0);

Expand Down
3 changes: 3 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ void MainWindow::initSignalConnections()

// connect file loaded signal with explorerView
connect(this, &MainWindow::dltFileLoaded, this, [this](const QStringList& paths){
Q_UNUSED(paths)
QSortFilterProxyModel* proxyModel = reinterpret_cast<QSortFilterProxyModel*>(ui->exploreView->model());
QFileSystemModel* fsModel = reinterpret_cast<QFileSystemModel*>(proxyModel->sourceModel());
ui->exploreView->scrollTo(
Expand Down Expand Up @@ -8359,10 +8360,12 @@ void MainWindow::on_checkBoxFilterRange_stateChanged(int arg1)

void MainWindow::on_lineEditFilterStart_textChanged(const QString &arg1)
{
Q_UNUSED(arg1)
applyConfigEnabled(true);
}

void MainWindow::on_lineEditFilterEnd_textChanged(const QString &arg1)
{
Q_UNUSED(arg1)
applyConfigEnabled(true);
}
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QT_VER_MIN = $$member(QT_VERSION, 1)
QMAKE_CFLAGS += -std=gnu99
QMAKE_CFLAGS += -Wall
QMAKE_CFLAGS += -Wextra
#QMAKE_CFLAGS += -pedantic
#QMAKE_CXXFLAGS += -pedantic
}

*-g++* {
Expand Down

0 comments on commit 63824b1

Please sign in to comment.