Fixes for 64bit compilation and Qt4.6

This commit is contained in:
Srivats P. 2010-04-16 16:45:35 +05:30
parent 2e77fd8b94
commit 35f4a8bafb
9 changed files with 36 additions and 27 deletions

View File

@ -1,3 +1,4 @@
debug: QMAKE_CONFIG=-config debug
release: QMAKE_CONFIG=-config release
all:
@ -7,7 +8,7 @@ all:
$(MAKE) -C client
release: qmake all
debug: qmake all
clean:
-$(MAKE) -C client $@

View File

@ -18,13 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include "mainwindow.h"
#include "../common/protocolmanager.h"
#include <QApplication>
#include <QFile>
#include <QSettings>
QSettings *appSettings;
extern ProtocolManager *OstProtocolManager;
QSettings *appSettings;
QMainWindow *mainWindow;
int main(int argc, char* argv[])
@ -32,6 +34,8 @@ int main(int argc, char* argv[])
QApplication app(argc, argv);
int exitCode;
OstProtocolManager = new ProtocolManager();
/* (Portable Mode) If we have a .ini file in the same directory as the
executable, we use that instead of the platform specific location
and format for the settings */

View File

@ -130,28 +130,28 @@ QVariant PortStatsModel::data(const QModelIndex &index, int role) const
// Statistics
case e_STAT_FRAMES_RCVD:
return stats.rx_pkts();
return quint64(stats.rx_pkts());
case e_STAT_FRAMES_SENT:
return stats.tx_pkts();
return quint64(stats.tx_pkts());
case e_STAT_FRAME_SEND_RATE:
return stats.tx_pps();
return quint64(stats.tx_pps());
case e_STAT_FRAME_RECV_RATE:
return stats.rx_pps();
return quint64(stats.rx_pps());
case e_STAT_BYTES_RCVD:
return stats.rx_bytes();
return quint64(stats.rx_bytes());
case e_STAT_BYTES_SENT:
return stats.tx_bytes();
return quint64(stats.tx_bytes());
case e_STAT_BYTE_SEND_RATE:
return stats.tx_bps();
return quint64(stats.tx_bps());
case e_STAT_BYTE_RECV_RATE:
return stats.rx_bps();
return quint64(stats.rx_bps());
#if 0
case e_STAT_FRAMES_RCVD_NIC:

View File

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
// FIXME(HI) - remove
#include "../common/protocolmanager.h"
extern ProtocolManager OstProtocolManager;
extern ProtocolManager *OstProtocolManager;
int StreamConfigDialog::lastTopLevelTabIndex = 0;
@ -95,7 +95,7 @@ StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
if (id2 != ButtonIdNone && id2 != ButtonIdOther)
{
if (OstProtocolManager.isValidNeighbour(id1, id2))
if (OstProtocolManager->isValidNeighbour(id1, id2))
{
connect(btn1, SIGNAL(toggled(bool)),
btn2, SLOT(setEnabled(bool)));
@ -117,7 +117,7 @@ StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
}
mpAvailableProtocolsModel = new QStringListModel(
OstProtocolManager.protocolDatabase(), this);
OstProtocolManager->protocolDatabase(), this);
lvAllProtocols->setModel(mpAvailableProtocolsModel);
mpSelectedProtocolsModel = new QStringListModel(this);
lvSelectedProtocols->setModel(mpSelectedProtocolsModel);
@ -375,7 +375,7 @@ void StreamConfigDialog::on_tbAdd_clicked()
}
foreach(QModelIndex idx, selection)
_iter->insert(OstProtocolManager.createProtocol(
_iter->insert(OstProtocolManager->createProtocol(
mpAvailableProtocolsModel->stringList().at(idx.row()), mpStream));
updateSelectProtocolsAdvancedWidget();
@ -689,7 +689,7 @@ void StreamConfigDialog::__updateProtocol(int level, int newId)
switch (oldId)
{
case ButtonIdNone:
_iter->insert(OstProtocolManager.createProtocol(
_iter->insert(OstProtocolManager->createProtocol(
newId, mpStream));
break;
@ -699,7 +699,7 @@ void StreamConfigDialog::__updateProtocol(int level, int newId)
p =_iter->next();
if (newId)
_iter->setValue(OstProtocolManager.createProtocol(
_iter->setValue(OstProtocolManager->createProtocol(
newId, mpStream));
else
_iter->remove();

View File

@ -215,7 +215,6 @@ QVariant IcmpProtocol::fieldData(int index, FieldAttrib attrib,
cksum = 0; // avoid the 'maybe used unitialized' warning
break;
}
printf("%s: attrib = %d, cksum = %d\n", __FUNCTION__, attrib, cksum);
switch(attrib)
{

View File

@ -33,12 +33,12 @@ ProtocolListIterator::~ProtocolListIterator()
bool ProtocolListIterator::findNext(const AbstractProtocol* value) const
{
return _iter->findNext((AbstractProtocol*)((uint)value));
return _iter->findNext(const_cast<AbstractProtocol*>(value));
}
bool ProtocolListIterator::findPrevious(const AbstractProtocol* value)
{
return _iter->findPrevious((AbstractProtocol*)((uint)value));
return _iter->findPrevious(const_cast<AbstractProtocol*>(value));
}
bool ProtocolListIterator::hasNext() const
@ -69,7 +69,7 @@ void ProtocolListIterator::insert(AbstractProtocol* value)
else
value->next = NULL;
_iter->insert((AbstractProtocol*)((uint)value));
_iter->insert(const_cast<AbstractProtocol*>(value));
}
AbstractProtocol* ProtocolListIterator::next()
@ -109,7 +109,7 @@ void ProtocolListIterator::setValue(AbstractProtocol* value) const
_iter->value()->next->prev = value;
value->prev = _iter->value()->prev;
value->next = _iter->value()->next;
_iter->setValue((AbstractProtocol*)((uint)value));
_iter->setValue(const_cast<AbstractProtocol*>(value));
}
void ProtocolListIterator::toBack()

View File

@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "userscript.h"
#include "sample.h"
ProtocolManager OstProtocolManager;
ProtocolManager *OstProtocolManager;
ProtocolManager::ProtocolManager()
{

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "protocollistiterator.h"
#include "protocolmanager.h"
extern ProtocolManager OstProtocolManager;
extern ProtocolManager *OstProtocolManager;
StreamBase::StreamBase() :
mStreamId(new OstProto::StreamId),
@ -39,12 +39,12 @@ StreamBase::StreamBase() :
iter = createProtocolListIterator();
// By default newly created streams have the mac and payload protocols
proto = OstProtocolManager.createProtocol(
proto = OstProtocolManager->createProtocol(
OstProto::Protocol::kMacFieldNumber, this);
iter->insert(proto);
qDebug("stream: mac = %p", proto);
proto = OstProtocolManager.createProtocol(
proto = OstProtocolManager->createProtocol(
OstProto::Protocol::kPayloadFieldNumber, this);
iter->insert(proto);
qDebug("stream: payload = %p", proto);
@ -89,7 +89,7 @@ void StreamBase::protoDataCopyFrom(const OstProto::Stream &stream)
iter = createProtocolListIterator();
for (int i=0; i < stream.protocol_size(); i++)
{
proto = OstProtocolManager.createProtocol(
proto = OstProtocolManager->createProtocol(
stream.protocol(i).protocol_id().id(), this);
proto->protoDataCopyFrom(stream.protocol(i));
iter->insert(proto);
@ -208,7 +208,7 @@ quint16 StreamBase::frameLen(int streamIndex) const
case OstProto::StreamCore::e_fl_random:
//! \todo (MED) This 'random' sequence is same across iterations
pktLen = 64; // to avoid the 'maybe used uninitialized' warning
qsrand(((uint) this));
qsrand(reinterpret_cast<ulong>(this));
for (int i = 0; i <= streamIndex; i++)
pktLen = qrand();
pktLen = frameLenMin() + (pktLen %

View File

@ -19,12 +19,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "drone.h"
#include "../common/protocolmanager.h"
extern ProtocolManager *OstProtocolManager;
int myport;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Drone drone;
OstProtocolManager = new ProtocolManager();
app.setApplicationName(drone.objectName());