Fixed gcc4 errors and warnings

This commit is contained in:
Srivats P. 2011-04-09 20:22:35 +05:30
parent 194aac9b7d
commit 9771c50592
6 changed files with 94 additions and 63 deletions

View File

@ -238,7 +238,7 @@ bool Port::openStreams(QString fileName, bool append, QString &error)
if (fmt == NULL) if (fmt == NULL)
goto _fail; goto _fail;
if (optDialog = fmt->openOptionsDialog()) if ((optDialog = fmt->openOptionsDialog()))
{ {
int ret; int ret;
optDialog->setParent(mainWindow, Qt::Dialog); optDialog->setParent(mainWindow, Qt::Dialog);

View File

@ -646,7 +646,7 @@ QDialog* PcapFileFormat::openOptionsDialog()
return importDialog_; return importDialog_;
} }
bool PcapFileFormat::isMyFileFormat(const QString fileName) bool PcapFileFormat::isMyFileFormat(const QString /*fileName*/)
{ {
// TODO // TODO
return true; return true;

View File

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "arp.pb.h" #include "arp.pb.h"
#include "eth2.pb.h" #include "eth2.pb.h"
#include "dot3.pb.h" #include "dot3.pb.h"
#include "gmp.pb.h"
#include "hexdump.pb.h" #include "hexdump.pb.h"
#include "llc.pb.h" #include "llc.pb.h"
#include "mac.pb.h" #include "mac.pb.h"
@ -68,9 +69,9 @@ PdmlProtocol* PdmlUnknownProtocol::createInstance()
return new PdmlUnknownProtocol(); return new PdmlUnknownProtocol();
} }
void PdmlUnknownProtocol::preProtocolHandler(QString name, void PdmlUnknownProtocol::preProtocolHandler(QString /*name*/,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes &attributes, int expectedPos,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol* /*pbProto*/, OstProto::Stream *stream)
{ {
bool isOk; bool isOk;
int size; int size;
@ -130,9 +131,9 @@ void PdmlUnknownProtocol::postProtocolHandler(OstProto::Protocol *pbProto,
endPos_ = expPos_ = -1; endPos_ = expPos_ = -1;
} }
void PdmlUnknownProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlUnknownProtocol::unknownFieldHandler(QString name, int pos,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
OstProto::HexDump *hexDump = pbProto->MutableExtension(OstProto::hexDump); OstProto::HexDump *hexDump = pbProto->MutableExtension(OstProto::hexDump);
@ -198,9 +199,9 @@ PdmlProtocol* PdmlFrameProtocol::createInstance()
return new PdmlFrameProtocol(); return new PdmlFrameProtocol();
} }
void PdmlFrameProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlFrameProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol* /*pbProto*/, OstProto::Stream *stream)
{ {
if (name == "frame.len") if (name == "frame.len")
{ {
@ -252,8 +253,8 @@ PdmlProtocol* PdmlSvlanProtocol::createInstance()
return new PdmlSvlanProtocol(); return new PdmlSvlanProtocol();
} }
void PdmlSvlanProtocol::preProtocolHandler(QString name, void PdmlSvlanProtocol::preProtocolHandler(QString /*name*/,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes& /*attributes*/, int /*expectedPos*/,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream *stream)
{ {
OstProto::Vlan *svlan = pbProto->MutableExtension(OstProto::svlan); OstProto::Vlan *svlan = pbProto->MutableExtension(OstProto::svlan);
@ -279,8 +280,8 @@ void PdmlSvlanProtocol::preProtocolHandler(QString name,
} }
} }
void PdmlSvlanProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlSvlanProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream *stream)
{ {
if ((name == "ieee8021ad.id") || (name == "ieee8021ad.svid")) if ((name == "ieee8021ad.id") || (name == "ieee8021ad.svid"))
@ -344,8 +345,8 @@ PdmlProtocol* PdmlVlanProtocol::createInstance()
return new PdmlVlanProtocol(); return new PdmlVlanProtocol();
} }
void PdmlVlanProtocol::preProtocolHandler(QString name, void PdmlVlanProtocol::preProtocolHandler(QString /*name*/,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes& /*attributes*/, int /*expectedPos*/,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream *stream)
{ {
OstProto::Vlan *vlan = pbProto->MutableExtension(OstProto::vlan); OstProto::Vlan *vlan = pbProto->MutableExtension(OstProto::vlan);
@ -371,8 +372,8 @@ void PdmlVlanProtocol::preProtocolHandler(QString name,
} }
} }
void PdmlVlanProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlVlanProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream *stream)
{ {
if (name == "vlan.id") if (name == "vlan.id")
@ -420,9 +421,9 @@ PdmlProtocol* PdmlEthProtocol::createInstance()
return new PdmlEthProtocol(); return new PdmlEthProtocol();
} }
void PdmlEthProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlEthProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol* /*pbProto*/, OstProto::Stream *stream)
{ {
if (name == "eth.vlan.tpid") if (name == "eth.vlan.tpid")
{ {
@ -523,9 +524,9 @@ PdmlProtocol* PdmlLlcProtocol::createInstance()
return new PdmlLlcProtocol(); return new PdmlLlcProtocol();
} }
void PdmlLlcProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlLlcProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol* /*pbProto*/, OstProto::Stream *stream)
{ {
if (name == "llc.oui") if (name == "llc.oui")
{ {
@ -554,7 +555,7 @@ void PdmlLlcProtocol::unknownFieldHandler(QString name, int pos, int size,
} }
void PdmlLlcProtocol::postProtocolHandler(OstProto::Protocol *pbProto, void PdmlLlcProtocol::postProtocolHandler(OstProto::Protocol *pbProto,
OstProto::Stream *stream) OstProto::Stream* /*stream*/)
{ {
OstProto::Llc *llc = pbProto->MutableExtension(OstProto::llc); OstProto::Llc *llc = pbProto->MutableExtension(OstProto::llc);
@ -615,9 +616,9 @@ PdmlProtocol* PdmlIp4Protocol::createInstance()
return new PdmlIp4Protocol(); return new PdmlIp4Protocol();
} }
void PdmlIp4Protocol::unknownFieldHandler(QString name, int pos, int size, void PdmlIp4Protocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
bool isOk; bool isOk;
@ -686,9 +687,9 @@ PdmlProtocol* PdmlIp6Protocol::createInstance()
return new PdmlIp6Protocol(); return new PdmlIp6Protocol();
} }
void PdmlIp6Protocol::unknownFieldHandler(QString name, int pos, int size, void PdmlIp6Protocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
bool isOk; bool isOk;
@ -711,7 +712,7 @@ void PdmlIp6Protocol::unknownFieldHandler(QString name, int pos, int size,
} }
void PdmlIp6Protocol::postProtocolHandler(OstProto::Protocol *pbProto, void PdmlIp6Protocol::postProtocolHandler(OstProto::Protocol *pbProto,
OstProto::Stream *stream) OstProto::Stream* /*stream*/)
{ {
OstProto::Ip6 *ip6 = pbProto->MutableExtension(OstProto::ip6); OstProto::Ip6 *ip6 = pbProto->MutableExtension(OstProto::ip6);
@ -751,8 +752,8 @@ PdmlProtocol* PdmlIcmpProtocol::createInstance()
} }
void PdmlIcmpProtocol::preProtocolHandler(QString name, void PdmlIcmpProtocol::preProtocolHandler(QString name,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes& /*attributes*/, int /*expectedPos*/,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
OstProto::Icmp *icmp = pbProto->MutableExtension(OstProto::icmp); OstProto::Icmp *icmp = pbProto->MutableExtension(OstProto::icmp);
@ -766,9 +767,9 @@ void PdmlIcmpProtocol::preProtocolHandler(QString name,
icmp->set_type(kIcmpInvalidType); icmp->set_type(kIcmpInvalidType);
} }
void PdmlIcmpProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlIcmpProtocol::unknownFieldHandler(QString /*name*/, int /*pos*/,
const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
bool isOk; bool isOk;
OstProto::Icmp *icmp = pbProto->MutableExtension(OstProto::icmp); OstProto::Icmp *icmp = pbProto->MutableExtension(OstProto::icmp);
@ -904,9 +905,9 @@ PdmlProtocol* PdmlIgmpProtocol::createInstance()
return new PdmlIgmpProtocol(); return new PdmlIgmpProtocol();
} }
void PdmlIgmpProtocol::preProtocolHandler(QString name, void PdmlIgmpProtocol::preProtocolHandler(QString /*name*/,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes& /*attributes*/, int /*expectedPos*/,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
OstProto::Gmp *igmp = pbProto->MutableExtension(OstProto::igmp); OstProto::Gmp *igmp = pbProto->MutableExtension(OstProto::igmp);
@ -918,9 +919,9 @@ void PdmlIgmpProtocol::preProtocolHandler(QString name,
version_ = 0; version_ = 0;
} }
void PdmlIgmpProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlIgmpProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
bool isOk; bool isOk;
OstProto::Gmp *igmp = pbProto->MutableExtension(OstProto::igmp); OstProto::Gmp *igmp = pbProto->MutableExtension(OstProto::igmp);
@ -992,7 +993,7 @@ void PdmlIgmpProtocol::unknownFieldHandler(QString name, int pos, int size,
} }
} }
void PdmlIgmpProtocol::postProtocolHandler(OstProto::Protocol *pbProto, void PdmlIgmpProtocol::postProtocolHandler(OstProto::Protocol* /*pbProto*/,
OstProto::Stream *stream) OstProto::Stream *stream)
{ {
// version is 0 for IGMP like protocols such as RGMP which we don't // version is 0 for IGMP like protocols such as RGMP which we don't
@ -1031,9 +1032,9 @@ PdmlProtocol* PdmlMldProtocol::createInstance()
return new PdmlMldProtocol(); return new PdmlMldProtocol();
} }
void PdmlMldProtocol::preProtocolHandler(QString name, void PdmlMldProtocol::preProtocolHandler(QString /*name*/,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes &attributes, int /*expectedPos*/,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
bool isOk; bool isOk;
OstProto::Gmp *mld = pbProto->MutableExtension(OstProto::mld); OstProto::Gmp *mld = pbProto->MutableExtension(OstProto::mld);
@ -1046,9 +1047,9 @@ void PdmlMldProtocol::preProtocolHandler(QString name,
protoSize_ = attributes.value("size").toString().toUInt(&isOk); protoSize_ = attributes.value("size").toString().toUInt(&isOk);
} }
void PdmlMldProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlMldProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream* /*stream*/)
{ {
bool isOk; bool isOk;
OstProto::Gmp *mld = pbProto->MutableExtension(OstProto::mld); OstProto::Gmp *mld = pbProto->MutableExtension(OstProto::mld);
@ -1143,9 +1144,9 @@ PdmlProtocol* PdmlTcpProtocol::createInstance()
return new PdmlTcpProtocol(); return new PdmlTcpProtocol();
} }
void PdmlTcpProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlTcpProtocol::unknownFieldHandler(QString name, int /*pos*/,
const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto, int /*size*/, const QXmlStreamAttributes &attributes,
OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream *stream)
{ {
if (name == "tcp.options") if (name == "tcp.options")
options_ = QByteArray::fromHex(attributes.value("value").toString().toUtf8()); options_ = QByteArray::fromHex(attributes.value("value").toString().toUtf8());
@ -1235,7 +1236,7 @@ PdmlProtocol* PdmlUdpProtocol::createInstance()
} }
void PdmlUdpProtocol::postProtocolHandler(OstProto::Protocol *pbProto, void PdmlUdpProtocol::postProtocolHandler(OstProto::Protocol *pbProto,
OstProto::Stream *stream) OstProto::Stream* /*stream*/)
{ {
OstProto::Udp *udp = pbProto->MutableExtension(OstProto::udp); OstProto::Udp *udp = pbProto->MutableExtension(OstProto::udp);
@ -1263,7 +1264,7 @@ PdmlProtocol* PdmlTextProtocol::createInstance()
return new PdmlTextProtocol(); return new PdmlTextProtocol();
} }
void PdmlTextProtocol::preProtocolHandler(QString name, void PdmlTextProtocol::preProtocolHandler(QString /*name*/,
const QXmlStreamAttributes &attributes, int expectedPos, const QXmlStreamAttributes &attributes, int expectedPos,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol *pbProto, OstProto::Stream *stream)
{ {
@ -1305,7 +1306,7 @@ _skip_pos_size_proc:
void PdmlTextProtocol::unknownFieldHandler(QString name, int pos, int size, void PdmlTextProtocol::unknownFieldHandler(QString name, int pos, int size,
const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto, const QXmlStreamAttributes &attributes, OstProto::Protocol *pbProto,
OstProto::Stream *stream) OstProto::Stream* /*stream*/)
{ {
_retry: _retry:
switch(contentType_) switch(contentType_)

View File

@ -49,15 +49,26 @@ bool PdmlFileFormat::openStreams(const QString fileName,
emit status("Reading PDML packets..."); emit status("Reading PDML packets...");
emit target(100); // in percentage emit target(100); // in percentage
// TODO: fill in error string isOk = reader->read(&file, NULL, &stop_);
if (stop_)
goto _user_cancel;
isOk = reader->read(&file); if (!isOk)
{
error.append(QString("Error processing PDML (%1, %2): %3\n")
.arg(reader->lineNumber())
.arg(reader->columnNumber())
.arg(reader->errorString()));
goto _exit;
}
goto _exit; goto _exit;
_open_fail: _open_fail:
isOk = false; isOk = false;
_user_cancel:
_exit: _exit:
delete reader; delete reader;

View File

@ -150,9 +150,9 @@ void PdmlProtocol::knownFieldHandler(QString name, QString valueHexStr,
} }
} }
void PdmlProtocol::unknownFieldHandler(QString name, void PdmlProtocol::unknownFieldHandler(QString /*name*/,
int pos, int size, const QXmlStreamAttributes &attributes, int /*pos*/, int /*size*/, const QXmlStreamAttributes& /*attributes*/,
OstProto::Protocol *pbProto, OstProto::Stream *stream) OstProto::Protocol* /*pbProto*/, OstProto::Stream* /*stream*/)
{ {
return; // do nothing! return; // do nothing!
} }

View File

@ -2,10 +2,29 @@ TEMPLATE = app
CONFIG += qt console CONFIG += qt console
QT += xml network script QT += xml network script
INCLUDEPATH += "../rpc/" "../common/" INCLUDEPATH += "../rpc/" "../common/"
LIBS += -L"../common/debug" -lostproto win32 {
LIBS += -lwpcap -lpacket
CONFIG(debug, debug|release) {
LIBS += -L"../common/debug" -lostproto
LIBS += -L"../rpc/debug" -lpbrpc
POST_TARGETDEPS += \
"../common/debug/libostproto.a" \
"../rpc/debug/libpbrpc.a"
} else {
LIBS += -L"../common/release" -lostproto
LIBS += -L"../rpc/release" -lpbrpc
POST_TARGETDEPS += \
"../common/release/libostproto.a" \
"../rpc/release/libpbrpc.a"
}
} else {
LIBS += -lpcap
LIBS += -L"../common" -lostproto
LIBS += -L"../rpc" -lpbrpc
POST_TARGETDEPS += "../common/libostproto.a" "../rpc/libpbrpc.a"
}
LIBS += -lprotobuf LIBS += -lprotobuf
LIBS += -L"../extra/qhexedit2/$(OBJECTS_DIR)/" -lqhexedit2 LIBS += -L"../extra/qhexedit2/$(OBJECTS_DIR)/" -lqhexedit2
POST_TARGETDEPS += "../common/debug/libostproto.a"
HEADERS += HEADERS +=
SOURCES += main.cpp SOURCES += main.cpp