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

@ -12,9 +12,9 @@ namespace Ndk
Entity::Entity(Entity&& entity) : Entity::Entity(Entity&& entity) :
m_components(std::move(entity.m_components)), m_components(std::move(entity.m_components)),
m_handles(std::move(entity.m_handles)), m_handles(std::move(entity.m_handles)),
m_id(entity.m_id),
m_componentBits(std::move(entity.m_componentBits)), m_componentBits(std::move(entity.m_componentBits)),
m_systemBits(std::move(entity.m_systemBits)), m_systemBits(std::move(entity.m_systemBits)),
m_id(entity.m_id),
m_world(entity.m_world), m_world(entity.m_world),
m_valid(entity.m_valid) m_valid(entity.m_valid)
{ {

View File

@ -35,9 +35,9 @@ namespace Nz
InstancedRenderable(billboard), InstancedRenderable(billboard),
m_color(billboard.m_color), m_color(billboard.m_color),
m_material(billboard.m_material), m_material(billboard.m_material),
m_rotation(billboard.m_rotation),
m_sinCos(billboard.m_sinCos), m_sinCos(billboard.m_sinCos),
m_size(billboard.m_size) m_size(billboard.m_size),
m_rotation(billboard.m_rotation)
{ {
} }

View File

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

View File

@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp // 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 // 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 delete
#undef new #undef new
#endif #endif

View File

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

View File

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

View File

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

View File

@ -1912,7 +1912,6 @@ namespace Nz
} }
else else
{ {
unsigned int newSize = m_sharedString->size + length;
auto newString = std::make_shared<SharedString>(m_sharedString->size + length); auto newString = std::make_shared<SharedString>(m_sharedString->size + length);
char* ptr = newString->string.get(); char* ptr = newString->string.get();

View File

@ -724,8 +724,6 @@ namespace Nz
return false; return false;
} }
bool glsl140 = (OpenGL::GetGLSLVersion() >= 140);
// Basic shader // Basic shader
{ {
UberShaderPreprocessorRef uberShader = UberShaderPreprocessor::New(); UberShaderPreprocessorRef uberShader = UberShaderPreprocessor::New();

View File

@ -4,6 +4,7 @@
#include <Nazara/Network/Algorithm.hpp> #include <Nazara/Network/Algorithm.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <cstring>
#include <Nazara/Network/Debug.hpp> #include <Nazara/Network/Debug.hpp>
namespace Nz namespace Nz
@ -173,14 +174,14 @@ namespace Nz
addressPtr = savedPtr; addressPtr = savedPtr;
// who knows how to parse ipv4? we do! // who knows how to parse ipv4? we do!
UInt8 result[16]; UInt8 ipv4[16];
bool isIPv6; bool ipv6;
if (!ParseIPAddress(addressPtr, result, nullptr, &isIPv6, &addressPtr) || isIPv6) // must parse and must be ipv4 if (!ParseIPAddress(addressPtr, ipv4, nullptr, &ipv6, &addressPtr) || ipv6) // must parse and must be ipv4
return false; return false;
// transfer addrlocal into the present location // transfer addrlocal into the present location
for (unsigned int j = 0; j < 4; ++j) for (unsigned int j = 0; j < 4; ++j)
*(resultPtr++) = result[j]; *(resultPtr++) = ipv4[j];
++i; // pretend like we took another short, since the ipv4 effectively is two shorts ++i; // pretend like we took another short, since the ipv4 effectively is two shorts
mappedIPv4 = true; // remember how we got here for further validation later mappedIPv4 = true; // remember how we got here for further validation later

View File

@ -7,6 +7,7 @@
#include <Nazara/Core/StringStream.hpp> #include <Nazara/Core/StringStream.hpp>
#include <Nazara/Network/Algorithm.hpp> #include <Nazara/Network/Algorithm.hpp>
#include <algorithm> #include <algorithm>
#include <limits>
#include <Nazara/Network/SystemSocket.hpp> #include <Nazara/Network/SystemSocket.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS) #if defined(NAZARA_PLATFORM_WINDOWS)
@ -55,6 +56,9 @@ namespace Nz
NazaraAssert(m_protocol <= NetProtocol_Max, "Protocol has value out of enum"); NazaraAssert(m_protocol <= NetProtocol_Max, "Protocol has value out of enum");
switch (m_protocol) switch (m_protocol)
{ {
case NetProtocol_Any:
break;
case NetProtocol_IPv4: case NetProtocol_IPv4:
return m_ipv4[0] == 127; return m_ipv4[0] == 127;
@ -69,12 +73,15 @@ namespace Nz
String IpAddress::ToString() const String IpAddress::ToString() const
{ {
StringStream stream; StringStream stream;
if (m_isValid) if (m_isValid)
{ {
NazaraAssert(m_protocol <= NetProtocol_Max, "Protocol has value out of enum"); NazaraAssert(m_protocol <= NetProtocol_Max, "Protocol has value out of enum");
switch (m_protocol) switch (m_protocol)
{ {
case NetProtocol_Any:
break;
case NetProtocol_IPv4: case NetProtocol_IPv4:
for (unsigned int i = 0; i < 4; ++i) for (unsigned int i = 0; i < 4; ++i)
{ {
@ -89,8 +96,8 @@ namespace Nz
// https://tools.ietf.org/html/rfc5952 // https://tools.ietf.org/html/rfc5952
// Find the longest zero sequence // Find the longest zero sequence
int f0 = -1; unsigned int f0 = std::numeric_limits<unsigned int>::max();
int l0 = -1; unsigned int l0 = std::numeric_limits<unsigned int>::max();
for (unsigned int i = 0; i < 8; ++i) for (unsigned int i = 0; i < 8; ++i)
{ {
@ -138,7 +145,7 @@ namespace Nz
if (m_port != 0) if (m_port != 0)
stream << ':' << m_port; stream << ':' << m_port;
} }
return stream; return stream;
} }
@ -146,7 +153,7 @@ namespace Nz
{ {
String hostname; String hostname;
IpAddressImpl::ResolveAddress(address, &hostname, service, error); IpAddressImpl::ResolveAddress(address, &hostname, service, error);
return hostname; return hostname;
} }

View File

@ -218,6 +218,10 @@ namespace Nz
{ {
switch (m_state) switch (m_state)
{ {
case SocketState_Bound:
case SocketState_Resolving:
break;
case SocketState_Connected: case SocketState_Connected:
return true; return true;
@ -278,4 +282,4 @@ namespace Nz
m_peerAddress = peerAddress; m_peerAddress = peerAddress;
UpdateState(SocketState_Connected); UpdateState(SocketState_Connected);
} }
} }

View File

@ -6,6 +6,7 @@
#include <Nazara/Core/CallOnExit.hpp> #include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Network/Win32/SocketImpl.hpp> #include <Nazara/Network/Win32/SocketImpl.hpp>
#include <cstring>
#include <Nazara/Network/Debug.hpp> #include <Nazara/Network/Debug.hpp>
namespace Nz namespace Nz
@ -64,7 +65,7 @@ namespace Nz
if (service) if (service)
service->Set(serviceBuffer.data()); service->Set(serviceBuffer.data());
} }
return result; return result;
} }
@ -95,7 +96,7 @@ namespace Nz
return IpAddress(rawIpV6[0], rawIpV6[1], rawIpV6[2], rawIpV6[3], rawIpV6[4], rawIpV6[5], rawIpV6[6], rawIpV6[7], ntohs(ipv6->sin6_port)); return IpAddress(rawIpV6[0], rawIpV6[1], rawIpV6[2], rawIpV6[3], rawIpV6[4], rawIpV6[5], rawIpV6[6], rawIpV6[7], ntohs(ipv6->sin6_port));
} }
} }
return IpAddress::Invalid; return IpAddress::Invalid;
} }

View File

@ -1546,7 +1546,7 @@ namespace Nz
glBindBuffer(OpenGL::BufferTarget[BufferType_Vertex], vertexBufferImpl->GetOpenGLID()); glBindBuffer(OpenGL::BufferTarget[BufferType_Vertex], vertexBufferImpl->GetOpenGLID());
unsigned int bufferOffset = vertexBuffer->GetStartOffset(); unsigned int bufferOffset = vertexBuffer->GetStartOffset();
const VertexDeclaration* vertexDeclaration = vertexBuffer->GetVertexDeclaration(); vertexDeclaration = vertexBuffer->GetVertexDeclaration();
unsigned int stride = vertexDeclaration->GetStride(); unsigned int stride = vertexDeclaration->GetStride();
// On définit les bornes (une fois de plus selon l'itération) // On définit les bornes (une fois de plus selon l'itération)
@ -1934,4 +1934,4 @@ namespace Nz
} }
unsigned int Renderer::s_moduleReferenceCounter = 0; unsigned int Renderer::s_moduleReferenceCounter = 0;
} }