Fix errors and warnings

Former-commit-id: a3ba309633f198f82c1d0277d750d867cad4ba44
This commit is contained in:
Lynix
2015-11-12 00:29:10 +01:00
parent a26c979d84
commit 5d6e6b2d45
14 changed files with 55 additions and 30 deletions

View File

@@ -3,6 +3,6 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Network/Config.hpp>
#if NAZARA_MODULENAME_MANAGE_MEMORY
#if NAZARA_NETWORK_MANAGE_MEMORY
#include <Nazara/Core/Debug/NewRedefinition.hpp>
#endif

View File

@@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
#if NAZARA_MODULENAME_MANAGE_MEMORY
#if NAZARA_NETWORK_MANAGE_MEMORY
#undef delete
#undef new
#endif

View File

@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Error.hpp>
#include <ostream>
#include <Nazara/Network/Debug.hpp>
namespace Nz
@@ -13,31 +14,31 @@ namespace Nz
}
inline IpAddress::IpAddress(const IPv4& ip, UInt16 port) :
m_isValid(true),
m_ipv4(ip),
m_protocol(NetProtocol_IPv4),
m_port(port)
m_port(port),
m_isValid(true)
{
}
inline IpAddress::IpAddress(const IPv6& ip, UInt16 port) :
m_isValid(true),
m_ipv6(ip),
m_protocol(NetProtocol_IPv6),
m_port(port)
m_port(port),
m_isValid(true)
{
}
inline IpAddress::IpAddress(const UInt8& a, const UInt8& b, const UInt8& c, const UInt8& d, UInt16 port) :
IpAddress(IPv4{a, b, c, d}, port)
{
}
inline IpAddress::IpAddress(const UInt16& a, const UInt16& b, const UInt16& c, const UInt16& d, const UInt16& e, const UInt16& f, const UInt16& g, const UInt16& h, UInt16 port) :
IpAddress(IPv6{a, b, c, d, e, f, g, h}, port)
{
}
inline IpAddress::IpAddress(const char* address)
{
BuildFromAddress(address);
@@ -116,6 +117,9 @@ namespace Nz
// Each protocol has its variables to compare
switch (first.m_protocol)
{
case NetProtocol_Any:
break;
case NetProtocol_IPv4:
{
if (first.m_ipv4 != second.m_ipv4)
@@ -162,6 +166,9 @@ namespace Nz
// Compare IP (thanks to std::array comparison operator)
switch (first.m_protocol)
{
case NetProtocol_Any:
break;
case NetProtocol_IPv4:
{
if (first.m_ipv4 != second.m_ipv4)

View File

@@ -35,6 +35,10 @@ namespace Nz
IpAddress any;
switch (protocol)
{
case NetProtocol_Any:
NazaraInternalError("Invalid protocol Any at this point");
return SocketState_NotConnected;
case NetProtocol_IPv4:
any = IpAddress::AnyIpV4;
break;

View File

@@ -29,6 +29,10 @@ namespace Nz
IpAddress any;
switch (m_protocol)
{
case NetProtocol_Any:
NazaraInternalError("Invalid protocol Any at this point");
return SocketState_NotConnected;
case NetProtocol_IPv4:
any = IpAddress::AnyIpV4;
break;