diff --git a/include/Nazara/Physics/Geom.hpp b/include/Nazara/Physics/Geom.hpp index 23a02c72b..e228c3d07 100644 --- a/include/Nazara/Physics/Geom.hpp +++ b/include/Nazara/Physics/Geom.hpp @@ -134,7 +134,7 @@ namespace Nz class NAZARA_PHYSICS_API CompoundGeom : public PhysGeom { public: - CompoundGeom(PhysGeom** geoms, unsigned int geomCount); + CompoundGeom(PhysGeom** geoms, std::size_t geomCount); const std::vector& GetGeoms() const; GeomType GetType() const override; diff --git a/src/Nazara/Network/Win32/IpAddressImpl.cpp b/src/Nazara/Network/Win32/IpAddressImpl.cpp index cbcebb83b..0097227ef 100644 --- a/src/Nazara/Network/Win32/IpAddressImpl.cpp +++ b/src/Nazara/Network/Win32/IpAddressImpl.cpp @@ -56,7 +56,7 @@ namespace Nz std::array hostnameBuffer; std::array serviceBuffer; - int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast(hostnameBuffer.size()), serviceBuffer.data(), static_cast(serviceBuffer.size()), flags); + int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast(hostnameBuffer.size()), serviceBuffer.data(), static_cast(serviceBuffer.size()), flags); if (result == 0) { if (hostname) diff --git a/src/Nazara/Physics/Geom.cpp b/src/Nazara/Physics/Geom.cpp index e814b8618..48d6f0090 100644 --- a/src/Nazara/Physics/Geom.cpp +++ b/src/Nazara/Physics/Geom.cpp @@ -125,16 +125,7 @@ namespace Nz PhysGeomRef PhysGeom::Build(const PrimitiveList& list) { - unsigned int primitiveCount = list.GetSize(); - - #if NAZARA_PHYSICS_SAFE - if (primitiveCount == 0) - { - NazaraError("PrimitiveList must have at least one primitive"); - return nullptr; - } - #endif - + std::size_t primitiveCount = list.GetSize(); if (primitiveCount > 1) { std::vector geoms(primitiveCount); @@ -144,8 +135,10 @@ namespace Nz return CompoundGeom::New(&geoms[0], primitiveCount); } - else + else if (primitiveCount > 0) return CreateGeomFromPrimitive(list.GetPrimitive(0)); + else + return NullGeom::New(); } bool PhysGeom::Initialize() @@ -246,10 +239,10 @@ namespace Nz /******************************* CompoundGeom ********************************/ - CompoundGeom::CompoundGeom(PhysGeom** geoms, unsigned int geomCount) + CompoundGeom::CompoundGeom(PhysGeom** geoms, std::size_t geomCount) { m_geoms.reserve(geomCount); - for (unsigned int i = 0; i < geomCount; ++i) + for (std::size_t i = 0; i < geomCount; ++i) m_geoms.emplace_back(geoms[i]); } @@ -349,7 +342,7 @@ namespace Nz NewtonCollision* ConvexHullGeom::CreateHandle(PhysWorld* world) const { - return NewtonCreateConvexHull(world->GetHandle(), m_vertices.size(), reinterpret_cast(m_vertices.data()), sizeof(Vector3f), m_tolerance, 0, m_matrix); + return NewtonCreateConvexHull(world->GetHandle(), static_cast(m_vertices.size()), reinterpret_cast(m_vertices.data()), sizeof(Vector3f), m_tolerance, 0, m_matrix); } /******************************* CylinderGeom ********************************/