diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-11 09:41:58 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-11 09:41:58 +0000 |
commit | 5db1d322be106c8462dc691072f9415dc0766ed4 (patch) | |
tree | 311cb5e6d5307d3e2b77652a9a2461a324c5ab2e /src/socket.cpp | |
parent | 0626e6a68af3327ecfda4467f2dd09d4e729773d (diff) |
Add -Wshadow to cflags, and fix a bunch of warnings that come with it. Add a note to webirc that needs looking at.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8892 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r-- | src/socket.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index bd8147b3f..b9e22c949 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -312,8 +312,8 @@ bool irc::sockets::MatchCIDR(const char* address, const char* cidr_mask, bool ma bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) { /* We allocate 2 of these, because sockaddr_in6 is larger than sockaddr (ugh, hax) */ - sockaddr* server = new sockaddr[2]; - memset(server,0,sizeof(sockaddr)*2); + sockaddr* servaddr = new sockaddr[2]; + memset(servaddr,0,sizeof(sockaddr)*2); int ret, size; @@ -330,13 +330,13 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) in6_addr addy; if (inet_pton(AF_INET6, addr, &addy) < 1) { - delete[] server; + delete[] servaddr; return false; } - ((sockaddr_in6*)server)->sin6_family = AF_INET6; - memcpy(&(((sockaddr_in6*)server)->sin6_addr), &addy, sizeof(in6_addr)); - ((sockaddr_in6*)server)->sin6_port = htons(port); + ((sockaddr_in6*)servaddr)->sin6_family = AF_INET6; + memcpy(&(((sockaddr_in6*)servaddr)->sin6_addr), &addy, sizeof(in6_addr)); + ((sockaddr_in6*)servaddr)->sin6_port = htons(port); size = sizeof(sockaddr_in6); } else @@ -345,13 +345,13 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) in_addr addy; if (inet_pton(AF_INET, addr, &addy) < 1) { - delete[] server; + delete[] servaddr; return false; } - ((sockaddr_in*)server)->sin_family = AF_INET; - ((sockaddr_in*)server)->sin_addr = addy; - ((sockaddr_in*)server)->sin_port = htons(port); + ((sockaddr_in*)servaddr)->sin_family = AF_INET; + ((sockaddr_in*)servaddr)->sin_addr = addy; + ((sockaddr_in*)servaddr)->sin_port = htons(port); size = sizeof(sockaddr_in); } } @@ -362,45 +362,45 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) /* Port -1: Means UDP IPV4 port binding - Special case * used by DNS engine. */ - ((sockaddr_in*)server)->sin_family = AF_INET; - ((sockaddr_in*)server)->sin_addr.s_addr = htonl(INADDR_ANY); - ((sockaddr_in*)server)->sin_port = 0; + ((sockaddr_in*)servaddr)->sin_family = AF_INET; + ((sockaddr_in*)servaddr)->sin_addr.s_addr = htonl(INADDR_ANY); + ((sockaddr_in*)servaddr)->sin_port = 0; size = sizeof(sockaddr_in); } else { /* Theres no address here, default to ipv6 bind to all */ - ((sockaddr_in6*)server)->sin6_family = AF_INET6; - memset(&(((sockaddr_in6*)server)->sin6_addr), 0, sizeof(in6_addr)); - ((sockaddr_in6*)server)->sin6_port = htons(port); + ((sockaddr_in6*)servaddr)->sin6_family = AF_INET6; + memset(&(((sockaddr_in6*)servaddr)->sin6_addr), 0, sizeof(in6_addr)); + ((sockaddr_in6*)servaddr)->sin6_port = htons(port); size = sizeof(sockaddr_in6); } } #else /* If we aren't built with ipv6, the choice becomes simple */ - ((sockaddr_in*)server)->sin_family = AF_INET; + ((sockaddr_in*)servaddr)->sin_family = AF_INET; if (*addr) { /* There is an address here. */ in_addr addy; if (inet_pton(AF_INET, addr, &addy) < 1) { - delete[] server; + delete[] servaddr; return false; } - ((sockaddr_in*)server)->sin_addr = addy; + ((sockaddr_in*)servaddr)->sin_addr = addy; } else { /* Bind ipv4 to all */ - ((sockaddr_in*)server)->sin_addr.s_addr = htonl(INADDR_ANY); + ((sockaddr_in*)servaddr)->sin_addr.s_addr = htonl(INADDR_ANY); } /* Bind ipv4 port number */ - ((sockaddr_in*)server)->sin_port = htons(port); + ((sockaddr_in*)servaddr)->sin_port = htons(port); size = sizeof(sockaddr_in); #endif - ret = SE->Bind(sockfd, server, size); - delete[] server; + ret = SE->Bind(sockfd, servaddr, size); + delete[] servaddr; if (ret < 0) { |