Merge pull request #11 from mem/master

Fix issues with channelNumber's type and nextChannelNumber
This commit is contained in:
Matt Broadstone 2015-02-11 17:23:01 -05:00
commit d45f5b09d6
4 changed files with 9 additions and 9 deletions

View File

@ -6,7 +6,7 @@
#include "qamqpclient.h" #include "qamqpclient.h"
#include "qamqpclient_p.h" #include "qamqpclient_p.h"
int QAmqpChannelPrivate::nextChannelNumber = 0; quint16 QAmqpChannelPrivate::nextChannelNumber = 0;
QAmqpChannelPrivate::QAmqpChannelPrivate(QAmqpChannel *q) QAmqpChannelPrivate::QAmqpChannelPrivate(QAmqpChannel *q)
: channelNumber(0), : channelNumber(0),
opened(false), opened(false),
@ -33,7 +33,7 @@ void QAmqpChannelPrivate::init(int channel, QAmqpClient *c)
client = c; client = c;
needOpen = channel == -1 ? true : false; needOpen = channel == -1 ? true : false;
channelNumber = channel == -1 ? ++nextChannelNumber : channel; channelNumber = channel == -1 ? ++nextChannelNumber : channel;
nextChannelNumber = qMax(channelNumber, (nextChannelNumber + 1)); nextChannelNumber = qMax(channelNumber, nextChannelNumber);
} }
bool QAmqpChannelPrivate::_q_method(const QAmqpMethodFrame &frame) bool QAmqpChannelPrivate::_q_method(const QAmqpMethodFrame &frame)

View File

@ -60,8 +60,8 @@ public:
QPointer<QAmqpClient> client; QPointer<QAmqpClient> client;
QString name; QString name;
int channelNumber; quint16 channelNumber;
static int nextChannelNumber; static quint16 nextChannelNumber;
bool opened; bool opened;
bool needOpen; bool needOpen;

View File

@ -22,12 +22,12 @@ QAmqpFrame::~QAmqpFrame()
{ {
} }
void QAmqpFrame::setChannel(qint16 channel) void QAmqpFrame::setChannel(quint16 channel)
{ {
channel_ = channel; channel_ = channel;
} }
qint16 QAmqpFrame::channel() const quint16 QAmqpFrame::channel() const
{ {
return channel_; return channel_;
} }

View File

@ -39,8 +39,8 @@ public:
FrameType type() const; FrameType type() const;
qint16 channel() const; quint16 channel() const;
void setChannel(qint16 channel); void setChannel(quint16 channel);
virtual qint32 size() const; virtual qint32 size() const;
@ -56,7 +56,7 @@ protected:
private: private:
qint8 type_; qint8 type_;
qint16 channel_; quint16 channel_;
friend QDataStream &operator<<(QDataStream &stream, const QAmqpFrame &frame); friend QDataStream &operator<<(QDataStream &stream, const QAmqpFrame &frame);
friend QDataStream &operator>>(QDataStream &stream, QAmqpFrame &frame); friend QDataStream &operator>>(QDataStream &stream, QAmqpFrame &frame);