mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 16:56:11 +01:00
Problem: ipc_address data member does not conform with naming convention
Solution: rename data member
This commit is contained in:
parent
808028fe02
commit
31015fdcfe
@ -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<const sockaddr *> (&address);
|
||||
return reinterpret_cast<const sockaddr *> (&_address);
|
||||
}
|
||||
|
||||
socklen_t zmq::ipc_address_t::addrlen () const
|
||||
{
|
||||
if (!address.sun_path[0] && address.sun_path[1])
|
||||
return static_cast<socklen_t> (strlen (address.sun_path + 1))
|
||||
if (!_address.sun_path[0] && _address.sun_path[1])
|
||||
return static_cast<socklen_t> (strlen (_address.sun_path + 1))
|
||||
+ sizeof (sa_family_t) + 1;
|
||||
return static_cast<socklen_t> (sizeof address);
|
||||
return static_cast<socklen_t> (sizeof _address);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -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 &);
|
||||
|
Loading…
x
Reference in New Issue
Block a user