diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-07 20:17:38 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-07 20:17:38 +0000 |
commit | 282b652028ca79baa5a43aa5356d779a688947a8 (patch) | |
tree | 66205f73da3a22532dc0defa6132778e258ded8e /sql/hostname.cc | |
parent | d995dd2865b4dd5d01175594ed667cfe8ce41712 (diff) | |
download | mariadb-git-282b652028ca79baa5a43aa5356d779a688947a8.tar.gz |
Windows, compiling : reenable warning C4996 (deprecated functions)
But set _CRT_NONSTDC_NO_WARNINGS to silence silly warnings about
ANSI C function being non-standard
Remove now deprecated GetVersion()/GetVersionEx(),except single case
where where it is really needed, in feedback plugin. Remove checks for
Windows NT.
Avoid old IPv4-only inet_aton, which generated the warning.
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r-- | sql/hostname.cc | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc index 56bd407f1dd..92888b737b4 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -701,13 +701,11 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage, static struct addrinfo debug_addr_info[2]; /* Simulating ipv4 192.0.2.126 */ debug_addr= & debug_sock_addr[0]; - debug_addr->sin_family= AF_INET; - debug_addr->sin_addr.s_addr= inet_addr("192.0.2.126"); + inet_pton(AF_INET,"192.0.2.126",debug_addr); /* Simulating ipv4 192.0.2.127 */ debug_addr= & debug_sock_addr[1]; - debug_addr->sin_family= AF_INET; - debug_addr->sin_addr.s_addr= inet_addr("192.0.2.127"); + inet_pton(AF_INET,"192.0.2.127",debug_addr); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in); @@ -733,13 +731,11 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage, static struct addrinfo debug_addr_info[2]; /* Simulating ipv4 192.0.2.5 */ debug_addr= & debug_sock_addr[0]; - debug_addr->sin_family= AF_INET; - debug_addr->sin_addr.s_addr= inet_addr("192.0.2.5"); + inet_pton(AF_INET,"192.0.2.5",debug_addr); /* Simulating ipv4 192.0.2.4 */ debug_addr= & debug_sock_addr[1]; - debug_addr->sin_family= AF_INET; - debug_addr->sin_addr.s_addr= inet_addr("192.0.2.4"); + inet_pton(AF_INET,"192.0.2.5",debug_addr); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in); @@ -772,47 +768,13 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage, static struct addrinfo debug_addr_info[2]; /* Simulating ipv6 2001:DB8::6:7E */ debug_addr= & debug_sock_addr[0]; - debug_addr->sin6_family= AF_INET6; ip6= & debug_addr->sin6_addr; - /* inet_pton not available on Windows XP. */ - ip6->s6_addr[ 0] = 0x20; - ip6->s6_addr[ 1] = 0x01; - ip6->s6_addr[ 2] = 0x0d; - ip6->s6_addr[ 3] = 0xb8; - ip6->s6_addr[ 4] = 0x00; - ip6->s6_addr[ 5] = 0x00; - ip6->s6_addr[ 6] = 0x00; - ip6->s6_addr[ 7] = 0x00; - ip6->s6_addr[ 8] = 0x00; - ip6->s6_addr[ 9] = 0x00; - ip6->s6_addr[10] = 0x00; - ip6->s6_addr[11] = 0x00; - ip6->s6_addr[12] = 0x00; - ip6->s6_addr[13] = 0x06; - ip6->s6_addr[14] = 0x00; - ip6->s6_addr[15] = 0x7e; + inet_pton(AF_INET6,"2001:DB8::6:7E",ip6); /* Simulating ipv6 2001:DB8::6:7F */ debug_addr= & debug_sock_addr[1]; - debug_addr->sin6_family= AF_INET6; ip6= & debug_addr->sin6_addr; - ip6->s6_addr[ 0] = 0x20; - ip6->s6_addr[ 1] = 0x01; - ip6->s6_addr[ 2] = 0x0d; - ip6->s6_addr[ 3] = 0xb8; - ip6->s6_addr[ 4] = 0x00; - ip6->s6_addr[ 5] = 0x00; - ip6->s6_addr[ 6] = 0x00; - ip6->s6_addr[ 7] = 0x00; - ip6->s6_addr[ 8] = 0x00; - ip6->s6_addr[ 9] = 0x00; - ip6->s6_addr[10] = 0x00; - ip6->s6_addr[11] = 0x00; - ip6->s6_addr[12] = 0x00; - ip6->s6_addr[13] = 0x06; - ip6->s6_addr[14] = 0x00; - ip6->s6_addr[15] = 0x7f; - + inet_pton(AF_INET6,"2001:DB8::6:7E",ip6); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in6); debug_addr_info[0].ai_next= & debug_addr_info[1]; |