added "override" keywords to overridden methods, fixed buffer overflow in setting up a connection

This commit is contained in:
Emiel Bruijntjes 2015-11-28 11:38:15 +01:00
parent d5d5d41401
commit 155c989db5
12 changed files with 18 additions and 18 deletions

View File

@ -1,7 +1,7 @@
/** /**
* AMQP field array * AMQP field array
* *
* @copyright 2014 Copernica BV * @copyright 2014, 2015 Copernica BV
*/ */
/** /**
@ -186,7 +186,7 @@ public:
* Output the object to a stream * Output the object to a stream
* @param std::ostream * @param std::ostream
*/ */
virtual void output(std::ostream &stream) const virtual void output(std::ostream &stream) const override
{ {
// prefix // prefix
stream << "array("; stream << "array(";
@ -212,7 +212,7 @@ public:
} }
/** /**
* Cast to array * Cast to array (compiler will probably never call this method)
* @return Array * @return Array
*/ */
virtual operator const Array& () const override virtual operator const Array& () const override

View File

@ -1,7 +1,7 @@
/** /**
* Decimal field type for AMQP * Decimal field type for AMQP
* *
* @copyright 2014 Copernica BV * @copyright 2014, 2015 Copernica BV
*/ */
/** /**
@ -127,7 +127,7 @@ public:
* *
* @return double value of decimalfield in double format * @return double value of decimalfield in double format
*/ */
operator double() const virtual operator double() const override
{ {
return _number / pow(10, _places); return _number / pow(10, _places);
} }
@ -138,7 +138,7 @@ public:
* *
* @return float value of decimalfield in float format * @return float value of decimalfield in float format
*/ */
operator float() const virtual operator float() const override
{ {
return static_cast<float>(_number / pow(10, _places)); return static_cast<float>(_number / pow(10, _places));
} }

View File

@ -1,7 +1,7 @@
/** /**
* Available field types for AMQP * Available field types for AMQP
* *
* @copyright 2014 Copernica BV * @copyright 2014, 2015 Copernica BV
*/ */
/** /**

View File

@ -30,6 +30,7 @@ extern const int global;
extern const int nolocal; extern const int nolocal;
extern const int noack; extern const int noack;
extern const int exclusive; extern const int exclusive;
extern const int nowait;
extern const int mandatory; extern const int mandatory;
extern const int immediate; extern const int immediate;
extern const int redelivered; extern const int redelivered;

View File

@ -192,7 +192,7 @@ public:
* Output the object to a stream * Output the object to a stream
* @param std::ostream * @param std::ostream
*/ */
virtual void output(std::ostream &stream) const virtual void output(std::ostream &stream) const override
{ {
// prefix // prefix
stream << "table("; stream << "table(";
@ -218,7 +218,7 @@ public:
} }
/** /**
* Cast to table * Cast to table (compiler will probably never call this method)
* @return Table * @return Table
*/ */
virtual operator const Table& () const override virtual operator const Table& () const override
@ -226,7 +226,6 @@ public:
// this already is an array, so no cast is necessary // this already is an array, so no cast is necessary
return *this; return *this;
} }
}; };
/** /**

View File

@ -45,7 +45,7 @@ public:
struct addrinfo hints; struct addrinfo hints;
// set everything to zero // set everything to zero
memset(&hints, 0, sizeof(struct AddressInfo)); memset(&hints, 0, sizeof(struct addrinfo));
// set hints // set hints
hints.ai_family = AF_UNSPEC; // allow IPv4 or IPv6 hints.ai_family = AF_UNSPEC; // allow IPv4 or IPv6

View File

@ -70,7 +70,7 @@ public:
* Return the type of frame * Return the type of frame
* @return uint8_t * @return uint8_t
*/ */
uint8_t type() const virtual uint8_t type() const override
{ {
return 3; return 3;
} }

View File

@ -20,7 +20,7 @@ protected:
* *
* @param buffer buffer to write frame to * @param buffer buffer to write frame to
*/ */
virtual void fill(OutBuffer& buffer) const virtual void fill(OutBuffer& buffer) const override
{ {
// call base // call base
ChannelFrame::fill(buffer); ChannelFrame::fill(buffer);

View File

@ -1,7 +1,7 @@
/** /**
* Class describing an AMQP header frame * Class describing an AMQP header frame
* *
* @copyright 2014 Copernica BV * @copyright 2014, 2015 Copernica BV
*/ */
/** /**
@ -33,7 +33,7 @@ protected:
* *
* @param buffer buffer to write frame to * @param buffer buffer to write frame to
*/ */
virtual void fill(OutBuffer& buffer) const virtual void fill(OutBuffer& buffer) const override
{ {
// call base // call base
ExtFrame::fill(buffer); ExtFrame::fill(buffer);

View File

@ -44,7 +44,7 @@ public:
* Return the type of frame * Return the type of frame
* @return uint8_t * @return uint8_t
*/ */
uint8_t type() const virtual uint8_t type() const override
{ {
// the documentation says 4, rabbitMQ sends 8 // the documentation says 4, rabbitMQ sends 8
return 8; return 8;

View File

@ -152,7 +152,7 @@ public:
* @param buffer buffer to send * @param buffer buffer to send
* @param size size of the buffer * @param size size of the buffer
*/ */
virtual void send(const char *buffer, size_t size) virtual void send(const char *buffer, size_t size) override
{ {
// is there already a buffer of data that can not be sent? // is there already a buffer of data that can not be sent?
if (_out) return _out.add(buffer, size); if (_out) return _out.add(buffer, size);

View File

@ -183,7 +183,7 @@ public:
* @param buffer buffer to send * @param buffer buffer to send
* @param size size of the buffer * @param size size of the buffer
*/ */
virtual void send(const char *buffer, size_t size) virtual void send(const char *buffer, size_t size) override
{ {
// add data to buffer // add data to buffer
_buffer.add(buffer, size); _buffer.add(buffer, size);