Some missing from merge.

Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
Salja 2012-08-05 14:54:07 +02:00 committed by Antz
parent ec939a5bce
commit f4be15a7af
1895 changed files with 160408 additions and 53601 deletions

View file

@ -1,14 +1,12 @@
// -*- C++ -*-
// $Id: OS_NS_arpa_inet.cpp 95534 2012-02-17 23:19:33Z mitza $
#include "ace/OS_NS_arpa_inet.h"
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_arpa_inet.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
#include "ace/Basic_Types.h"
#include <cstdlib>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
int
@ -23,54 +21,6 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr)
if (host_name == 0 || host_name[0] == '\0')
host_name = " ";
# endif /* ACE_WIN32 */
# if defined (ACE_LACKS_INET_ADDR)
if (!host_name)
return 0;
ACE_UINT32 ip = 0;
int part = 0;
for (const char *dot; *host_name; host_name = *dot ? dot + 1 : dot, ++part)
{
if (part > 3)
return 0;
dot = ACE_OS::strchr (host_name, '.');
if (!dot)
dot = host_name + ACE_OS::strlen (host_name);
char *last;
const unsigned long n = std::strtoul (host_name, &last, 0);
if (last != dot)
return 0;
if (!*dot)
switch (part)
{
case 0:
# if ACE_SIZEOF_LONG > 4
if (n > 0xffffffff)
return 0;
# endif
ip = static_cast<ACE_UINT32> (n);
continue;
case 1:
if (n > 0xffffff)
return 0;
ip <<= 24;
ip |= n;
continue;
case 2:
if (n > 0xffff)
return 0;
ip <<= 16;
ip |= n;
continue;
}
if (n > 0xff)
return 0;
ip <<= 8;
ip |= n;
}
addr->s_addr = ACE_HTONL (ip);
return 1;
# else
unsigned long ip_addr = ACE_OS::inet_addr (host_name);
if (ip_addr == INADDR_NONE
@ -84,8 +34,7 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr)
addr->s_addr = ip_addr; // Network byte ordered
return 1;
}
# endif // ACE_LACKS_INET_ADDR
#elif defined (ACE_VXWORKS)
#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x690)
// inet_aton() returns OK (0) on success and ERROR (-1) on failure.
// Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026
::errnoSet(0);