Fix another lot of warnings from Clang
Closes #90 Closes #91 Closes #92 Closes #93
This commit is contained in:
parent
7e594a861f
commit
4c6f049e0d
|
|
@ -13,7 +13,7 @@ namespace Ndk
|
|||
void LuaBinding::BindCore()
|
||||
{
|
||||
/*********************************** Nz::Clock **********************************/
|
||||
clockClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Clock* clock, std::size_t argumentCount)
|
||||
clockClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Clock* clock, std::size_t /*argumentCount*/)
|
||||
{
|
||||
int argIndex = 1;
|
||||
Nz::Int64 startingValue = lua.Check<Nz::Int64>(&argIndex, 0);
|
||||
|
|
|
|||
|
|
@ -20,10 +20,8 @@ namespace Ndk
|
|||
return reinterpret_cast<Nz::InstancedRenderableRef*>(model); //TODO: Make a ObjectRefCast
|
||||
});
|
||||
|
||||
modelClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::ModelRef* model, std::size_t argumentCount)
|
||||
modelClass.SetConstructor([] (Nz::LuaInstance& /*lua*/, Nz::ModelRef* model, std::size_t /*argumentCount*/)
|
||||
{
|
||||
NazaraUnused(argumentCount);
|
||||
|
||||
Nz::PlacementNew(model, Nz::Model::New());
|
||||
return true;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -93,10 +93,8 @@ namespace Ndk
|
|||
});
|
||||
|
||||
/*********************************** Nz::Font **********************************/
|
||||
fontClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::FontRef* font, std::size_t argumentCount)
|
||||
fontClass.SetConstructor([] (Nz::LuaInstance& /*lua*/, Nz::FontRef* font, std::size_t /*argumentCount*/)
|
||||
{
|
||||
NazaraUnused(argumentCount);
|
||||
|
||||
Nz::PlacementNew(font, Nz::Font::New());
|
||||
return true;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,11 +25,6 @@ namespace Nz
|
|||
|
||||
private:
|
||||
const NoiseBase& m_source;
|
||||
float m_value;
|
||||
float m_remainder;
|
||||
float m_offset;
|
||||
float m_weight;
|
||||
float m_signal;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ namespace Nz
|
|||
mutable StringStream m_outputStream;
|
||||
bool m_keepLastLine;
|
||||
unsigned int m_lineCount;
|
||||
unsigned int m_streamFlags;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ aiReturn StreamSeek(aiFile* file, size_t offset, aiOrigin origin)
|
|||
|
||||
case aiOrigin_SET:
|
||||
return (stream->SetCursorPos(offset)) ? aiReturn_SUCCESS : aiReturn_FAILURE;
|
||||
|
||||
case _AI_ORIGIN_ENFORCE_ENUM_SIZE: // To prevent a warning
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraWarning("Unhandled aiOrigin enum (value: 0x" + String(origin, 16) + ')');
|
||||
|
|
|
|||
|
|
@ -208,8 +208,9 @@ namespace Nz
|
|||
|
||||
time_t FileImpl::GetCreationTime(const String& filePath)
|
||||
{
|
||||
NazaraWarning("Posix has no creation time information");
|
||||
NazaraUnused(filePath);
|
||||
|
||||
NazaraWarning("Posix has no creation time information");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Nz
|
|||
{
|
||||
ErrorFlags flags(ErrorFlag_ThrowException, true);
|
||||
|
||||
std::array<UInt8, 4> whitePixel = {255, 255, 255, 255};
|
||||
std::array<UInt8, 4> whitePixel = { {255, 255, 255, 255} };
|
||||
m_whiteTexture.Create(ImageType_2D, PixelFormatType_RGBA8, 1, 1);
|
||||
m_whiteTexture.Update(whitePixel.data());
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Nz
|
|||
{
|
||||
ErrorFlags flags(ErrorFlag_ThrowException, true);
|
||||
|
||||
std::array<UInt8, 4> whitePixel = {255, 255, 255, 255};
|
||||
std::array<UInt8, 4> whitePixel = { {255, 255, 255, 255} };
|
||||
m_whiteTexture.Create(ImageType_2D, PixelFormatType_RGBA8, 1, 1);
|
||||
m_whiteTexture.Update(whitePixel.data());
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Nz
|
|||
byteToInt hostOrder;
|
||||
hostOrder.i = ntohl(addr.s_addr);
|
||||
|
||||
return { hostOrder.b[3], hostOrder.b[2], hostOrder.b[1], hostOrder.b[0] };
|
||||
return { {hostOrder.b[3], hostOrder.b[2], hostOrder.b[1], hostOrder.b[0]} };
|
||||
}
|
||||
|
||||
IpAddress::IPv6 convertSockaddr6ToIPv6(const in6_addr& addr)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Nz
|
|||
activeSockets = SocketImpl::Poll(m_sockets.data(), m_sockets.size(), static_cast<int>(msTimeout), error);
|
||||
|
||||
m_activeSockets.clear();
|
||||
if (activeSockets > 0U)
|
||||
if (activeSockets > 0)
|
||||
{
|
||||
int socketRemaining = activeSockets;
|
||||
for (PollSocket& entry : m_sockets)
|
||||
|
|
|
|||
|
|
@ -51,11 +51,12 @@ namespace Nz
|
|||
d[2] = d[0] + Vector2f(1.f - 2.f * s_UnskewCoeff2D);
|
||||
|
||||
Vector2i offset(skewedCubeOrigin.x & 255, skewedCubeOrigin.y & 255);
|
||||
std::array<std::size_t, 3> gi =
|
||||
{
|
||||
m_permutations[offset.x + m_permutations[offset.y]] & 7,
|
||||
m_permutations[offset.x + off1.x + m_permutations[offset.y + off1.y]] & 7,
|
||||
m_permutations[offset.x + 1 + m_permutations[offset.y + 1]] & 7
|
||||
std::array<std::size_t, 3> gi = {
|
||||
{
|
||||
m_permutations[offset.x + m_permutations[offset.y]] & 7,
|
||||
m_permutations[offset.x + off1.x + m_permutations[offset.y + off1.y]] & 7,
|
||||
m_permutations[offset.x + 1 + m_permutations[offset.y + 1]] & 7
|
||||
}
|
||||
};
|
||||
|
||||
float n = 0.f;
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@ namespace Nz
|
|||
{
|
||||
namespace
|
||||
{
|
||||
static constexpr std::array<float, 4> m_functionScales =
|
||||
{
|
||||
1.f / float(M_SQRT2),
|
||||
0.5f / float(M_SQRT2),
|
||||
0.5f / float(M_SQRT2),
|
||||
0.5f / float(M_SQRT2)
|
||||
static constexpr std::array<float, 4> m_functionScales = {
|
||||
{
|
||||
1.f / float(M_SQRT2),
|
||||
0.5f / float(M_SQRT2),
|
||||
0.5f / float(M_SQRT2),
|
||||
0.5f / float(M_SQRT2)
|
||||
}
|
||||
};
|
||||
}
|
||||
Worley::Worley() :
|
||||
|
|
@ -111,11 +112,21 @@ namespace Nz
|
|||
|
||||
float Worley::Get(float x, float y, float z, float scale) const
|
||||
{
|
||||
NazaraUnused(x);
|
||||
NazaraUnused(y);
|
||||
NazaraUnused(z);
|
||||
NazaraUnused(scale);
|
||||
|
||||
throw std::runtime_error("Worley 3D not available yet.");
|
||||
}
|
||||
|
||||
float Worley::Get(float x, float y, float z, float w, float scale) const
|
||||
{
|
||||
NazaraUnused(x);
|
||||
NazaraUnused(y);
|
||||
NazaraUnused(z);
|
||||
NazaraUnused(scale);
|
||||
|
||||
throw std::runtime_error("Worley 4D not available yet.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ namespace Nz
|
|||
return ColliderType2D_Null;
|
||||
}
|
||||
|
||||
float NullCollider2D::ComputeInertialMatrix(float mass) const
|
||||
float NullCollider2D::ComputeInertialMatrix(float /*mass*/) const
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
std::vector<cpShape*> NullCollider2D::CreateShapes(RigidBody2D* body) const
|
||||
std::vector<cpShape*> NullCollider2D::CreateShapes(RigidBody2D* /*body*/) const
|
||||
{
|
||||
return std::vector<cpShape*>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ namespace Nz
|
|||
|
||||
bool SaveToStream(const Mesh& mesh, const String& format, Stream& stream, const MeshParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
if (!mesh.IsValid())
|
||||
{
|
||||
NazaraError("Invalid mesh");
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Nz
|
|||
void WriteToStream(void* userdata, void* data, int size)
|
||||
{
|
||||
Stream* stream = static_cast<Stream*>(userdata);
|
||||
if (stream->Write(data, size) != size)
|
||||
if (stream->Write(data, size) != static_cast<std::size_t>(size))
|
||||
throw std::runtime_error("Failed to write to stream");
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +142,8 @@ namespace Nz
|
|||
|
||||
bool SaveBMP(const Image& image, const ImageParams& parameters, Stream& stream)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
Image tempImage(image); //< We're using COW here to prevent Image copy unless required
|
||||
|
||||
int componentCount = ConvertToIntegerFormat(tempImage);
|
||||
|
|
@ -159,9 +161,11 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool SaveHDR(const Image& image, const ImageParams& parameters, Stream& stream)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
Image tempImage(image); //< We're using COW here to prevent Image copy unless required
|
||||
|
||||
int componentCount = ConvertToFloatFormat(tempImage);
|
||||
|
|
@ -182,6 +186,8 @@ namespace Nz
|
|||
|
||||
bool SavePNG(const Image& image, const ImageParams& parameters, Stream& stream)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
Image tempImage(image); //< We're using COW here to prevent Image copy unless required
|
||||
|
||||
int componentCount = ConvertToIntegerFormat(tempImage);
|
||||
|
|
@ -202,6 +208,8 @@ namespace Nz
|
|||
|
||||
bool SaveTGA(const Image& image, const ImageParams& parameters, Stream& stream)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
Image tempImage(image); //< We're using COW here to prevent Image copy unless required
|
||||
|
||||
int componentCount = ConvertToIntegerFormat(tempImage);
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ TEST_CASE("MixToMono", "[AUDIO][ALGORITHM]")
|
|||
{
|
||||
SECTION("Mix two channels together")
|
||||
{
|
||||
std::array<int, 4> input{ 1, 3, 5, 3 };
|
||||
std::array<int, 2> output{ 0, 0 };
|
||||
std::array<int, 4> input = { { 1, 3, 5, 3 } };
|
||||
std::array<int, 2> output = { { 0, 0 } };
|
||||
|
||||
// Two channels and two frames !
|
||||
Nz::MixToMono(input.data(), output.data(), 2, 2);
|
||||
|
||||
std::array<int, 2> theoric{ 2, 4 }; // It's the mean of the two channels
|
||||
REQUIRE(output == theoric);
|
||||
std::array<int, 2> theoric = { { 2, 4 } }; // It's the mean of the two channels
|
||||
CHECK(output == theoric);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ SCENARIO("AbstractHash", "[CORE][ABSTRACTHASH]")
|
|||
|
||||
WHEN("We introduce data")
|
||||
{
|
||||
std::array<Nz::UInt8, 4> array{ 0, 1, 2, 3 };
|
||||
std::array<Nz::UInt8, 4> array{ { 0, 1, 2, 3 } };
|
||||
SHA512->Append(array.data(), array.size());
|
||||
|
||||
THEN("We ask for the bytearray")
|
||||
{
|
||||
Nz::ByteArray byteArray = SHA512->End();
|
||||
REQUIRE(byteArray.GetSize() == SHA512->GetDigestLength());
|
||||
CHECK(byteArray.GetSize() == SHA512->GetDigestLength());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ SCENARIO("Bitset", "[CORE][BITSET]")
|
|||
|
||||
THEN("Capacity is 3 and size is 3")
|
||||
{
|
||||
REQUIRE(bitset.GetSize() == 3);
|
||||
REQUIRE(bitset.GetCapacity() >= 3);
|
||||
CHECK(bitset.GetSize() == 3);
|
||||
CHECK(bitset.GetCapacity() >= 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -25,11 +25,11 @@ SCENARIO("Bitset", "[CORE][BITSET]")
|
|||
WHEN("We assign 'anotherData'")
|
||||
{
|
||||
defaultByte = anotherDataString;
|
||||
REQUIRE(anotherData == defaultByte);
|
||||
REQUIRE(defaultByte.GetSize() == 4);
|
||||
REQUIRE(defaultByte.GetCapacity() >= 4);
|
||||
REQUIRE(anotherData.GetSize() == 4);
|
||||
REQUIRE(anotherData.GetCapacity() >= 4);
|
||||
CHECK(anotherData == defaultByte);
|
||||
CHECK(defaultByte.GetSize() == 4);
|
||||
CHECK(defaultByte.GetCapacity() >= 4);
|
||||
CHECK(anotherData.GetSize() == 4);
|
||||
CHECK(anotherData.GetCapacity() >= 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -43,17 +43,17 @@ SCENARIO("Bitset", "[CORE][BITSET]")
|
|||
|
||||
THEN("We get a copy")
|
||||
{
|
||||
REQUIRE(copyBitset == originalArray);
|
||||
CHECK(copyBitset == originalArray);
|
||||
|
||||
AND_WHEN("We modify one")
|
||||
{
|
||||
for (auto i = 0; i < copyBitset.GetSize(); ++i)
|
||||
for (std::size_t i = 0; i < copyBitset.GetSize(); ++i)
|
||||
copyBitset[i] = false;
|
||||
|
||||
THEN("They are no more equal")
|
||||
{
|
||||
REQUIRE(copyBitset != originalArray);
|
||||
REQUIRE(copyBitset == Nz::Bitset<>(3, false));
|
||||
CHECK(copyBitset != originalArray);
|
||||
CHECK(copyBitset == Nz::Bitset<>(3, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,40 +7,40 @@ SCENARIO("SparsePtr", "[CORE][SPARSEPTR]")
|
|||
{
|
||||
GIVEN("A sparse pointer pointing to an array with a stride of 2")
|
||||
{
|
||||
std::array<int, 5> arrays{0, 1, 2, 3, 4};
|
||||
std::array<int, 5> arrays = { {0, 1, 2, 3, 4} };
|
||||
Nz::SparsePtr<int> sparsePtr(arrays.data(), 2 * sizeof(int));
|
||||
|
||||
WHEN("We use operators")
|
||||
{
|
||||
THEN("Operator[] with 2 should be 4")
|
||||
{
|
||||
REQUIRE(4 == sparsePtr[2]);
|
||||
CHECK(4 == sparsePtr[2]);
|
||||
}
|
||||
|
||||
THEN("Operator++ and Operator-- should be opposite")
|
||||
{
|
||||
++sparsePtr;
|
||||
REQUIRE(2 == *sparsePtr);
|
||||
CHECK(2 == *sparsePtr);
|
||||
auto old = sparsePtr++;
|
||||
REQUIRE(2 == *old);
|
||||
REQUIRE(4 == *sparsePtr);
|
||||
CHECK(2 == *old);
|
||||
CHECK(4 == *sparsePtr);
|
||||
|
||||
--sparsePtr;
|
||||
REQUIRE(2 == *sparsePtr);
|
||||
CHECK(2 == *sparsePtr);
|
||||
auto oldMinus = sparsePtr--;
|
||||
REQUIRE(2 == *oldMinus);
|
||||
REQUIRE(0 == *sparsePtr);
|
||||
CHECK(2 == *oldMinus);
|
||||
CHECK(0 == *sparsePtr);
|
||||
}
|
||||
|
||||
THEN("Operator+ and operator-")
|
||||
{
|
||||
auto offsetTwo = sparsePtr + 2;
|
||||
REQUIRE(4 == *offsetTwo);
|
||||
CHECK(4 == *offsetTwo);
|
||||
|
||||
auto offsetZero = offsetTwo - 2;
|
||||
REQUIRE(0 == *offsetZero);
|
||||
CHECK(0 == *offsetZero);
|
||||
|
||||
REQUIRE((offsetTwo - offsetZero) == 2);
|
||||
CHECK((offsetTwo - offsetZero) == 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ class TestParticleEmitter : public Nz::ParticleEmitter
|
|||
public:
|
||||
~TestParticleEmitter() override = default;
|
||||
|
||||
void Emit(Nz::ParticleGroup& system, float elapsedTime) const override
|
||||
void Emit(Nz::ParticleGroup& system, float /*elapsedTime*/) const override
|
||||
{
|
||||
system.GenerateParticles(GetEmissionCount());
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupParticles(Nz::ParticleMapper& mapper, unsigned int count) const override
|
||||
void SetupParticles(Nz::ParticleMapper& /*mapper*/, unsigned int /*count*/) const override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -49,7 +49,7 @@ class TestParticleGenerator : public Nz::ParticleGenerator
|
|||
~TestParticleGenerator() override = default;
|
||||
|
||||
// Be aware that the interval is [startId, endId] and NOT [startId, endId)
|
||||
void Generate(Nz::ParticleGroup& system, Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId) override
|
||||
void Generate(Nz::ParticleGroup& /*system*/, Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId) override
|
||||
{
|
||||
Nz::SparsePtr<Nz::Vector3f> positionPtr = mapper.GetComponentPtr<Nz::Vector3f>(Nz::ParticleComponent_Position);
|
||||
Nz::SparsePtr<Nz::Vector3f> velocityPtr = mapper.GetComponentPtr<Nz::Vector3f>(Nz::ParticleComponent_Velocity);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace
|
|||
static Ndk::SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void OnUpdate(float elapsedTime) override
|
||||
void OnUpdate(float /*elapsedTime*/) override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace
|
|||
static Ndk::SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void OnUpdate(float elapsedTime) override
|
||||
void OnUpdate(float /*elapsedTime*/) override
|
||||
{
|
||||
for (const Ndk::EntityHandle& entity : GetEntities())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
class TestState : public Ndk::State
|
||||
{
|
||||
public:
|
||||
void Enter(Ndk::StateMachine& fsm) override
|
||||
void Enter(Ndk::StateMachine& /*fsm*/) override
|
||||
{
|
||||
m_isUpdated = false;
|
||||
}
|
||||
|
|
@ -14,11 +14,11 @@ class TestState : public Ndk::State
|
|||
return m_isUpdated;
|
||||
}
|
||||
|
||||
void Leave(Ndk::StateMachine& fsm) override
|
||||
void Leave(Ndk::StateMachine& /*fsm*/) override
|
||||
{
|
||||
}
|
||||
|
||||
bool Update(Ndk::StateMachine& fsm, float elapsedTime) override
|
||||
bool Update(Ndk::StateMachine& /*fsm*/, float /*elapsedTime*/) override
|
||||
{
|
||||
m_isUpdated = true;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace
|
|||
private:
|
||||
int m_value;
|
||||
|
||||
void OnUpdate(float elapsedTime) override
|
||||
void OnUpdate(float /*elapsedTime*/) override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace
|
|||
static Ndk::SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void OnUpdate(float elapsedTime) override
|
||||
void OnUpdate(float /*elapsedTime*/) override
|
||||
{
|
||||
for (const Ndk::EntityHandle& entity : GetEntities())
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue