Removed IpAddress::IsValid(), added IpAddress::None

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1456 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-03-13 09:50:24 +00:00
parent 81fd4c5d1d
commit 691eea4c69
6 changed files with 10 additions and 37 deletions

View file

@ -34,6 +34,7 @@
namespace sf
{
////////////////////////////////////////////////////////////
const IpAddress IpAddress::None;
const IpAddress IpAddress::LocalHost(127, 0, 0, 1);
@ -52,7 +53,7 @@ IpAddress::IpAddress(const std::string& address)
myAddress = inet_addr(address.c_str());
// If not successful, try to convert it as a host name
if (!IsValid())
if (myAddress == INADDR_NONE)
{
hostent* host = gethostbyname(address.c_str());
if (host)
@ -76,7 +77,7 @@ IpAddress::IpAddress(const char* address)
myAddress = inet_addr(address);
// If not successful, try to convert it as a host name
if (!IsValid())
if (myAddress == INADDR_NONE)
{
hostent* host = gethostbyname(address);
if (host)
@ -107,13 +108,6 @@ IpAddress::IpAddress(Uint32 address)
}
////////////////////////////////////////////////////////////
bool IpAddress::IsValid() const
{
return myAddress != INADDR_NONE;
}
////////////////////////////////////////////////////////////
std::string IpAddress::ToString() const
{