From 1479922901fde20ce3ab2abd83b3b15108111f96 Mon Sep 17 00:00:00 2001 From: Dirkco du Plessis Date: Sun, 22 Apr 2018 15:53:52 +0100 Subject: [PATCH 1/2] Fix MSVC compile warning C4800 for bitwise operation resulting in int to boolean assignment. Fix MSVC compile warning C4244 possible loss of data. Possible data loss from uint64_t to uint32_t. --- include/amqpcpp/callbacks.h | 2 +- src/channelimpl.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/amqpcpp/callbacks.h b/include/amqpcpp/callbacks.h index a2d5ec4..66fef0d 100644 --- a/include/amqpcpp/callbacks.h +++ b/include/amqpcpp/callbacks.h @@ -45,7 +45,7 @@ using DeleteCallback = std::function; * When retrieving the size of a queue in some way */ using EmptyCallback = std::function; -using SizeCallback = std::function; +using SizeCallback = std::function; /** * Starting and stopping a consumer diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 053e479..0d55da4 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -261,11 +261,11 @@ Deferred &ChannelImpl::declareExchange(const std::string &name, ExchangeType typ else if (type == ExchangeType::consistent_hash) exchangeType = "x-consistent-hash"; // the boolean options - bool passive = flags & AMQP::passive; - bool durable = flags & AMQP::durable; - bool autodelete = flags & AMQP::autodelete; - bool internal = flags & AMQP::internal; - bool nowait = flags & AMQP::nowait; + bool passive = (flags & AMQP::passive) != 0; + bool durable = (flags & AMQP::durable) != 0; + bool autodelete = (flags & AMQP::autodelete) != 0; + bool internal = (flags & AMQP::internal) != 0; + bool nowait = (flags & AMQP::nowait) != 0; // send declare exchange frame return push(ExchangeDeclareFrame(_id, name, exchangeType, passive, durable, autodelete, internal, nowait, arguments)); From 5ec49d5b8a85a908700c8f4f390c475f1aeba3b2 Mon Sep 17 00:00:00 2001 From: Dirkco du Plessis Date: Mon, 23 Apr 2018 08:30:37 +0100 Subject: [PATCH 2/2] Added CountCallback to support 32bit unsigned int passed in defferedget. --- include/amqpcpp/callbacks.h | 3 ++- include/amqpcpp/deferredget.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/amqpcpp/callbacks.h b/include/amqpcpp/callbacks.h index 66fef0d..e1881f7 100644 --- a/include/amqpcpp/callbacks.h +++ b/include/amqpcpp/callbacks.h @@ -45,7 +45,8 @@ using DeleteCallback = std::function; * When retrieving the size of a queue in some way */ using EmptyCallback = std::function; -using SizeCallback = std::function; +using CountCallback = std::function; +using SizeCallback = std::function; /** * Starting and stopping a consumer diff --git a/include/amqpcpp/deferredget.h b/include/amqpcpp/deferredget.h index 78332be..5f5716f 100644 --- a/include/amqpcpp/deferredget.h +++ b/include/amqpcpp/deferredget.h @@ -38,9 +38,9 @@ private: /** * Callback with the number of messages still in the queue - * @var SizeCallback + * @var CountCallback */ - SizeCallback _countCallback; + CountCallback _countCallback; /** * Report success for a get operation @@ -149,7 +149,7 @@ public: * Register a function to be called when queue size information is known * @param callback the callback to execute */ - DeferredGet &onCount(const SizeCallback &callback) + DeferredGet &onCount(const CountCallback &callback) { // store callback _countCallback = callback;