From fdabd73da68cdc43f44c879bb46904f2ec921483 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Sun, 8 Dec 2019 14:59:41 +0100 Subject: [PATCH] Problem: parameters not const where const possible Solution: add const --- src/ctx.cpp | 4 +++- src/ctx.hpp | 2 +- src/options.cpp | 2 +- tests/test_security_curve.cpp | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ctx.cpp b/src/ctx.cpp index 01780526..bd5f7f16 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -616,7 +616,9 @@ int zmq::thread_ctx_t::set (int option_, const void *optval_, size_t optvallen_) return -1; } -int zmq::thread_ctx_t::get (int option_, void *optval_, size_t *optvallen_) +int zmq::thread_ctx_t::get (int option_, + void *optval_, + const size_t *optvallen_) { const bool is_int = (*optvallen_ == sizeof (int)); int *value = static_cast (optval_); diff --git a/src/ctx.hpp b/src/ctx.hpp index 9aef8434..bdc358b2 100644 --- a/src/ctx.hpp +++ b/src/ctx.hpp @@ -73,7 +73,7 @@ class thread_ctx_t const char *name_ = NULL) const; int set (int option_, const void *optval_, size_t optvallen_); - int get (int option_, void *optval_, size_t *optvallen_); + int get (int option_, void *optval_, const size_t *optvallen_); protected: // Synchronisation of access to context options. diff --git a/src/options.cpp b/src/options.cpp index 8d0041e8..19a800e1 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -85,7 +85,7 @@ int zmq::do_getsockopt (void *const optval_, #ifdef ZMQ_HAVE_CURVE static int do_getsockopt_curve_key (void *const optval_, - size_t *const optvallen_, + const size_t *const optvallen_, const uint8_t (&curve_key_)[CURVE_KEYSIZE]) { if (*optvallen_ == CURVE_KEYSIZE) { diff --git a/tests/test_security_curve.cpp b/tests/test_security_curve.cpp index 5c1f61e4..62eff79e 100644 --- a/tests/test_security_curve.cpp +++ b/tests/test_security_curve.cpp @@ -100,9 +100,9 @@ static void zap_handler_large_routing_id (void * /*unused_*/) zap_handler_generic (zap_ok, large_routing_id); } -void expect_new_client_curve_bounce_fail (char *server_public_, - char *client_public_, - char *client_secret_, +void expect_new_client_curve_bounce_fail (const char *server_public_, + const char *client_public_, + const char *client_secret_, char *my_endpoint_, void *server_, void **client_mon_ = NULL,