Problem: unnecessary passing of non-const data

Solution: make const
This commit is contained in:
Simon Giesecke 2018-05-30 22:49:54 +02:00
parent c641644bb2
commit a2f91c5509
2 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ zmq::socks_greeting_t::socks_greeting_t (uint8_t method_) : num_methods (1)
methods[0] = method_; methods[0] = method_;
} }
zmq::socks_greeting_t::socks_greeting_t (uint8_t *methods_, zmq::socks_greeting_t::socks_greeting_t (const uint8_t *methods_,
uint8_t num_methods_) : uint8_t num_methods_) :
num_methods (num_methods_) num_methods (num_methods_)
{ {
@ -273,7 +273,7 @@ bool zmq::socks_response_decoder_t::message_ready () const
return _bytes_read == 10; return _bytes_read == 10;
if (atyp == 0x03) if (atyp == 0x03)
return _bytes_read > 4 && _bytes_read == 4 + 1 + _buf[4] + 2u; return _bytes_read > 4 && _bytes_read == 4 + 1 + _buf[4] + 2u;
else
return _bytes_read == 22; return _bytes_read == 22;
} }

View File

@ -39,7 +39,7 @@ namespace zmq
struct socks_greeting_t struct socks_greeting_t
{ {
socks_greeting_t (uint8_t method_); socks_greeting_t (uint8_t method_);
socks_greeting_t (uint8_t *methods_, uint8_t num_methods_); socks_greeting_t (const uint8_t *methods_, uint8_t num_methods_);
uint8_t methods[UINT8_MAX]; uint8_t methods[UINT8_MAX];
const size_t num_methods; const size_t num_methods;