diff options
author | louiz’ <louiz@louiz.org> | 2016-10-28 00:11:17 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-10-31 01:39:35 +0100 |
commit | 0d8a2bfd13ecd9b118f8800531ac68ba8ef8100b (patch) | |
tree | d5aa5312b55e638f3d4edf6fccb7ee45bb8a81fd | |
parent | f7f4e3f638ed8e6cd932eaf761ef4a41cd43a1ab (diff) | |
download | biboumi-0d8a2bfd13ecd9b118f8800531ac68ba8ef8100b.tar.gz biboumi-0d8a2bfd13ecd9b118f8800531ac68ba8ef8100b.tar.bz2 biboumi-0d8a2bfd13ecd9b118f8800531ac68ba8ef8100b.tar.xz biboumi-0d8a2bfd13ecd9b118f8800531ac68ba8ef8100b.zip |
Rename a variable that shadows a class member
-rw-r--r-- | louloulibs/network/resolver.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/louloulibs/network/resolver.cpp b/louloulibs/network/resolver.cpp index d3ecd7c..2987aaa 100644 --- a/louloulibs/network/resolver.cpp +++ b/louloulibs/network/resolver.cpp @@ -117,12 +117,13 @@ void Resolver::fill_ares_addrinfo4(const struct hostent* hostent) current->ai_protocol = 0; current->ai_addrlen = sizeof(struct sockaddr_in); - struct sockaddr_in* addr = new struct sockaddr_in; - addr->sin_family = hostent->h_addrtype; - addr->sin_port = htons(strtoul(this->port.data(), nullptr, 10)); - addr->sin_addr.s_addr = (*address)->s_addr; + struct sockaddr_in* ai_addr = new struct sockaddr_in; + + ai_addr->sin_family = hostent->h_addrtype; + ai_addr->sin_port = htons(std::strtoul(this->port.data(), nullptr, 10)); + ai_addr->sin_addr.s_addr = (*address)->s_addr; - current->ai_addr = reinterpret_cast<struct sockaddr*>(addr); + current->ai_addr = reinterpret_cast<struct sockaddr*>(ai_addr); current->ai_next = nullptr; current->ai_canonname = nullptr; @@ -148,14 +149,14 @@ void Resolver::fill_ares_addrinfo6(const struct hostent* hostent) current->ai_protocol = 0; current->ai_addrlen = sizeof(struct sockaddr_in6); - struct sockaddr_in6* addr = new struct sockaddr_in6; - addr->sin6_family = hostent->h_addrtype; - addr->sin6_port = htons(strtoul(this->port.data(), nullptr, 10)); - ::memcpy(addr->sin6_addr.s6_addr, (*address)->s6_addr, 16); - addr->sin6_flowinfo = 0; - addr->sin6_scope_id = 0; + struct sockaddr_in6* ai_addr = new struct sockaddr_in6; + ai_addr->sin6_family = hostent->h_addrtype; + ai_addr->sin6_port = htons(std::strtoul(this->port.data(), nullptr, 10)); + ::memcpy(ai_addr->sin6_addr.s6_addr, (*address)->s6_addr, sizeof(ai_addr->sin6_addr.s6_addr)); + ai_addr->sin6_flowinfo = 0; + ai_addr->sin6_scope_id = 0; - current->ai_addr = reinterpret_cast<struct sockaddr*>(addr); + current->ai_addr = reinterpret_cast<struct sockaddr*>(ai_addr); current->ai_canonname = nullptr; current->ai_next = prev; |