From 98d5d4d7f041778293844cefac18435dd5950437 Mon Sep 17 00:00:00 2001 From: Constantin Rack Date: Fri, 13 Nov 2015 09:47:03 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Problem:=20call=20of=20overloaded=20?= =?UTF-8?q?=E2=80=98pow()=E2=80=99=20is=20ambiguous?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solution: make base a double value --- src/options.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index e4bc011a..63b7a6ee 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -285,13 +285,13 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, case ZMQ_TCP_RECV_BUFFER: if (is_int && (value >= 0 && value <= 10) ) { - tcp_recv_buffer_size = static_cast(std::pow(2, value)) * 1024; + tcp_recv_buffer_size = static_cast(std::pow(2.0, value)) * 1024; } break; case ZMQ_TCP_SEND_BUFFER: if (is_int && (value >= 0 && value <= 10) ) { - tcp_send_buffer_size = static_cast(std::pow(2, value)) * 1024; + tcp_send_buffer_size = static_cast(std::pow(2.0, value)) * 1024; } break; From a992d9aca0ef604bd85314622c644fadd98ebbff Mon Sep 17 00:00:00 2001 From: Constantin Rack Date: Fri, 13 Nov 2015 10:08:30 +0100 Subject: [PATCH 2/2] Problem: comparison between signed and unsigned integer expressions Solution: make tcp_recv_buffer_size and tcp_send_buffer_size unsigned --- src/options.cpp | 4 ++-- src/options.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 63b7a6ee..c89d3a02 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -285,13 +285,13 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, case ZMQ_TCP_RECV_BUFFER: if (is_int && (value >= 0 && value <= 10) ) { - tcp_recv_buffer_size = static_cast(std::pow(2.0, value)) * 1024; + tcp_recv_buffer_size = static_cast(std::pow(2.0, value)) * 1024; } break; case ZMQ_TCP_SEND_BUFFER: if (is_int && (value >= 0 && value <= 10) ) { - tcp_send_buffer_size = static_cast(std::pow(2.0, value)) * 1024; + tcp_send_buffer_size = static_cast(std::pow(2.0, value)) * 1024; } break; diff --git a/src/options.hpp b/src/options.hpp index be04ec64..5eab5060 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -156,9 +156,9 @@ namespace zmq typedef std::vector tcp_accept_filters_t; tcp_accept_filters_t tcp_accept_filters; - // TCO buffer sizes - int tcp_recv_buffer_size; - int tcp_send_buffer_size; + // TCP buffer sizes + unsigned int tcp_recv_buffer_size; + unsigned int tcp_send_buffer_size; // IPC accept() filters # if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED