From 31015fdcfe4bfe88a499360abcb28e1faf0b3a08 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Wed, 6 Feb 2019 07:12:21 -0500 Subject: [PATCH] Problem: ipc_address data member does not conform with naming convention Solution: rename data member --- src/ipc_address.cpp | 30 +++++++++++++++--------------- src/ipc_address.hpp | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/ipc_address.cpp b/src/ipc_address.cpp index 3b5711ea..fce5137e 100644 --- a/src/ipc_address.cpp +++ b/src/ipc_address.cpp @@ -39,16 +39,16 @@ zmq::ipc_address_t::ipc_address_t () { - memset (&address, 0, sizeof address); + memset (&_address, 0, sizeof _address); } zmq::ipc_address_t::ipc_address_t (const sockaddr *sa_, socklen_t sa_len_) { zmq_assert (sa_ && sa_len_ > 0); - memset (&address, 0, sizeof address); + memset (&_address, 0, sizeof _address); if (sa_->sa_family == AF_UNIX) - memcpy (&address, sa_, sa_len_); + memcpy (&_address, sa_, sa_len_); } zmq::ipc_address_t::~ipc_address_t () @@ -58,7 +58,7 @@ zmq::ipc_address_t::~ipc_address_t () int zmq::ipc_address_t::resolve (const char *path_) { const size_t path_len = strlen (path_); - if (path_len >= sizeof address.sun_path) { + if (path_len >= sizeof _address.sun_path) { errno = ENAMETOOLONG; return -1; } @@ -67,28 +67,28 @@ int zmq::ipc_address_t::resolve (const char *path_) return -1; } - address.sun_family = AF_UNIX; - memcpy (address.sun_path, path_, path_len + 1); + _address.sun_family = AF_UNIX; + memcpy (_address.sun_path, path_, path_len + 1); /* Abstract sockets start with '\0' */ if (path_[0] == '@') - *address.sun_path = '\0'; + *_address.sun_path = '\0'; return 0; } int zmq::ipc_address_t::to_string (std::string &addr_) const { - if (address.sun_family != AF_UNIX) { + if (_address.sun_family != AF_UNIX) { addr_.clear (); return -1; } const char prefix[] = "ipc://"; - char buf[sizeof prefix + sizeof address.sun_path]; + char buf[sizeof prefix + sizeof _address.sun_path]; char *pos = buf; memcpy (pos, prefix, sizeof prefix - 1); pos += sizeof prefix - 1; - const char *src_pos = address.sun_path; - if (!address.sun_path[0] && address.sun_path[1]) { + const char *src_pos = _address.sun_path; + if (!_address.sun_path[0] && _address.sun_path[1]) { *pos++ = '@'; src_pos++; } @@ -105,15 +105,15 @@ int zmq::ipc_address_t::to_string (std::string &addr_) const const sockaddr *zmq::ipc_address_t::addr () const { - return reinterpret_cast (&address); + return reinterpret_cast (&_address); } socklen_t zmq::ipc_address_t::addrlen () const { - if (!address.sun_path[0] && address.sun_path[1]) - return static_cast (strlen (address.sun_path + 1)) + if (!_address.sun_path[0] && _address.sun_path[1]) + return static_cast (strlen (_address.sun_path + 1)) + sizeof (sa_family_t) + 1; - return static_cast (sizeof address); + return static_cast (sizeof _address); } #endif diff --git a/src/ipc_address.hpp b/src/ipc_address.hpp index 006a0d2f..a33926e7 100644 --- a/src/ipc_address.hpp +++ b/src/ipc_address.hpp @@ -57,7 +57,7 @@ class ipc_address_t socklen_t addrlen () const; private: - struct sockaddr_un address; + struct sockaddr_un _address; ipc_address_t (const ipc_address_t &); const ipc_address_t &operator= (const ipc_address_t &);