Fixed compiler warnings
This commit is contained in:
parent
d0cddbafb8
commit
d9f788e93d
@ -78,4 +78,4 @@ QMAKE_DISTCLEAN += object_script.*
|
||||
include(../version.pri)
|
||||
|
||||
# TODO(LOW): Test only
|
||||
include(modeltest.pri)
|
||||
CONFIG(debug, debug|release):include(modeltest.pri)
|
||||
|
@ -29,11 +29,13 @@ PortGroupList::PortGroupList()
|
||||
{
|
||||
PortGroup *pg;
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
// TODO(LOW): Remove
|
||||
streamModelTester_ = new ModelTest(getStreamModel());
|
||||
portModelTester_ = new ModelTest(getPortModel());
|
||||
portStatsModelTester_ = new ModelTest(getPortStatsModel());
|
||||
|
||||
#endif
|
||||
|
||||
// Add the "Local" Port Group
|
||||
pg = new PortGroup;
|
||||
addPortGroup(*pg);
|
||||
|
@ -168,10 +168,10 @@ void PortsWindow::when_portModel_dataChanged(const QModelIndex& topLeft,
|
||||
if ((tvPortList->currentIndex() >= topLeft) &&
|
||||
(tvPortList->currentIndex() <= bottomRight))
|
||||
#endif
|
||||
if ((topLeft < tvPortList->currentIndex()) ||
|
||||
(topLeft == tvPortList->currentIndex()) &&
|
||||
((tvPortList->currentIndex() < bottomRight)) ||
|
||||
(tvPortList->currentIndex() == bottomRight))
|
||||
if (((topLeft < tvPortList->currentIndex()) ||
|
||||
(topLeft == tvPortList->currentIndex())) &&
|
||||
(((tvPortList->currentIndex() < bottomRight)) ||
|
||||
(tvPortList->currentIndex() == bottomRight)))
|
||||
{
|
||||
updatePortViewActions(tvPortList->currentIndex());
|
||||
}
|
||||
|
@ -135,7 +135,9 @@ StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
|
||||
LoadCurrentStream();
|
||||
mpPacketModel = new PacketModel(this);
|
||||
tvPacketTree->setModel(mpPacketModel);
|
||||
#ifndef QT_NO_DEBUG
|
||||
mpPacketModelTester = new ModelTest(mpPacketModel);
|
||||
#endif
|
||||
tvPacketTree->header()->hide();
|
||||
vwPacketDump->setModel(mpPacketModel);
|
||||
vwPacketDump->setSelectionModel(tvPacketTree->selectionModel());
|
||||
@ -386,7 +388,7 @@ void StreamConfigDialog::on_tbDelete_clicked()
|
||||
{
|
||||
int n;
|
||||
QModelIndex idx;
|
||||
AbstractProtocol *p;
|
||||
AbstractProtocol *p = NULL;
|
||||
|
||||
idx = lvSelectedProtocols->currentIndex();
|
||||
|
||||
@ -405,6 +407,7 @@ void StreamConfigDialog::on_tbDelete_clicked()
|
||||
p = _iter->next();
|
||||
}
|
||||
|
||||
Q_CHECK_PTR(p);
|
||||
_iter->remove();
|
||||
delete p;
|
||||
|
||||
@ -416,7 +419,7 @@ void StreamConfigDialog::on_tbUp_clicked()
|
||||
{
|
||||
int m, n;
|
||||
QModelIndex idx;
|
||||
AbstractProtocol *p;
|
||||
AbstractProtocol *p = NULL;
|
||||
|
||||
idx = lvSelectedProtocols->currentIndex();
|
||||
|
||||
@ -435,6 +438,7 @@ void StreamConfigDialog::on_tbUp_clicked()
|
||||
p = _iter->next();
|
||||
}
|
||||
|
||||
Q_CHECK_PTR(p);
|
||||
_iter->remove();
|
||||
_iter->previous();
|
||||
_iter->insert(p);
|
||||
@ -447,7 +451,7 @@ void StreamConfigDialog::on_tbDown_clicked()
|
||||
{
|
||||
int m, n;
|
||||
QModelIndex idx;
|
||||
AbstractProtocol *p;
|
||||
AbstractProtocol *p = NULL;
|
||||
|
||||
idx = lvSelectedProtocols->currentIndex();
|
||||
|
||||
@ -466,6 +470,7 @@ void StreamConfigDialog::on_tbDown_clicked()
|
||||
p = _iter->next();
|
||||
}
|
||||
|
||||
Q_CHECK_PTR(p);
|
||||
_iter->remove();
|
||||
_iter->next();
|
||||
_iter->insert(p);
|
||||
|
@ -403,7 +403,7 @@ int StreamBase::frameProtocolLength(int frameIndex) const
|
||||
|
||||
int StreamBase::frameCount() const
|
||||
{
|
||||
int count;
|
||||
int count = 0;
|
||||
|
||||
switch (sendUnit())
|
||||
{
|
||||
|
@ -82,7 +82,8 @@ void PbRpcChannel::CallMethod(
|
||||
::google::protobuf::Message *response,
|
||||
::google::protobuf::Closure* done)
|
||||
{
|
||||
char msg[MSGBUF_SIZE];
|
||||
char msgBuf[MSGBUF_SIZE];
|
||||
char* const msg = &msgBuf[0];
|
||||
int len;
|
||||
bool ret;
|
||||
|
||||
@ -110,7 +111,7 @@ void PbRpcChannel::CallMethod(
|
||||
if (!req->IsInitialized())
|
||||
{
|
||||
qWarning("RpcChannel: missing required fields in request");
|
||||
qDebug(req->InitializationErrorString().c_str());
|
||||
qDebug("%s", req->InitializationErrorString().c_str());
|
||||
|
||||
qFatal("exiting");
|
||||
|
||||
@ -125,13 +126,13 @@ void PbRpcChannel::CallMethod(
|
||||
this->response=response;
|
||||
isPending = true;
|
||||
|
||||
ret = req->SerializeToArray((void*) (&msg[PB_HDR_SIZE]), sizeof(msg));
|
||||
ret = req->SerializeToArray((void*)(msg+PB_HDR_SIZE), sizeof(msgBuf)-PB_HDR_SIZE);
|
||||
Q_ASSERT(ret == true);
|
||||
|
||||
len = req->ByteSize();
|
||||
*((quint16*)(&msg[0])) = HTONS(PB_MSG_TYPE_REQUEST); // type
|
||||
*((quint16*)(&msg[2])) = HTONS(method->index()); // method id
|
||||
*((quint32*)(&msg[4])) = HTONL(len); // len
|
||||
*((quint16*)(msg+0)) = HTONS(PB_MSG_TYPE_REQUEST); // type
|
||||
*((quint16*)(msg+2)) = HTONS(method->index()); // method id
|
||||
*((quint32*)(msg+4)) = HTONL(len); // len
|
||||
|
||||
// Avoid printing stats since it happens every couple of seconds
|
||||
if (pendingMethodId != 13)
|
||||
@ -260,7 +261,7 @@ void PbRpcChannel::on_mpSocket_readyRead()
|
||||
if (!response->IsInitialized())
|
||||
{
|
||||
qWarning("RpcChannel: missing required fields in response");
|
||||
qDebug(response->InitializationErrorString().c_str());
|
||||
qDebug("%s", response->InitializationErrorString().c_str());
|
||||
|
||||
controller->SetFailed("Required fields missing");
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ void RpcServer::done(PbRpcController *controller)
|
||||
{
|
||||
google::protobuf::Message *response = controller->response();
|
||||
QIODevice *blob;
|
||||
char msg[MSGBUF_SIZE];
|
||||
char msgBuf[MSGBUF_SIZE];
|
||||
char* const msg = &msgBuf[0];
|
||||
int len;
|
||||
|
||||
//qDebug("In RpcServer::done");
|
||||
@ -86,9 +87,9 @@ void RpcServer::done(PbRpcController *controller)
|
||||
len = blob->size();
|
||||
qDebug("is binary blob of len %d", len);
|
||||
|
||||
*((quint16*)(&msg[0])) = HTONS(PB_MSG_TYPE_BINBLOB); // type
|
||||
*((quint16*)(&msg[2])) = HTONS(pendingMethodId); // method
|
||||
(*(quint32*)(&msg[4])) = HTONL(len); // len
|
||||
*((quint16*)(msg+0)) = HTONS(PB_MSG_TYPE_BINBLOB); // type
|
||||
*((quint16*)(msg+2)) = HTONS(pendingMethodId); // method
|
||||
(*(quint32*)(msg+4)) = HTONL(len); // len
|
||||
|
||||
clientSock->write(msg, PB_HDR_SIZE);
|
||||
|
||||
@ -97,7 +98,7 @@ void RpcServer::done(PbRpcController *controller)
|
||||
{
|
||||
int l;
|
||||
|
||||
len = blob->read(msg, sizeof(msg));
|
||||
len = blob->read(msg, sizeof(msgBuf));
|
||||
l = clientSock->write(msg, len);
|
||||
Q_ASSERT(l == len);
|
||||
}
|
||||
@ -108,18 +109,18 @@ void RpcServer::done(PbRpcController *controller)
|
||||
if (!response->IsInitialized())
|
||||
{
|
||||
qWarning("response missing required fields!!");
|
||||
qDebug(response->InitializationErrorString().c_str());
|
||||
qDebug("%s", response->InitializationErrorString().c_str());
|
||||
qFatal("exiting");
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
response->SerializeToArray((void*) &msg[PB_HDR_SIZE], sizeof(msg));
|
||||
response->SerializeToArray((void*)(msg+PB_HDR_SIZE), sizeof(msgBuf)-PB_HDR_SIZE);
|
||||
|
||||
len = response->ByteSize();
|
||||
|
||||
*((quint16*)(&msg[0])) = HTONS(PB_MSG_TYPE_RESPONSE); // type
|
||||
*((quint16*)(&msg[2])) = HTONS(pendingMethodId); // method
|
||||
*((quint32*)(&msg[4])) = HTONL(len); // len
|
||||
*((quint16*)(msg+0)) = HTONS(PB_MSG_TYPE_RESPONSE); // type
|
||||
*((quint16*)(msg+2)) = HTONS(pendingMethodId); // method
|
||||
*((quint32*)(msg+4)) = HTONL(len); // len
|
||||
|
||||
// Avoid printing stats since it happens once every couple of seconds
|
||||
if (pendingMethodId != 13)
|
||||
@ -248,7 +249,7 @@ void RpcServer::when_dataAvail()
|
||||
if (!req->IsInitialized())
|
||||
{
|
||||
qWarning("Missing required fields in request");
|
||||
qDebug(req->InitializationErrorString().c_str());
|
||||
qDebug("%s", req->InitializationErrorString().c_str());
|
||||
qFatal("exiting");
|
||||
delete req;
|
||||
delete resp;
|
||||
|
@ -76,7 +76,7 @@ StreamBase* AbstractPort::stream(int streamId)
|
||||
{
|
||||
for (int i = 0; i < streamList_.size(); i++)
|
||||
{
|
||||
if (streamId == streamList_.at(i)->id())
|
||||
if ((uint)streamId == streamList_.at(i)->id())
|
||||
return streamList_.at(i);
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ bool AbstractPort::deleteStream(int streamId)
|
||||
{
|
||||
StreamBase *stream;
|
||||
|
||||
if (streamId == streamList_.at(i)->id())
|
||||
if ((uint)streamId == streamList_.at(i)->id())
|
||||
{
|
||||
stream = streamList_.takeAt(i);
|
||||
delete stream;
|
||||
@ -157,6 +157,7 @@ void AbstractPort::updatePacketList()
|
||||
if (streamList_[i]->isFrameVariable())
|
||||
{
|
||||
isVariable = true;
|
||||
len = 0; // avoid compiler warning; get len value for each pkt
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,7 +217,7 @@ void AbstractPort::updatePacketList()
|
||||
*/
|
||||
|
||||
setPacketListLoopMode(true, streamList_[i]->sendUnit() ==
|
||||
OstProto::StreamControl::e_su_bursts ? ibg : ipg);
|
||||
StreamBase::e_su_bursts ? ibg : ipg);
|
||||
goto _stop_no_more_pkts;
|
||||
|
||||
case ::OstProto::StreamControl::e_nw_goto_next:
|
||||
|
@ -132,6 +132,7 @@ PcapPort::PortMonitor::PortMonitor(const char *device, Direction direction,
|
||||
ret = pcap_setdirection(handle_, PCAP_D_OUT);
|
||||
break;
|
||||
default:
|
||||
ret = -1; // avoid 'may be used uninitialized' warning
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
#endif
|
||||
@ -351,8 +352,7 @@ int PcapPort::PortTransmitter::sendQueueTransmit(pcap_t *p,
|
||||
struct pcap_pkthdr *hdr = (struct pcap_pkthdr*) queue->buffer;
|
||||
char *end = queue->buffer + queue->len;
|
||||
|
||||
if (sync)
|
||||
ts = hdr->ts;
|
||||
ts = hdr->ts;
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
void init();
|
||||
|
||||
virtual bool hasExclusiveControl() { return false; }
|
||||
virtual bool setExclusiveControl(bool exclusive) { return false; }
|
||||
virtual bool setExclusiveControl(bool /*exclusive*/) { return false; }
|
||||
|
||||
virtual void clearPacketList() {
|
||||
transmitter_->clearPacketList();
|
||||
|
Loading…
Reference in New Issue
Block a user